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)

  • 相关阅读:
    PHP 数组和字符串转换(超详细
    获取客户端ip、地理信息、浏览器、真实IP的php类库
    将博客搬至CSDN
    1.0.1unity服务器学习经验
    音游制作插件Koreographer-第0篇 简介
    Unity UIWidgets
    Unity UIWidgets
    Unity UIWidgets
    Lua中ipairs和pairs的区别详解
    ubuntu下面配置apache
  • 原文地址:https://www.cnblogs.com/Jason-c/p/6656113.html
Copyright © 2011-2022 走看看