提交 b7e55b20 编写于 作者: C CyrusNajmabadi

Add C# UI.

上级 f596847a
......@@ -293,6 +293,25 @@ public C(string s)
//]
}
}
";
private static readonly string s_preferNullPropagation = @"
using System;
class C
{
public C(object o)
{
//[
// Prefer:
var v = o?.ToString();
// Over:
var v = o == null ? null : o.ToString(); // or
var v = o != null ? o.ToString() : null;
//]
}
}
";
private static readonly string s_preferPatternMatchingOverAsWithNullCheck = @"
......@@ -620,6 +639,7 @@ internal StyleViewModel(OptionSet optionSet, IServiceProvider serviceProvider) :
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CodeStyleOptions.PreferThrowExpression, CSharpVSResources.Prefer_throw_expression, s_preferThrowExpression, s_preferThrowExpression, this, optionSet, nullCheckingGroupTitle));
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferConditionalDelegateCall, CSharpVSResources.Prefer_conditional_delegate_call, s_preferConditionalDelegateCall, s_preferConditionalDelegateCall, this, optionSet, nullCheckingGroupTitle));
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CodeStyleOptions.PreferCoalesceExpression, ServicesVSResources.Prefer_coalesce_expression, s_preferCoalesceExpression, s_preferCoalesceExpression, this, optionSet, nullCheckingGroupTitle));
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CodeStyleOptions.PreferNullPropagation, ServicesVSResources.Prefer_null_propagation, s_preferNullPropagation, s_preferNullPropagation, this, optionSet, nullCheckingGroupTitle));
}
}
}
\ No newline at end of file
......@@ -1392,6 +1392,15 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Prefer null propagation.
/// </summary>
internal static string Prefer_null_propagation {
get {
return ResourceManager.GetString("Prefer_null_propagation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Prefer object initializer.
/// </summary>
......
......@@ -807,4 +807,7 @@ Additional information: {1}</value>
<data name="Prefer_coalesce_expression" xml:space="preserve">
<value>Prefer coalesce expression</value>
</data>
<data name="Prefer_null_propagation" xml:space="preserve">
<value>Prefer null propagation</value>
</data>
</root>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册