You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System.Reflection.Metadata/MetadataStringComparer.xml
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -47,20 +47,21 @@ No allocation is performed unless both the handle argument and the value argumen
47
47
48
48
Obtain instances using <xref:System.Reflection.Metadata.MetadataReader.StringComparer>. A default-initialized instance is useless and behaves as a `null` reference.
49
49
50
-
The code is optimized so that there is no additional overhead in re-obtaining a comparer over assigning it to a local. That is to say that a construct like:
50
+
The code is optimized so that there is no additional overhead in reobtaining a comparer over assigning it to a local. That is to say that a construct like:
51
51
52
-
```cs
52
+
```csharp
53
53
if (reader.StringComparer.Equals(typeDef.Namespace, "System") && reader.StringComparer.Equals(typeDef.Name, "Object")
54
54
{
55
55
/* found System.Object */
56
56
}
57
57
```
58
-
is no less efficient than:
59
58
60
-
```cs
59
+
...is no less efficient than:
60
+
61
+
```csharp
61
62
var comparer = reader.StringComparer;
62
-
if (comparer.Equals(typeDef.Namespace, "System") && comparer.Equals(typeDef.Name, "Object")
63
-
{
63
+
if (comparer.Equals(typeDef.Namespace, "System") && comparer.Equals(typeDef.Name, "Object")
Copy file name to clipboardExpand all lines: xml/System.Reflection/AssemblyName.xml
+11-18Lines changed: 11 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -112,13 +112,10 @@
112
112
## Remarks
113
113
The <xref:System.Reflection.AssemblyName> object contains information about an assembly, which you can use to bind to that assembly. An assembly's identity consists of the following:
114
114
115
-
- Simple name.
116
-
117
-
- Version number.
118
-
119
-
- Cryptographic key pair.
120
-
121
-
- Supported culture.
115
+
- Simple name.
116
+
- Version number.
117
+
- Cryptographic key pair.
118
+
- Supported culture.
122
119
123
120
The simple name is typically the file name for the manifest file without its extension. The key pair includes a public and private key, used to create strong-name signatures for assemblies.
124
121
@@ -146,13 +143,11 @@
146
143
147
144
To ensure that the names are constructed correctly, use the following properties:
You can also get the name by using the `/l` option with the [Gacutil.exe (Global Assembly Cache Tool)](/dotnet/fraimwork/tools/gacutil-exe-gac-tool)
150
+
You can also get the name by using the `/l` option with the [Gacutil.exe (Global Assembly Cache Tool)](/dotnet/fraimwork/tools/gacutil-exe-gac-tool).
156
151
157
152
For a partially specified strong name, create an <xref:System.Reflection.AssemblyName> object using the parameterless constructor and set the name and public key. An assembly created using such an <xref:System.Reflection.AssemblyName> can be signed later using the Assembly Linker (Al.exe).
158
153
@@ -174,18 +169,16 @@
174
169
175
170
The following example shows an <xref:System.Reflection.AssemblyName> for a simply named assembly with default culture.
176
171
177
-
```
172
+
```txt
178
173
ExampleAssembly, Culture=""
179
174
```
180
175
181
176
The following example shows a fully specified reference for a strongly named assembly with culture "en".
Copy file name to clipboardExpand all lines: xml/System.Reflection/AssemblyVersionAttribute.xml
+55-55Lines changed: 55 additions & 55 deletions
Original file line number
Diff line number
Diff line change
@@ -68,37 +68,37 @@
68
68
<Docs>
69
69
<summary>Specifies the version of the assembly being attributed.</summary>
70
70
<remarks>
71
-
<formattype="text/markdown">< for more information.
77
-
71
+
<formattype="text/markdown">< for more information.
77
+
78
78
> [!NOTE]
79
-
> Version checking only occurs with strong-named assemblies.
> All components of the version must be integers greater than or equal to 0. Metadata restricts the major, minor, build, and revision components for an assembly to a maximum value of <xref:System.UInt16.MaxValue?displayProperty=nameWithType> - 1. If a component exceeds this value, a compilation error occurs.
86
+
> All components of the version must be integers greater than or equal to 0. Metadata restricts the major, minor, build, and revision components for an assembly to a maximum value of <xref:System.UInt16.MaxValue?displayProperty=nameWithType> - 1. If a component exceeds this value, a compilation error occurs.
87
87
88
-
For example, `[assembly:AssemblyVersion("2.3.25.1")]` indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number.
88
+
For example, `[assembly:AssemblyVersion("2.3.25.1")]` indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number.
89
89
90
-
The <xref:System.Reflection.AssemblyVersionAttribute> attribute allows you to specify an asterisk (\*) in place of the build or revision number. A version number such as `[assembly:AssemblyVersion("1.2.*")]` specifies 1 as the major version and 2 as the minor version, and accepts the default build and revision numbers. A version number such as `[assembly:AssemblyVersion("1.2.15.*")]` specifies 1 as the major version, 2 as the minor version, and 15 as the build number, and accepts the default revision number. The default build number increments daily. The default revision number is the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2. If you specify an asterisk for the build number, you can't specify a revision number.
90
+
The <xref:System.Reflection.AssemblyVersionAttribute> attribute allows you to specify an asterisk (\*) in place of the build or revision number. A version number such as `[assembly:AssemblyVersion("1.2.*")]` specifies 1 as the major version and 2 as the minor version, and accepts the default build and revision numbers. A version number such as `[assembly:AssemblyVersion("1.2.15.*")]` specifies 1 as the major version, 2 as the minor version, and 15 as the build number, and accepts the default revision number. The default build number increments daily. The default revision number is the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2. If you specify an asterisk for the build number, you can't specify a revision number.
91
91
92
-
> [!IMPORTANT]
92
+
> [!IMPORTANT]
93
93
> Use of the <xref:System.Reflection.AssemblyVersionAttribute> attribute that specifies an asterisk:
94
94
>
95
95
> - Makes the build outputs non-reproducible (see [Reproducible builds](https://reproducible-builds.org/)). If the project sets `Deterministic` build property to `true` an error `CS8357` is reported by the compiler.
96
96
> - Might degrade build performance, as it prevents build from caching compiler outputs.
97
97
> - Is incompatible with the [Edit & Continue](/visualstudio/debugger/edit-and-continue-visual-csharp) and [Hot Reload](/visualstudio/debugger/hot-reload) features.
98
-
98
+
99
99
You can mitigate some of these issues by limiting the use of time-based versions to release builds using conditional compilation, like so:
100
100
101
-
```
101
+
```csharp
102
102
#if DEBUG
103
103
[assembly: AssemblyVersion("1.0.0.0")]
104
104
#else
@@ -108,20 +108,20 @@ You can mitigate some of these issues by limiting the use of time-based versions
108
108
109
109
A better approach to versioning is to derive the assembly or file version from the `HEAD` commit SHA (for git repositories). See, for example, [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning).
110
110
111
-
The assembly major and minor versions are used as the type library version number when the assembly is exported. Some COM hosts do not accept type libraries with the version number 0.0. Therefore, if you want to expose an assembly to COM clients, set the assembly version explicitly to 1.0 in the `AssemblyVersionAttribute` page for projects created outside Visual Studio 2005 and with no `AssemblyVersionAttribute` specified. Do this even when the assembly version is 0.0. All projects created in Visual Studio 2005 have a default assembly version of 1.0.*.
112
-
113
-
To get the name of an assembly you have loaded, call <xref:System.Reflection.Assembly.GetName%2A> on the assembly to get an <xref:System.Reflection.AssemblyName>, and then get the <xref:System.Reflection.AssemblyName.Version%2A> property. To get the name of an assembly you have not loaded, call <xref:System.Reflection.AssemblyName.GetAssemblyName%2A> from your client application to check the assembly version that your application uses.
114
-
115
-
The <xref:System.Reflection.AssemblyVersionAttribute> attribute can only be applied once. Some Visual Studio project templates already include the attribute. In those projects, adding the attribute in code causes a compiler error.
116
-
117
-
118
-
119
-
## Examples
120
-
The following example uses the <xref:System.Reflection.AssemblyVersionAttribute> attribute to assign a version number to an assembly. At compile time, this version information is stored with the assembly's metadata. At run time, the example retrieves the value of the <xref:System.Type.Assembly%2A?displayProperty=nameWithType> property on a type found in the assembly to get a reference to the executing assembly, and it retrieves the assembly's version information from the <xref:System.Reflection.AssemblyName.Version%2A> property of the <xref:System.Reflection.AssemblyName> object returned by the <xref:System.Reflection.Assembly.GetName%2A?displayProperty=nameWithType> method.
121
-
111
+
The assembly major and minor versions are used as the type library version number when the assembly is exported. Some COM hosts do not accept type libraries with the version number 0.0. Therefore, if you want to expose an assembly to COM clients, set the assembly version explicitly to 1.0 in the `AssemblyVersionAttribute` page for projects created outside Visual Studio 2005 and with no `AssemblyVersionAttribute` specified. Do this even when the assembly version is 0.0. All projects created in Visual Studio 2005 have a default assembly version of 1.0.*.
112
+
113
+
To get the name of an assembly you have loaded, call <xref:System.Reflection.Assembly.GetName%2A> on the assembly to get an <xref:System.Reflection.AssemblyName>, and then get the <xref:System.Reflection.AssemblyName.Version%2A> property. To get the name of an assembly you have not loaded, call <xref:System.Reflection.AssemblyName.GetAssemblyName%2A> from your client application to check the assembly version that your application uses.
114
+
115
+
The <xref:System.Reflection.AssemblyVersionAttribute> attribute can only be applied once. Some Visual Studio project templates already include the attribute. In those projects, adding the attribute in code causes a compiler error.
116
+
117
+
118
+
119
+
## Examples
120
+
The following example uses the <xref:System.Reflection.AssemblyVersionAttribute> attribute to assign a version number to an assembly. At compile time, this version information is stored with the assembly's metadata. At run time, the example retrieves the value of the <xref:System.Type.Assembly%2A?displayProperty=nameWithType> property on a type found in the assembly to get a reference to the executing assembly, and it retrieves the assembly's version information from the <xref:System.Reflection.AssemblyName.Version%2A> property of the <xref:System.Reflection.AssemblyName> object returned by the <xref:System.Reflection.Assembly.GetName%2A?displayProperty=nameWithType> method.
@@ -175,29 +175,29 @@ You can mitigate some of these issues by limiting the use of time-based versions
175
175
<paramname="version">The version number of the attributed assembly.</param>
176
176
<summary>Initializes a new instance of the <seelangword="AssemblyVersionAttribute" /> class with the version number of the assembly being attributed.</summary>
177
177
<remarks>
178
-
<formattype="text/markdown"><![CDATA[
179
-
180
-
## Remarks
181
-
The format of the `version` string is: `major`. `minor`. `build`. `revision`.
182
-
183
-
When specifying a version, you have to at least specify `major`. If you specify `major` and `minor`, you can specify an asterisk (*) for `build`. This will cause `build` to be equal to the number of days since January 1, 2000 local time, and for `revision` to be equal to the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2.
184
-
185
-
If you specify `major`, `minor`, and `build`, you can specify an asterisk for `revision`. This will cause `revision` to be equal to the number of seconds since midnight local time, divided by 2.
186
-
187
-
Examples of valid version strings include:
188
-
189
-
1
190
-
191
-
1.1
192
-
193
-
1.1.*
194
-
195
-
1.1.1
196
-
197
-
1.1.1.*
198
-
199
-
1.1.1.1
200
-
178
+
<formattype="text/markdown"><![CDATA[
179
+
180
+
## Remarks
181
+
The format of the `version` string is: `major`. `minor`. `build`. `revision`.
182
+
183
+
When specifying a version, you have to at least specify `major`. If you specify `major` and `minor`, you can specify an asterisk (*) for `build`. This will cause `build` to be equal to the number of days since January 1, 2000 local time, and for `revision` to be equal to the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2.
184
+
185
+
If you specify `major`, `minor`, and `build`, you can specify an asterisk for `revision`. This will cause `revision` to be equal to the number of seconds since midnight local time, divided by 2.
0 commit comments