What is the syntax for an interface method when using MarshalAs

Radiation

New Member
I am trying to create a COM object that has a method in it. The method returns an array which has to be marshalled because it is being used by Classic ASP.I have found questions on stack overflow that show me how to do it for properties but not for methods.This is what I have tried:\[code\]public interface IMine{ [DispId(1)] object stringSize(string txt, string fontName, float fontSize) { [return: MarshalAs(UnmanagedType.Struct, SafeArraySubType = VarEnum.VT_ARRAY)] }}\[/code\]It's clearly wrong as I'm getting the error:\[code\]The name 'MarshalAs' does not exist in the current context\[/code\]which means nothing to me.The actual method is:\[code\] public object stringSize(string txt, string fontName, float fontSize) { System.Drawing.SizeF result = _textSize(txt, fontName, fontSize); return new object[] { result.Width, result.Height }; }\[/code\]Somebody please correct my syntax.
 
Top