namespace ComInterfacesInCSharp
{
    public class Class1 : System.Runtime.InteropServices.ComTypes.IAdviseSink 
    {
    }
}
error CS0535: 'Class1' does not implement interface member ...
  ... System.Runtime.InteropServices.ComTypes.IAdviseSink ...
OnDataChange(ref System.Runtime.InteropServices.ComTypes.FORMATETC, 
              ref System.Runtime.InteropServices.ComTypes.STGMEDIUM)
OnViewChange(int, int)
OnRename(System.Runtime.InteropServices.ComTypes.IMoniker)
OnSave()
OnClose()
namespace ComInterfacesInCSharp
{
    public class Class1 : System.Runtime.InteropServices.ComTypes.IAdviseSink 
    {
        void System.Runtime.InteropServices.ComTypes.IAdviseSink.OnDataChange(
                      ref System.Runtime.InteropServices.ComTypes.FORMATETC form, 
                      ref System.Runtime.InteropServices.ComTypes.STGMEDIUM medium) { }
        void System.Runtime.InteropServices.ComTypes.IAdviseSink.OnViewChange(
                      int i1, int i2) {}
        void System.Runtime.InteropServices.ComTypes.IAdviseSink.OnRename(
                         System.Runtime.InteropServices.ComTypes.IMoniker mon) {}
        void System.Runtime.InteropServices.ComTypes.IAdviseSink.OnSave() {}
        void System.Runtime.InteropServices.ComTypes.IAdviseSink.OnClose() {}
    }
}
using System.Runtime.InteropServices.ComTypes;
namespace ComInterfacesInCSharp
{
    public class Class1 : IAdviseSink 
    {
        void IAdviseSink.OnDataChange(ref FORMATETC form, 
                      ref STGMEDIUM medium) { }
        void IAdviseSink.OnViewChange(int i1, int i2) {}
        void IAdviseSink.OnRename(IMoniker mon) {}
        void IAdviseSink.OnSave() {}
        void IAdviseSink.OnClose() {}
    }
}
*** EDIT *** EDIT *** EDIT *** EDIT ***
So I asked about another interface on StackOverflow that wasn't playing ball and my new favourite Stackoverflow user gave both an excellent link to Microsoft Reference Source site and also a new gif to remind me that the C# IDE can be very very helpful and write out the interface for you from the menu. Here is the gif ...
 
 
No comments:
Post a Comment