- 博客(23)
- 收藏
- 关注
原创 c# 线程
名称空间:System.Threading异步委托异步委托使用线程池。基于IAsyncResult的异步模式。static int TakesAWhile(int data, int ms){}public delegate int TakesAWhileDelegate(int data, int ms);static void Main() TakesAWhil
2012-11-07 10:13:47 745
转载 c# Runtime load library; Load Assembly from Specific Directory Path
Reference: http://www.chilkatsoft.com/p/p_502.aspusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using Sy
2012-10-18 13:06:57 683
转载 C# using
http://www.cnblogs.com/cding/articles/1363712.html 1.using指令。using + 命名空间名字2.using别名。using + 别名 = 包括详细命名空间信息的具体的类型。3.using语句,定义一个范围,在范围结束时处理对象。场景:当在某个代码段中使用了类的实例,而希望无论因为什么原因,只要离开了这个代码段就自
2012-09-06 11:01:05 259
转载 Control的Invoke和BeginInvoke
Reference:http://www.cnblogs.com/c2303191/articles/826571.html MethodInvoker 提供一个简单委托,该委托用于调用含 void 参数列表的方法。在对控件的 Invoke 方法进行调用时或需要一个简单委托又不想自己定义时可以使用该委托(摘自MSDN)在多线程编程时,DotNet2.0会对跨线程访问控件进
2012-09-06 10:53:57 411
转载 timer
Reference:http://www.cnblogs.com/ryhan/archive/2011/07/14/2106350.htmlhttp://www.biye5u.com/article/Csharp/winform/2010/2813.html 在C#里现在有3个Timer类:System.Windows.Forms.Timer System.Threadin
2012-09-04 11:19:36 317
转载 C#Hashtable与Dictionary性能
http://www.cnblogs.com/zcy_soft/archive/2010/10/02/1841165.html
2012-09-03 16:56:03 303
原创 从C#程序中调用非受管DLLs
using System.Runtime.InteropServices; // DllImport所在的名字空间 [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_POWER_STATUS { public byte ACLine
2012-08-29 10:52:29 515
转载 委托-异步调用-泛型委托-匿名方法-Lambda表达式-事件
1. 委托From: http://www.cnblogs.com/daxnet/archive/2008/11/08/1687014.html类是对象的抽象,而委托则可以看成是函数的抽象。一个委托代表了具有相同参数列表和返回值的所有函数。 class Program { delegate int CalculateDelegate(int a,
2012-08-28 17:31:10 3440
转载 P/Invoke
http://blog.csdn.net/qixi0616/article/details/2865498 平台调用是一种服务,它使托管代码能够调用 DLL 中实现的非托管函数.如调用系统的 API 或与 COM 对象打交道,通过 System.Runtime.InteropServices 命名空间. 例如: MessageBox在win32的头文件中的声明: int
2012-08-28 13:48:15 505
转载 Get current time and interval
Reference:http://blog.sina.com.cn/s/blog_7e2ace6a0100xqk5.html C++DWORD GetTickCount();GetLocalTime(SYSTEMTIME*);char buffer[1024]; SYSTEMTIME s; GetLocalTime(&s);
2012-08-27 15:20:09 455
转载 43 Singleton Pattern
Singleton:ensures a class has only one instance, and provides a global point of access to it. Java example 1: public class Singleton { private static Singleton instance; private Singlet
2012-08-21 16:23:14 241
转载 Find the Root Folder Name of the SD Card.
Find the Root Folder Name of the SD Card.void getSdCardPath(){ DirectoryInfo rootDir = new DirectoryInfo(@"\"); FileAttributes attrStorageCard = FileAttributes.Directory | FileAttributes.Tem
2012-08-01 16:30:09 359
原创 string and byte[] converter
byte[] byteArray = System.Text.Encoding.Default.GetBytes ( str );string str = System.Text.Encoding.Default.GetString ( byteArray ); public static string ToHexString ( byte[] bytes ) //
2012-08-01 11:43:07 450
转载 IMEI & IMSI & TAPI
IMEI(International Mobile Equipment Identity)是国际移动设备身份码的缩写,国际移动装备辨识码,是由15位数字组成的"电子串号",它与每台手机一一对应,而且该码是全世界唯一的。IMEI组成 IMEI由15位数字组成,其组成为: 1、前6位数(TAC,TYPE APPROVAL CODE)是"型号核准号码",一般代表机型。 2、
2012-07-31 16:43:10 397
原创 How to use WMI classes
Example 1: private static Hashtable getBiosInfo() { ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_BIOS"); ManagementObjectSearcher searcher = new Ma
2012-07-30 11:22:23 320
转载 如何隐藏控制台窗口
http://blog.csdn.net/fengzi_shen/article/details/1887893 How to hide the console window in windows console project? #pragma comment( linker, "/subsystem:windows /entry:mainCRTStartup" )
2012-07-26 10:47:42 266
转载 42 Decorator pattern
Decorator:Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for extending functionality.Principles:Classes should be open f
2012-06-26 14:06:48 11025
转载 41 Observer pattern
Observer:defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.Principles:Strive for loosely coupl
2012-06-26 11:37:21 227
转载 40 strategy pattern
Strategy:defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.Principles:Identify
2012-06-25 15:31:32 334
转载 17 print stack trace
Throwable ex = new Throwable(); StackTraceElement[] stackElements = ex.getStackTrace(); if (stackElements != null) { for (int i = 0; i Log.d(TAG, "
2012-05-02 15:31:20 435
原创 09 gradient
android:shape="rectangle" > android:startColor="#00ff0000" android:endColor="#ffff0000" android:angle="270" />
2012-04-16 11:05:42 176
原创 02 LayoutInflater
(1) LayoutInflater inflater = LayoutInflater.from(getContext());View itemView = inflater.inflate(R.layout.agenda_item, this);(2) LayoutInflater inflater = (LayoutInflater) context.getSystemSer
2012-04-05 11:45:15 211
原创 03 DisplayMetrics
WindowManager-->Display-->DisplayMetrics(1) DisplayMetrics metrics = new DisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(metrics);(2)DisplayMetrics metrics = new Dis
2012-04-05 11:43:17 259
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人