<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FReflection%2FParameter</id>
		<title>Csharp/CSharp Tutorial/Reflection/Parameter - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FReflection%2FParameter"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Parameter&amp;action=history"/>
		<updated>2026-04-30T01:30:03Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Parameter&amp;diff=5968&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Parameter&amp;diff=5968&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</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;Версия 15:31, 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://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Parameter&amp;diff=5969&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Parameter&amp;diff=5969&amp;oldid=prev"/>
				<updated>2010-05-26T12:17:52Z</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;==Analyze method parameters using reflection==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System; &lt;br /&gt;
using System.Reflection; &lt;br /&gt;
 &lt;br /&gt;
class MyClass { &lt;br /&gt;
  public MyClass(int i, int j) { &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public int sum() { &lt;br /&gt;
    return 0; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public bool isBetween(int i) { &lt;br /&gt;
    return false; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void set(int a, int b) { &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void set(double a, double b) { &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void show() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;show&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
class MainClass { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    Type t = typeof(MyClass);&lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Analyzing methods in &amp;quot; + t.Name);     &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Methods supported: &amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
    MethodInfo[] mi = t.GetMethods(); &lt;br /&gt;
 &lt;br /&gt;
    // Display methods supported by MyClass. &lt;br /&gt;
    foreach(MethodInfo m in mi) { &lt;br /&gt;
      // Display return type and name. &lt;br /&gt;
      Console.Write(&amp;quot;   &amp;quot; + m.ReturnType.Name + &lt;br /&gt;
                      &amp;quot; &amp;quot; + m.Name + &amp;quot;(&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
      // Display parameters. &lt;br /&gt;
      ParameterInfo[] pi = m.GetParameters(); &lt;br /&gt;
 &lt;br /&gt;
      for(int i=0; i &amp;lt; pi.Length; i++) { &lt;br /&gt;
        Console.Write(pi[i].ParameterType.Name + &lt;br /&gt;
                      &amp;quot; &amp;quot; + pi[i].Name); &lt;br /&gt;
        if(i+1 &amp;lt; pi.Length) Console.Write(&amp;quot;, &amp;quot;); &lt;br /&gt;
      } &lt;br /&gt;
 &lt;br /&gt;
      Console.WriteLine(&amp;quot;)&amp;quot;); &lt;br /&gt;
     &lt;br /&gt;
      Console.WriteLine(); &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Analyzing methods in MyClass&lt;br /&gt;
Methods supported:&lt;br /&gt;
   Int32 sum()&lt;br /&gt;
   Boolean isBetween(Int32 i)&lt;br /&gt;
   Void set(Int32 a, Int32 b)&lt;br /&gt;
   Void set(Double a, Double b)&lt;br /&gt;
   Void show()&lt;br /&gt;
   Type GetType()&lt;br /&gt;
   String ToString()&lt;br /&gt;
   Boolean Equals(Object obj)&lt;br /&gt;
   Int32 GetHashCode()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Generic parameter information==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
using System.Reflection;&lt;br /&gt;
using System.Reflection.Emit;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        PrintTypeParams(typeof(List&amp;lt;&amp;gt;));&lt;br /&gt;
        PrintTypeParams(typeof(List&amp;lt;int&amp;gt;));&lt;br /&gt;
        PrintTypeParams(typeof(Nullable&amp;lt;&amp;gt;));&lt;br /&gt;
    }&lt;br /&gt;
    private static void PrintTypeParams(Type t)&lt;br /&gt;
    {&lt;br /&gt;
        Console.WriteLine(t.FullName);&lt;br /&gt;
        foreach (Type ty in t.GetGenericArguments())&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(ty.FullName);&lt;br /&gt;
            Console.WriteLine(ty.IsGenericParameter);&lt;br /&gt;
            if (ty.IsGenericParameter)&lt;br /&gt;
            {&lt;br /&gt;
                Type[] constraints = ty.GetGenericParameterConstraints();&lt;br /&gt;
                foreach (Type c in constraints)&lt;br /&gt;
                    Console.WriteLine(c.FullName);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;System.Collections.Generic.List`1&lt;br /&gt;
True&lt;br /&gt;
System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicK&lt;br /&gt;
eyToken=b77a5c561934e089]]&lt;br /&gt;
System.Int32&lt;br /&gt;
False&lt;br /&gt;
System.Nullable`1&lt;br /&gt;
True&lt;br /&gt;
System.ValueType&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Invoke method with parameter type int==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System; &lt;br /&gt;
using System.Reflection; &lt;br /&gt;
 &lt;br /&gt;
class MyClass { &lt;br /&gt;
  public MyClass(int i) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Constructing MyClass(int). &amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public MyClass(int i, int j) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Constructing MyClass(int, int). &amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public int sum() { &lt;br /&gt;
    return 0; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public bool isBetween(int i) { &lt;br /&gt;
    return false; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void set(int a, int b) { &lt;br /&gt;
    Console.Write(&amp;quot;Inside set(int, int). &amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void set(double a, double b) { &lt;br /&gt;
    Console.Write(&amp;quot;Inside set(double, double). &amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void show() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Values&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
class MainClass { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    Type t = typeof(MyClass); &lt;br /&gt;
    int x; &lt;br /&gt;
    // Find matching constructor. &lt;br /&gt;
    ConstructorInfo[] ci = t.GetConstructors(); &lt;br /&gt;
 &lt;br /&gt;
    for(x=0; x &amp;lt; ci.Length; x++) { &lt;br /&gt;
      ParameterInfo[] pi =  ci[x].GetParameters(); &lt;br /&gt;
      if(pi.Length == 2) break; &lt;br /&gt;
    } &lt;br /&gt;
 &lt;br /&gt;
    if(x == ci.Length) { &lt;br /&gt;
      Console.WriteLine(&amp;quot;No matching constructor found.&amp;quot;); &lt;br /&gt;
      return; &lt;br /&gt;
    } &lt;br /&gt;
    else &lt;br /&gt;
      Console.WriteLine(&amp;quot;Two-parameter constructor found.\n&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
    // Construct the object.   &lt;br /&gt;
    object[] consargs = new object[2]; &lt;br /&gt;
    consargs[0] = 10; &lt;br /&gt;
    consargs[1] = 20; &lt;br /&gt;
    object reflectOb = ci[x].Invoke(consargs);  &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Two-parameter constructor found.&lt;br /&gt;
Constructing MyClass(int, int).&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>