@ForEveR
В астрале
7991 / 4750 / 321
Регистрация: 24.06.2010
Сообщений: 10,547
|
29.11.2011, 23:13
|
|
Bers, http://ru.wikipedia.org/wiki/%CE%F2%...E0%ED%E8%E5%29
Пример на шарпе.
C# | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Reflection;
namespace first
{
class Some
{
public Some():this(0)
{
}
public Some(int t)
{
Value = t;
}
public int Value {get; set;}
public void Method()
{
Console.WriteLine(this.GetType().GetMethod("Method").Name);
}
static void Main(string[] args)
{
Type t = Type.GetType("first.Some");
ConstructorInfo[] info = t.GetConstructors();
Some first = (Some)info[0].Invoke(null);
Console.WriteLine(first.Value);
Some second = (Some)info[1].Invoke(new object[] {5});
Console.WriteLine(second.Value);
MethodInfo method = t.GetMethod("Method");
method.Invoke(first, null);
}
}
} |
|
Вывод :
Код
0
5
Method
Press any key to continue...
0
|