The line of code i need to translate from C++ to C#:
void GetAnalysisModeName( ON_wString& name ) const;
I've tried with:
public override void GetAnalysisModeName(string name){}
But it tells me that the return type has to be a string.
The line of code i need to translate from C++ to C#:
void GetAnalysisModeName( ON_wString& name ) const;
I've tried with:
public override void GetAnalysisModeName(string name){}
But it tells me that the return type has to be a string.
If the function you are overloading returns a string your function must return a string. If you have no underlying function remove the override from the declaration.
Is this what you are looking for?
public void GetAnalysisModeName(ref string name){}
The ref
keyword has a similar meaning to the C++ &
: it indicates a reference parameter.
But importantly, who / what is telling you that the return type has to be a string?
A straight conversion would be:
public void GetAnalysisModeName(ref string name)
{
}
But it looks like you're also trying to override something inside of the C# class.
Judging by the message that the return type must be a string, I'd say that the signature of the method you are overriding and the signature of the C++ method you posted don't match.
EDIT
This is actually a mis-understanding. I double checked the Rhino APIs. You're using the .NET SDK. Your C++ example uses the C++ SDK. The two SDKs have different signatures. For you to properly override the .NET version, you need:
public string GetAnalysisModeName(){ }
I suggest you download the .NET SDK Documentation for Rhino so that you have it as a reference. It will also give you a brief description of what the method is supposed to do when implemented.