1. 快速定义类的属性与函数
输入ctor+两次Tab键:定义类的构造函数
public Student()
{
}
输入prop+两次Tab键:定义不带private字段的属性
public int MyProperty { get; set; }
输入propfull+两次Tab键:定义带private字段的属性
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
输入propdp+两次Tab键:定义依赖属性
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 PropertyMetadata(0));
输入propa+两次Tab键:定义附加属性
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 PropertyMetadata(0));
本文介绍了Visual Studio Code中提高开发效率的一些快捷键,如ctor、prop、propfull、propdp和propa等,用于快速创建类的构造函数、属性以及依赖和附加属性。这些快捷方式对于简化代码编写和增强生产力非常有帮助。
1431

被折叠的 条评论
为什么被折叠?



