VC++'s Cstring to C# string


hello,

i manoj,

i want pass cstring value vc++ function string value in c# function.

i have added class library project of c# vc++ project.

vc++ code:

cstring to_pass="hello";

funcstring(to_pass);

---------------------------------------------

c# code:

funcstring(string a)

{

//printing operation;

}

conversion not happening.

kindly me.

thank you.


vc++'s cstring , c#'s string have nothing in common, have convert manually 1 other. marshaling library of vc++ should make simple:

#include <msclr/marshal_atl.h>  void example() {     cstring to_pass = "hello";     funcstring(msclr::interop::marshal_as<system::string^>(to_pass)); }



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'