Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What is the syntax for an interface method when using MarshalAs
  2. public interface IMine
  3. {
  4.   [DispId(1)]
  5.   object stringSize(string txt, string fontName, float fontSize)
  6.   {
  7.     [return: MarshalAs(UnmanagedType.Struct, SafeArraySubType = VarEnum.VT_ARRAY)]
  8.   }
  9. }
  10.        
  11. The name 'MarshalAs' does not exist in the current context
  12.        
  13. public object stringSize(string txt, string fontName, float fontSize)
  14.     {
  15.         System.Drawing.SizeF result = _textSize(txt, fontName, fontSize);
  16.         return new object[] { result.Width, result.Height };
  17.     }
  18.        
  19. public interface IMine
  20. {
  21.   [DispId(1)]
  22.   [return: MarshalAs(UnmanagedType.Struct, SafeArraySubType = VarEnum.VT_ARRAY)]  
  23.   object stringSize(string txt, string fontName, float fontSize)
  24.   {
  25.     // stuff...
  26.   }
  27. }