Skip to content

Commit 57ccffd

Browse files
authored
Merge pull request #4583 from dotnet/publish-26615
Merge master into live
2 parents 0398021 + 086c3d5 commit 57ccffd

File tree

32 files changed

+606
-439
lines changed

32 files changed

+606
-439
lines changed

samples/snippets/.editorconfig

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Default settings:
7+
# A newline ending every file
8+
# Use 4 spaces as indentation
9+
[*]
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 4
13+
trim_trailing_whitespace = true
14+
15+
[project.json]
16+
indent_size = 2
17+
18+
# C# and Visual Basic files
19+
[*.{cs,vb}]
20+
charset = utf-8-bom
21+
dotnet_sort_system_directives_first = true
22+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
23+
dotnet_style_predefined_type_for_member_access = true:suggestion
24+
25+
# avoid this. unless absolutely necessary
26+
dotnet_style_qualification_for_field = false:suggestion
27+
dotnet_style_qualification_for_property = false:suggestion
28+
dotnet_style_qualification_for_method = false:suggestion
29+
dotnet_style_qualification_for_event = false:suggestion
30+
31+
# name all constant fields using PascalCase
32+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
33+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
34+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
35+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
36+
dotnet_naming_symbols.constant_fields.required_modifiers = const
37+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
38+
39+
# static fields should have s_ prefix
40+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
41+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
42+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
43+
dotnet_naming_symbols.static_fields.applicable_kinds = field
44+
dotnet_naming_symbols.static_fields.required_modifiers = static
45+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
46+
dotnet_naming_style.static_prefix_style.required_prefix = s_
47+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
48+
49+
# internal and private fields should be _camelCase
50+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
51+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
52+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
53+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
54+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
55+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
56+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
57+
58+
# Code quality
59+
dotnet_style_readonly_field = true:suggestion
60+
dotnet_code_quality_unused_parameters = non_public:suggestion
61+
62+
# Expression-level preferences
63+
dotnet_style_object_initializer = true:suggestion
64+
dotnet_style_collection_initializer = true:suggestion
65+
dotnet_style_explicit_tuple_names = true:suggestion
66+
dotnet_style_coalesce_expression = true:suggestion
67+
dotnet_style_null_propagation = true:suggestion
68+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
69+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
70+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
71+
dotnet_style_prefer_auto_properties = true:suggestion
72+
dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
73+
dotnet_style_prefer_conditional_expression_over_return = true:refactoring
74+
75+
# Analyzers
76+
dotnet_code_quality.ca1802.api_surface = private, internal
77+
78+
# C# files
79+
[*.cs]
80+
# New line preferences
81+
csharp_new_line_before_open_brace = all
82+
csharp_new_line_before_else = true
83+
csharp_new_line_before_catch = true
84+
csharp_new_line_before_finally = true
85+
csharp_new_line_before_members_in_object_initializers = true
86+
csharp_new_line_before_members_in_anonymous_types = true
87+
csharp_new_line_between_query_expression_clauses = true
88+
89+
# Indentation preferences
90+
csharp_indent_block_contents = true
91+
csharp_indent_braces = false
92+
csharp_indent_case_contents = true
93+
csharp_indent_case_contents_when_block = true
94+
csharp_indent_switch_labels = true
95+
csharp_indent_labels = one_less_than_current
96+
97+
# Modifier preferences
98+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
99+
100+
# Code style defaults
101+
csharp_using_directive_placement = outside_namespace:suggestion
102+
csharp_prefer_braces = true:refactoring
103+
csharp_preserve_single_line_blocks = true:none
104+
csharp_preserve_single_line_statements = false:none
105+
csharp_prefer_static_local_function = true:suggestion
106+
csharp_prefer_simple_using_statement = false:none
107+
csharp_style_prefer_switch_expression = true:suggestion
108+
109+
# Expression-bodied members
110+
csharp_style_expression_bodied_methods = true:refactoring
111+
csharp_style_expression_bodied_constructors = true:refactoring
112+
csharp_style_expression_bodied_operators = true:refactoring
113+
csharp_style_expression_bodied_properties = true:refactoring
114+
csharp_style_expression_bodied_indexers = true:refactoring
115+
csharp_style_expression_bodied_accessors = true:refactoring
116+
csharp_style_expression_bodied_lambdas = true:refactoring
117+
csharp_style_expression_bodied_local_functions = true:refactoring
118+
119+
# Pattern matching
120+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
121+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
122+
csharp_style_inlined_variable_declaration = true:suggestion
123+
124+
# Expression-level preferences
125+
csharp_prefer_simple_default_expression = true:suggestion
126+
127+
# Null checking preferences
128+
csharp_style_throw_expression = true:suggestion
129+
csharp_style_conditional_delegate_call = true:suggestion
130+
131+
# Other features
132+
csharp_style_prefer_index_operator = false:none
133+
csharp_style_prefer_range_operator = false:none
134+
csharp_style_pattern_local_over_anonymous_function = false:none
135+
136+
# Space preferences
137+
csharp_space_after_cast = false
138+
csharp_space_after_colon_in_inheritance_clause = true
139+
csharp_space_after_comma = true
140+
csharp_space_after_dot = false
141+
csharp_space_after_keywords_in_control_flow_statements = true
142+
csharp_space_after_semicolon_in_for_statement = true
143+
csharp_space_around_binary_operators = before_and_after
144+
csharp_space_around_declaration_statements = do_not_ignore
145+
csharp_space_before_colon_in_inheritance_clause = true
146+
csharp_space_before_comma = false
147+
csharp_space_before_dot = false
148+
csharp_space_before_open_square_brackets = false
149+
csharp_space_before_semicolon_in_for_statement = false
150+
csharp_space_between_empty_square_brackets = false
151+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
152+
csharp_space_between_method_call_name_and_opening_parenthesis = false
153+
csharp_space_between_method_call_parameter_list_parentheses = false
154+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
155+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
156+
csharp_space_between_method_declaration_parameter_list_parentheses = false
157+
csharp_space_between_parentheses = false
158+
csharp_space_between_square_brackets = false
159+
160+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
161+
csharp_style_var_for_built_in_types = false:suggestion
162+
csharp_style_var_when_type_is_apparent = false:none
163+
csharp_style_var_elsewhere = false:suggestion
164+
165+
# Visual Basic files
166+
[*.vb]
167+
# Modifier preferences
168+
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
169+
170+
# C++ Files
171+
[*.{cpp,h,in}]
172+
curly_bracket_next_line = true
173+
indent_brace_style = Allman
174+
175+
# Xml project files
176+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
177+
indent_size = 2
178+
179+
# Xml build files
180+
[*.builds]
181+
indent_size = 2
182+
183+
# Xml files
184+
[*.{xml,stylecop,resx,ruleset}]
185+
indent_size = 2
186+
187+
# Xml config files
188+
[*.{props,targets,config,nuspec}]
189+
indent_size = 2
190+
191+
# Shell scripts
192+
[*.sh]
193+
end_of_line = lf
194+
[*.{cmd, bat}]
195+
end_of_line = crlf

samples/snippets/csharp/VS_Snippets_CLR_System/system.Decimal.Parse/CS/parse.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ private static void CallParse()
2222
number = Decimal.Parse(value);
2323
Console.WriteLine("'{0}' converted to {1}.", value, number);
2424
// Displays:
25-
// 16,523,421' converted to 16523421.
25+
// '16,523,421' converted to 16523421.
2626

2727
// Parse a floating point value with thousands separators
2828
value = "25,162.1378";
2929
number = Decimal.Parse(value);
3030
Console.WriteLine("'{0}' converted to {1}.", value, number);
3131
// Displays:
32-
// 25,162.1378' converted to 25162.1378.
32+
// '25,162.1378' converted to 25162.1378.
3333

3434
// Parse a floating point number with US currency symbol.
3535
value = "$16,321,421.75";
@@ -117,16 +117,16 @@ private static void CallParseWithStylesAndProvider()
117117
NumberStyles style;
118118
CultureInfo provider;
119119

120-
// Parse string using "." as the thousands separator
121-
// and " " as the decimal separator.
120+
// Parse string using " " as the thousands separator
121+
// and "." as the decimal separator.
122122
value = "892 694,12";
123123
style = NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands;
124124
provider = new CultureInfo("fr-FR");
125125

126126
number = Decimal.Parse(value, style, provider);
127127
Console.WriteLine("'{0}' converted to {1}.", value, number);
128128
// Displays:
129-
// 892 694,12' converted to 892694.12.
129+
// '892 694,12' converted to 892694.12.
130130

131131
try
132132
{

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Parse/VB/parse.vb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Module modMain
2222
number = Decimal.Parse(value)
2323
Console.WriteLine("'{0}' converted to {1}.", value, number)
2424
' Displays:
25-
' 16,523,421' converted to 16523421.
25+
' '16,523,421' converted to 16523421.
2626

2727
' Parse a floating point value with thousands separators
2828
value = "25,162.1378"
2929
number = Decimal.Parse(value)
3030
Console.WriteLine("'{0}' converted to {1}.", value, number)
3131
' Displays:
32-
' 25,162.1378' converted to 25162.1378.
32+
' '25,162.1378' converted to 25162.1378.
3333

3434
' Parse a floating point number with US currency symbol.
3535
value = "$16,321,421.75"
@@ -106,16 +106,16 @@ Module modMain
106106
Dim style As NumberStyles
107107
Dim provider As CultureInfo
108108

109-
' Parse string using "." as the thousands separator
110-
' and " " as the decimal separator.
109+
' Parse string using " " as the thousands separator
110+
' and "." as the decimal separator.
111111
value = "892 694,12"
112112
style = NumberStyles.AllowDecimalPoint Or NumberStyles.AllowThousands
113113
provider = New CultureInfo("fr-FR")
114114

115115
number = Decimal.Parse(value, style, provider)
116116
Console.WriteLine("'{0}' converted to {1}.", value, number)
117117
' Displays:
118-
' 892 694,12' converted to 892694.12.
118+
' '892 694,12' converted to 892694.12.
119119

120120
Try
121121
number = Decimal.Parse(value, style, CultureInfo.InvariantCulture)

xml/System.CodeDom.Compiler/CodeDomProvider.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@
648648
649649
If more than one provider implementation is configured for the language name, <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%2A> returns a provider instance for the last matching configuration element.
650650
651-
Use the <xref:System.Activator.CreateInstance%28System.Type%2CSystem.Reflection.BindingFlags%2CSystem.Reflection.Binder%2CSystem.Object%5B%5D%2CSystem.Globalization.CultureInfo%29?displayProperty=nameWithType> method overload when you want a specific language provider implementation. For example, use the <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%2A> method to get a provider instance that supports the language name `"CSharp"`; use the <xref:System.Activator.CreateInstance%28System.Type%2CSystem.Reflection.BindingFlags%2CSystem.Reflection.Binder%2CSystem.Object%5B%5D%2CSystem.Globalization.CultureInfo%29?displayProperty=nameWithType> method overload to get a provider instance specifically for the <xref:Microsoft.CSharp.CSharpCodeProvider?displayProperty=nameWithType> implementation. You should use the [\], CultureInfo, Object\<xref:System.Activator.CreateInstance%28System.Type%2CSystem.Reflection.BindingFlags%2CSystem.Reflection.Binder%2CSystem.Object%5B%5D%2CSystem.Globalization.CultureInfo%2CSystem.Object%5B%5D%29?displayProperty=nameWithType> method if you have multiple code providers for a language and you desire to instantiate a specific code provider.
651+
Use the <xref:System.Activator.CreateInstance(System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,System.Object%5B%5D,System.Globalization.CultureInfo)?displayProperty=nameWithType> method overload when you want a specific language provider implementation. For example, use the <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%2A> method to get a provider instance that supports the language name `"CSharp"`; use the <xref:System.Activator.CreateInstance(System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,System.Object%5B%5D,System.Globalization.CultureInfo)?displayProperty=nameWithType> method overload to get a provider instance specifically for the <xref:Microsoft.CSharp.CSharpCodeProvider?displayProperty=nameWithType> implementation. Use the <xref:System.Activator.CreateInstance(System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,System.Object%5B%5D,System.Globalization.CultureInfo,System.Object%5B%5D)?displayProperty=nameWithType> method if you have multiple code providers for a language and you desire to instantiate a specific code provider.
652652
653653
The <xref:System.CodeDom.Compiler.CodeDomProvider.IsDefinedLanguage%2A> method checks whether at least one provider implementation supports a specific language. You can validate a language name using <xref:System.CodeDom.Compiler.CodeDomProvider.IsDefinedLanguage%2A> before passing it to <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%2A>. If you pass an unsupported language name to <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%2A> a <xref:System.Configuration.ConfigurationException?displayProperty=nameWithType> is thrown.
654654
@@ -719,11 +719,11 @@
719719
## Remarks
720720
721721
> [!NOTE]
722-
> This method is most commonly used to create an instance of a code provider in an application that may optionally use one of several providers. <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%28System.String%2CSystem.Collections.Generic.IDictionary%7BSystem.String%2CSystem.String%7D%29> enables you to specify at run time the version of the code provider you want to instantiate. If you know at design time which code provider is to be used, you should create an instance of that code provider instead of using the <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%28System.String%2CSystem.Collections.Generic.IDictionary%7BSystem.String%2CSystem.String%7D%29> method.
722+
> This method is most commonly used to create an instance of a code provider in an application that may optionally use one of several providers. <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider(System.String,System.Collections.Generic.IDictionary%7BSystem.String,System.String%7D)> enables you to specify at run time the version of the code provider you want to instantiate. If you know at design time which code provider is to be used, you should create an instance of that code provider instead of using the <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider(System.String,System.Collections.Generic.IDictionary%7BSystem.String,System.String%7D)> method.
723723
724-
Use <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%28System.String%2CSystem.Collections.Generic.IDictionary%7BSystem.String%2CSystem.String%7D%29> when you want to dynamically find a configured provider implementation for a specific language and options. Language names are case-insensitive. For information about supported provider options, see the specific CodeDOM provider documentation.
724+
Use <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider(System.String,System.Collections.Generic.IDictionary%7BSystem.String,System.String%7D)> when you want to dynamically find a configured provider implementation for a specific language and options. Language names are case-insensitive. For information about supported provider options, see the specific CodeDOM provider documentation.
725725
726-
For information about validating a provider and calling a provider if more than one provider implementation is configured for the language name, see the Remarks section of the <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider%28System.String%29> method.
726+
For information about validating a provider and calling a provider if more than one provider implementation is configured for the language name, see the Remarks section of the <xref:System.CodeDom.Compiler.CodeDomProvider.CreateProvider(System.String)> method.
727727
728728
729729

0 commit comments

Comments
 (0)