N
NG
Hi All,
I want to declare an interface in C#. I have the equivalent code for VB.NET
but when I try to write the corresponding code in C#, it does not work. Can
anyone please help me by providing the correct code.
I am pasting below both VB.NET code (working) and C# code (not working)
<VB.NET>
Option Explicit On
Option Strict On
Imports System.Runtime.InteropServices
<ComVisible(True), ComImport(),
Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IPersistStreamInit
' IPersist interface
Sub GetClassID(ByRef pClassID As Guid)
<PreserveSig()> Function IsDirty() As Integer
<PreserveSig()> Function Load(ByVal pstm As UCOMIStream) As Integer
<PreserveSig()> Function Save(ByVal pstm As UCOMIStream, ByVal
ByValfClearDirty As Boolean) As Integer
<PreserveSig()> Function GetSizeMax(<InAttribute(), Out(),
MarshalAs(UnmanagedType.U8)> ByRef pcbSize As Long) As Integer
<PreserveSig()> Function InitNew() As Integer
End Interface
</VB.NET>
<CSHARP>
using System.Runtime.InteropServices;
[Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"),
InterfaceType(ComInterfaceType.InterfaceIsDual)]
interface IPersistStreamInit // cannot list any base interfaces here
{
void GetClassID(System.Guid pClassID);
[PreserveSig] int IsDirty();
[PreserveSig] int Load([In] UCOMIStream pstm);
[PreserveSig] int Save([In] UCOMIStream pstm, [In] bool ClearDirty);
[PreserveSig] int GetSizeMax([In, Out, MarshalAs(UnmanagedType.U8)] ref long
pcbSize);
[PreserveSig] int InitNew();
}
</CSHARP>
Any help is much appreciated.
Thanks
NG
I want to declare an interface in C#. I have the equivalent code for VB.NET
but when I try to write the corresponding code in C#, it does not work. Can
anyone please help me by providing the correct code.
I am pasting below both VB.NET code (working) and C# code (not working)
<VB.NET>
Option Explicit On
Option Strict On
Imports System.Runtime.InteropServices
<ComVisible(True), ComImport(),
Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IPersistStreamInit
' IPersist interface
Sub GetClassID(ByRef pClassID As Guid)
<PreserveSig()> Function IsDirty() As Integer
<PreserveSig()> Function Load(ByVal pstm As UCOMIStream) As Integer
<PreserveSig()> Function Save(ByVal pstm As UCOMIStream, ByVal
ByValfClearDirty As Boolean) As Integer
<PreserveSig()> Function GetSizeMax(<InAttribute(), Out(),
MarshalAs(UnmanagedType.U8)> ByRef pcbSize As Long) As Integer
<PreserveSig()> Function InitNew() As Integer
End Interface
</VB.NET>
<CSHARP>
using System.Runtime.InteropServices;
[Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"),
InterfaceType(ComInterfaceType.InterfaceIsDual)]
interface IPersistStreamInit // cannot list any base interfaces here
{
void GetClassID(System.Guid pClassID);
[PreserveSig] int IsDirty();
[PreserveSig] int Load([In] UCOMIStream pstm);
[PreserveSig] int Save([In] UCOMIStream pstm, [In] bool ClearDirty);
[PreserveSig] int GetSizeMax([In, Out, MarshalAs(UnmanagedType.U8)] ref long
pcbSize);
[PreserveSig] int InitNew();
}
</CSHARP>
Any help is much appreciated.
Thanks
NG