- 博客(12)
- 资源 (8)
- 收藏
- 关注
原创 Ilist 的深入学习和ArrayList中Cast<>的使用
在项目中经常看到判断null的判断,对这个有无必要执怀疑,有空就测试了一下,在列表创建之后就已不是空,所以完全无必要namespace ConsoleApplication1{ class Program { static void Main(string[] args) { List list = new List()
2018-01-31 16:23:20 1130
原创 如何用corflags查看dll版本
找到corflags.exe + dll位置 >corflags C:\Users\AGV-LS\Desktop\agvsz.common.dllThe most interesting aspect is the PE(Portable executable) and the 32BIT flag of the header. These combine to specify th
2018-01-25 14:38:53 1409
原创 事件的订阅与处理
public class CustomEventArgs :EventArgs { private string msg; public CustomEventArgs(string s) { msg = s; } publ...
2018-01-20 10:09:59 1684
转载 Lazy<>的使用
lazy对象由一个线程创建,其它线程可共用using System;using System.Collections.Generic;using System.Diagnostics;using System.Linq;using System.Text;using System.Threading;using System.Threading.Tasks;namespace Co
2018-01-19 21:21:22 739
原创 C#中的unsafe代码
public static void Main() { string stringA = "I seem to be turned around"; int copylen = stringA.Length; IntPtr sptr = Marshal.StringToHGlobalAnsi(stringA)
2018-01-19 19:48:44 564
原创 变量的生命周期
namespace BillTest{ public class Test { Animal animal = new Animal(); Dog dog = new Dog(); public void initial() { animal.initial(6);
2018-01-19 15:36:07 247
翻译 CountdownEvent的使用 Task 的异步编程
ConcurrentQueue queue = new ConcurrentQueue(Enumerable.Range(0,10000)); CountdownEvent cde = new CountdownEvent(10000); //This is the logic for all queue consumers
2018-01-15 16:03:03 464
翻译 #define的使用
The #define directive cannot be used to declare constant values as is typically done in C and C++. Constants in C# are best defined as static members of a class or struct. If you have several such c
2018-01-15 14:46:24 436
原创 ThreadStatic的作用
//ThreadStatic 指示每个静态类型字段对于每一个线程都是唯一的 [ThreadStatic] public static int i; // 不赋值,否则只执行一次 public static void ChangeI() { i = 3; console.writeLine( i.ToStr
2018-01-15 10:56:02 2047
原创 IEnumerable<>接口的实现
需要实现一个 ADD的静态扩展方法,否则 无法使用构造函数添加数据 public class Enrollment : IEnumerable { private List allStudents = new List(); public void Enroll(Student s) { allStudent
2018-01-15 10:52:58 1755
原创 练过的最复杂一个方法
using System;using System.Collections.Generic;using System.Linq;using System.Reflection;using System.Text;using System.Threading.Tasks;using log4net.Appender;using System.IO;using log4net.Lay
2018-01-09 11:27:11 232
原创 利用委托设计可以应用于不同情境下的日志记录器
There's no need for greater accessibility because the delegate infrastructure can connect the delegatesnamespace Logger{ class Program { //We need to write the single implementation
2018-01-02 16:05:54 163
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人