上一页 1 2 3 4 5 6 7 ··· 18 下一页
摘要: 参数 dragSourceDependencyObject 对依赖项对象的引用(该对象是被拖动数据的源)。 dataObject 包含被拖动数据的数据对象。 allowedEffectsDragDropEffects DragDropEffects 值中的一个,指定拖放操作的允许效果。 返回 Dra 阅读全文
posted @ 2024-09-24 13:29 echo-efun 阅读(91) 评论(0) 推荐(0)
摘要: 1.Assembly.CreateInstance 从程序集中查找某个类型,然后使用系统激活器创建它的实例,有以下三种方式实现: CreateInstance(String) 使用区分大小写的搜索,从此程序集中查找指定的类型,然后使用系统激活器创建它的实例。 CreateInstance(Strin 阅读全文
posted @ 2024-09-21 16:04 echo-efun 阅读(93) 评论(0) 推荐(0)
摘要: 匿名类型: *提供了一种方便的方法,用来将一组只读属性封装到单个对象中,而无需首先显示定义一个类型 *类型名由编译器生成 *结合new运算符和对象初始值设定项创建匿名类型 *匿名类型是class类型,直接派生自object *如下示例,查找年龄是两岁的猫 public class Cat { // 阅读全文
posted @ 2024-09-20 11:30 echo-efun 阅读(67) 评论(0) 推荐(0)
摘要: 使用对象初始值设定项: *在创建对象时,向对象的任何可访问字段或属性分配值 *可为构造函数指定参数或忽略参数 public class Cat { // Auto-implemented properties. public int Age { get; set; } public string? 阅读全文
posted @ 2024-09-20 10:45 echo-efun 阅读(60) 评论(0) 推荐(0)
摘要: 自动实现的属性:*实例如下 public string Name { get; set; } *属性声明更加简洁 *前提是:不需要任何其他逻辑 *输入prop后按tab键可自动生成 *不能在接口中,声明自动实现的属性 *自动实现属性初始化 public string FirstName { get; 阅读全文
posted @ 2024-09-19 17:09 echo-efun 阅读(94) 评论(0) 推荐(0)
摘要: init关键字: 1.init在属性或索引器中定义访问器方法 2.仅在对象构造期间为属性或索引器元素赋值 3.init强制实施不可变性(对象一旦初始化,将无法更改) 4.如下同时定义get和init访问器 class Person_InitExample { private int _yearOfB 阅读全文
posted @ 2024-09-19 17:01 echo-efun 阅读(224) 评论(0) 推荐(0)
摘要: 1.fixed语句 *固定用于指针操作的变量; *可防止垃圾回收器重新定位可移动变量,并声明指向该变量的指针; *固定变量的地址,在语句的持续时间内不会更改 *fixed语句中,只能使用声明的指针,声明的指针是只读的,无法修改 *fixed语句只能在不安全的上下文中使用 static void Ma 阅读全文
posted @ 2024-09-19 11:16 echo-efun 阅读(970) 评论(0) 推荐(0)
摘要: xml位于命名空间中时查找 static void Main(string[] args) { XElement root = XElement.Parse(@"<aw:Root xmlns:aw='http://www.efun.com'> <aw:Child1> <aw:GrandChild1> 阅读全文
posted @ 2024-09-18 17:19 echo-efun 阅读(110) 评论(0) 推荐(0)
摘要: static void Main(string[] args) { XElement purchaseOrder = XElement.Load("Contacts.xml"); string partNos = (string)(from item in purchaseOrder.Descend 阅读全文
posted @ 2024-09-18 17:09 echo-efun 阅读(39) 评论(0) 推荐(0)
摘要: using System.Xml.Linq; static void Main(string[] args) { XElement contacts = new XElement("Contacts", new XElement("Contact", new XElement("Name", "Pa 阅读全文
posted @ 2024-09-18 16:10 echo-efun 阅读(22) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 18 下一页