Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
</Project>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,24 @@ public class Test
{
public static void Main()
{
Test t = new Test();
Test t = new();
t.GetSerializers();
}

public void GetSerializers()
{
// Create an array of types.
Type[]types = new Type[3];
types[0] = typeof(Instrument);
types[1] = typeof(Player);
types[2] = typeof(Piece);
Type[] types = [typeof(Instrument), typeof(Player), typeof(Piece)];

// Create an array for XmlSerializer objects.
XmlSerializer[]serializers= new XmlSerializer[3];
XmlSerializer[] serializers = new XmlSerializer[3];
serializers = XmlSerializer.FromTypes(types);
// Create one Instrument and serialize it.
Instrument i = new Instrument();
i.InstrumentName = "Piano";
// Create a TextWriter to write with.
TextWriter writer = new StreamWriter("Inst.xml");
serializers[0].Serialize(writer,i);
serializers[0].Serialize(writer, i);
writer.Close();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
Imports System.IO
Imports System.Xml.Serialization


' Three classes are included here. Each one will
' be used to create three XmlSerializer objects.
' be used to create three XmlSerializer objects.

Public Class Instrument
Public InstrumentName As String
Expand All @@ -19,19 +18,19 @@ Public Class Piece
End Class

Public Class Test

Public Shared Sub Main()
Dim t As New Test()
t.GetSerializers()
End Sub
End Sub

Public Sub GetSerializers()
' Create an array of types.
Dim types(3) As Type
types(0) = GetType(Instrument)
types(1) = GetType(Player)
types(2) = GetType(Piece)

' Create an array for XmlSerializer objects.
Dim serializers(3) As XmlSerializer
serializers = XmlSerializer.FromTypes(types)
Expand All @@ -45,4 +44,4 @@ Public Class Test
End Sub
End Class

' </Snippet1>
' </Snippet1>
10 changes: 5 additions & 5 deletions xml/System.Xml.Serialization/XmlSerializer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1897,15 +1897,15 @@ The following example contains two main classes: `PurchaseOrder` and `Test`. The
<format type="text/markdown"><![CDATA[

## Remarks
The <xref:System.Xml.Serialization.XmlSerializer.FromTypes%2A> method allows you to efficiently create an array of <xref:System.Xml.Serialization.XmlSerializer> objects for processing an array of <xref:System.Type> objects. However, it is recommended for callers to cache the returned serializers when there are repeated calls to this method.


The <xref:System.Xml.Serialization.XmlSerializer.FromTypes%2A> method allows you to efficiently create an array of <xref:System.Xml.Serialization.XmlSerializer> objects for processing an array of <xref:System.Type> objects. However, it's recommended for callers to cache the returned serializers when there are repeated calls to this method.

## Examples
The following example uses the <xref:System.Xml.Serialization.XmlSerializer.FromTypes%2A> method to return an array of <xref:System.Xml.Serialization.XmlSerializer> objects. The code includes three class definitions that are each used to create an array of <xref:System.Type> objects.

:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/FromTypes/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/FromTypes/source.vb" id="Snippet1":::
The following example uses the <xref:System.Xml.Serialization.XmlSerializer.FromTypes%2A> method to return an array of <xref:System.Xml.Serialization.XmlSerializer> objects. The code includes three class definitions that are each used to create an array of <xref:System.Type> objects.

:::code language="csharp" source="~/snippets/csharp/System.Xml.Serialization/XmlSerializer/FromTypes/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Xml.Serialization/XmlSerializer/FromTypes/source.vb" id="Snippet1":::

]]></format>
</remarks>
Expand Down
5 changes: 4 additions & 1 deletion xml/System/AppDomain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8821,7 +8821,10 @@ The friendly name of the default application domain is the file name of the proc
</ReturnValue>
<Docs>
<summary>Occurs when an exception is not caught.</summary>
<remarks>For more information about this API, see <see href="/dotnet/fundamentals/runtime-libraries/system-appdomain-unhandledexception">Supplemental API remarks for UnhandledException</see>.</remarks>
<remarks>
Handlers may be invoked multiple times if exceptions are thrown from different threads.

For more information about this API, see <see href="/dotnet/fundamentals/runtime-libraries/system-appdomain-unhandledexception">Supplemental API remarks for UnhandledException</see>.</remarks>
<example>
<format type="text/markdown"><![CDATA[
The following example demonstrates the <xref:System.AppDomain.UnhandledException> event. It defines an event handler, `MyHandler`, that is invoked whenever an unhandled exception is thrown in the default application domain. It then throws two exceptions. The first is handled by a **try/catch** block. The second is unhandled and invokes the `MyHandle` routine before the application terminates.
Expand Down
5 changes: 1 addition & 4 deletions xml/System/String.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12841,14 +12841,11 @@ Note that the method is called with the `options` argument set to <xref:System.S
<param name="separator">A character that delimits the substrings in this instance.</param>
<param name="count">The maximum number of elements expected in the array.</param>
<param name="options">A bitwise combination of the enumeration values that specifies whether to trim substrings and include empty substrings.</param>
<summary>Splits a string into a maximum number of substrings based on a specified delimiting character and, optionally, options.
Splits a string into a maximum number of substrings based on the provided character separator, optionally omitting empty substrings from the result.</summary>
<summary>Splits a string into a maximum number of substrings based on the provided character separator, optionally omitting empty substrings from the result.</summary>
<returns>An array that contains at most <paramref name="count" /> substrings from this instance that are delimited by <paramref name="separator" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks

If the string has already been split `count` - 1 times, but the end of the string has not been reached, then the last string in the returned array will contain this instance's remaining trailing substring, untouched.

]]></format>
Expand Down