PropertyInfo.SetValue : PropertyInfo « Reflection « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net » Reflection » PropertyInfo 




PropertyInfo.SetValue
 

Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Public Class TestClass
    Private myCaption As String = "A Default caption"
    Public Property Caption() As String
        Get
            Return myCaption
        End Get
        Set
            If myCaption <> value Then myCaption = value
        End Set
    End Property
End Class

Public Class TestPropertyInfo
    Public Shared Sub Main()
        Dim As New TestClass()

        Dim myType As Type = t.GetType()
        Dim pinfo As PropertyInfo = myType.GetProperty("Caption")

        Console.WriteLine(pinfo.GetValue(t, Nothing))

        pinfo.SetValue(t, "changed.", Nothing)

        Console.WriteLine(pinfo.GetValue(t, Nothing))
    End Sub
End Class

   
  














Related examples in the same category
1.PropertyInfo.Attributes Property gets the attributes for this property.
2.PropertyInfo.CanRead
3.PropertyInfo.CanWrite
4.PropertyInfo.GetAccessors
5.PropertyInfo.GetGetMethod returns the public or non-public get accessor for this property.
6.Get and display the GetGetMethod Method for each property
7.Display the GetGetMethod without using the MethodInfo
8.PropertyInfo.GetIndexParameters
9.Get Index Parameters
10.PropertyInfo.GetSetMethod
11.Display the GetSetMethod without using the MethodInfo
12.PropertyInfo.MemberType
13.PropertyInfo.PropertyType Property
14.LocalVariableInfo Class (System.Reflection)_VB.htm
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.