Arrays and Collections in .NET - PowerPoint PPT Presentation

About This Presentation
Title:

Arrays and Collections in .NET

Description:

?????? ???????? ?? ?????? ??????? ?? ?????? ? .NET (Common ... ???????? ?????? (jagged arrays) ?????????? ?? ????? ?? ??????: ????????: ?????? ?? ??????????: ... – PowerPoint PPT presentation

Number of Views:298
Avg rating:3.0/5.0
Slides: 53
Provided by: Svetli6
Category:

less

Transcript and Presenter's Notes

Title: Arrays and Collections in .NET


1
(No Transcript)
2
?????? ? ????????
???????????? ?? .NET Framework
http//www.nakov.com/dotnet/
??????? ?????
?????????? ???????? ?? ?????????? ?? ???????
academy.devbg.org
3
?????????? ??????
  • ?????? ???????? ?? ????????? ?? ?????
  • ?????? ???????? ?? ?????? ??????? ?? ?????? ?
    .NET (Common Type System)
  • ?????? ???????? ?? ????? C

4
??????????
  • ??????. ???????? ? .NET Framework
  • ?????????? ??????
  • ?????? ?? ??????
  • ????? System.Array
  • ????????? ?? ??????
  • ??????? ???????
  • ????????. ?????????? ? .NET Framework
  • IList, ArrayList, Queue ? Stack
  • IDictionary ? Hashtable
  • ????????? ???-???????
  • ?????? SortedList

5
????? e ??????
  • ???????? ?? ???????? ????????????????? ?? ???????
    ?? ??? ????????
  • ??????????? ?? ????? ? C
  • ???????? (?????????) ?? ????? ? C
  • ? ??????? ?? ?????? ????? ? ?????? 5 ???????? ??
    ??? System.Int32

int myArray
myArray new int5
0 1 2 3 4
myArray

????????? ?????
6
???????? ? .NET Framework
  • ?????? ?????? ? .NET Framework
  • ?????????? ???? System.Array
  • ????????????? ???????????? ICloneable, IList,
    ICollection ? IEnumerable
  • ???????? ?? ?????????? ?? ????? ?? ??????
    (??????? ????? ?? ????????)
  • ??????????? ?? ?????????? ?????????? ??????? ??
    0, ?? .NET Framework ???????? ? ?????? ? ????????
    ????? ???????
  • ???????? ?? ?????????? ?? ???????? ? ????????
    ?? ?? ??????? ???????? ????? ????????? ?
    ????????????? ??

7
???????? ? .NET Framework
  • ????????? ?? ????????? ??????, ?????????? ??????
    ? ?????? ?? ??????
  • ?????? ?????? ????? ? ???? ?? ?????????? ?? ????
    ?? ????????????? ?? ? ????????? ?? ????? ?? ???
  • ???????? ?? ?????????? ?????? ? ??????????
    ?????????? ?? ? ??????? ?? ??????????? ????? (?.
    ???. managed heap)
  • ???????? ?? ?????????? ?? ???????? ? ???????? ??
    ?????? ? ?? ??????
  • ?????? ?? ???????? ?? ??????????
  • ????? ?? ?? ????????????? ??? ???????????

8
?????? ??????
int primes 2, 3, 5, 7, 11, 13, 17,
19 foreach (int p in primes)
Console.Write("0 ",p) Console.WriteLine() //
???????? 2 3 5 7 11 13 17 19 for (int i 0 i
lt primes.Length i) primesi primesi
primesi foreach (int p in primes)
Console.Write("0 ",p) Console.WriteLine() //
???????? 4 9 25 49 121 169 289 361
9
?????? ????? ??????
// ???????? ? ??????????? ?? ?????? ?????? ?????
????? 2 ? 100 static void Main(string args)
const int COUNT 100 bool prime new
boolCOUNT1 // ????? 0..100 for (int i
2 i lt COUNT i) primei
true for (int p 2 p lt COUNT p)
if (primep)
Console.Write("0 ", p) for (int i
2p i lt COUNT i p)
primei false

10
???????????? 1
  • ??????? ?? ?????? ????? ???? ?????? ?? ?????????

11
?????????? ??????
  • .NET Framework ???????? ? ?????????? ??????
    (?????? ? ??????? ???????????)
  • ??????????? ? ????????
  • ?????? ?? ??????????
  • ???????????? ?????? ?? ?????????? ?????????? ??
    ???? ???? ???? ? ??????? ??????? ?? ?????????
    ?????

int, matrix new int5,7 char,, cube new
char5,5,5
matrix2,6 42 cube1,2,3 'a'
12
?????????? ?????? ??????
static void PrintMatrix(int, aMatrix)
for (int row 0 row lt aMatrix.GetLength(0)
row) for (int col 0
colltaMatrix.GetLength(1) col)
Console.Write("0 ", aMatrixrow, col)
Console.WriteLine()
Console.WriteLine() static int,
Multiply(int, aMatrix1, int, aMatrix2)
int width1 aMatrix1.GetLength(1) int
height1 aMatrix1.GetLength(0) int width2
aMatrix2.GetLength(1) int height2
aMatrix2.GetLength(0) (???????? ??????????)
13
?????????? ?????? ??????
if (width1 ! height2) throw new
ArgumentException("Invalid dimensions!")
int, resultMatrix new intheight1,
width2 for (int row 0 row lt height1
row) for (int col 0 col lt
width2 col)
resultMatrixrow, col 0 for (int
i 0 i lt width1 i)
resultMatrixrow, col
aMatrix1row, i aMatrix2i, col
return resultMatrix (????
???? ??????????)
14
?????????? ?????? ??????
static void Main(string args) int, m1
new int4,2 1,2, 3,4,
5,6, 7,8
PrintMatrix(m1) int, m2 new int2,3
1,2,3, 4,5,6
PrintMatrix(m2) int, m3 Multiply(m1,
m2) PrintMatrix(m3)
15
???????????? 2
  • ????????? ?? ???????

16
?????? ?? ??????
  • ? .NET Framework ????? ?? ?? ????????? ??? ??????
    ?? ??????, ?. ???. ???????? ?????? (jagged
    arrays)
  • ?????????? ?? ????? ?? ??????
  • ????????
  • ?????? ?? ??????????

int jaggedArray
jaggedArray new int2 jaggedArray0 new
int5 jaggedArray1 new int3
jaggedArray03 12345
17
?????????? ?? ?????? ??????
const int HEIGHT 12 // Allocate the array in a
triangle form long triangle new
longHEIGHT1 for (int row 0 row lt
HEIGHT row) trianglerow new
longrow1 // Calculate the Pascal's
triangle triangle00 1 for (int row 0
row lt HEIGHT row) for (int col 0 col
lt row col) trianglerow1col
trianglerowcol trianglerow1col
1 trianglerowcol (????????
??????????)
18
?????????? ?? ?????? ??????
// Print the Pascal's triangle for (int row 0
row lt HEIGHT row) Console.Write("".PadLe
ft((HEIGHT-row)2)) for (int col 0 col lt
row col) Console.Write("0,3 ",
trianglerowcol) Console.WriteLine()
// ???????? // 1 //
1 1 // 1
2 1 // 1 3 3 1 //
1 4 6 4 1 // 1 5
10 10 5 1 // 1 6 15 20 15
6 1 // 1 7 21 35 35 21 7
1 // 1 8 28 56 70 56 28 8 1
19
????? System.Array
  • ?????? ?????? ?????? ?????????? System.Array ?
    ????????? ???????? ?????? ? ????????
  • ??-????? ?????? ? ???????? ?? ????? System.Array
  • Rank ???? ?? ?????????????
  • Length ??? ???? ?? ?????????? ?? ??????
    ???????????
  • GetLength(index) ????? ???? ???????? ??
    ???????? ?????????? (???????? ??????? ?? 0)
  • GetEnumerator() ????? IEnumerator ?? ??????????
    ?? ?????? (C ???????? ???? ? ?????????????
    foreach)
  • Sort() ??????? ?????????? ?? ??????

20
????? System.Array
  • ??-????? ?????? ? ???????? ?? ????? System.Array
  • BinarySearch ????? ????? ??????? ? ????????
    ????? (???? ??????? ???????)
  • IndexOf ????? ??????? ??????? ? ????? ? ?????
    ??????? ??????? (??? ??? ??????)
  • LastIndexOf ????? ??????? ??????? ? ????? ?
    ????? ?????????? ??????? (??? ??? ??????)
  • Reverse ?????? ?????????? ?? ????? ? ???????
    ???
  • Clear ?????? ???????? 0 (null) ?? ??????
    ???????? ?? ??????
  • CreateInstance ??????? ?????, ???? ???? ?? ??
    ?????? ????? ???????????, ??????? ?????? ? ????
    ???????? ?? ????? ?? ???

21
????? System.Array
  • ????? System.Array ???????????? ????????????
    ICloneable, IList, ICollection ? IEnumerable
  • ICloneable ????????? ?????????
  • ?? ???????????? ???????? ?? ???????? ??????
  • IList ????????? ???????? ?????? ?? ??????????
    ?? ??????
  • ICollection ????????? ?????????? ??????,
    ???????? ?? ????????????? ? ?? ????????? ??
    ?????? ????????
  • IEnumerable ????????? ???????? ?? ????????? ??
    ?????? ???????? (???????? ? ????????? foreach ?
    C)

22
????????? ?? ??????
  • ?? ??????????? ?? ?????? ? .NET Framework ??
    ???????? ?????????? ????? Sort ?? ?????
    System.Array
  • Sort(Array) ??????? ?????????? ?? ?????????
    ?????, ???? ?????? ?? ?? ????????????? ??????????
    IComparable
  • ??????????? IComparable ? ????????????? ?? ?????
    ?????????? ?????? (Int32, Float, Double, Decimal,
    String, DateTime, )
  • Sort(Array, IComparer) ??????? ????? ????? ??
    ?????????? ????? ?? ????????? (?????????????? ?
    ?????????? IComparer)
  • ???????? ? ????????? ? ?? ???? ?? ?????, ????????
    ???? Sort(Array, index, length)

23
????????? ?? ?????? ??????
static void Main() String beers
"???????", "??????", "????????",
"??????", "????????", "???????", "??????"
Console.WriteLine("Unsorted 0",
String.Join(", ", beers)) // ????????
Unsorted ???????, ??????, ????????, //
??????, ????????, ???????, ?????? //
?????????? ?? ?????? beers ?? ?? ??? String,
// ????? ???????????? IComparable
Array.Sort(beers) Console.WriteLine("Sorted
0", String.Join(", ", beers)) //
???????? Sorted ??????, ??????, ??????, //
???????, ???????, ????????, ????????
24
????????? ? IComparer ??????
using System using System.Collections class
Student internal string mName internal
int mAge public Student(string aName, int
aAge) mName aName mAge
aAge public override string
ToString() return
String.Format("(0 1)", mName, mAge)
(???????? ??????????)
25
????????? ? IComparer ??????
class StudentAgeComparer IComparer public
int Compare(object aEl1, object aEl2)
Student student1 aEl1 as Student if
(student1 null) throw
new ArgumentException( "Argument
1 is not Student or is null")
Student student2 aEl2 as Student if
(student2 null) throw
new ArgumentException( "Argument
2 is not Student or is null")
return student1.mAge.CompareTo(student2.mAge)
(???????? ??????????)
26
????????? ? IComparer ??????
static void Main() Student
students new Student("??? ????",
73), new Student("???? ????", 644),
new Student("???? ???", 412),
new Student("???? ????", 27), new
Student("????? ????????", 32)
Array.Sort(students, new
StudentAgeComparer())
Console.WriteLine("Students sorted by age")
foreach (Student student in students)
Console.WriteLine(student)

27
??????? ???????
  • ????????? ??????? ? ???? ????? ?? ??????????? ??
    ???????? ?????
  • ??? ???????? T(log(n)) ?? ??????????? ?? ????? ?
    n ????????
  • ??????????? ? ? ?????? Array. BinarySearch(Array,
    object), ????? ????? ??????? ?? ????????? ?????
    ??? ??????????? ????? ??? ?? ? ???????
  • ????? ?????? ???????, ???? ??? ?????? Sort ???
    ?????? ?????????? ?? ????????????? IComparable
    ??? ?????? ?? ?? ?????? ????????? ?? IComparer

28
??????? ??????? ??????
static void Main() String beers
"???????", "??????", "????????",
"??????", "????????", "???????", "??????"
Array.Sort(beers) string target
"??????" int index Array.BinarySearch(beers
, target) Console.WriteLine("0 is found at
index 1.", target, index) //
???????? ?????? is found at index 2. target
"???????" index Array.BinarySearch(beers,
target) Console.WriteLine("0 is not found
(index1).", target, index) //
???????? ??????? is not found (index-7).
29
?????? ?? ?????? ? ??????
  • ?????? ????? ????? ????? ????? ? ?????? ??
    ??????? ?????? ?????, ???????? ????? ? 0
    ????????, ? ?? null
  • ???????? ?? ???????? ?? ?????????? ? ??????, ???
    ?????? ?? ??? ???????, ?? ????? ????? ???? ??
    ??????? ????? ?????, ????????? ?? ????? ?? ????
  • Clone() ??????? ????? ?????? ????? ?? ?????? ?
    ?????? ??? ?????????? ?????? ?????? ??
    ??????????? ????????? ??????? ?????????
  • ??? ???????? ????? ? ????? ?? ???? ???,
    ??????????? ?????? Copy(), ? ?? Clone()

30
????????
  • ???????? ???????? ?????????, ????? ????????
    ?????????? ?? ???????? (?. ???. ?????????
    ???????)
  • ? .NET Framework ?????????, ??????????????
    ???????? ?? ??????? ? ??????????????
    System.Collections
  • ?????????? ? C ?? ??????? ????
  • ???????? (IList, ICollection) ArrayList, Queue,
    Stack, BitArray, StringCollection
  • ????????? (IDictionary) Hashtable, SortedList,
    StringDictionary
  • ?? ??????? ?? ???????? ???????? ???????? ????
    ????????? ?????? ? ?????????? ???????? ?
    ????????? ?? ????????

31
?????????? ? .NET
  • ?????????? ? .NET ?? ??????? ?? ???????? ?????
    ??? ??????? ???????? ?? ??? System.Object ?
    ???????? ??????????
  • ???? ????????? ??????????
  • ????? ?? ????????????? ?? ????????
  • boxing/unboxing ??? ?????????? ?? ??????????
    ??????
  • ???????? ????????????????
  • ? .NET Framework 2.0 ?? ??? ?????????? ????????
    (???????? ?? ?. ???. generics)

ArrayList list new ArrayList() list.Add("????")
// string ? ????????? System.Object string s
(string) list0
32
???????????? ?? ????????
  • ?????? ???????? ? .NET Framework ?????????????
    ???? ??? ??????? ?? ???????????? IEnumerable,
    ICollection, IDictionary ? IList

33
IList ? ArrayList
  • ??????????? IList ????????
  • ?????? ?? ?????????? ?? ??????
  • ???????? ?? ??????? (Add)
  • ???????? ?? ??????? (Insert)
  • ??????? ?? ??????? (IndexOf)
  • ????????? ?? ?????? ??? ?? ???????? (RemoveAt,
    Remove)
  • ?????? ArrayList ???????????? IList ???? ?????
  • ?????? ????????????? ??????? ????? (Capacity) ??
    ?????????????? ????????, ????? ?? ?????????????
    ??? ?????????
  • ??? ????? ??????, ??????? ?? ???????? (Sort(),
    BinSearch(), Reverse())
  • ???? ?? ?? ???????? ? ????? (ToArray())

34
ArrayList ??????
static void Main() ArrayList list new
ArrayList() for (int i 1 i lt 10 i)
list.Add(i) // ???????? i ? ????
list.Insert(3, 123) // ???????? 123 ?????
??????? 3 list.RemoveAt(7) // ??????????
??????? ? ?????? 7 list.Remove(2) //
?????????? ??????? ??? ???????? 2 list1
500 // ????????? ??????? ? ?????? 1
list.Sort() // ????????? ? ????????? ???
int arr (int)list.ToArray(typeof(int))
foreach(int i in arr)
Console.Write("0 ",i)
Console.WriteLine() // ???????? 1 4 5 6 8 9
10 123 500
35
????? ???????? ????????
  • Queue ?????? (first-in, first-out ?????????),
    ??????????? ? ???????? ?????, ????????
  • ???????? ?? ??????? (Enqueue)
  • ????????? ?? ??????? (Dequeue)
  • Stack ???? (last-in, first-out ?????????),
    ?????????? ? ?????, ????????
  • ???????? ?? ??????? (Push)
  • ????????? ?? ??????? (Pop)
  • ??????????? ?? ??????? (Peek)
  • StringCollection ???? ArrayList, ?? ?? string
    ??????
  • BitArray ????? ?? ?????? ?????????, ?????
    ???????? ? 1 ???

36
Queue ? Stack ???????
Queue queue new Queue() queue.Enqueue("1.
???????") queue.Enqueue("2. ????????") while
(queue.Count gt 0) string beer (string)
queue.Dequeue() Console.Write("0 ",
beer) Console.WriteLine() // ???????? 1.
??????? 2. ????????
Stack stack new Stack() stack.Push("1.
???????") stack.Push("2. ????????") while
(stack.Count gt 0) string beer (string)
stack.Pop() Console.Write("0 ",
beer) Console.WriteLine() // ???????? 2.
???????? 1. ???????
37
IDictionary ? Hashtable
  • ??????????? IDictionary ???????????? ???????? ??
    ?????? ????-????????
  • IDictionary ????????
  • ???????? ?? ?????? ????-???????? (Add)
  • ??????? ?? ???????? ?? ???? (??????????)
  • ????????? ?? ???????? ?? ???? (Remove)
  • ????????? ?? ?????? ??????? (Keys)
  • ????????? ?? ?????? ????????? (Values)
  • ?????? Hashtable ???????????? IDictionary ????
    ???-???????
  • ?????????? ? ????????? ?? ??????? ?? ???? ????
    ?????????? ???????? ? ??????? ??????
  • ?? ???? ?? ??? ??????? ??? null ???????

38
??? ?? ????? Hashtable
  • ?????? ??????? ? ???-????????? ?????? ?? ?? ??
    ???? ? ??? ???
  • ?????? Hashtable ??????? ?? ??????
    Object.GetHashCode() ?? ?????????? ??
    ???-???????? ?? ????????? ? ?? ??????
    Object.Equals() ?? ????????? ?? ???????
  • ???????????? ?????? ????????????? GetHashCode() ?
    Equals(), ?? ?? ????????? ?????? ? ?????
    ????????? ?????????????
  • ?????? Hashtable ?????????? ????? GetEnumerator()
    ?? ????????? ?? ???????? ????-???????? (? C ?
    foreach)

foreach (DictionaryEntry entry in someHashTable)
...
39
Hashtable ??????
static void Main() Hashtable priceTable
new Hashtable() priceTable.Add("??????",
0.62) priceTable.Add("???????", 0.85)
priceTable.Add("????????", 0.78)
priceTable.Add("??????", 0.86)
Console.WriteLine("???? \"0\", ???? 1 ??.",
"???????", priceTable"???????")
priceTable.Remove("???????")
priceTable"??????" 0.79
foreach(DictionaryEntry beerPrices in
priceTable) Console.WriteLine("????
\"0\", ???? 1 ??.",
beerPrices.Key, beerPrices.Value)
40
????????? ???-???????
  • ??? ?????????? ?? ????????????? ?????? ????
    ??????? ? ???-???????, ?????? ?? ?? ??????????
    ???????? Equals() ? GetHashCode() ??
    System.Object
  • ???-????? ??????
  • ?? ? ??????? ??? ??????? ??????
  • ?? ??????? ???????? ??-????? ???????
  • ?? ?? ????????? ?????
  • ??????

class Student protected string mName
protected int mAge (???????? ??????????)
41
????????? ???-??????? ??????
public Student(string aName, int aAge)
mName aName mAge aAge public override
string ToString() return String.Format("(0
, 1)", mName, mAge) public override bool
Equals(object aStudent) if
((aStudentnull) !(aStudent is Student))
return false Student student (Student)
aStudent bool equals (mName
student.mName) (mAge
student.mAge) return equals (????????
??????????)
42
????????? ???-??????? ??????
public override int GetHashCode()
int hashCode mName.GetHashCode() mAge
return hashCode class
CustomHashCodesDemo private static
Hashtable mAddressTable static void
PrintAddress(Student aStudent) if
(mAddressTable.ContainsKey(aStudent))
Console.WriteLine("0 ??? ?????
1.", aStudent,
mAddressTableaStudent) else
Console.Write("???? ?????
?? 0.", aStudent)
(???????? ??????????)
43
????????? ???-??????? ??????
static void Main() Student ivan
new Student("??? ????", 67) Student
yaga new Student("???? ???", 318)
Student kiro new Student("??? ????", 38)
mAddressTable new Hashtable()
mAddressTable.Add(ivan, "?. ?????, ?? ???????")
mAddressTable.Add(yaga, "?? ???????")
mAddressTable.Add(kiro, "??????, ??.
?????????") PrintAddress(ivan)
PrintAddress(new Student("???? ???", 318))
PrintAddress(new Student("???? ???",
24)) // ???????? // (??? ????, 67) ???
????? ?. ?????, ?? ???????. // (???? ???, 318)
??? ????? ?? ???????. // ???? ????? ?? (????
???, 24).
44
???????????? 3
  • ????????? ???-???????

45
????? ????????? ????????
  • SortedList ????????????? ?? IDictionary, ?????
  • ??????? ?? ???-??????? ? ?? ?????
  • ????????? ?????? ????-????????, ????????? ? ??
    ????
  • ????????? ?????????? ??????
  • ?????? ??????????? ????? ?????? ???????????
  • ?????-?????????? ???????? System.Collections.Spe
    cialized
  • StringDictionary ???? Hashtable, ?? ????????
    string ?? ????????? ? ?? ????????????? ?????????
  • CollectionsUtil.CreateCaseInsensitiveHashtable()
    ????? ???-???????, ????? ?? ????????? ????? ?
    ?????? ????? ? ?????

46
SortedList ??????
SortedList sl new SortedList() sl.Add("???????"
, 0.75) sl.Add("????????", 0.72) sl.Add("??????"
, 0.57) sl.Add("???????", 0.64) sl.Remove("?????
??") sl"??????" 0.61 Console.WriteLine("???
???? ???????? ????") foreach (string beer in
sl.GetKeyList()) Console.WriteLine("0 ",
beer) Console.WriteLine("\n?????? ?? ?????
??????") for (int i 0 i lt sl.Count i)
Console.WriteLine("0 - 1 ??. ",
sl.GetKey(i), sl.GetByIndex(i))
47
?????? ? ????????
????????
48
??????????
  1. ???????? ????????, ????? ??????? ?? ????????? N
    ???? ?????, ??????? ?? ? ????? ? ?????????
    ??????? ???? ? ???????? ?? ???????????.
  2. ???????? ????????, ????? ??????? ?? ?????????
    ????? ?? ????? ? ?????? ? ???? ???-???????
    ???????? ?? ?????, ?????? ?? ????? ???????? ?? ?
    ??-?????? ?? ???????????.
  3. ???????? ????????, ????? ??????? ?? ?????????
    ????? ?? N ????? ? ?????? ? ???? ???????? ??
    ????? K ????? (1ltKltN) ? ?????????? ????.
  4. ???????? ???? Matrix, ????? ??????? ??????? ??
    ?????? ?????, ??????????? ???? ???????? ?????.
    ??????????? ????????? ?? ????????, ????????? ?
    ????????? ?? ???????, ?????? ?? ?????? ??
    ???????????? ? ????? ?? ???????????.

49
??????????
  1. ???????? ????????, ????? ??????? ?? ?????????
    ????? ?? N ???? ????? ? ???? ????? K, ???????
    ?????? ? ???? ?????? Array.BinSearch ??????
    ???-???????? ????? ?? ?????? K ? ???-???????
    ????? ?? ?????? K. ?? ?? ???????? ??????????
    ?????, ? ?????????? ? ???? ????????? ??? ?????.
  2. ????? ? ????? ?? N ???? ?????, ?? ????? ?????, ??
    ???? ?? ?????????? ?? (?. ???. ????????) ?? ?????
    ?? ???? 1 N/2 ???????? ???????. ?? ?? ??????
    ????????, ????? ? ??????? ?? ????? Stack ??????
    ????????? ?? ??????. ???????? ??? ????? ??????
    3,2,2,3,2,1,3,2,2,2,1, ???????? ???????? ? 2.
    ??? ?? ????????????, ????????? ???? ?? ?????? ??
    ???????? ?????????? ? ????? ?? ??? ??? ?? ??
    ???????? ? ?????, ??? ??????? ? ???????? ?? ?????
    ??, ??? ?? ?????????? ???????? ?? ????? ?? ?????
    ? ???????? ??????.

50
??????????
  1. ????? ? ????? ?? ???????? ??????. ?? ?? ??????
    ?????, ????? ?????? ?????? ?????? ?? ??????,
    ????? ???? ????? ???????. ??????? ?????? ?? ?????
    ????? ?? ???????? ?????? ? ?????? ???????? ??
    ???????? ????? StringCollection.
  2. ????? ? ????? ?? ???????? ??????. ?? ?? ??????
    ????????, ????? ????????? ?????? ???????? ??????
    ?? ?????? ? ?? ????? ?? ??? ????? ???? ?? ?????.
    ???????? ? ????????? ?????? ?? ?? ????????? ??
    ???? ???????? ? ???????? ???. ?????????? ??
    ?????????? ?? ???-??????? ? ??????? ???????? ?
    ????????? ???? ????????. ?? ??????????? ???? ??
    ?? ???????? Array.Sort.
  3. ????? ? ??????, ????? ???????????? ????? ??
    ?????? ????????? ???? ? ????????. ?? ?? ??????
    ????????, ????? ???????? ???????? ?? ????. ??? ??
    ?????? ?? ?? ?????? ???-????????

51
??????????
  1. ?? ?? ?????? ???? ComplexNumber, ?????
    ???????????? ?????????? ????? ? ?????? ?
    ?????????? ???? ?? ??? double. ?? ?? ??????
    ?????, ????? ?????? ???? ????????? ????? ??
    ?????????? ????? ? ????? ???? ????????
    ???????????? ?????, ????? ?? ????? ???-????? ????
    ???? ? ???? ?????. ?? ????? ?? ?? ????????
    ???-???????, ???? ????????????? ?? ?????????? ??
    ???????? ????? ???????? Equals() ? GetHashCode()
    ?? ????? ComplexNumber.

52
?????????? ??????????
  • MSDN Training, Programming with the Microsoft
    .NET Framework (MOC 2349B), Module 7 Strings,
    Arrays, and Collections
  • Jeffrey Richter, Applied Microsoft .NET Framework
    Programming, Microsoft Press, 2002, ISBN
    0735614229
  • MSDN Library http//msdn.microsoft.com
Write a Comment
User Comments (0)
About PowerShow.com