BindingFlags Enumeration : BindingFlags « 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 Tutorial
VB.Net by API
VB.Net » Reflection » BindingFlagsScreenshots 
BindingFlags Enumeration
 

Imports System
Imports System.Reflection
Imports System.IO


Public Class TestClass
    Public Name As String
    Private values() As [Object{0123456789}

    Default Public Property Item(ByVal index As IntegerAs [Object]
        Get
            Return values(index)
        End Get
        Set(ByVal Value As [Object])
            values(index= Value
        End Set
    End Property

    Public ReadOnly Property Value() As [Object]
        Get
            Return "the value"
        End Get
    End Property

    Public Sub New(ByVal initName As String)
        Name = initName
    End Sub

    Public Sub New()
        MyClass.New("initialName")
    End Sub

    Private methodCalled As Integer = 0

    Public Shared Sub SayHello()
        Console.WriteLine("Hello")
    End Sub

    Public Sub AddUp()
        methodCalled += 1
        Console.WriteLine("AddUp Called {0} times", methodCalled)
    End Sub

    Public Shared Function ComputeSum(ByVal d1 As Double, ByVal d2 As DoubleAs Double
        Return d1 + d2
    End Function

    Public Shared Sub PrintName(ByVal firstName As [String], ByVal lastName As [String])
        Console.WriteLine("{0},{1}", lastName, firstName)
    End Sub

    Public Sub PrintTime()
        Console.WriteLine(DateTime.Now)
    End Sub

    Public Sub Swap(ByRef a As Integer, ByRef b As Integer)
        Dim As Integer = a
        a = b
        b = x
    End Sub
End Class


Class Invoke

    Public Shared Sub Main()
        Dim As Type = GetType(TestClass)

        t.InvokeMember("SayHello", BindingFlags.InvokeMethod Or BindingFlags.Public _
            Or BindingFlags.Static, Nothing, Nothing, New Object() {})
    End Sub
End Class

   
  
Related examples in the same category
1.Call an instance method
2.Call a method with parameters
3.BindingFlags.GetField, SetField
4.Get an indexed property value
5.Get a field or property
6.Invoking a method with named parameters
7.Call the default member of a type
8.Invoking a method with ByRef parameters
9.Creating an instance with parameterless constructor
10.Creating an instance with a constructor that has parameters
11.DeclaredOnly instance members
12.Using IgnoreCase and invoking the PrintName method
13.Using FlattenHierarchy to get inherited static protected and public members
14.Without FlattenHierarchy
w__w_w_.___ja___va___2___s__._co_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.