com - Passing string by ref to activex component in C# -
i'm trying activex api function pattern function(ref string returnvalue) in c#. api function modifies string.
string returnvalue = string.empty; api.func(ref returnvalue); // disp_e_typemismatch ok, maybe that's because strings immutable. trying stringbuilder per this:
stringbuilder returnvalue = new stringbuilder(128); api.func(returnvalue); this causes compile-time error type mismatch.
how call function?
i don't know if need marshal c# string bstr, , if so, don't know how pass ref api function.
if func should change returnvalue , think code should changed this:
string returnvalue = string.empty; api.func(ref returnvalue); you should init returnvalue before pass ref.
upd: did try call this?:
api.func(ref marshal.stringtobstr(string value));
Comments
Post a Comment