<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_by_API%2FSystem.Reflection%2FMethodInfo</id>
		<title>VB.Net by API/System.Reflection/MethodInfo - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_by_API%2FSystem.Reflection%2FMethodInfo"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_by_API/System.Reflection/MethodInfo&amp;action=history"/>
		<updated>2026-04-05T05:42:48Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_by_API/System.Reflection/MethodInfo&amp;diff=2385&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_by_API/System.Reflection/MethodInfo&amp;diff=2385&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:16Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_by_API/System.Reflection/MethodInfo&amp;diff=2386&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_by_API/System.Reflection/MethodInfo&amp;diff=2386&amp;oldid=prev"/>
				<updated>2010-05-26T12:50:45Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==MethodInfo.GetCustomAttributes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;  &lt;br /&gt;
Imports System.Reflection&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Public Shared Sub Main()&lt;br /&gt;
        Dim MethodObj As System.Reflection.MethodInfo&lt;br /&gt;
        Dim MessageDemo As New Demo()&lt;br /&gt;
        For Each MethodObj In MessageDemo.GetType.GetMethods()&lt;br /&gt;
            Dim Attr As Attribute&lt;br /&gt;
            For Each Attr In MethodObj.GetCustomAttributes(False)&lt;br /&gt;
                Console.WriteLine(MethodObj.Name)&lt;br /&gt;
                Console.WriteLine(Attr)&lt;br /&gt;
                Console.WriteLine(CType(Attr, UserName).Name)&lt;br /&gt;
            Next&lt;br /&gt;
        Next&lt;br /&gt;
   &lt;br /&gt;
   End Sub&lt;br /&gt;
End Class &lt;br /&gt;
&lt;br /&gt;
Class UserName&lt;br /&gt;
    Inherits Attribute&lt;br /&gt;
    Public Name As String &lt;br /&gt;
    Public Sub New(ByVal Name As String)&lt;br /&gt;
        MyBase.New()&lt;br /&gt;
        Me.Name = Name&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
Class Demo&lt;br /&gt;
    &amp;lt;UserName(&amp;quot;Name 1&amp;quot;)&amp;gt; Sub DemoMsg()&lt;br /&gt;
        Console.WriteLine(&amp;quot;Message&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;lt;UserName(&amp;quot;Name 2&amp;quot;)&amp;gt; Sub Greet()&lt;br /&gt;
        Console.WriteLine(&amp;quot;Hello&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MethodInfo.GetParameters()==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;  &lt;br /&gt;
Imports System.Reflection&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
   Public Shared Sub Main()&lt;br /&gt;
        Dim SomeObj = New Demo()&lt;br /&gt;
        Dim IntegerVar As Integer = 1&lt;br /&gt;
        Dim DoubleVar As Double = 100.0&lt;br /&gt;
        Dim StringVar As String = &amp;quot;Hello&amp;quot;&lt;br /&gt;
        Dim Param As ParameterInfo&lt;br /&gt;
        Dim MethodObj As System.Reflection.MethodInfo&lt;br /&gt;
        For Each MethodObj In SomeObj.GetType.GetMethods()&lt;br /&gt;
            Dim Parameters(MethodObj.GetParameters().Length - 1) As Object&lt;br /&gt;
            Dim CallMethod As Boolean = True&lt;br /&gt;
            Dim I As Integer = 0&lt;br /&gt;
            For Each Param In MethodObj.GetParameters()&lt;br /&gt;
                If Equals(Param.ParameterType, IntegerVar.GetType()) Then&lt;br /&gt;
                    Parameters(I) = IntegerVar&lt;br /&gt;
                ElseIf Equals(Param.ParameterType, DoubleVar.GetType()) Then&lt;br /&gt;
                    Parameters(I) = DoubleVar&lt;br /&gt;
                ElseIf Equals(Param.ParameterType, StringVar.GetType()) Then&lt;br /&gt;
                    Parameters(I) = StringVar&lt;br /&gt;
                Else&lt;br /&gt;
                    CallMethod = False&lt;br /&gt;
                End If&lt;br /&gt;
                I = I + 1&lt;br /&gt;
            Next&lt;br /&gt;
            If (CallMethod) Then&lt;br /&gt;
                If MethodObj.GetParameters().Length = 0 Then&lt;br /&gt;
                    Console.WriteLine(&amp;quot;Calling: &amp;quot; &amp;amp; MethodObj.Name)&lt;br /&gt;
                    Console.WriteLine(MethodObj.Invoke(SomeObj, Nothing))&lt;br /&gt;
                Else&lt;br /&gt;
                    Console.WriteLine(&amp;quot;Calling: &amp;quot; &amp;amp; MethodObj.Name)&lt;br /&gt;
                    Console.WriteLine(MethodObj.Invoke(SomeObj, Parameters))&lt;br /&gt;
                End If&lt;br /&gt;
            End If&lt;br /&gt;
            Console.WriteLine()&lt;br /&gt;
        Next&lt;br /&gt;
   &lt;br /&gt;
   End Sub&lt;br /&gt;
End Class &lt;br /&gt;
&lt;br /&gt;
    Class Demo&lt;br /&gt;
        Public Sub Hello()&lt;br /&gt;
        End Sub&lt;br /&gt;
        Public Sub ShowMessage(ByVal Msg As String)&lt;br /&gt;
        End Sub&lt;br /&gt;
        Public Function AddTwoIntegers(ByVal A As Integer, ByVal B As Integer) As Integer&lt;br /&gt;
        End Function&lt;br /&gt;
        Public Sub ShowThreeDoubles(ByVal A As Double, ByVal B As Double, ByVal C As Double)&lt;br /&gt;
        End Sub&lt;br /&gt;
    End Class&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MethodInfo.Invoke==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;  &lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Reflection&lt;br /&gt;
 &lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main(  )&lt;br /&gt;
         Dim theMathType As Type = Type.GetType(&amp;quot;System.Math&amp;quot;)&lt;br /&gt;
         Dim paramTypes(0) As Type&lt;br /&gt;
         paramTypes(0) = Type.GetType(&amp;quot;System.Double&amp;quot;)&lt;br /&gt;
         Dim ConsineInfo As MethodInfo = _&lt;br /&gt;
             theMathType.GetMethod(&amp;quot;Sin&amp;quot;, paramTypes)&lt;br /&gt;
         Dim parameters(0) As Object&lt;br /&gt;
         parameters(0) = 45 * (Math.PI / 180)&lt;br /&gt;
         Dim returnVal As Object&lt;br /&gt;
         returnVal = ConsineInfo.Invoke(theMathType, parameters)&lt;br /&gt;
         Console.WriteLine(&amp;quot;The sine of a 45 degree angle is {0}&amp;quot;, _&lt;br /&gt;
             returnVal)&lt;br /&gt;
    End Sub&lt;br /&gt;
  &lt;br /&gt;
End Class&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MethodInfo.Name==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;  &lt;br /&gt;
Module Module1&lt;br /&gt;
    Class Book&lt;br /&gt;
        Public Title As String&lt;br /&gt;
        Public Author As String&lt;br /&gt;
        Public Price As Double&lt;br /&gt;
        Public Sub New(ByVal Title As String, ByVal Author As String, ByVal Price As Double)&lt;br /&gt;
            Me.Title = Title&lt;br /&gt;
            Me.Author = Author&lt;br /&gt;
            Me.Price = Price&lt;br /&gt;
        End Sub&lt;br /&gt;
        Public Sub ShowTitle()&lt;br /&gt;
            Console.WriteLine(&amp;quot;Title: &amp;quot; &amp;amp; Title)&lt;br /&gt;
        End Sub&lt;br /&gt;
        Public Sub ShowBook()&lt;br /&gt;
            Console.WriteLine(&amp;quot;Title: &amp;quot; &amp;amp; Title)&lt;br /&gt;
            Console.WriteLine(&amp;quot;Author: &amp;quot; &amp;amp; Author)&lt;br /&gt;
            Console.WriteLine(&amp;quot;Price: &amp;quot; &amp;amp; Price)&lt;br /&gt;
        End Sub&lt;br /&gt;
    End Class&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Dim NetBook As New Book(&amp;quot;AAA&amp;quot;,&amp;quot;BBB&amp;quot;, 49.99)&lt;br /&gt;
        Console.WriteLine(&amp;quot;Method Names&amp;quot;)&lt;br /&gt;
        Dim Info As Reflection.MethodInfo&lt;br /&gt;
        For Each Info In NetBook.GetType.GetMethods()&lt;br /&gt;
            Console.WriteLine(Info.Name)&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>