A
Annette Miller
Hi All,
I've never really touched C++ and thought that seeing as I'm familiar with
C# & the Framework, I may as well have a go at managed C++.
I'm trying to write a Class Library to work with my C# program. I want to do
this in C++ for two reasons, 1 because PInvoking is a pain and 2 for the
learning curve.
At the moment I'm trying to work out how to set a string value by passing
the string to a function - heres my code:
....
public ref struct MyStruct
{
public:
String ^myString;
};
public ref class MyClass
{
public:
static MyStruct^ SetMyStructValue()
{
MyStruct ^ms = gcnew MyStruct();
SetStringValue(ms->myString);
return ms;
}
private:
static void SetStringValue(String^ string)
{
string = gcnew String("hello, world"); // this doesn't
work?
}
};
Now I know I can set the string value in SetMyStructValue() but I am
expirementing here... help is much appreciated! Thanks in advance guys...
I've never really touched C++ and thought that seeing as I'm familiar with
C# & the Framework, I may as well have a go at managed C++.
I'm trying to write a Class Library to work with my C# program. I want to do
this in C++ for two reasons, 1 because PInvoking is a pain and 2 for the
learning curve.
At the moment I'm trying to work out how to set a string value by passing
the string to a function - heres my code:
....
public ref struct MyStruct
{
public:
String ^myString;
};
public ref class MyClass
{
public:
static MyStruct^ SetMyStructValue()
{
MyStruct ^ms = gcnew MyStruct();
SetStringValue(ms->myString);
return ms;
}
private:
static void SetStringValue(String^ string)
{
string = gcnew String("hello, world"); // this doesn't
work?
}
};
Now I know I can set the string value in SetMyStructValue() but I am
expirementing here... help is much appreciated! Thanks in advance guys...