Inheritance of a .Net interface: How to access to base properties
I want to create my own category class inherited from Microsoft.Office.Interop.Outlook.Category interface but I am trying to access members of the base interface without success.
I tried base.Name and this.Name both give me:
Error 2 'object' does not contain a definition for 'Name'
Using VS 2013, .Net 4.5
Code:
using System;
using Outlook = Microsoft.Office.Interop.Outlook;
namespace MyCategory
{
public class MyCategory : Outlook.Category
{
private string colorName;
public string ColorName
{
get
{
return this.colorName;
}
set
{
//Name is a member of Outlook.Category
//https://msdn.microsoft.com/en-us/library/office/microsoft.office.interop.outlook.category_members.aspx
this.colorName = base.Name;
//
}
}
}
}
So far I see on your code, you didn't implement interface. You're not inheriting from a class but following contract established by
Outlook.Categoryinterface. There is no "base" members here, you have to add members to your class.If you put mouse cursor above
Outlook.Categoryit should offer to implement it for you.I recommend you to take a deeper look to how interfaces work on C#