CSharpTest.Net
PropertyValue Constructor
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Reflection Namespace > PropertyValue Class : PropertyValue Constructor

instance
An instance of an object to retrieve the property/field from
name
The name of the property or field

Glossary Item Box

Provided an instance of an object and the name of a property/field this object allows you to set/get the value in that property/field

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal instance As Object, _
   ByVal name As String _
)
C# 
public PropertyValue( 
   object instance,
   string name
)

Parameters

instance
An instance of an object to retrieve the property/field from
name
The name of the property or field

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.NETCopy 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)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys