views:

254

answers:

1

I've build a classlibrary using c# and the .net framework 3.5. In my class library there is a class called Utilities with two methods.

public string Method1(int length)
{
}

public string Method2(int length, string aStringParameter)
{
}

Now I went and build a simple asp page calling my methods. Method1 work like a charm. Method2 causes a "Type Mismatch" error. What am I missing here?

+1  A: 

Try to put

  MarshalAs(UnmanagedType.BStr)

for string type that you are passing to method2.

Here is a detailed explanation.

Vinay