Allows reflection upon a property or field by name.
Syntax
Visual Basic (Declaration) | |
---|
Public Class PropertyType |
C# | |
---|
public class PropertyType |
Example
Library/Library.Test/TestPropertyType.cs
C# | Copy Code |
---|
PropertyType pt = new PropertyType(typeof(a), "PropertyA");
Assert.IsTrue(pt.IsDefined(typeof(System.ComponentModel.DisplayNameAttribute), false));
Assert.AreEqual(1, pt.GetCustomAttributes(false).Length);
Assert.AreEqual(1, pt.GetCustomAttributes(typeof(System.ComponentModel.DisplayNameAttribute), false).Length);
Assert.AreEqual(0, pt.GetCustomAttributes(typeof(System.ComponentModel.DesignOnlyAttribute), false).Length); |
VB.NET | Copy Code |
---|
Dim pt As New PropertyType(GetType(a), "PropertyA")
Assert.IsTrue(pt.IsDefined(GetType(System.ComponentModel.DisplayNameAttribute), False))
Assert.AreEqual(1, pt.GetCustomAttributes(False).Length)
Assert.AreEqual(1, pt.GetCustomAttributes(GetType(System.ComponentModel.DisplayNameAttribute), False).Length)
Assert.AreEqual(0, pt.GetCustomAttributes(GetType(System.ComponentModel.DesignOnlyAttribute), False).Length) |
Inheritance Hierarchy
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also