zoukankan      html  css  js  c++  java
  • Unity C#集合

    集合分为两种:非泛型集合,泛型集合。

    非泛型集合需要引入:System.Collections命名空间,其命名空间下的类有:

    ArrayList表示大小根据需要动态增加的对象数组。

    Hashtable表示根据键的哈希代码进行组织的键/值对的集合。

    Queue表示对象的先进先出(FIFO)集合。

    Stack表示对象的后进先出(LIFO)集合。

    Stack  stack=new  Stack();

    Stack<int>  stack=new  Stack<int>();

    泛型集合需要引入:System.Collection.Generic命名空间,其命名空间下的类有:

    Dictionary<TKey,TValue>表示根据键进行组织的键/值对的集合。

    Dictionary<string,int>  dic=new  Dictionary<string,int>();

    List<T>表示可根据索引访问对象的列表。提供用于对列表进行搜索,排序和修改的方法

    Queue<T>表示对象的先进先出集合

    SortedList<TKye,TValue>

    表示根据键进行排序的键/值对的集合,而键基于的是相关 IComparer<T>实现

    Stack<T>表示对象的后进先出集合

    我要……

    泛型集合选项

    非泛型集合选项

    线程安全或不可变集合选项

    将项存储为键/值对以通过键进行快速查找

    Dictionary<TKey, TValue>

    Hashtable 

    (根据键的哈希代码组织的键/值对的集合。)

    System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>

    System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>

    ImmutableDictionary(TKey, TValue)

    按索引访问项

    List<T>

    System.Array

    System.Collections.ArrayList

    ImmutableList(T)

    ImmutableArray

    使用项先进先出 (FIFO)

    Queue<T>

    Queue

    System.Collections.Concurrent.ConcurrentQueue<T>

    ImmutableQueue(T)

    使用数据后进先出 (LIFO)

    Stack<T>

    Stack

    System.Collections.Concurrent.ConcurrentStack<T>

    ImmutableStack(T)

    按顺序访问项

    LinkedList<T>

    无建议

    无建议

    删除集合中的项或向集合添加项时接收通知。 (实现 INotifyPropertyChanged 和 System.Collections.Specialized.INotifyCollectionChanged)

    System.Collections.ObjectModel.ObservableCollection<T>

    无建议

    无建议

    已排序的集合

    System.Collections.Generic.SortedList<TKey, TValue>

    System.Collections.SortedList

    ImmutableSortedDictionary(TKey, TValue)

    ImmutableSortedSet(T)

    数学函数的一个集

    System.Collections.Generic.HashSet<T>

    System.Collections.Generic.SortedSet<T>

    无建议

    ImmutableHashSet(T)

    ImmutableSortedSet(T)

  • 相关阅读:
    CF1221D Make The Fence Great Again
    HDU.1536.S-Nim(博弈论 Nim)
    HDU.1848.Fibonacci again and again(博弈论 Nim)
    POJ.1704.Georgia and Bob(博弈论 Nim)
    洛谷.2197.nim游戏(博弈论 Nim)
    博弈论基础——巴什博弈
    SPOJ.104.Highways([模板]Matrix Tree定理 生成树计数)
    BZOJ.4289.PA2012 Tax(思路 Dijkstra)
    BZOJ.4753.[JSOI2016]最佳团体(01分数规划 树形背包DP)
    图论
  • 原文地址:https://www.cnblogs.com/Jason-c/p/6656113.html
Copyright © 2011-2022 走看看