I'm trying to implement a Component Object Model interface in C# but I'm running into some issues.
This is the interface
interface IInsModule: IDispatch
{
[id(0x00000001)]
HRESULT _stdcall Mod_Initialize(
[in] IInsDriver *driver,
[in] IInsCommBase *comm,
[in] IInsBaseModule *basemod,
[in] IInsBaseMessage *basemsg,
[in] IInsLogWriter *logger );
[id(0x00000002)]
HRESULT _stdcall Mod_Activate( void );
[id(0x00000003)]
HRESULT _stdcall Mod_Finish( void );
[id(0x00000004)]
[propput] HRESULT _stdcall Mod_Value( long key, [in] BSTR value );
[id(0x00000004)]
[propget] HRESULT _stdcall Mod_Value( long key, [out, retval] BSTR *value );
};
And this is my code so far which has been auto implemented by Visual Studio.
public class CSharpDriver : IInsModule
{
public void Mod_Initialize(CoDriver driver, IInsCommBase comm, IInsBaseModule basemod, IInsBaseMessage basemsg, IInsLogWriter logger)
{
throw new NotImplementedException();
}
public void Mod_Activate()
{
throw new NotImplementedException();
}
public void Mod_Finish()
{
throw new NotImplementedException();
}
public string Mod_Value { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
}
The 3 "normal" methods implement just fine and I get no errors at this stage, the problem is that I get red squiggy on IInsModule with the messages
- CS0535: 'CSharpDriver' does not implement interface member 'IInsModule.Mod_Value[int].set'
- CS0535: 'CSharpDriver' does not implement interface member 'IInsModule.Mod_Value[int].get'
I've tried every possible variation of a getter and setter I can think of but nothing has satisfied the interface. I don't know how to write it since IInsModule.Mod_Value[int].set and get are weird looking because of that int. Hope someone can tell me what to write based on the interface, thanks!