Posted on 2006-04-01 00:08
被遗弃的小指 阅读(1731)
评论(8) 编辑 收藏 网摘 所属分类:
移动应用开发.NET技术
刚才偶然发现MSDN网站上放出了微软开发的一些针对VS2005的Code Snippet Libraries,里面提供了很多封装好的代码片断,可以直接拿来使用。
下载地址分别是:
C#:
http://msdn.microsoft.com/vstudio/downloads/codesnippets/default.aspxVB.NET:
http://msdn.microsoft.com/vbasic/downloads/snippets/default.aspxVSTO:
http://msdn.microsoft.com/office/understanding/vsto/training/snippets/default.aspx我自己只下载了C#部分的,总共14个分类(Application, Collections, Connectivity, Crystal Reports, Database, Datatypes, File System, Math, OS, Refectoring, Security, Smart Devices, Windows Forms, XML)大约300个代码片断。
举例,如果我要使用关于Smart Device部分的代码片断,只需要在代码编辑器中输入sd(所有的Smart Device的Code Snippet都是以sd开头),则会自动列出来sd开头的代码片断快捷,例如,我只需要输入sdmemory,然后按一下Tab键,则自动会生成查询Windows Mobile设备当前可用内存的代码片断:
[System.Runtime.InteropServices.DllImport("CoreDll.Dll")]
public static extern int GlobalMemoryStatus(ref MEMORYSTATUS ms);

[System.Runtime.InteropServices.DllImport("CoreDll.Dll")]
public static extern int GetSystemMemoryDivision(ref uint lpdwStorePages, ref uint ldpwRamPages, ref uint ldpwPageSize);

public static MEMORYSTATUS GetMemory()

{
MEMORYSTATUS memStatus = new MEMORYSTATUS();
GlobalMemoryStatus(ref memStatus);

return memStatus;
}看看,不错吧。。。。呵呵。。。好好研究研究会发现里面有好多不错的代码片断你可以用上呢~~~