Allows setting or getting a property or field on an object via reflection
Syntax
Visual Basic (Declaration) | |
---|
Public Class PropertyValue
Inherits PropertyType |
Example
Library/Library.Test/TestPropertyValue.cs
C# | Copy Code |
---|
a obj = new a();
obj.PropertyA = "a";
PropertyValue pt = new PropertyValue(obj, "privateField");
Assert.AreEqual("privateField", pt.Name);
Assert.AreEqual(typeof(string), pt.Type);
Assert.AreEqual("a", pt.Value);
pt.Value = "b";
Assert.AreEqual("b", pt.Value); |
VB.NET | Copy Code |
---|
Dim obj As New a()
obj.PropertyA = "a"
Dim pt As New PropertyValue(obj, "privateField")
Assert.AreEqual("privateField", pt.Name)
Assert.AreEqual(GetType(String), pt.Type)
Assert.AreEqual("a", pt.Value)
pt.Value = "b"
Assert.AreEqual("b", pt.Value) |
Inheritance Hierarchy
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also