【发布时间】:2009-06-24 20:30:32
【问题描述】:
C#,网络 2.0
这是代码(我取出了所有特定于域的东西,它仍然返回一个空数组):
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ChildClass cc = new ChildClass();
cc.OtherProperty = 1;
FieldInfo[] fi = cc.GetType().GetFields();
Console.WriteLine(fi.Length);
Console.ReadLine();
}
}
class BaseClass<T>
{
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
}
class ChildClass : BaseClass<ChildClass>
{
private int myVar;
public int OtherProperty
{
get { return myVar; }
set { myVar = value; }
}
}
}
【问题讨论】:
标签: c# reflection type-parameter