Tutorial :C++/CLI .ToString() returning error


I am a beginner to C++/CLI as I come from a C# background. I am currently writing a wrapper for some native C++ code. I have the following methods:

    void AddToBlockList(System::String^ address)      {          char* cAddress = (char*)(void*)Marshal::StringToHGlobalAnsi(address);          _packetFilter->AddToBlockList(cAddress);      }        void AddToBlockList(IPAddress^ address)      {          char* cAddress = (char*)(void*)Marshal::StringToHGlobalAnsi(address.ToString());          _packetFilter->AddToBlockList(cAddress);      }  

...The first method works fine and converts my string into the character array. However, the second function with the IPAddress object as the signiture gives me the following error:

error C2228: left of '.ToString' must have class/struct/union  

...When I type

? address.ToString()   

...in the command window, the IP Address prints. Not sure where I'm going wrong. Any ideas?


address->ToString() ?

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »