|
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ComInterOpExample
{
[Guid("69C85C8D-DBEB-4d85-83A7-7E5077AD11BA")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface iInterface
{
[DispId(1)] int PerformAddition(int a, int b);
[DispId(2)] int PerformDeletion(int a, int b);
}
[Guid("0C216A19-E1B7-4b05-86D3-4C516BDDC041")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("ComInterOpClass")]
public class ComInterOpClass:iInterface
{
#region iInterface Members
public int PerformAddition(int a, int b)
{
// throw new Exception("The method or operation is not implemented.");
try
{
return a + b;
}
catch
{
return 0;
}
}
public int PerformDeletion(int a, int b)
{
//throw new Exception("The method or operation is not implemented.");
try
{
return a - b;
}
catch
{
return 0;
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.