.


:




:

































 

 

 

 


. , ,




is as. , foreach. . , , , . . , . .

.NET Framework . : ArrayList >List <T>, Queue > Queue <T>, Stack > Stack <T>, HashTable

List <T> , .

<T> - (Type), <K> - (Key), <V> - (Value).

, , List, int . Add . foreach, .

2- . ref, . Figura.

static void Swap <T>(ref T a, ref T b)

{ Console.WriteLine( Swap +typeof(T));

T x; x=a; a=b; b=x; }

// Main():

// 1) :

int a=8, b=37; Figura.Swap <int> (ref a, ref b); Console.WriteLine( : +a+, +b);

// 2) :

string st1=!, st2= !; Figura.Swap <string> (ref st1, ref st2);

Console.WriteLine( : +st1+, +st2);

Vektor.

class Vektor <T>

{ private T x1, y1, x2, y2;

// :

public Vektor (T a, Tb, Tc, T d)

{ x1=a; t1=b; x2=c; y2=d; }

// :

public T Koord_x1

{ get {return x1;}

set {x1=value;}

}

public T Koord_y1

{ get {return y1;}

set {y1=value;}

}

// x2 y2.

public void Show()

{ Console.WriteLine( +typeof(T));

Console.WriteLine(x1=+x1+, y1=+y1+, x2=+x2+, y2=+y2);

// Main():

Vektor <int> v1=new Vektor <int> (5, 8, 0, 1);

v1.Show();

v1.Koord_x1=100;

v1.Koord_y1=200;

v1.Show();

 


41. . . System.Type. . . .

CLR . (assembly) , . , . , , : 1) () (, , ). 2) , , , , (, , ) ; 3) MSIL ; 4) (, , ), .

Object Browser, ILDasm.exe. , , IL, .

-> VsTools -> Promt -> ILDasm -> -> Debug -> *.exe.

, . . : . *.dll *.exe. , internal. internal . , , , .

(reflection) , () . . .

, . , . System.Type. , . Type : using System.Reflection;. Type System.Reflection.MemberInfo. , , , . Type, , , ( Type) .

. , .. . - . , Windows Program [STAThread] (Single Threaded Apartament) . System.Attribute. , . , ErrorAttribute, AttributeUsage. , . .

. # 3 : 1) AttributeUsage , . Object Browser. , , , , .. 2) Conditional . , , . . 3) Obsolete[message] - .





:


: 2016-10-06; !; : 439 |


:

:

80% - .
==> ...

1705 - | 1558 -


© 2015-2024 lektsii.org - -

: 0.008 .