<?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%2FGeneric%2FGeneric_Class</id>
		<title>Csharp/CSharp Tutorial/Generic/Generic Class - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FGeneric%2FGeneric_Class"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Generic/Generic_Class&amp;action=history"/>
		<updated>2026-04-30T02:47:29Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Generic/Generic_Class&amp;diff=5289&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/Generic/Generic_Class&amp;diff=5289&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/Generic/Generic_Class&amp;diff=5290&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/Generic/Generic_Class&amp;diff=5290&amp;oldid=prev"/>
				<updated>2010-05-26T12:14:48Z</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;==A simple generic class==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;T is a type parameter that will be replaced by a real type when an object of type Gen is created.&amp;lt;/p&amp;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;
 &lt;br /&gt;
class Gen&amp;lt;T&amp;gt; { &lt;br /&gt;
  T ob;&lt;br /&gt;
   &lt;br /&gt;
  public Gen(T o) { &lt;br /&gt;
    ob = o; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public T getob() { &lt;br /&gt;
    return ob; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void showType() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Type of T is &amp;quot; + typeof(T)); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
class MainClass { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    Gen&amp;lt;int&amp;gt; iOb = new Gen&amp;lt;int&amp;gt;(102); &lt;br /&gt;
    iOb.showType(); &lt;br /&gt;
 &lt;br /&gt;
    int v = iOb.getob(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;value: &amp;quot; + v); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    Gen&amp;lt;string&amp;gt; strOb = new Gen&amp;lt;string&amp;gt;(&amp;quot;Generics add power.&amp;quot;); &lt;br /&gt;
    strOb.showType(); &lt;br /&gt;
    string str = strOb.getob(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;value: &amp;quot; + str); &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==A simple generic class with two type parameters: T and V==&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;
 &lt;br /&gt;
class TwoGen&amp;lt;T, V&amp;gt; { &lt;br /&gt;
  T ob1; &lt;br /&gt;
  V ob2; &lt;br /&gt;
   &lt;br /&gt;
  public TwoGen(T o1, V o2) { &lt;br /&gt;
    ob1 = o1; &lt;br /&gt;
    ob2 = o2; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void showTypes() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Type of T is &amp;quot; + typeof(T)); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Type of V is &amp;quot; + typeof(V)); &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public T getT() { &lt;br /&gt;
    return ob1; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public V getV() { &lt;br /&gt;
    return ob2; &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
class MainClass { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
 &lt;br /&gt;
    TwoGen&amp;lt;int, string&amp;gt; tgObj = new TwoGen&amp;lt;int, string&amp;gt;(1, &amp;quot;A&amp;quot;); &lt;br /&gt;
 &lt;br /&gt;
    tgObj.showTypes(); &lt;br /&gt;
 &lt;br /&gt;
    int v = tgObj.getT(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;value: &amp;quot; + v); &lt;br /&gt;
 &lt;br /&gt;
    string str = tgObj.getV(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;value: &amp;quot; + str); &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Type of T is System.Int32&lt;br /&gt;
Type of V is System.String&lt;br /&gt;
value: 1&lt;br /&gt;
value: A&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Generic Pair==&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.ruponentModel;&lt;br /&gt;
    public sealed class Pair&amp;lt;TFirst, TSecond&amp;gt;: IEquatable&amp;lt;Pair&amp;lt;TFirst, TSecond&amp;gt;&amp;gt;{&lt;br /&gt;
        private readonly TFirst first;&lt;br /&gt;
        private readonly TSecond second;&lt;br /&gt;
        public Pair(TFirst first, TSecond second)&lt;br /&gt;
        {&lt;br /&gt;
            this.first = first;&lt;br /&gt;
            this.second = second;&lt;br /&gt;
        }&lt;br /&gt;
        public TFirst First&lt;br /&gt;
        {&lt;br /&gt;
            get { return first; }&lt;br /&gt;
        }&lt;br /&gt;
        public TSecond Second&lt;br /&gt;
        {&lt;br /&gt;
            get { return second; }&lt;br /&gt;
        }&lt;br /&gt;
        public bool Equals(Pair&amp;lt;TFirst, TSecond&amp;gt; other)&lt;br /&gt;
        {&lt;br /&gt;
            if (other == null)&lt;br /&gt;
            {&lt;br /&gt;
                return false;&lt;br /&gt;
            }&lt;br /&gt;
            return EqualityComparer&amp;lt;TFirst&amp;gt;.Default.Equals(this.First, other.First) &amp;amp;&amp;amp;&lt;br /&gt;
                   EqualityComparer&amp;lt;TSecond&amp;gt;.Default.Equals(this.Second, other.Second);&lt;br /&gt;
        }&lt;br /&gt;
        public override bool Equals(object o)&lt;br /&gt;
        {&lt;br /&gt;
            return Equals(o as Pair&amp;lt;TFirst, TSecond&amp;gt;);&lt;br /&gt;
        }&lt;br /&gt;
        public override int GetHashCode()&lt;br /&gt;
        {&lt;br /&gt;
            return EqualityComparer&amp;lt;TFirst&amp;gt;.Default.GetHashCode(first) * 37 +&lt;br /&gt;
                   EqualityComparer&amp;lt;TSecond&amp;gt;.Default.GetHashCode(second);&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>