随笔分类 -  c#

摘要:int[] a = new int[] { 3,4,5 }; 阅读全文
posted @ 2022-02-09 16:34 流星曳尾 阅读(135) 评论(0) 推荐(0)
摘要:IList<IList<int>> l = new List<IList<int>>(); 阅读全文
posted @ 2022-01-26 16:38 流星曳尾 阅读(366) 评论(0) 推荐(0)
摘要:如题 阅读全文
posted @ 2022-01-05 20:46 流星曳尾 阅读(78) 评论(0) 推荐(0)
摘要:#region 某个功能 #endregion 阅读全文
posted @ 2021-03-10 19:27 流星曳尾 阅读(96) 评论(0) 推荐(0)
摘要:dai gen 阅读全文
posted @ 2021-03-04 20:42 流星曳尾 阅读(34) 评论(0) 推荐(0)
摘要:c#中^是异或二元运算符的意思,即两个中仅有一个为true才返回true 阅读全文
posted @ 2021-01-31 22:18 流星曳尾 阅读(3159) 评论(0) 推荐(0)
摘要:原文:C# $的用法 -darkif 在字符串前加$相当于对string.format()的简化如:int m_a = 1;int m_b = 2;使用string.format():Console.WriteLine(string.format("this is a:{0},this is b:{ 阅读全文
posted @ 2020-12-04 17:03 流星曳尾 阅读(160) 评论(0) 推荐(0)
摘要:public static float Log(float f, float p); Description Returns the logarithm of a specified number in a specified base. using UnityEngine;public class 阅读全文
posted @ 2020-08-12 13:34 流星曳尾 阅读(312) 评论(0) 推荐(0)
摘要:访问权限不同的修饰符 private:私有成员,在类的内部才可以访问 protected:保护成员,在类的内部和继承类中可以访问 public:公共成员,完全公开,没有访问限制 internal:当前程序集内可以访问 参考:简述private,protected,public,internal修饰符 阅读全文
posted @ 2020-07-22 14:07 流星曳尾 阅读(267) 评论(0) 推荐(0)
摘要:帮助实现多重继承,实现不相关类的相同行为 定义接口 public interface IStringList { void Add(string s); int Count {get;} string this[int index]{get;set}; } //public abstract被省略了 阅读全文
posted @ 2020-07-20 21:09 流星曳尾 阅读(96) 评论(0) 推荐(0)
摘要:属性与字段: 字段多用于内部。属性用于外部的访问,在get和set中加以约束。达到封装的目的。 public class Person { // 字段 private string name; private int age; private string sex; // 属性 public str 阅读全文
posted @ 2020-07-20 15:55 流星曳尾 阅读(126) 评论(0) 推荐(0)
摘要:指针变量声明:例: int* p1, p2, p3; public static unsafe void swap(int a,int b) { int temp; temp = a; a = b; b = a; } public static unsafe void swapP(int* pa,i 阅读全文
posted @ 2020-07-19 13:32 流星曳尾 阅读(377) 评论(0) 推荐(0)
摘要:Obsolete 这个预定义特性标记了不应被使用的程序实体。它可以让您通知编译器丢弃某个特定的目标元素 实例 using System;public class MyClass{ [Obsolete("Don't use OldMethod, use NewMethod instead", true 阅读全文
posted @ 2020-07-18 21:34 流星曳尾 阅读(130) 评论(0) 推荐(0)
摘要:如题 阅读全文
posted @ 2020-07-10 22:41 流星曳尾 阅读(146) 评论(0) 推荐(0)
摘要:arraylist 声明时不需要指定长度也不需要指定数据类型的数组,所以有数据类型不安全和装箱拆箱引起性能损耗的缺陷。 所以.net 2.0推出list,声明时需指定数据类型。 例: array //定义string[] strs = new string[5]; //赋值 strs[0] = "A 阅读全文
posted @ 2020-07-10 19:35 流星曳尾 阅读(2413) 评论(0) 推荐(0)
摘要:值类型转换为引用类型-装箱 引用类型转换为值类型-拆箱 阅读全文
posted @ 2020-05-27 20:44 流星曳尾 阅读(80) 评论(0) 推荐(0)
摘要:void btn_Click(object sender, EventArgs e){ Button btn = sender as Button; //当前点中的按钮} 阅读全文
posted @ 2020-05-25 16:30 流星曳尾 阅读(128) 评论(0) 推荐(0)
摘要:多态分为运行多态与编译多态。运行多态为重载,编译多态为重写。 阅读全文
posted @ 2020-05-25 16:29 流星曳尾 阅读(105) 评论(0) 推荐(0)
摘要:如题 阅读全文
posted @ 2020-05-25 15:53 流星曳尾 阅读(111) 评论(0) 推荐(0)