Interface definition
public interface IPayeePayrollRunInitialPayElementData : IPayeePayrollRunPayElementData
But in my code the BaseType of my interface is null. I cannot make any sense of this!
Because it's defined to be so?
Interfaces inherit from zero or more base interfaces; therefore, this property returns null if the Type object represents an interface. The base interfaces can be determined with GetInterfaces or FindInterfaces .
From Type.BaseType
page;
Interfaces inherit from zero or more base interfaces; therefore, this property returns null if the Type object represents an interface . The base interfaces can be determined with
GetInterfaces
orFindInterfaces
.
public interface IPayeePayrollRunInitialPayElementData : IPayeePayrollRunPayElementData
{ }
public interface IPayeePayrollRunPayElementData
{ }
class Program
{
static void Main(string[] args)
{
foreach (Type tinterface in typeof(IPayeePayrollRunInitialPayElementData).GetInterfaces())
{
Console.WriteLine(tinterface.FullName);
}
}
}
Output will be;
IPayeePayrollRunPayElementData
Here is a DEMO
.
接口不是从对象派生的。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.