随笔分类 - c#
摘要:int[] a = new int[] { 3,4,5 };
阅读全文
摘要:IList<IList<int>> l = new List<IList<int>>();
阅读全文
摘要:c#中^是异或二元运算符的意思,即两个中仅有一个为true才返回true
阅读全文
摘要:原文: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:{
阅读全文
摘要:public static float Log(float f, float p); Description Returns the logarithm of a specified number in a specified base. using UnityEngine;public class
阅读全文
摘要:访问权限不同的修饰符 private:私有成员,在类的内部才可以访问 protected:保护成员,在类的内部和继承类中可以访问 public:公共成员,完全公开,没有访问限制 internal:当前程序集内可以访问 参考:简述private,protected,public,internal修饰符
阅读全文
摘要:帮助实现多重继承,实现不相关类的相同行为 定义接口 public interface IStringList { void Add(string s); int Count {get;} string this[int index]{get;set}; } //public abstract被省略了
阅读全文
摘要:属性与字段: 字段多用于内部。属性用于外部的访问,在get和set中加以约束。达到封装的目的。 public class Person { // 字段 private string name; private int age; private string sex; // 属性 public str
阅读全文
摘要:指针变量声明:例: 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
阅读全文
摘要:Obsolete 这个预定义特性标记了不应被使用的程序实体。它可以让您通知编译器丢弃某个特定的目标元素 实例 using System;public class MyClass{ [Obsolete("Don't use OldMethod, use NewMethod instead", true
阅读全文
摘要:arraylist 声明时不需要指定长度也不需要指定数据类型的数组,所以有数据类型不安全和装箱拆箱引起性能损耗的缺陷。 所以.net 2.0推出list,声明时需指定数据类型。 例: array //定义string[] strs = new string[5]; //赋值 strs[0] = "A
阅读全文
摘要:void btn_Click(object sender, EventArgs e){ Button btn = sender as Button; //当前点中的按钮}
阅读全文
摘要:如题
阅读全文

浙公网安备 33010602011771号