User1234
User1234

Reputation: 1633

string* [] in c++ converts to string[] in c#

I am a beginner in dot net. My Doubt is the following:- In a dll a function takes string* [] as one of its parameters. Now this method needs to be used in c#. This dll reference is added to c# project. Now in c# project when pressing f12 i.e "Go to definition" for this function, it displays string[] in place of string* [] and long in place of long long in function prototype, e.g :- Suppose in dll the function looks like-

public void fn(long long a, string* attributeNames[]) {....}

Now in C#-

After adding dll reference to current c# project. F12 is pressed on function name, then in Meta Data it displays following function prototype-

public void fn(long a, string[] attributeNames);

This dll is wrapper that contains both managed as well as unmanaged code.
Thanks in Advance.

Upvotes: 3

Views: 104

Answers (1)

Krikor Ailanjian
Krikor Ailanjian

Reputation: 1852

The C++ is converted to IL which is translated to C# in the metadata.

You don't need to explicitly define pointers in C#, reference types are implicitly pointers. That is why string* attributeNames[] converts to string[] attributeNames

long long in C++ is a 64 bit integer which in C# is the long

Upvotes: 1

Related Questions