zoukankan      html  css  js  c++  java
  • 排序列表

        排序列表用SortedList对象表示,用Add()方法会自动将元素插入到适当的位置以保持关键字的顺序

    /*
      Example11_8.cs illustrates the use of a SortedList
    */
    
    using System;
    using System.Collections;
    
    class Example11_8
    {
    
      public static void Main()
      {
    
        // create a SortedList object
        SortedList mySortedList = new SortedList();
    
        // add elements containing US state abbreviations and state
        // names to mySortedList using the Add() method
        mySortedList.Add("NY", "New York");
        mySortedList.Add("FL", "Florida");
        mySortedList.Add("AL", "Alabama");
        mySortedList.Add("WY", "Wyoming");
        mySortedList.Add("CA", "California");
    
        // get the state name value for "CA"
        string myState = (string) mySortedList["CA"];
        Console.WriteLine("myState = " + myState);
    
        // get the state name value at index 3 using the GetByIndex() method
        string anotherState = (string) mySortedList.GetByIndex(3);
        Console.WriteLine("anotherState = " + anotherState);
    
        // display the keys for mySortedList using the Keys property
        foreach (string myKey in mySortedList.Keys)
        {
          Console.WriteLine("myKey = " + myKey);
        }
    
        // display the values for mySortedList using the Values property
        foreach(string myValue in mySortedList.Values)
        {
          Console.WriteLine("myValue = " + myValue);
        }
    
      }
    
    }
    
  • 相关阅读:
    (转 )Unity对Lua的编辑器拓展
    unity timeline
    unity拖尾粒子问题
    unity shader 波动圈
    linux教程
    Unity Shader 基础
    ugui拖拽
    unity shader 热扭曲 (屏幕后处理)
    英文取名神器
    lua正则表达式替换字符串
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2039424.html
Copyright © 2011-2022 走看看