C# Property inheritance question

Posted by mcxiand on Stack Overflow See other posts from Stack Overflow or by mcxiand
Published on 2010-05-12T06:04:55Z Indexed on 2010/05/12 6:14 UTC
Read the original article Hit count: 205

Filed under:
|

Hi all,

How do i inherit a property in c# from an interface and give that property other name on the class?

For example:

public interface IFoo
{
  int Num {get;set;}
}

public class IFooCls : IFoo
{
  int Ifoo.Num{get;set}
}

In this case, what the property name in the interface is also the same in the class. What i want is to give other property name on the class but still pointing to "Num" in the interface in this case. In VB, we can do it like this:

Public ReadOnly Property UserId() As String Implements System.Security.Principal.IIdentity.Name
    Get
        Return _userId
    End Get
End Property

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET