Kee*_*ker 16 .net c# visual-studio code-snippets
我已经构建了一些片段来为设置类生成字段.我现在使用2个变量 - $setting$和$Setting$- 为属性和支持字段生成名称.我喜欢使用单个变量,因为唯一的区别是后备字段始终是低级版本.
当前代码:
string $setting$;
/// <summary>
/// Gets the $bigComment$.
/// </summary>
/// <value>The $smallComment$.</value>
public string $Setting$
{
get
{
if (String.IsNullOrEmpty($setting$))
{
$setting$ = CFW.Common.Configuration.GetAppSetting("$Setting$", $defaultValue$);
}
return $setting$;
}
}
Run Code Online (Sandbox Code Playgroud)
这可能吗?
无法更改代码片段中的文字。有一些功能可用:
GenerateSwitchCases - 为 EnumerationLiteral 参数指定的枚举成员生成 switch 语句和一组 case 语句。EnumerationLiteral 参数必须是对枚举文字或枚举类型的引用。
ClassName - 返回包含插入片段的类的名称。
SimpleTypeName - 在调用片段的上下文中将 TypeName 参数简化为最简单的形式。
但他们不能修改文字。
来源:http : //msdn.microsoft.com/en-us/library/ms242312(v=vs.110).aspx
| 归档时间: |
|
| 查看次数: |
7104 次 |
| 最近记录: |