<?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%2FInterface</id>
		<title>Csharp/CSharp Tutorial/Reflection/Interface - История изменений</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%2FInterface"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Interface&amp;action=history"/>
		<updated>2026-04-29T23:44:44Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Reflection/Interface&amp;diff=5964&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/Interface&amp;diff=5964&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/Interface&amp;diff=5965&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/Interface&amp;diff=5965&amp;oldid=prev"/>
				<updated>2010-05-26T12:17:51Z</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;==Get all implemented interface and their methods==&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;
public interface IFaceOne&lt;br /&gt;
{&lt;br /&gt;
  void MethodA();&lt;br /&gt;
}&lt;br /&gt;
public interface IFaceTwo&lt;br /&gt;
{&lt;br /&gt;
  void MethodB();&lt;br /&gt;
}&lt;br /&gt;
public class MyClass: IFaceOne, IFaceTwo&lt;br /&gt;
{&lt;br /&gt;
  public enum MyNestedEnum{}&lt;br /&gt;
  &lt;br /&gt;
  public int myIntField;&lt;br /&gt;
  public string myStringField;&lt;br /&gt;
  public void myMethod(int p1, string p2)&lt;br /&gt;
  {&lt;br /&gt;
  }&lt;br /&gt;
  public int MyProp&lt;br /&gt;
  {&lt;br /&gt;
    get { return myIntField; }&lt;br /&gt;
    set { myIntField = value; }&lt;br /&gt;
  }&lt;br /&gt;
  void IFaceOne.MethodA(){}&lt;br /&gt;
  void IFaceTwo.MethodB(){}&lt;br /&gt;
}&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main(string[] args)&lt;br /&gt;
  {&lt;br /&gt;
    MyClass f = new MyClass();&lt;br /&gt;
    Type t = f.GetType();&lt;br /&gt;
    &lt;br /&gt;
    Type[] iFaces = t.GetInterfaces();&lt;br /&gt;
    for(int i = 0; i &amp;lt; iFaces.Length; i ++)&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Info on Interface named: {0}&amp;quot;, iFaces[i]);&lt;br /&gt;
      MethodInfo[] classMethodNames = t.GetInterfaceMap(iFaces[i]).TargetMethods;&lt;br /&gt;
      MethodInfo[] interfaceMethodNames = t.GetInterfaceMap(iFaces[i]).InterfaceMethods;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Info on Interface named: IFaceOne&lt;br /&gt;
Info on Interface named: IFaceTwo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Map Interface Methods To Class Methods==&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;
public interface IFaceOne&lt;br /&gt;
{&lt;br /&gt;
  void MethodA();&lt;br /&gt;
}&lt;br /&gt;
public interface IFaceTwo&lt;br /&gt;
{&lt;br /&gt;
  void MethodB();&lt;br /&gt;
}&lt;br /&gt;
public class MyClass: IFaceOne, IFaceTwo&lt;br /&gt;
{&lt;br /&gt;
  public enum MyNestedEnum{}&lt;br /&gt;
  &lt;br /&gt;
  public int myIntField;&lt;br /&gt;
  public string myStringField;&lt;br /&gt;
  public void myMethod(int p1, string p2)&lt;br /&gt;
  {&lt;br /&gt;
  }&lt;br /&gt;
  public int MyProp&lt;br /&gt;
  {&lt;br /&gt;
    get { return myIntField; }&lt;br /&gt;
    set { myIntField = value; }&lt;br /&gt;
  }&lt;br /&gt;
  void IFaceOne.MethodA(){}&lt;br /&gt;
  void IFaceTwo.MethodB(){}&lt;br /&gt;
}&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main(string[] args)&lt;br /&gt;
  {&lt;br /&gt;
    MyClass f = new MyClass();&lt;br /&gt;
    Type t = f.GetType();&lt;br /&gt;
    &lt;br /&gt;
    Type[] iFaces = t.GetInterfaces();&lt;br /&gt;
    for(int i = 0; i &amp;lt; iFaces.Length; i ++)&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Info on Interface named: {0}&amp;quot;, iFaces[i]);&lt;br /&gt;
      MethodInfo[] classMethodNames = t.GetInterfaceMap(iFaces[i]).TargetMethods;&lt;br /&gt;
      MethodInfo[] interfaceMethodNames = t.GetInterfaceMap(iFaces[i]).InterfaceMethods;&lt;br /&gt;
      for(int j = 0; j &amp;lt; classMethodNames.Length; j++)&lt;br /&gt;
      {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Interface method: {0}&amp;quot;,  interfaceMethodNames[j].Name);&lt;br /&gt;
        Console.WriteLine(&amp;quot;is implemented by class method: {0}&amp;quot;, classMethodNames[j].Name);&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;Info on Interface named: IFaceOne&lt;br /&gt;
Interface method: MethodA&lt;br /&gt;
is implemented by class method: IFaceOne.MethodA&lt;br /&gt;
Info on Interface named: IFaceTwo&lt;br /&gt;
Interface method: MethodB&lt;br /&gt;
is implemented by class method: IFaceTwo.MethodB&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Return Type Inference==&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.ruponentModel;&lt;br /&gt;
&lt;br /&gt;
    delegate T MyFunc&amp;lt;T&amp;gt;();&lt;br /&gt;
    class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        static void WriteResult&amp;lt;T&amp;gt;(MyFunc&amp;lt;T&amp;gt; function)&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(function());&lt;br /&gt;
        }&lt;br /&gt;
        static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            WriteResult(delegate { return 5; });&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Type: IsNestedPrivate, IsNestedPublic==&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;
public interface IFaceOne&lt;br /&gt;
{&lt;br /&gt;
  void MethodA();&lt;br /&gt;
}&lt;br /&gt;
public interface IFaceTwo&lt;br /&gt;
{&lt;br /&gt;
  void MethodB();&lt;br /&gt;
}&lt;br /&gt;
public class MyClass: IFaceOne, IFaceTwo&lt;br /&gt;
{&lt;br /&gt;
  public enum MyNestedEnum{}&lt;br /&gt;
  &lt;br /&gt;
  public int myIntField;&lt;br /&gt;
  public string myStringField;&lt;br /&gt;
  public void myMethod(int p1, string p2)&lt;br /&gt;
  {&lt;br /&gt;
  }&lt;br /&gt;
  public int MyProp&lt;br /&gt;
  {&lt;br /&gt;
    get { return myIntField; }&lt;br /&gt;
    set { myIntField = value; }&lt;br /&gt;
  }&lt;br /&gt;
  void IFaceOne.MethodA(){}&lt;br /&gt;
  void IFaceTwo.MethodB(){}&lt;br /&gt;
}&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
  public static void Main(string[] args)&lt;br /&gt;
  {&lt;br /&gt;
    MyClass theMyClass = new MyClass();&lt;br /&gt;
    Type t = Type.GetType(&amp;quot;MyClass&amp;quot;);&lt;br /&gt;
    Console.WriteLine(&amp;quot;Enum name? {0}&amp;quot;, t.Name);&lt;br /&gt;
    Console.WriteLine(&amp;quot;Is enum nested private? {0}&amp;quot;, t.IsNestedPrivate);&lt;br /&gt;
    Console.WriteLine(&amp;quot;Is enum nested public? {0}&amp;quot;, t.IsNestedPublic);&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Enum name? MyClass&lt;br /&gt;
Is enum nested private? False&lt;br /&gt;
Is enum nested public? False&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>