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.ComponentModel.DataAnnotations/DisplayFormatAttribute.xml
+1-6Lines changed: 1 addition & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -52,18 +52,15 @@
52
52
When you apply this attribute to a data field, you must follow the guidelines for the use of the attributes. For more information, see [ASP.NET Dynamic Data Guidelines](/previous-versions/aspnet/cc668215(v=vs.100)).
53
53
54
54
## Examples
55
-
See an online example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.ComponentModel.DataAnnotations.DisplayFormatAttribute).
56
55
57
-
The following example shows how to use the <xref:System.ComponentModel.DataAnnotations.DisplayFormatAttribute> to customize formatting for a data field. The example performs the following steps:
56
+
The following example shows how to use the <xref:System.ComponentModel.DataAnnotations.DisplayFormatAttribute> to customize formatting for a data field. The example performs the following steps:
58
57
59
58
- Implements a metadata partial class and an associated metadata class.
60
59
61
60
- In the associated metadata class, it applies the <xref:System.ComponentModel.DataAnnotations.DisplayFormatAttribute> attribute to specify the following results:
62
61
63
62
- Display the text "[Null]" when a data field is empty.
64
-
65
63
- Display currency data in locale specific currency format.
66
-
67
64
- Display date information in short format (mm/dd/yy). This format also applies in edit mode.
- The AdventureWorksLT sample database. For information about how to download and install the SQL Server sample database, see [Microsoft SQL Server Product Samples: Database](https://github.com/Microsoft/sql-server-samples/releases) on GitHub. Make sure that you install the correct version of the sample database for the version of SQL Server that you are running.
77
-
78
73
- A data-driven Web site. This enables you to create a data context for the database and the class that contains the data field to customize. For more information, see `Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding`.
Copy file name to clipboardExpand all lines: xml/System.Text/CodePagesEncodingProvider.xml
+25-1Lines changed: 25 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -75,6 +75,15 @@
75
75
76
76
After an <xref:System.Text.EncodingProvider> object is registered, the encodings that it supports are available by calling the overloads of <xref:System.Text.Encoding.GetEncoding%2A?displayProperty=nameWithType>; you should not call the <xref:System.Text.EncodingProvider.GetEncoding%2A?displayProperty=nameWithType> overloads.
77
77
78
+
### Impact on default encoding behavior
79
+
80
+
Registering <xref:System.Text.CodePagesEncodingProvider> also affects the behavior of <xref:System.Text.Encoding.GetEncoding(System.Int32)> when called with a `codepage` argument of `0` in .NET (Core):
81
+
82
+
- On Windows, `GetEncoding(0)` returns the encoding that matches the system's active code page, which is the same behavior as in .NET Framework.
83
+
- On non-Windows platforms, `GetEncoding(0)` returns UTF-8, maintaining cross-platform consistency.
84
+
85
+
When no encoding provider is registered, `GetEncoding(0)` returns UTF-8 on all platforms in .NET Core and later versions.
86
+
78
87
]]></format>
79
88
</remarks>
80
89
</Docs>
@@ -154,7 +163,22 @@ The .NET Framework supports a large number of character encodings and code pages
154
163
<paramname="codepage">The code page identifier of the preferred encoding that the encoding provider might support.</param>
155
164
<summary>Returns the encoding associated with the specified code page identifier.</summary>
156
165
<returns>The encoding associated with the specified code page identifier, or <seelangword="null" /> if the provider does not support the requested codepage encoding.</returns>
157
-
<remarks>To be added.</remarks>
166
+
<remarks>
167
+
<formattype="text/markdown"><![CDATA[
168
+
169
+
## Remarks
170
+
171
+
This method provides access to code page encodings that are available in .NET Framework but not natively supported in .NET Core and later versions.
172
+
173
+
When `codepage` is `0`, this method has special behavior that affects the default encoding returned by <xref:System.Text.Encoding.GetEncoding(System.Int32)>:
174
+
175
+
- **On Windows**: Returns the encoding that matches the system's active code page, providing the same behavior as .NET Framework.
176
+
- **On non-Windows platforms**: Returns `null`, allowing <xref:System.Text.Encoding.GetEncoding(System.Int32)> to fall back to its default UTF-8 behavior.
177
+
178
+
For all other supported code page identifiers, this method returns the corresponding encoding if it's available from the code pages encoding provider, or `null` if the code page is not supported.
Copy file name to clipboardExpand all lines: xml/System.Text/Encoding.xml
+44-12Lines changed: 44 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -985,7 +985,23 @@ The returned <xref:System.IO.Stream>'s <xref:System.IO.Stream.CanRead> and <xref
985
985
<Docs>
986
986
<summary>Gets the default encoding for this .NET implementation.</summary>
987
987
<value>The default encoding for this .NET implementation.</value>
988
-
<remarks>For more information about this API, see <seehref="/dotnet/fundamentals/runtime-libraries/system-text-encoding-default">Supplemental API remarks for Encoding.Default</see>.</remarks>
988
+
<remarks>
989
+
<formattype="text/markdown"><![CDATA[
990
+
991
+
## Remarks
992
+
993
+
The behavior of the <xref:System.Text.Encoding.Default%2A> property varies between different .NET implementations:
994
+
995
+
- **In .NET Framework**: Returns the encoding that corresponds to the system's active code page. This is the same encoding returned by <xref:System.Text.Encoding.GetEncoding(System.Int32)> when called with a `codepage` argument of `0`.
996
+
997
+
- **In .NET Core and later versions**: Always returns a <xref:System.Text.UTF8Encoding> object. This behavior was changed to encourage the use of Unicode encodings for better cross-platform compatibility and data integrity.
998
+
999
+
For the most consistent results across different platforms and .NET implementations, consider using a specific Unicode encoding such as UTF-8 directly instead of relying on the default encoding. You can obtain UTF-8 encoding by calling <xref:System.Text.Encoding.UTF8?displayProperty=nameWithType> or <xref:System.Text.Encoding.GetEncoding(System.String)?displayProperty=nameWithType> with "utf-8".
1000
+
1001
+
For more information about this API, see <see href="/dotnet/fundamentals/runtime-libraries/system-text-encoding-default">Supplemental API remarks for Encoding.Default</see>.
1002
+
1003
+
]]></format>
1004
+
</remarks>
989
1005
</Docs>
990
1006
</Member>
991
1007
<MemberMemberName="EncoderFallback">
@@ -3531,13 +3547,19 @@ The returned <xref:System.IO.Stream>'s <xref:System.IO.Stream.CanRead> and <xref
3531
3547
3532
3548
In addition to the encodings that are natively available on .NET Core or that are intrinsically supported on a specific platform version of .NET Framework, the <xref:System.Text.Encoding.GetEncoding%2A> method returns any additional encodings that are made available by registering an <xref:System.Text.EncodingProvider> object. If the same encoding has been registered by multiple <xref:System.Text.EncodingProvider> objects, this method returns the last one registered.
3533
3549
3534
-
You can also supply a value of 0 for the `codepage` argument. Its precise behavior depends on whether any encodings have been made available by registering an <xref:System.Text.EncodingProvider> object:
3550
+
You can also supply a value of 0 for the `codepage` argument. The behavior varies between .NET Framework and .NET Core and later versions:
3551
+
3552
+
**In .NET Framework**: Always returns the encoding that corresponds to the system's active code page in Windows. This is the same encoding returned by the <xref:System.Text.Encoding.Default?displayProperty=nameWithType> property.
3535
3553
3536
-
- If one or more encoding providers have been registered, it returns the encoding of the last registered provider that has chosen to return a encoding when the <xref:System.Text.Encoding.GetEncoding%2A> method is passed a `codepage` argument of 0.
3554
+
**In .NET Core and later versions**: The behavior depends on the encoding configuration of the application:
3537
3555
3538
-
- On .NET Framework, if no encoding provider has been registered, if the <xref:System.Text.CodePagesEncodingProvider> is the registered encoding provider, or if no registered encoding provider handles a `codepage` value of 0, it returns the operating system's active code page. To determine the active code page on Windows systems, call the Windows [GetACP](/windows/win32/api/winnls/nf-winnls-getacp) function from .NET Framework.
3556
+
- **No encoding provider registered**: Returns a <xref:System.Text.UTF8Encoding>, same as <xref:System.Text.Encoding.Default?displayProperty=nameWithType>.
3539
3557
3540
-
- On .NET Core, if no encoding provider has been registered or if no registered encoding provider handles a `codepage` value of 0, it returns the <xref:System.Text.UTF8Encoding>.
- On **Windows**, returns the encoding that matches the system's active code page (same as .NET Framework behavior).
3560
+
- On **non-Windows platforms**, always returns a <xref:System.Text.UTF8Encoding>.
3561
+
3562
+
- **A different provider registered**: The behavior is determined by that provider. Consult its documentation for details. If multiple providers are registered, the method returns the encoding from the last registered provider that handles a `codepage` argument of 0.
3541
3563
3542
3564
> [!NOTE]
3543
3565
> - Some unsupported code pages cause an <xref:System.ArgumentException> to be thrown, whereas others cause a <xref:System.NotSupportedException>. Therefore, your code must catch all exceptions indicated in the Exceptions section.
@@ -3731,13 +3753,19 @@ In .NET Framework, the <xref:System.Text.Encoding.GetEncoding%2A> method relies
3731
3753
3732
3754
In addition to the encodings that are natively available on .NET Core or that are intrinsically supported on a specific platform version of .NET Framework, the <xref:System.Text.Encoding.GetEncoding%2A> method returns any additional encodings that are made available by registering an <xref:System.Text.EncodingProvider> object. If the same encoding has been registered by multiple <xref:System.Text.EncodingProvider> objects, this method returns the last one registered.
3733
3755
3734
-
You can also supply a value of 0 for the `codepage` argument. Its precise behavior depends on whether any encodings have been made available by registering an <xref:System.Text.EncodingProvider> object:
3756
+
You can also supply a value of 0 for the `codepage` argument. The behavior varies between .NET Framework and .NET Core and later versions:
3757
+
3758
+
**In .NET Framework**: Always returns the encoding that corresponds to the system's active code page in Windows. This is the same encoding returned by the <xref:System.Text.Encoding.Default?displayProperty=nameWithType> property.
3735
3759
3736
-
- If one or more encoding providers have been registered, it returns the encoding of the last registered provider that has chosen to return a encoding when the <xref:System.Text.Encoding.GetEncoding%2A> method is passed a `codepage` argument of 0.
3760
+
**In .NET Core and later versions**: The behavior depends on the encoding configuration of the application:
3737
3761
3738
-
- On .NET Framework, if no encoding provider has been registered, if the <xref:System.Text.CodePagesEncodingProvider> is the registered encoding provider, or if no registered encoding provider handles a `codepage` value of 0, it returns the active code page.
3762
+
- **No encoding provider registered**: Returns a <xref:System.Text.UTF8Encoding>, same as <xref:System.Text.Encoding.Default?displayProperty=nameWithType>.
3739
3763
3740
-
- On .NET Core, if no encoding provider has been registered or if no registered encoding provider handles a `codepage` value of 0, it returns the <xref:System.Text.UTF8Encoding> encoding.
- On **Windows**, returns the encoding that matches the system's active code page (same as .NET Framework behavior).
3766
+
- On **non-Windows platforms**, always returns a <xref:System.Text.UTF8Encoding>.
3767
+
3768
+
- **A different provider registered**: The behavior is determined by that provider. Consult its documentation for details. If multiple providers are registered, the method returns the encoding from the last registered provider that handles a `codepage` argument of 0.
3741
3769
3742
3770
> [!NOTE]
3743
3771
> The ANSI code pages can be different on different computers and can change on a single computer, leading to data corruption. For this reason, if the active code page is an ANSI code page, encoding and decoding data using the default code page returned by `Encoding.GetEncoding(0)` is not recommended. For the most consistent results, you should use Unicode, such as UTF-8 (code page 65001) or UTF-16, instead of a specific code page.
@@ -5296,11 +5324,15 @@ The goal is to save this file, then open and decode it as a binary stream.
5296
5324
## Remarks
5297
5325
The <xref:System.Text.Encoding.RegisterProvider%2A> method allows you to register a class derived from <xref:System.Text.EncodingProvider> that makes character encodings available on a platform that does not otherwise support them. Once the encoding provider is registered, the encodings that it supports can be retrieved by calling any <xref:System.Text.Encoding.GetEncoding%2A?displayProperty=nameWithType> overload. If there are multiple encoding providers, the <xref:System.Text.Encoding.GetEncoding%2A?displayProperty=nameWithType> method attempts to retrieve a specified encoding from each provider starting with the one most recently registered.
5298
5326
5299
-
Registering an encoding provider by using the <xref:System.Text.Encoding.RegisterProvider%2A> method also modifies the behavior of the [Encoding.GetEncoding(Int32)](<xref:System.Text.Encoding.GetEncoding(System.Int32)>) and [EncodingProvider.GetEncoding(Int32, EncoderFallback, DecoderFallback)](xref:System.Text.Encoding.GetEncoding(System.Int32,System.Text.EncoderFallback,System.Text.DecoderFallback)) methods when passed an argument of `0`:
5327
+
Registering an encoding provider by using the <xref:System.Text.Encoding.RegisterProvider%2A> method also affects the behavior of <xref:System.Text.Encoding.GetEncoding(System.Int32)> when passed an argument of `0`. This is particularly important in .NET Core and later versions where the default behavior for <xref:System.Text.Encoding.GetEncoding(System.Int32)> with `codepage` 0 is to return UTF-8:
5328
+
5329
+
- **If the registered provider is <xref:System.Text.CodePagesEncodingProvider>**:
5330
+
- On **Windows**, <xref:System.Text.Encoding.GetEncoding(System.Int32)> with `codepage` 0 returns the encoding that matches the system's active code page (same as .NET Framework behavior).
5331
+
- On **non-Windows platforms**, it still returns UTF-8.
5300
5332
5301
-
- If the registered provider is the <xref:System.Text.CodePagesEncodingProvider>, the method returns the encoding that matches the system active code page when running on the Windows operating system.
5333
+
- **If a custom encoding provider is registered**: The provider can choose which encoding to return when <xref:System.Text.Encoding.GetEncoding(System.Int32)> is passed an argument of `0`. The provider can also choose to not handle this case by returning `null` from its <xref:System.Text.EncodingProvider.GetEncoding%2A?displayProperty=nameWithType> method, in which case the default UTF-8 behavior is used.
5302
5334
5303
-
- A custom encoding provider can choose which encoding to return when either of these <xref:System.Text.Encoding.GetEncoding%2A> method overloads is passed an argument of `0`. The provider can also choose to not return an encoding by having the <xref:System.Text.EncodingProvider.GetEncoding%2A?displayProperty=nameWithType> method return `null`.
5335
+
If multiple providers are registered, <xref:System.Text.Encoding.GetEncoding(System.Int32)> attempts to retrieve the encoding from the most recently registered provider first.
5304
5336
5305
5337
Starting with .NET Framework 4.6, .NET Framework includes one encoding provider, <xref:System.Text.CodePagesEncodingProvider>, that makes the encodings available that are present in the full .NET Framework but are not available in the Universal Windows Platform. By default, the Universal Windows Platform only supports the Unicode encodings, ASCII, and code page 28591.
Copy file name to clipboardExpand all lines: xml/System.Web.DynamicData/DynamicControl.xml
-6Lines changed: 0 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -102,10 +102,7 @@
102
102
</asp:DynamicControl>
103
103
```
104
104
105
-
106
-
107
105
## Examples
108
-
See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicControl).
109
106
110
107
The following example demonstrates how to use the <xref:System.Web.DynamicData.DynamicControl> control in a <xref:System.Web.UI.WebControls.ListView> control to display, insert, delete and edit values from a database table. It is important to notice that in order to make the insert operation to work, the <xref:System.Data.Linq.Mapping.ColumnAttribute.IsDbGenerated%2A> property of the `rowguid` and `ModifiedDate` columns are set to `true`.
111
108
@@ -844,10 +841,7 @@
844
841
845
842
The field template that you specify using the <xref:System.Web.DynamicData.DynamicControl.UIHint%2A> property is specific to this instance of the <xref:System.Web.DynamicData.DynamicControl> control. You can also change the field template used by a data field across the entire application by applying the <xref:System.ComponentModel.DataAnnotations.UIHintAttribute> to your data model. Setting the <xref:System.Web.DynamicData.DynamicControl.UIHint%2A> property overrides the metadata applied to the data model. For more information about metadata attributes, see [ASP.NET Dynamic Data](https://msdn.microsoft.com/library/78c7fcd7-5f38-46a0-a4bc-48eff3c8a512).
846
843
847
-
848
-
849
844
## Examples
850
-
See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicControl.UIHint).
851
845
852
846
The following example shows how you can specify a data field to use a different field template to render its contents. The second example shows the custom field template specified by the <xref:System.Web.DynamicData.DynamicControl.UIHint%2A> property.
Copy file name to clipboardExpand all lines: xml/System.Web.DynamicData/DynamicField.xml
-3Lines changed: 0 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -158,10 +158,7 @@
158
158
<asp:DynamicField />
159
159
```
160
160
161
-
162
-
163
161
## Examples
164
-
See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicField).
165
162
166
163
The following example demonstrates how to use the <xref:System.Web.DynamicData.DynamicField> object in a <xref:System.Web.UI.WebControls.GridView> control to display and edit values from a database table.
Copy file name to clipboardExpand all lines: xml/System.Web.DynamicData/DynamicQueryStringParameter.xml
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -30,10 +30,6 @@
30
30
31
31
In order to use the <xref:System.Web.DynamicData.DynamicQueryStringParameter> class, you must add a <xref:System.Web.DynamicData.DynamicDataManager> control to the page and you must register the data-bound control with the <xref:System.Web.DynamicData.DynamicDataManager> control by using the <xref:System.Web.DynamicData.DynamicDataManager.RegisterControl%2A?displayProperty=nameWithType> method.
32
32
33
-
See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicQueryStringParameter).
34
-
35
-
36
-
37
33
## Examples
38
34
The following example shows how to use the <xref:System.Web.DynamicData.DynamicQueryStringParameter> object as filter when displaying data in a <xref:System.Web.UI.WebControls.GridView> control. The <xref:System.Web.UI.WebControls.GridView> control contains a <xref:System.Web.UI.WebControls.TemplateField> object that creates a link that sets the query string value by using the foreign key value.
0 commit comments