C#
文章平均质量分 64
妖刀丶朔夜
最是人间留不住
展开
-
string 基本操作方法整理总结
属性 (1) 下标访问:string可根据字符在字符串中的具体位置进行访问,以该形式访问string时,返回值为该位置的字符(char类型) s ="ABCD"; Console.WriteLine(s[0]); // 输出"A"; (2)长度:length可获取string的具体长度。string中index从0开始计数,原创 2017-07-17 18:19:14 · 2056 阅读 · 1 评论 -
C# 装箱,拆箱,向上转型,向下转型
c#中,数据类型分为值类型和引用类型,装箱和拆箱属于值类型和引用类型间的转换操作,一下简要介绍装箱和拆箱: 装箱:值类型向引用类型转换时发生, 当 CLR 对值类型进行装箱时,会将该值包装到 System.Object 内部,再将后者存储在托管堆上。 以下为装箱操作实例:int i = 123;// The following line boxes i.object o = i; 此语句的结原创 2017-07-21 14:23:28 · 1318 阅读 · 0 评论 -
Unity中的数组介绍
数组初始化string[] arrayA = { "Shirdrn", "Hamtty", "Saxery" };Console.WriteLine("第一种声明数组并初始化的方法");string[] arrayB;arrayB = new string[3] { "shirdrn", "Hamtty", "Saxery" };Console.WriteLine原创 2017-07-18 17:18:20 · 4082 阅读 · 0 评论 -
常用数据结构
常用的数据结构:Array: 优点:在内存中连续存储,索引速度快;访问简单,可通过下标进行访问;赋值和修改简单 缺点:声明数组的时候必须制定数组长度;插入和删除数组时,需要移动大量元素;数组长度过大时,会造成内存浪费,过段时会造成内存溢出。 使用(具体使用见具体文章):int size = 5;int[] test = new int[size];ArrayList :使用该数据结构时,需引用Syste原创 2017-07-21 18:35:31 · 213 阅读 · 1 评论 -
工具类:Time
class in UnityEngine Description 描述 The interface to get time information from Unity. 获取时间信息的接口。 Static Variables 静态变量captureFramerate Slows game playback time to allow screenshots to be saved between翻译 2017-09-06 13:49:43 · 204 阅读 · 0 评论 -
写文件方法之一
public void SaveData(string data, string path) { FileStream fs = new FileStream(path, FileMode.Create); StreamWriter sw = new StreamWriter(fs); //开始写入 ...原创 2018-03-06 15:03:57 · 137 阅读 · 0 评论 -
C#连接mysql
//创建连接 string constr = @”server=ipAddress;database=dbName;uid=idName;pwd=password”; conn = new SqlConnection(constr);//创建查询 SqlCommand cmd = new SqlCommand(“SELECT Count(*) FROM tableName”, conn)...原创 2018-03-06 15:15:43 · 127 阅读 · 0 评论