http://msdn.microsoft.com/en-us/library/435f1dw2.aspx
public class Base
{
public string Field;
}
public class Child : Base
{
public new string Field;
}
[TestFixture]
public class TestClass
{
[Test]
public void DetectNew()
{
var fieldInfo = typeof(Child).GetField("Field");
//How do I tell fieldInfo has a new modifier?
Debug.WriteLine(fieldInfo);
}
}
Edit: I know for Methods and Properties I can check “MethodBase.IsHideBySig”. Why doesnt a similar property exist for FieldInfo?
Just a guess, but I think you’d have to search the base-class(es) for a member with the same name.
You could also take a look at the generated IL for both fields to see if there’re any differences that you can use through reflection.