zoukankan      html  css  js  c++  java
  • 11月14日笔记

    namespace(命名空间),用于解决类重名问题,可以看做“类的文件夹”。
    如果代码和被使用的类在一个namespace则不需要using。
    在不同命名空间下的类调用有两种方法:
    –写全称  命名空间.类名
    –先using引用命名空间,再调用
    using可以声明namespace的引入,还可以实现非托管资源的释放,实现了IDisposiable的类在using中创建,using结束后会自动调用该对象的Dispose方法,释放资源。
    string可以看做是char的只读数组。
    string str = "在校不迷茫,毕业即辉煌"; 
    char[] chararray = new char[str.Length];
                for (int i = 0; i < str.Length; i++)
                {
    
                
                }
    
                for (int i = 0; i < chararray.Length; i++)
                {
                    Console.WriteLine(chararray[i]);
                }
                Console.ReadKey();
    

    StartsWith、EndsWith

    string str = "Hello  World";
                Console.WriteLine(str.StartsWith("Hw"));
                Console.WriteLine(str.EndsWith("ld"));
                Console.ReadKey();
    
  • 相关阅读:
    php解析文本文件呈现在表格上
    nyoj 1058部分和问题
    nyoj 488素数环
    nyoj 82迷宫寻宝(一)
    nyoj58最少步数
    nyoj 325 zb的生日
    nyoj 20 吝啬的国度
    nyoj 349 Sorting It All Out
    nyoj 284
    PPT基础整理
  • 原文地址:https://www.cnblogs.com/songfang/p/4098097.html
Copyright © 2011-2022 走看看