VS2008代码段快捷方式小记
微软的IDE为程序员提供了很多的方便而之前就看到过园子里的朋友发过关于代码段(Snippet)的文章,最后会列举一些,这里花点时间把除了VAssist X之外的,微软VS2008自带的代码段快捷方式贴一下,希望有用。按字母顺序:
#if true
#endif
~ 析构函数代码段
代码段



Attribute (属性模型代码段)
checked
class
ctor (构造函数)
cw (Console.WriteLine代码段)
do
else
enum (枚举)
equals代码段
Exception

for
foreach
forr (for逆向代码段)

if
indexer(索引器)
interface(代码段)
invoke(安全调用事件代码段)
iterator(简单迭代器代码段)
——————————简单迭代器代码段示例——————————————————————
public System.Collections.Generic.IEnumerator<ElementType> GetEnumerator()
{
throw new NotImplementedException();
yield return default(ElementType);
}
——————————————————————————————————————————
iterindex
——————————iterindex示例——————————————————————————————
public MyViewIterator MyView
{
get
{
return new MyViewIterator(this);
}
}

public class MyViewIterator
{
readonly TypeSystem outer;

internal MyViewIterator(TypeSystem outer)
{
this.outer = outer;
}

// TODO: provide an appropriate implementation here
public int Length { get { return 1; } }

public ElementType this[int index]
{
get
{
//
// TODO: implement indexer here
//
// you have full access to TypeSystem privates
//
throw new NotImplementedException();
return default(ElementType);
}
}

public System.Collections.Generic.IEnumerator<ElementType> GetEnumerator()
{
for (int i = 0; i < this.Length; i++)
{
yield return this[i];
}
}
}
——————————————————————————————————————————————————

lock

mbox (MessageBox.Show())
namespace
prop (public int MyProperty { get; set; } )
propa
——————————————————————————————————————————————————————
public static int GetMyProperty(DependencyObject obj)
{
return (int)obj.GetValue(MyPropertyProperty);
}

public static void SetMyProperty(DependencyObject obj, int value)
{
obj.SetValue(MyPropertyProperty, value);
}

// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.RegisterAttached("MyProperty", typeof(int), typeof(ownerclass), new UIPropertyMetadata(0));

——————————————————————————————————————————————————————
propdp
——————————————————————————————————————————————————————
public int MyProperty
{
get { return (int)GetValue(MyPropertyProperty); }
set { SetValue(MyPropertyProperty, value); }
}

// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(int), typeof(ownerclass), new UIPropertyMetadata(0));
——————————————————————————————————————————————————————
propg : public int MyProperty { get; private set; }
sim :
————————————————————————————
static int Main(string[] args)
{

return 0;
}
——————————————————————————
struct
——————————————————————————
static void Main(string[] args)
{

}
——————————————————————————
switch
try
tryf
unchecked
unsafe
using
wde(依赖属性代码段)
wdp(工作流活动中创建依赖属性代码段)
while
特殊字符





A~J













































































L~Z






























































相关文章:
http://www.cnblogs.com/shanyou/archive/2007/11/20/965024.html
http://www.infoq.com/news/2007/11/SnippetEditor
http://www.cnblogs.com/xiaoxijin/archive/2007/03/30/694569.html
http://www.cnblogs.com/xiaoshatian/
http://www.cnblogs.com/heekui/archive/2007/03/13/672532.html
http://www.cnblogs.com/island/archive/
.......
还有很多,不一一列举了 :)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端