zoukankan      html  css  js  c++  java
  • C# List(T).Reverse 方法 顺序反转

    using System;
    using System.Collections.Generic;
    
    public class Example
    {
        public static void Main()
        {
            List<string> dinosaurs = new List<string>();
    
            dinosaurs.Add("Pachycephalosaurus");
            dinosaurs.Add("Parasauralophus");
            dinosaurs.Add("Mamenchisaurus");
            dinosaurs.Add("Amargasaurus");
            dinosaurs.Add("Coelophysis");
            dinosaurs.Add("Oviraptor");
    
            Console.WriteLine();
            foreach(string dinosaur in dinosaurs)
            {
                Console.WriteLine(dinosaur);
            }
    
            dinosaurs.Reverse();
    
            Console.WriteLine();
            foreach(string dinosaur in dinosaurs)
            {
                Console.WriteLine(dinosaur);
            }
    
            dinosaurs.Reverse(1, 4);
    
            Console.WriteLine();
            foreach(string dinosaur in dinosaurs)
            {
                Console.WriteLine(dinosaur);
            }
        }
    }
    
    /* This code example produces the following output:
    
    Pachycephalosaurus
    Parasauralophus
    Mamenchisaurus
    Amargasaurus
    Coelophysis
    Oviraptor
    
    Oviraptor
    Coelophysis
    Amargasaurus
    Mamenchisaurus
    Parasauralophus
    Pachycephalosaurus
    
    Oviraptor
    Parasauralophus
    Mamenchisaurus
    Amargasaurus
    Coelophysis
    Pachycephalosaurus
     */
  • 相关阅读:
    ORA-14404
    ORA-00845
    ORA-00054
    oracle-11g-配置dataguard
    ORACLE 11G 配置DG 报ORA-10458、ORA-01152、ORA-01110
    Python:if __name__ == '__main__'
    HDFS-Shell 文件操作
    HDFS 概述
    PL/SQL Developer
    CentOS7 图形化方式安装 Oracle 18c 单实例
  • 原文地址:https://www.cnblogs.com/Peng18233754457/p/8619012.html
Copyright © 2011-2022 走看看