1 / 14

C# pentru începători

L4. C# pentru începători. Florin Tudor Cristea · Microsoft Student Partners. Implementarea colecţiilor şi a tipurilor generice în Microsoft .NET Framework 2.0. C3355. CONT ’ D. Lucrând cu colecţiile generice. Privire generală.

bobby
Télécharger la présentation

C# pentru începători

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. L4 C#pentruîncepători Florin Tudor Cristea· Microsoft Student Partners

  2. Implementarea colecţiilor şi a tipurilor generice în Microsoft .NET Framework 2.0 C3355

  3. CONT’D

  4. Lucrând cu colecţiile generice

  5. Privire generală Deşi am văzut cât de flexibile sunt colecţiile non-generice, ne-am putea pune întrebarea cât de des avem cu adevărat nevoie să stocăm mai multe tipuri de date într-o singură colecţie. Să spunem că am scris o aplicaţie web şi dorim să înregistrăm undeva ID-ul fiecărui client atunci când acesta se autentifică pe sit. Deseori ne confruntăm cu un volum foarte mare de vizitatori şi nu putem face această operaţie în timp real. Vrem să stocăm aceste date drept întregi într-un Queue şi să le procesăm în fundal. Colecţiile generice ne permit să facem exact asta. Spre deosebire de colecţiile non-generice, colecţiile generice stochează datele ca tipuri de date specifice, ceea ce face mai rapidă stocarea şi recuperarea datelor din colecţie. Motivul este că nu mai avem nevoie să trecem prin rutina de boxing sau unboxing în cazul tipurilor valoare, respectiv casting în cazul tipurilor referinţă.

  6. Privire generală • System.Collections.Generic • List • Stack • Queue • Dictionary • SortedList • LinkedList

  7. List Proiect: ListSample • List.Enumerator (IEnumerator) • Current • MoveNext

  8. Key-value pairs Proiect: KeyValuePairsSample ~ Dictionary ~ SortedList ~ SortedDictionary

  9. Linked list Proiect: LinkedListSample LinkedList ~ Count ~ First ~ List ~ AddFirst ~ AddLast ~ AddBefore ~ AddAfter ~ Remove ~ Contains ~ Find LinkedListNode ~ Value ~ List ~ Next ~ Previous

  10. Lucrând cu colecţiile specializate

  11. NameObjectCollectionBase Proiect: NameObjectCollectionBaseSample ~ NameObjectCollectionBase ~ NameObjectCollectionBase. KeysCollection

  12. Lucrând cu clasele de bază referitoare la colecţii

  13. Privire generală Proiect: CollectionBaseSample ~ CollectionBase OnRemove, OnClear, OnInsert, OnSet ~ ReadOnlyCollectionBase ~ DictionaryBase OnInsert, OnRemove, OnClear, OnGet, OnSet ~ DictionaryEntry

  14. Pe data viitoare!  http://students.info.uaic.ro/~florin.cristea/cspi

More Related