C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet988/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   984   985   986   987   988   989   990   991   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

ICollection

,

HashSet

 adds 

Comparer

,

shown here:



public IEqualityComparer Comparer { get; }

It obtains the comparer for the invoking hash set.

Method

Description



public T Dequeue( )

Returns the object at the front of the invoking queue. The 

object is removed in the process.

public void Enqueue(T 



v

)

Adds 



v

 to the end of the queue.

public T Peek( )

Returns the object at the front of the invoking queue, but does 

not remove it.

public T[ ] ToArray( )

Returns an array that contains copies of the elements of the 

invoking queue.

public void TrimExcess( )

Removes the excess capacity of the invoking stack.

T

ABLE


 24-20 

The Methods Defi ned by 

Queue

www.freepdf-books.com




798

 

P a r t   I I :  



E x p l o r i n g   t h e   C #   L i b r a r y

Here is an example that shows 



HashSet

 in action:

// Demonstrate the HashSet class.

using System;

using System.Collections.Generic;

class HashSetDemo {

  static void Show(string msg, HashSet set) {

    Console.Write(msg);

    foreach(char ch in set)

      Console.Write(ch + " ");

    Console.WriteLine();

  }


  static void Main() {

    HashSet setA = new HashSet();

    HashSet setB = new HashSet();

    setA.Add('A');

Method

Description



public void ExceptWith(IEnumerable 

set2

)

Removes the elements in 



set2

 from the 

invoking set.

public void IntersectWith(IEnumerable 



set2

)

Removes from the invoking set those elements 



not common to both the invoking set and 

set2.

public bool

    IsProperSubsetOf(IEnumerable 

set2

)

Returns true if the invoking set is a proper 



subset of 

set2.

public bool

    IsProperSupersetOf(IEnumerable 

set2

)

Returns true if the invoking set is a proper 



superset of 

set2.

public bool IsSubsetOf(IEnumerable 



set2

)

Returns true if the invoking set is a subset 



of

set2.

public bool IsSuperSetOf(IEnumerable 



set2

)

Returns true if the invoking set is a superset 



of

set2.

public bool SetEquals(IEnumerable 



set2

)

Returns true if the invoking set is equivalent to 



set2.

 This determination is independent of the 

order of the elements.

public void

    SymmetricExceptWith(IEnumerable 

set2

)

Changes the invoking set so that it contains all 



elements from both the invoking set and 

set2,

except for those elements common to both sets. 

This is usually called the symmetric difference 

of the two sets.

public void UnionWith(IEnumerable 

set2

)

Adds the elements from 



set2

 to the invoking 

set. Duplicates are not included. Thus, it creates 

a union of the two sets.

T

ABLE


 24-21 

The Set Operations Defi ned by 

HashSet

www.freepdf-books.com




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   984   985   986   987   988   989   990   991   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish