Skip to content

Commit 7bc52be

Browse files
authored
.NET Interactive: Enable_try_dotnet_to_batch_17a (dotnet#4593)
* enable_try_dotnet_to_batch_17a * removed_extra_line * enabling_second_sample
1 parent 6c4ba01 commit 7bc52be

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

xml/System/Type.xml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,9 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3
525525

526526
## Examples
527527
The following example uses the <xref:System.Type.Attributes%2A> property.
528-
529-
[!code-csharp[System.Type.Attributes#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.attributes/cs/attributes1.cs#1)]
530-
[!code-vb[System.Type.Attributes#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.attributes/vb/attributes1.vb#1)]
528+
529+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.attributes/cs/attributes1.cs" interactive="try-dotnet" id="Snippet1":::
530+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.attributes/vb/attributes1.vb" id="Snippet1":::
531531

532532
]]></format>
533533
</remarks>
@@ -665,10 +665,10 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3
665665

666666
## Examples
667667
The following example defines a generic class with two type parameters and then defines a second generic class that derives from the first class. The derived class's base class has two type arguments: the first is <xref:System.Int32> and the second is a type parameter of the derived type. The example displays information about these generic classes, including the positions reported by the <xref:System.Type.GenericParameterPosition%2A> property.
668-
669-
[!code-cpp[System.Type.HasUnboundGenericParameters#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp#1)]
670-
[!code-csharp[System.Type.HasUnboundGenericParameters#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CS/source.cs#1)]
671-
[!code-vb[System.Type.HasUnboundGenericParameters#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/VB/source.vb#1)]
668+
669+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp" id="Snippet1":::
670+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
671+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/VB/source.vb" id="Snippet1":::
672672

673673
]]></format>
674674
</remarks>
@@ -738,11 +738,11 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3
738738
## Examples
739739
The following code example defines a class that has a generic method, assigns a type argument to the method, and invokes the resulting constructed generic method. It also displays information about the generic method definition and the constructed method. When displaying information about the type parameters of the generic method definition, in the `DisplayGenericMethodInfo` method, the example code shows the value of the <xref:System.Type.DeclaringMethod%2A> property for the method's generic type parameter.
740740

741-
[!code-cpp[MethodInfo.Generics#1](~/samples/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp#1)]
742-
[!code-csharp[MethodInfo.Generics#1](~/samples/snippets/csharp/VS_Snippets_CLR/MethodInfo.Generics/CS/source.cs#1)]
743-
[!code-vb[MethodInfo.Generics#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/MethodInfo.Generics/VB/source.vb#1)]
744-
745-
]]></format>
741+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp" id="Snippet1":::
742+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/MethodInfo.Generics/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
743+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/MethodInfo.Generics/VB/source.vb" id="Snippet1":::
744+
745+
]]></format>
746746
</remarks>
747747
<altmember cref="P:System.Type.IsGenericParameter" />
748748
<related type="Article" href="/dotnet/framework/reflection-and-codedom/reflection-and-generic-types">Reflection and Generic Types</related>
@@ -817,10 +817,10 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3
817817

818818
## Examples
819819
This example displays the declaring type of a method in a derived class.
820-
821-
[!code-cpp[Classic Type.DeclaringType Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp#1)]
822-
[!code-csharp[Classic Type.DeclaringType Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CS/source.cs#1)]
823-
[!code-vb[Classic Type.DeclaringType Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/VB/source.vb#1)]
820+
821+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp" id="Snippet1":::
822+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
823+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/VB/source.vb" id="Snippet1":::
824824

825825
]]></format>
826826
</remarks>
@@ -1493,9 +1493,9 @@ The `filter` argument can be a custom delegate of type <xref:System.Reflection.M
14931493
## Examples
14941494
The following example finds all the members in a class that match the specified search criteria, and then displays the matched members.
14951495

1496-
[!code-cpp[Type_FindMembers#1](~/samples/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp#1)]
1497-
[!code-csharp[Type_FindMembers#1](~/samples/snippets/csharp/VS_Snippets_CLR/Type_FindMembers/CS/type_findmembers.cs#1)]
1498-
[!code-vb[Type_FindMembers#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_FindMembers/VB/type_findmembers.vb#1)]
1496+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp" id="Snippet1":::
1497+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Type_FindMembers/CS/type_findmembers.cs" interactive="try-dotnet" id="Snippet1":::
1498+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_FindMembers/VB/type_findmembers.vb" id="Snippet1":::
14991499

15001500
]]></format>
15011501
</remarks>
@@ -1557,32 +1557,32 @@ The `filter` argument can be a custom delegate of type <xref:System.Reflection.M
15571557
For example, the fully qualified name of the <xref:System.String> type is `System.String`. Contrast this with the assembly-qualified name returned by the <xref:System.Type.AssemblyQualifiedName%2A> property, which consists of the full name plus the full assembly name.
15581558

15591559
If the current type represents a closed generic type, the type arguments in the string returned by the <xref:System.Type.FullName%2A> property are qualified by their full assembly name, even though the string representation of the generic type itself is not qualified by its full assembly name. The following example illustrates the difference in the FullName property for a type that represents generic type definition and one that represents a closed generic type.
1560-
1561-
[!code-csharp[System.Type.FullName#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/fullnameex1.cs#2)]
1562-
[!code-vb[System.Type.FullName#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/fullnameex1.vb#2)]
1560+
1561+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/fullnameex1.cs" interactive="try-dotnet" id="Snippet2":::
1562+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/fullnameex1.vb" id="Snippet2":::
15631563

15641564
This property returns `null` if:
15651565

15661566
- The current <xref:System.Type> object represents a type parameter of a generic type.
15671567

15681568
The following example retrieves the type parameter of the <xref:System.Nullable%601> type and attempts to display its <xref:System.Type.FullName%2A> property.
15691569

1570-
[!code-csharp[System.Type.FullName#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/Fullname3.cs#3)]
1571-
[!code-vb[System.Type.FullName#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/Fullname3.vb#3)]
1570+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/Fullname3.cs" interactive="try-dotnet" id="Snippet3":::
1571+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/Fullname3.vb" id="Snippet3":::
15721572

15731573
- The current <xref:System.Type> object represents an array type, a pointer type, or a `byref` type that is based on a generic type parameter.
15741574

15751575
The following example defines a generic type, `Generictype1<T>`, with three methods: `Display(T[])`, which is passed an array of type T; `HandleT(T)`, which is passed a T object; and `ChangeValue(ref T)`, which is passed a T object by reference. Because C# and Visual Basic do not allow us to define T as a pointer in the `HandleT` method, we have to call the <xref:System.Type.MakePointerType%2A> method on the <xref:System.Type> object that represents the method's parameter type to create a pointer to a generic type. The output from the example shows that in all three cases, the <xref:System.Type.FullName%2A> property is `null`.
15761576

1577-
[!code-csharp[System.Type.FullName#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/Fullname4.cs#4)]
1578-
[!code-vb[System.Type.FullName#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/FullName4.vb#4)]
1577+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/Fullname4.cs" interactive="try-dotnet" id="Snippet4":::
1578+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/FullName4.vb" id="Snippet4":::
15791579

15801580
- The current type contains generic type parameters that have not been replaced by specific types (that is, the <xref:System.Type.ContainsGenericParameters%2A> property returns `true`), but the type is not a generic type definition (that is, the <xref:System.Type.IsGenericTypeDefinition%2A> property returns `false`
15811581

15821582
In the following example, `Derived<T>` inherits from `Base<T>`. The <xref:System.Type.BaseType%2A> property obtains the <xref:System.Type> object that represents the base type of `Derived<T>`, and its <xref:System.Type.FullName%2A> property returns `null`.
15831583

1584-
[!code-csharp[System.Type.FullName#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/Fullname5.cs#5)]
1585-
[!code-vb[System.Type.FullName#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/FullName5.vb#5)]
1584+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.fullname/cs/Fullname5.cs" interactive="try-dotnet" id="Snippet5":::
1585+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.fullname/vb/FullName5.vb" id="Snippet5":::
15861586

15871587
To get a <xref:System.Type.FullName%2A> that is not `null`, you can use the <xref:System.Type.GetGenericTypeDefinition%2A> method to get the generic type definition, as the example illustrates.
15881588

@@ -1592,15 +1592,15 @@ The `filter` argument can be a custom delegate of type <xref:System.Reflection.M
15921592

15931593
## Examples
15941594
The following example displays the full name of the specified type.
1595-
1596-
[!code-cpp[TestFullName#1](~/samples/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp#1)]
1597-
[!code-csharp[TestFullName#1](~/samples/snippets/csharp/VS_Snippets_CLR/TestFullName/CS/testfullname.cs#1)]
1598-
[!code-vb[TestFullName#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/TestFullName/VB/testfullname.vb#1)]
1599-
1595+
1596+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp" id="Snippet1":::
1597+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/TestFullName/CS/testfullname.cs" interactive="try-dotnet" id="Snippet1":::
1598+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/TestFullName/VB/testfullname.vb" id="Snippet1":::
1599+
16001600
The following example compares the strings returned by the <xref:System.Type.ToString%2A> method and the <xref:System.Type.Name%2A>, `FullName`, and <xref:System.Type.AssemblyQualifiedName%2A> properties.
16011601

1602-
[!code-csharp[System.Type.ToString#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.tostring/cs/fullname1.cs#1)]
1603-
[!code-vb[System.Type.ToString#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.tostring/vb/fullname1.vb#1)]
1602+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.type.tostring/cs/fullname1.cs" interactive="try-dotnet" id="Snippet1":::
1603+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.type.tostring/vb/fullname1.vb" id="Snippet1":::
16041604

16051605
]]></format>
16061606
</remarks>
@@ -12166,10 +12166,10 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance
1216612166

1216712167
## Examples
1216812168
The following example demonstrates the use of the `IsInstanceOfType` method.
12169-
12170-
[!code-cpp[TestIsInstanceOfType#1](~/samples/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp#1)]
12171-
[!code-csharp[TestIsInstanceOfType#1](~/samples/snippets/csharp/VS_Snippets_CLR/TestIsInstanceOfType/CS/testisinstanceoftype.cs#1)]
12172-
[!code-vb[TestIsInstanceOfType#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/TestIsInstanceOfType/VB/testisinstanceoftype.vb#1)]
12169+
12170+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp" id="Snippet1":::
12171+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/TestIsInstanceOfType/CS/testisinstanceoftype.cs" interactive="try-dotnet" id="Snippet1":::
12172+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/TestIsInstanceOfType/VB/testisinstanceoftype.vb" id="Snippet1":::
1217312173

1217412174
]]></format>
1217512175
</remarks>
@@ -12233,10 +12233,10 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance
1223312233
## Examples
1223412234
The following example creates an interface, checks for the interface type, and indicates whether a class has the `IsInterface` property set.
1223512235

12236-
[!code-cpp[Type_IsInterface#1](~/samples/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp#1)]
12237-
[!code-csharp[Type_IsInterface#1](~/samples/snippets/csharp/VS_Snippets_CLR/Type_IsInterface/CS/type_isinterface.cs#1)]
12238-
[!code-vb[Type_IsInterface#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_IsInterface/VB/type_isinterface.vb#1)]
12239-
12236+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp" id="Snippet1":::
12237+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Type_IsInterface/CS/type_isinterface.cs" interactive="try-dotnet" id="Snippet1":::
12238+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_IsInterface/VB/type_isinterface.vb" id="Snippet1":::
12239+
1224012240
]]></format>
1224112241
</remarks>
1224212242
<altmember cref="T:System.Reflection.TypeAttributes" />

0 commit comments

Comments
 (0)