From d9497aa990de7fe8edfe39aab75411a25af1bb25 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 30 May 2025 17:30:40 -0700 Subject: [PATCH 1/4] delete C++ snippet refs in System namespace --- xml/System/Action.xml | 48 ++-- xml/System/Action`1.xml | 64 ++--- xml/System/Activator.xml | 10 - xml/System/ArgumentException.xml | 4 - xml/System/Array.xml | 66 ----- xml/System/ArraySegment`1.xml | 5 - xml/System/ArrayTypeMismatchException.xml | 6 - xml/System/Attribute.xml | 37 --- xml/System/AttributeTargets.xml | 31 +- xml/System/AttributeUsageAttribute.xml | 127 ++++----- xml/System/BitConverter.xml | 26 -- xml/System/Boolean.xml | 3 - xml/System/Buffer.xml | 171 ++++++----- xml/System/Byte.xml | 17 -- xml/System/Char.xml | 30 -- xml/System/CharEnumerator.xml | 6 - xml/System/Comparison`1.xml | 67 +++-- xml/System/Console.xml | 65 ----- xml/System/ConsoleCancelEventArgs.xml | 3 - xml/System/ConsoleCancelEventHandler.xml | 23 +- xml/System/ConsoleKey.xml | 23 +- xml/System/ConsoleKeyInfo.xml | 181 ++++++------ xml/System/ConsoleModifiers.xml | 27 +- xml/System/ConsoleSpecialKey.xml | 27 +- xml/System/Convert.xml | 61 ---- xml/System/Converter`2.xml | 36 ++- xml/System/DateTime.xml | 34 --- xml/System/DayOfWeek.xml | 25 +- xml/System/Decimal.xml | 52 ---- xml/System/Double.xml | 18 -- xml/System/Enum.xml | 9 - xml/System/Environment+SpecialFolder.xml | 39 ++- xml/System/Environment.xml | 19 -- xml/System/EventArgs.xml | 1 - xml/System/EventHandler`1.xml | 1 - xml/System/Exception.xml | 15 - xml/System/FlagsAttribute.xml | 2 - xml/System/Func`2.xml | 53 ++-- xml/System/GC.xml | 14 - xml/System/GCNotificationStatus.xml | 23 +- xml/System/IAsyncResult.xml | 9 +- xml/System/IComparable.xml | 2 - xml/System/IComparable`1.xml | 134 +++++---- xml/System/IConvertible.xml | 35 ++- xml/System/IDisposable.xml | 2 - xml/System/Int16.xml | 8 - xml/System/Int32.xml | 12 - xml/System/Int64.xml | 2 - xml/System/Math.xml | 27 -- xml/System/MissingFieldException.xml | 2 - xml/System/MissingMemberException.xml | 2 - xml/System/MissingMethodException.xml | 2 - xml/System/MulticastDelegate.xml | 1 - xml/System/NonSerializedAttribute.xml | 47 ++- xml/System/Nullable`1.xml | 1 - xml/System/Object.xml | 3 - xml/System/ObjectDisposedException.xml | 1 - xml/System/OperatingSystem.xml | 6 - xml/System/PlatformID.xml | 21 +- xml/System/Random.xml | 12 - xml/System/RuntimeTypeHandle.xml | 1 - xml/System/SByte.xml | 1 - xml/System/SerializableAttribute.xml | 33 ++- xml/System/Single.xml | 13 - xml/System/String.xml | 104 ------- xml/System/StringComparer.xml | 6 - xml/System/StringSplitOptions.xml | 1 - xml/System/TimeSpan.xml | 40 --- xml/System/TimeZone.xml | 254 ++++++++--------- xml/System/TimeoutException.xml | 1 - xml/System/Type.xml | 116 -------- xml/System/TypeCode.xml | 27 +- xml/System/TypeLoadException.xml | 10 +- xml/System/UInt16.xml | 3 - xml/System/UInt32.xml | 4 - xml/System/UInt64.xml | 3 - xml/System/UnhandledExceptionEventArgs.xml | 1 - xml/System/Uri.xml | 51 ---- xml/System/UriBuilder.xml | 314 ++++++++++----------- xml/System/ValueType.xml | 2 - xml/System/Version.xml | 8 - 81 files changed, 887 insertions(+), 1904 deletions(-) diff --git a/xml/System/Action.xml b/xml/System/Action.xml index 196e7270286..2b434879fa9 100644 --- a/xml/System/Action.xml +++ b/xml/System/Action.xml @@ -63,38 +63,36 @@ Encapsulates a method that has no parameters and does not return a value. - [!NOTE] -> To reference a method that has no parameters and returns a value, use the generic delegate instead. - - When you use the delegate, you do not have to explicitly define a delegate that encapsulates a parameterless procedure. For example, the following code explicitly declares a delegate named `ShowValue` and assigns a reference to the `Name.DisplayToWindow` instance method to its delegate instance. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp" id="Snippet1"::: +> To reference a method that has no parameters and returns a value, use the generic delegate instead. + + When you use the delegate, you do not have to explicitly define a delegate that encapsulates a parameterless procedure. For example, the following code explicitly declares a delegate named `ShowValue` and assigns a reference to the `Name.DisplayToWindow` instance method to its delegate instance. + :::code language="csharp" source="~/snippets/csharp/System/Action/Overview/delegate1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action/fs/Delegate.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.action.delegate/vb/delegate.vb" id="Snippet1"::: - - The following example simplifies this code by instantiating the delegate instead of explicitly defining a new delegate and assigning a named method to it. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp" id="Snippet2"::: + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.action.delegate/vb/delegate.vb" id="Snippet1"::: + + The following example simplifies this code by instantiating the delegate instead of explicitly defining a new delegate and assigning a named method to it. + :::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Action.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action/fs/Action.fs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/Action.vb" id="Snippet2"::: - - You can also use the delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).) - - :::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Anon.cs" id="Snippet3"::: - - You can also assign a lambda expression to an delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions (C#)](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions) or [Lambda Expressions (F#)](/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword).) - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/Action.vb" id="Snippet2"::: + + You can also use the delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).) + + :::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Anon.cs" id="Snippet3"::: + + You can also assign a lambda expression to an delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions (C#)](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions) or [Lambda Expressions (F#)](/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword).) + :::code language="csharp" source="~/snippets/csharp/System/Action/Overview/Lambda.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action/fs/Lambda.fs" id="Snippet4"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/lambda.vb" id="Snippet4"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action/vb/lambda.vb" id="Snippet4"::: + ]]> diff --git a/xml/System/Action`1.xml b/xml/System/Action`1.xml index fbd0eeffa3c..bbaf1e77c32 100644 --- a/xml/System/Action`1.xml +++ b/xml/System/Action`1.xml @@ -73,49 +73,47 @@ The parameter of the method that this delegate encapsulates. Encapsulates a method that has a single parameter and does not return a value. - delegate to pass a method as a parameter without explicitly declaring a custom delegate. The encapsulated method must correspond to the method signature that is defined by this delegate. This means that the encapsulated method must have one parameter that is passed to it by value, and it must not return a value. (In C#, the method must return `void`. In Visual Basic, it must be defined by the `Sub`…`End Sub` construct. It can also be a method that returns a value that is ignored.) Typically, such a method is used to perform an operation. - + delegate to pass a method as a parameter without explicitly declaring a custom delegate. The encapsulated method must correspond to the method signature that is defined by this delegate. This means that the encapsulated method must have one parameter that is passed to it by value, and it must not return a value. (In C#, the method must return `void`. In Visual Basic, it must be defined by the `Sub`…`End Sub` construct. It can also be a method that returns a value that is ignored.) Typically, such a method is used to perform an operation. + > [!NOTE] -> To reference a method that has one parameter and returns a value, use the generic delegate instead. - - When you use the delegate, you do not have to explicitly define a delegate that encapsulates a method with a single parameter. For example, the following code explicitly declares a delegate named `DisplayMessage` and assigns a reference to either the method or the `ShowWindowsMessage` method to its delegate instance. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp" id="Snippet1"::: +> To reference a method that has one parameter and returns a value, use the generic delegate instead. + + When you use the delegate, you do not have to explicitly define a delegate that encapsulates a method with a single parameter. For example, the following code explicitly declares a delegate named `DisplayMessage` and assigns a reference to either the method or the `ShowWindowsMessage` method to its delegate instance. + :::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Delegate.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~1/fs/Delegate.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Delegate.vb" id="Snippet1"::: - - The following example simplifies this code by instantiating the delegate instead of explicitly defining a new delegate and assigning a named method to it. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp" id="Snippet2"::: + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Delegate.vb" id="Snippet1"::: + + The following example simplifies this code by instantiating the delegate instead of explicitly defining a new delegate and assigning a named method to it. + :::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Action1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~1/fs/Action1.fs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Action1.vb" id="Snippet2"::: - - You can also use the delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).) - - :::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Anon.cs" id="Snippet3"::: - - You can also assign a lambda expression to an delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions).) - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/Action1.vb" id="Snippet2"::: + + You can also use the delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).) + + :::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Anon.cs" id="Snippet3"::: + + You can also assign a lambda expression to an delegate instance, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions).) + :::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/Lambda.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action~1/fs/Lambda.fs" id="Snippet4"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/lambda.vb" id="Snippet4"::: - - The and methods each take an delegate as a parameter. The method encapsulated by the delegate allows you to perform an action on each element in the array or list. The example uses the method to provide an illustration. - - - -## Examples - The following example demonstrates the use of the delegate to print the contents of a object. In this example, the `Print` method is used to display the contents of the list to the console. In addition, the C# example also demonstrates the use of anonymous methods to display the contents to the console. Note that the example does not explicitly declare an variable. Instead, it passes a reference to a method that takes a single parameter and that does not return a value to the method, whose single parameter is an delegate. Similarly, in the C# example, an delegate is not explicitly instantiated because the signature of the anonymous method matches the signature of the delegate that is expected by the method. + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action~1/vb/lambda.vb" id="Snippet4"::: + + The and methods each take an delegate as a parameter. The method encapsulated by the delegate allows you to perform an action on each element in the array or list. The example uses the method to provide an illustration. + + + +## Examples + The following example demonstrates the use of the delegate to print the contents of a object. In this example, the `Print` method is used to display the contents of the list to the console. In addition, the C# example also demonstrates the use of anonymous methods to display the contents to the console. Note that the example does not explicitly declare an variable. Instead, it passes a reference to a method that takes a single parameter and that does not return a value to the method, whose single parameter is an delegate. Similarly, in the C# example, an delegate is not explicitly instantiated because the signature of the anonymous method matches the signature of the delegate that is expected by the method. :::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/action.cs" interactive="try-dotnet-method" id="Snippet01"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Action_PrintExample/fs/action.fs" id="Snippet01"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action_PrintExample/vb/action.vb" id="Snippet01"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action_PrintExample/vb/action.vb" id="Snippet01"::: + ]]> diff --git a/xml/System/Activator.xml b/xml/System/Activator.xml index c53417e1b0b..e4753b0b11d 100644 --- a/xml/System/Activator.xml +++ b/xml/System/Activator.xml @@ -96,12 +96,9 @@ Assemblies contain type definitions. The method creates an instance of a type from a currently running assembly. The method creates an instance from a file that contains an assembly. The method creates an instance of a COM object from a file that contains an assembly. - - ## Examples The following example shows how to use the class to dynamically construct objects at run time. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Activator/Overview/ActivatorX.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ActivatorX/fs/ActivatorX.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ActivatorX/VB/ActivatorX.vb" id="Snippet1"::: @@ -409,12 +406,9 @@ > [!NOTE] > Starting with .NET Framework 2.0, this method can be used to access nonpublic types if the caller has been granted with the flag and if the grant set of the assembly that contains the nonpublic types is restricted to the caller's grant set or to a subset thereof. (See [Security Considerations for Reflection](/dotnet/framework/reflection-and-codedom/security-considerations-for-reflection).) To use this functionality, your application should target .NET Framework 3.5 or later. - - ## Examples The following code example demonstrates how to call the method. Instances of several different types are created and their default values are displayed. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Activator/Overview/source2.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ActivatorX/fs/source2.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ActivatorX/VB/source2.vb" id="Snippet4"::: @@ -1907,7 +1901,6 @@ An error occurred when attempting remote activation in a target specified in generic method is used by compilers to implement the instantiation of types specified by type parameters. For example, in the following generic method, the implementation of `new T()` (`gcnew T()` in C++) uses the generic method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Activator/CreateInstanceT/remarks.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.activation.createinstance~~1/fs/remarks.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.activation.createinstance~~1/vb/remarks.vb" id="Snippet1"::: @@ -2000,12 +1993,9 @@ Note: In .NET for Win For information about other exceptions that can be thrown by invoked methods, see the Exceptions section of the and methods. - - ## Examples The following code example demonstrates how to call the method. This code example is part of a larger example provided for the class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Activator/Overview/ActivatorX.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ActivatorX/fs/ActivatorX.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ActivatorX/VB/ActivatorX.vb" id="Snippet3"::: diff --git a/xml/System/ArgumentException.xml b/xml/System/ArgumentException.xml index a4b87cbb0ca..3fae15c7c2d 100644 --- a/xml/System/ArgumentException.xml +++ b/xml/System/ArgumentException.xml @@ -102,7 +102,6 @@ In F#, you can use the [invalidArg](/dotnet/fsharp/language-reference/exception- The following example demonstrates how to throw and catch an . It uses the [ArgumentException.GetType().Name](xref:System.Type.Name%2A) property to display the name of the exception object, and also uses the property to display the text of the exception message. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/ArgumentException/Overview/argumentexception2.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ArgumentException/FS/argumentexception2.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ArgumentException/vb/program2.vb" id="Snippet3"::: @@ -432,12 +431,9 @@ The following example demonstrates how to throw and catch an |The error message string.| ||The parameter name string.| - - ## Examples The following code example demonstrates how to call the constructor. This code example is part of a larger example provided for the class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/ArgumentException/Overview/argumentexception.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ArgumentException/FS/argumentexception.fs" id="Snippet2"::: diff --git a/xml/System/Array.xml b/xml/System/Array.xml index 1918ee348d9..0995e82ae94 100644 --- a/xml/System/Array.xml +++ b/xml/System/Array.xml @@ -129,14 +129,12 @@ The following code example shows how copies elements between an array of type integer and an array of type . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array Example/VB/source.vb" id="Snippet1"::: The following code example creates and initializes an and displays its properties and its elements. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array Example/FS/source3.fs" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Overview/source3.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array Example/VB/source3.vb" id="Snippet2"::: @@ -218,12 +216,9 @@ This method is an O(1) operation. - - ## Examples The following example wraps an array in a read-only . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/AsReadOnlyT/arrayasreadonly.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.AsReadOnly/FS/arrayasreadonly.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.AsReadOnly/VB/arrayasreadonly.vb" id="Snippet1"::: @@ -339,7 +334,6 @@ > [!NOTE] > The array is created with its elements in ascending sort order. The method requires the array to be sorted in ascending order. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/BinarySearch/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/VB/source.vb" id="Snippet1"::: @@ -805,7 +799,6 @@ The generic method overload is then used to search for two strings, one that is not in the array and one that is. The array and the return value of the method are passed to the `ShowWhere` generic method (the `showWhere` function in the F# example), which displays the index value if the string is found, and otherwise the elements the search string would fall between if it were in the array. The index is negative if the string is not in the array, so the `ShowWhere` method takes the bitwise complement (the ~ operator in C# and Visual C++, the ~~~ operator in F#, `Xor`-1 in Visual Basic) to obtain the index of the first element in the list that is larger than the search string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/BinarySearchT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_SortSearch/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearch/vb/source.vb" id="Snippet1"::: @@ -939,7 +932,6 @@ The generic method overload is then used to search for two strings, one that is not in the array and one that is. The array and the return value of the method are passed to the `ShowWhere` generic method (the `showWhere` function in the F# example), which displays the index value if the string is found, and otherwise the elements the search string would fall between if it were in the array. The index is negative if the string is not n the array, so the `ShowWhere` method takes the bitwise complement (the ~ operator in C# and Visual C++, the ~~~ operator in F#, `Xor` -1 in Visual Basic) to obtain the index of the first element in the list that is larger than the search string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/BinarySearchT/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_SortSearchComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearchComparer/vb/source.vb" id="Snippet1"::: @@ -1418,7 +1410,6 @@ ## Examples The following code example clones a array and demonstrates the behavior of a shallow copy. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Clone/arrayclone.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Clone/FS/arrayclone.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Clone/VB/arrayclone.vb" id="Snippet1"::: @@ -1624,7 +1615,6 @@ ## Examples The following code example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates an array of structures, creates a `Converter` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. In the F# example, the `pointFToPoint` function is implicitly casted to the `Converter` delegate. Both lists are displayed. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/ConvertAllTInput,TOutput/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_ConvertAll/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_ConvertAll/vb/source.vb" id="Snippet1"::: @@ -1657,7 +1647,6 @@ ## Examples The following code example shows how to copy from one of type to another of type integer. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Copy/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/VB/source.vb" id="Snippet1"::: @@ -2187,14 +2176,12 @@ ## Examples The following code example shows how to copy an to another . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CopyTo/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source.vb" id="Snippet1"::: The following code example shows how to copy an to another with a nonzero lower bound. Note that the entire source is copied, including empty elements that overwrite existing elements in the target . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/FS/source2.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CopyTo/source2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source2.vb" id="Snippet1"::: @@ -2453,7 +2440,6 @@ ## Examples The following code example shows how to create and initialize a one-dimensional . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CreateInstance/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/VB/source.vb" id="Snippet1"::: @@ -2556,7 +2542,6 @@ ## Examples The following code example shows how to create and initialize a multidimensional . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CreateInstance/source3.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/VB/source.vb" id="Snippet1"::: @@ -2658,7 +2643,6 @@ ## Examples The following code example shows how to create and initialize a multidimensional . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CreateInstance/source3.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/VB/source.vb" id="Snippet1"::: @@ -2753,7 +2737,6 @@ ## Examples The following code example shows how to create and initialize a two-dimensional . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CreateInstance/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/VB/source.vb" id="Snippet1"::: @@ -2860,7 +2843,6 @@ ## Examples The following code example shows how to create and initialize a multidimensional with specified lower bounds. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CreateInstance/source4.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/csharp/System/Array/CreateInstance/source4.cs" id="Snippet1"::: @@ -2969,7 +2951,6 @@ ## Examples The following code example shows how to create and initialize a three-dimensional . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/CreateInstance/source2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/VB/source.vb" id="Snippet1"::: @@ -3629,7 +3610,6 @@ The code example also demonstrates the and generic methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/FindAllT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_FindEtAl/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_FindEtAl/vb/source.vb" id="Snippet1"::: @@ -3675,7 +3655,6 @@ The method overload is used to search the array beginning at position 2 and continuing to the end of the array. It finds the element at position 5. Finally, the method overload is used to search the range of three elements beginning at position 2. It returns -1 because there are no dinosaur names in that range that end with "saurus". - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/FindIndexT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_FindIndex/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_FindIndex/vb/source.vb" id="Snippet1"::: @@ -4041,7 +4020,6 @@ The code example also demonstrates the and generic methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/FindAllT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_FindEtAl/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_FindEtAl/vb/source.vb" id="Snippet1"::: @@ -4087,7 +4065,6 @@ The method overload is used to search the array beginning at position 4 and continuing backward to the beginning of the array. It finds the element at position 1. Finally, the method overload is used to search the range of three elements beginning at position 4 and working backward (that is, elements 4, 3, and 2). It returns -1 because there are no dinosaur names in that range that end with "saurus". - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/FindLastIndexT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_FindLastIndex/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_FindLastIndex/vb/source.vb" id="Snippet1"::: @@ -4438,7 +4415,6 @@ ## Examples The following example shows how to use to display the squares of each element in an integer array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/ForEachT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.array.foreach/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.array.foreach/vb/source.vb" id="Snippet1"::: @@ -4528,7 +4504,6 @@ ## Examples The following code example shows how to use to list the elements of an array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/GetEnumerator/array_getenumerator.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array_GetEnumerator/FS/array_getenumerator.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array_GetEnumerator/VB/array_getenumerator.vb" id="Snippet1"::: @@ -4602,7 +4577,6 @@ ## Examples The following example shows how to use to display the dimensions of two arrays with different ranks. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/GetLength/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.array.getlength/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.array.getlength/vb/source.vb" id="Snippet1"::: @@ -4762,7 +4736,6 @@ ## Examples The following example uses the and methods to display the bounds of a one-dimensional and two-dimensional array and to display the values of their array elements. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/GetLowerBound/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.array.getupperbound/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.array.getupperbound/vb/source.vb" id="Snippet1"::: @@ -4848,7 +4821,6 @@ ## Examples The following example uses the and methods to display the bounds of a one-dimensional and two-dimensional array and to display the values of their array elements. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/GetLowerBound/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.array.getupperbound/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.array.getupperbound/vb/source.vb" id="Snippet1"::: @@ -4880,7 +4852,6 @@ ## Examples The following code example demonstrates how to set and get a specific value in a one-dimensional or multidimensional array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/GetValue/array_getsetvalue.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array_GetSetValue/FS/array_getsetvalue.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array_GetSetValue/VB/array_getsetvalue.vb" id="Snippet1"::: @@ -5564,7 +5535,6 @@ - , to determine the first occurrence of the string "the" in a string array from the element that follows the last successful match to the end of the array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IndexOf/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/VB/source.vb" id="Snippet1"::: @@ -5665,7 +5635,6 @@ - , to determine the first occurrence of the string "the" in a string array from the element that follows the last successful match to the end of the array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IndexOf/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/VB/source.vb" id="Snippet1"::: @@ -5775,7 +5744,6 @@ - , to determine the first occurrence of the string "the" in a string array from the element that follows the last successful match to the end of the array. To determine the value of the `count` argument, it subtracts the upper bound of the array from the starting index and adds one. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IndexOf/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/VB/source.vb" id="Snippet1"::: @@ -5871,7 +5839,6 @@ ## Examples The following example demonstrates all three generic overloads of the method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the array from the beginning, and finds the first occurrence of the string. The method overload is used to search the array beginning with index location 3 and continuing to the end of the array, and finds the second occurrence of the string. Finally, the method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IndexOfT/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_IndexOf/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_IndexOf/vb/source.vb" id="Snippet1"::: @@ -5959,7 +5926,6 @@ ## Examples The following example demonstrates all three generic overloads of the method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the array from the beginning, and finds the first occurrence of the string. The method overload is used to search the array beginning with index location 3 and continuing to the end of the array, and finds the second occurrence of the string. Finally, the method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IndexOfT/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_IndexOf/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_IndexOf/vb/source.vb" id="Snippet1"::: @@ -6051,7 +6017,6 @@ ## Examples The following example demonstrates all three generic overloads of the method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the array from the beginning, and finds the first occurrence of the string. The method overload is used to search the array beginning with index location 3 and continuing to the end of the array, and finds the second occurrence of the string. Finally, the method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IndexOfT/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_IndexOf/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_IndexOf/vb/source.vb" id="Snippet1"::: @@ -6324,7 +6289,6 @@ ## Examples The following code example shows how to lock an array during the entire enumeration by using the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IsSynchronized/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.SyncRoot/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.SyncRoot/vb/source.vb" id="Snippet1"::: @@ -6430,7 +6394,6 @@ ## Examples The following code example shows how to determine the index of the last occurrence of a specified element in an array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/LastIndexOf/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/VB/source.vb" id="Snippet1"::: @@ -6526,7 +6489,6 @@ ## Examples The following code example shows how to determine the index of the last occurrence of a specified element in an array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/LastIndexOf/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/VB/source.vb" id="Snippet1"::: @@ -6630,7 +6592,6 @@ ## Examples The following code example shows how to determine the index of the last occurrence of a specified element in an array. Note that the method is a backward search; therefore, `count` must be less than or equal to (`startIndex` minus the lower bound of the array plus 1). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/LastIndexOf/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/VB/source.vb" id="Snippet1"::: @@ -6728,7 +6689,6 @@ ## Examples The following code example demonstrates all three generic overloads of the method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the entire array from the end, and finds the second occurrence of the string. The method overload is used to search the array backward beginning with index location 3 and continuing to the beginning of the array, and finds the first occurrence of the string. Finally, the method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/LastIndexOfT/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_LastIndexOf/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_LastIndexOf/vb/source.vb" id="Snippet1"::: @@ -6816,7 +6776,6 @@ ## Examples The following code example demonstrates all three generic overloads of the method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the entire array from the end, and finds the second occurrence of the string. The method overload is used to search the array backward beginning with index location 3 and continuing to the beginning of the array, and finds the first occurrence of the string. Finally, the method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/LastIndexOfT/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_LastIndexOf/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_LastIndexOf/vb/source.vb" id="Snippet1"::: @@ -6908,7 +6867,6 @@ ## Examples The following code example demonstrates all three generic overloads of the method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the entire array from the end, and finds the second occurrence of the string. The method overload is used to search the array backward beginning with index location 3 and continuing to the beginning of the array, and finds the first occurrence of the string. Finally, the method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/LastIndexOfT/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_LastIndexOf/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_LastIndexOf/vb/source.vb" id="Snippet1"::: @@ -7299,7 +7257,6 @@ int[,,] TDArray = new int[1,1,1]; ## Examples The following example shows how resizing affects the array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/ResizeT/arrayresize.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Resize/FS/arrayresize.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Resize/VB/arrayresize.vb" id="Snippet1"::: @@ -7395,7 +7352,6 @@ int[,,] TDArray = new int[1,1,1]; ## Examples The following code example shows how to reverse the sort of the values in an . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Reverse/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.Reverse Example/VB/source.vb" id="Snippet1"::: @@ -7482,7 +7438,6 @@ int[,,] TDArray = new int[1,1,1]; ## Examples The following code example shows how to reverse the sort of the values in a range of elements in an . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Reverse/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/VB/source.vb" id="Snippet1"::: @@ -7637,7 +7592,6 @@ int[,,] TDArray = new int[1,1,1]; ## Examples The following code example demonstrates how to set and get a specific value in a one-dimensional or multidimensional array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/GetValue/array_getsetvalue.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array_GetSetValue/FS/array_getsetvalue.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array_GetSetValue/VB/array_getsetvalue.vb" id="Snippet1"::: @@ -8400,7 +8354,6 @@ int[,,] TDArray = new int[1,1,1]; ## Examples The following code example shows how to sort the values in an using the default comparer and a custom comparer that reverses the sort order. Note that the result might vary depending on the current . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort/FS/arraysort.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort/VB/arraysort.vb" id="Snippet1"::: @@ -8509,7 +8462,6 @@ int[,,] TDArray = new int[1,1,1]; ## Examples The following example shows how to sort two associated arrays where the first array contains the keys and the second array contains the values. Sorts are done using the default comparer and a custom comparer that reverses the sort order. Note that the result might vary depending on the current . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort2/FS/arraysort2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort2/VB/arraysort2.vb" id="Snippet1"::: @@ -8633,7 +8585,6 @@ This method is an O(`n` log `n`) operation, where `n` is the implementation named `ReverseComparer` that reverses an object's default sort order while performing a case-insensitive string comparison. Note that the output might vary depending on the current culture. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort/FS/arraysort.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort/VB/arraysort.vb" id="Snippet1"::: @@ -8765,7 +8716,6 @@ This method is an O(`n` log `n`) operation, where `n` is the . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort2/FS/arraysort2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort2/VB/arraysort2.vb" id="Snippet1"::: @@ -8876,7 +8826,6 @@ This method is an O(`n` log `n`) operation, where `n` is the using the default comparer and a custom comparer that reverses the sort order. Note that the result might vary depending on the current . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort/FS/arraysort.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort/VB/arraysort.vb" id="Snippet1"::: @@ -8997,7 +8946,6 @@ This method is an O(`n` log `n`) operation, where `n` is the . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort2/FS/arraysort2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort2/VB/arraysort2.vb" id="Snippet1"::: @@ -9138,7 +9086,6 @@ This method is an O(`n` log `n`) operation, where `n` is the using the default comparer and a custom comparer that reverses the sort order. Note that the result might vary depending on the current . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort/FS/arraysort.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort/VB/arraysort.vb" id="Snippet1"::: @@ -9289,7 +9236,6 @@ This method is an O(`n` log `n`) operation, where `n` is the . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/Sort/arraysort2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.Sort2/FS/arraysort2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.Sort2/VB/arraysort2.vb" id="Snippet1"::: @@ -9431,7 +9377,6 @@ This method is an O(`n` log `n`) operation, where `n` is the generic method overload is then used to search for two strings, one that is not in the array and one that is. The array and the return value of the method are passed to the `ShowWhere` generic method, which displays the index value if the string is found, and otherwise the elements the search string would fall between if it were in the array. The index is negative if the string is not n the array, so the `ShowWhere` method takes the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) to obtain the index of the first element in the list that is larger than the search string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/BinarySearchT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_SortSearch/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearch/vb/source.vb" id="Snippet1"::: @@ -9551,7 +9496,6 @@ This method is an O(`n` log `n`) operation, where `n` is the generic method overload is then used to search for two strings, one that is not in the array and one that is. The array and the return value of the method are passed to the `ShowWhere` generic method, which displays the index value if the string is found, and otherwise the elements the search string would fall between if it were in the array. The index is negative if the string is not n the array, so the `ShowWhere` method takes the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) to obtain the index of the first element in the list that is larger than the search string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/BinarySearchT/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_SortSearchComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearchComparer/vb/source.vb" id="Snippet1"::: @@ -9656,7 +9600,6 @@ This method is an O(`n` log `n`) operation, where `n` is the generic delegate representing the `CompareDinosByLength` method, and displayed again. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/SortT/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_SortComparison/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_SortComparison/vb/source.vb" id="Snippet1"::: @@ -9775,7 +9718,6 @@ This method is an O(`n` log `n`) operation, where `n` is the [!NOTE] > The calls to the and generic methods do not look any different from calls to their nongeneric counterparts, because Visual Basic, C#, and C++ infer the type of the generic type parameter from the type of the first argument. If you use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to examine the Microsoft intermediate language (MSIL), you can see that the generic methods are being called. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/SortT/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_SortIntIntIComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_SortIntIntIComparer/vb/source.vb" id="Snippet1"::: @@ -9909,7 +9851,6 @@ This method is an O(`n` log `n`) operation, where `n` is the [!NOTE] > The calls to the and generic methods do not look any different from calls to their nongeneric counterparts, because Visual Basic, C#, and C++ infer the type of the generic type parameter from the type of the first argument. If you use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to examine the Microsoft intermediate language (MSIL), you can see that the generic methods are being called. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/SortT/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_SortIntIntIComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_SortIntIntIComparer/vb/source.vb" id="Snippet1"::: @@ -10056,7 +9997,6 @@ This method is an O(`n` log `n`) operation, where `n` is the [!NOTE] > The calls to the generic methods do not look any different from calls to their nongeneric counterparts, because Visual Basic, C#, and C++ infer the type of the generic type parameter from the type of the first two arguments. If you use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to examine the Microsoft intermediate language (MSIL), you can see that the generic methods are being called. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/SortTKey,TValue/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_Sort2IntIntIComparer/vb/source.vb" id="Snippet1"::: @@ -10200,7 +10140,6 @@ This method is an O(`n` log `n`) operation, where `n` is the [!NOTE] > The calls to the generic methods do not look any different from calls to their nongeneric counterparts, because Visual Basic, C#, and C++ infer the type of the generic type parameter from the type of the first two arguments. If you use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to examine the Microsoft intermediate language (MSIL), you can see that the generic methods are being called. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/SortTKey,TValue/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_Sort2IntIntIComparer/vb/source.vb" id="Snippet1"::: @@ -10347,7 +10286,6 @@ This method is an O(`n` log `n`) operation, where `n` is the [!NOTE] > The calls to the generic methods do not look any different from calls to their nongeneric counterparts, because Visual Basic, C#, and C++ infer the type of the generic type parameter from the type of the first two arguments. If you use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to examine the Microsoft intermediate language (MSIL), you can see that the generic methods are being called. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/SortTKey,TValue/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_Sort2IntIntIComparer/vb/source.vb" id="Snippet1"::: @@ -10512,7 +10450,6 @@ This method is an O(`n` log `n`) operation, where `n` is the [!NOTE] > The calls to the generic methods do not look any different from calls to their nongeneric counterparts, because Visual Basic, C#, and C++ infer the type of the generic type parameter from the type of the first two arguments. If you use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to examine the Microsoft intermediate language (MSIL), you can see that the generic methods are being called. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/SortTKey,TValue/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_Sort2IntIntIComparer/vb/source.vb" id="Snippet1"::: @@ -10615,12 +10552,9 @@ This property implements the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/IsSynchronized/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Array.SyncRoot/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.SyncRoot/vb/source.vb" id="Snippet1"::: diff --git a/xml/System/ArraySegment`1.xml b/xml/System/ArraySegment`1.xml index dace550fd2f..4c4bcf6e234 100644 --- a/xml/System/ArraySegment`1.xml +++ b/xml/System/ArraySegment`1.xml @@ -143,7 +143,6 @@ ## Examples The following code example passes an structure to a method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArraySegmentT/Overview/arraysegment.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ArraySegment/FS/arraysegment.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ArraySegment/VB/arraysegment.vb" id="Snippet1"::: @@ -170,7 +169,6 @@ ## Examples The following code example passes an structure to a method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArraySegmentT/Overview/arraysegment.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ArraySegment/FS/arraysegment.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ArraySegment/VB/arraysegment.vb" id="Snippet1"::: @@ -360,7 +358,6 @@ ## Examples The following code example passes an to a method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArraySegmentT/Overview/arraysegment.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ArraySegment/FS/arraysegment.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ArraySegment/VB/arraysegment.vb" id="Snippet1"::: @@ -562,7 +559,6 @@ The underlying array of is structure to a method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArraySegmentT/Overview/arraysegment.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ArraySegment/FS/arraysegment.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ArraySegment/VB/arraysegment.vb" id="Snippet1"::: @@ -948,7 +944,6 @@ The underlying array of is structure to a method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArraySegmentT/Overview/arraysegment.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ArraySegment/FS/arraysegment.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ArraySegment/VB/arraysegment.vb" id="Snippet1"::: diff --git a/xml/System/ArrayTypeMismatchException.xml b/xml/System/ArrayTypeMismatchException.xml index f7729f63593..4557bf3ec88 100644 --- a/xml/System/ArrayTypeMismatchException.xml +++ b/xml/System/ArrayTypeMismatchException.xml @@ -88,12 +88,9 @@ For a list of initial property values for an instance of , see the constructors. - - ## Examples The following code example demonstrates scenarios where is thrown. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArrayTypeMismatchException/Overview/class1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ArrayTypeMismatch/VB/class1.vb" id="Snippet1"::: @@ -173,7 +170,6 @@ ## Examples The following example demonstrates the ArrayTypeMismatchException() constructor of the class. It contains a function which takes two arrays as arguments and checks whether the two arrays are of the same type. If the arrays are of different types, a new is thrown and then caught in the calling method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArrayTypeMismatchException/.ctor/arraytypemismatch_constructor1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/FS/arraytypemismatch_constructor1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/VB/arraytypemismatch_constructor1.vb" id="Snippet1"::: @@ -243,7 +239,6 @@ ## Examples The following example demonstrates the ArrayTypeMismatchException(String) constructor of the class. It contains a function which takes two arrays as arguments and checks whether the two arrays are of the same type. If the arrays are of different types, a new is thrown and then caught in the calling method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArrayTypeMismatchException/.ctor/arraytypemismatch_constructor2.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/FS/arraytypemismatch_constructor2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/VB/arraytypemismatch_constructor2.vb" id="Snippet1"::: @@ -380,7 +375,6 @@ ## Examples The following code example demonstrates the constructor of the class. It contains a function that takes two arrays as arguments and checks whether the two arrays are of the same type. If the arrays are of different types, a new is thrown and then caught in the calling method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ArrayTypeMismatchException/.ctor/arraytypemismatch_constructor3.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/FS/arraytypemismatch_constructor3.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/VB/arraytypemismatch_constructor3.vb" id="Snippet1"::: diff --git a/xml/System/Attribute.xml b/xml/System/Attribute.xml index 28fb0b0c425..2431ac01d19 100644 --- a/xml/System/Attribute.xml +++ b/xml/System/Attribute.xml @@ -99,7 +99,6 @@ ## Examples The following code example demonstrates the usage of . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/Overview/customattribute.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/AnimalAttributes/FS/customattribute.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AnimalAttributes/VB/customattribute.vb" id="Snippet1"::: @@ -160,7 +159,6 @@ ## Examples The following code example shows the definition of a custom parameter class with its constructor. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/.ctor/getcustattrparam.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/FS/getcustattrparam.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/VB/getcustattrparam.vb" id="Snippet2"::: @@ -242,7 +240,6 @@ When implementing your own class derived from , you can o ## Examples The following example defines two custom parameter classes, then creates several objects of each class and uses the method to compare them. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/Equals/equals.cs" interactive="try-dotnet"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Attribute.Equals/FS/equals.fs"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Attribute.Equals/VB/equals.vb"::: @@ -326,7 +323,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of the method taking an as a parameter.   - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id1.vb" id="Snippet1"::: @@ -405,7 +401,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of the method taking a as a parameter.   - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id4.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id4.vb" id="Snippet4"::: @@ -479,7 +474,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of the method taking a as a parameter.   - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id2.vb" id="Snippet2"::: @@ -555,7 +549,6 @@ When implementing your own class derived from , you can o ## Examples The following code example defines a custom parameter class and applies the custom attribute to a method in a derived class and the base of the derived class. The example shows the use of the method to return the attributes. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/.ctor/getcustattrparam.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/FS/getcustattrparam.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/VB/getcustattrparam.vb" id="Snippet1"::: @@ -636,7 +629,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of the method taking an as a parameter.   - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id1.vb" id="Snippet1"::: @@ -716,7 +708,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of the method taking a as a parameter.   - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id4.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id4.vb" id="Snippet4"::: @@ -792,7 +783,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of the method taking a as a parameter.   - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id2.vb" id="Snippet2"::: @@ -870,7 +860,6 @@ When implementing your own class derived from , you can o ## Examples The following code example defines a custom parameter class and applies the custom attribute to a method in a derived class and the base of the derived class. The example shows the use of the method to return the attributes. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/.ctor/getcustattrprminh.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/FS/getcustattrprminh.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/VB/getcustattrprminh.vb" id="Snippet3"::: @@ -950,7 +939,6 @@ When implementing your own class derived from , you can o ## Examples The following example retrieves the custom attributes found in the current assembly. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca1.vb" id="Snippet1"::: @@ -1017,7 +1005,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca4.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca4.vb" id="Snippet4"::: @@ -1079,7 +1066,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca2.vb" id="Snippet2"::: @@ -1143,7 +1129,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca5.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca5.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca5.vb" id="Snippet5"::: @@ -1205,7 +1190,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking an as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca1.vb" id="Snippet1"::: @@ -1273,7 +1257,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking an as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca1.vb" id="Snippet1"::: @@ -1344,7 +1327,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca4.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca4.vb" id="Snippet4"::: @@ -1413,7 +1395,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca2.vb" id="Snippet2"::: @@ -1474,7 +1455,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca2.vb" id="Snippet2"::: @@ -1548,7 +1528,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca5.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca5.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca5.vb" id="Snippet5"::: @@ -1616,7 +1595,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca5.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca5.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca5.vb" id="Snippet5"::: @@ -1689,7 +1667,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking an as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca1.vb" id="Snippet1"::: @@ -1767,7 +1744,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca4.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca4.vb" id="Snippet4"::: @@ -1840,7 +1816,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca2.vb" id="Snippet2"::: @@ -1916,7 +1891,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca5.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca5.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca5.vb" id="Snippet5"::: @@ -1997,7 +1971,6 @@ When implementing your own class derived from , you can o ## Examples The following code example demonstrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttributes/ca4.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/GetCustomAttributes/FS/ca4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GetCustomAttributes/VB/ca4.vb" id="Snippet4"::: @@ -2129,7 +2102,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/IsDefaultAttribute/defattr.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefaultAttribute/FS/defattr.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefaultAttribute/VB/defattr.vb" id="Snippet1"::: @@ -2206,7 +2178,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking an as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id1.vb" id="Snippet1"::: @@ -2278,7 +2249,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id4.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id4.vb" id="Snippet4"::: @@ -2349,7 +2319,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id2.vb" id="Snippet2"::: @@ -2418,7 +2387,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id5.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id5.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id5.vb" id="Snippet5"::: @@ -2491,7 +2459,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking an as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id1.vb" id="Snippet1"::: @@ -2564,7 +2531,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id4.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id4.vb" id="Snippet4"::: @@ -2643,7 +2609,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id2.vb" id="Snippet2"::: @@ -2709,7 +2674,6 @@ When implementing your own class derived from , you can o ## Examples The following code example illustrates the use of , taking a as a parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/GetCustomAttribute/id5.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/IsDefined/FS/id5.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IsDefined/VB/id5.vb" id="Snippet5"::: @@ -3039,7 +3003,6 @@ When implementing your own class derived from , you can o ## Examples The following code example implements the property in a custom parameter class and shows its use. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Attribute/TypeId/typeid.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Attribute.TypeId/FS/typeid.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Attribute.TypeId/VB/typeid.vb" id="Snippet1"::: diff --git a/xml/System/AttributeTargets.xml b/xml/System/AttributeTargets.xml index cddbd938d66..748339965fd 100644 --- a/xml/System/AttributeTargets.xml +++ b/xml/System/AttributeTargets.xml @@ -64,26 +64,25 @@ Specifies the application elements on which it is valid to apply an attribute. - class uses this enumeration to specify the kind of element on which it is valid to apply an attribute. - - enumeration values can be combined with a bitwise OR operation to get the preferred combination. - - - -## Examples - The following example illustrates the application of attributes to various targets. - + class uses this enumeration to specify the kind of element on which it is valid to apply an attribute. + + enumeration values can be combined with a bitwise OR operation to get the preferred combination. + + + +## Examples + The following example illustrates the application of attributes to various targets. + > [!NOTE] -> Visual Basic and Visual C++ syntax currently do not support the application of attributes to type parameters. +> Visual Basic and Visual C++ syntax currently do not support the application of attributes to type parameters. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/AttributeTargets/Overview/attrtargs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/attrtargs.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AttrTargs/VB/AttrTargs.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AttrTargs/VB/AttrTargs.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/AttributeUsageAttribute.xml b/xml/System/AttributeUsageAttribute.xml index 37f7a0dfd70..48d85aac071 100644 --- a/xml/System/AttributeUsageAttribute.xml +++ b/xml/System/AttributeUsageAttribute.xml @@ -65,29 +65,29 @@ Specifies the usage of another attribute class. This class cannot be inherited. - on your attribute class. The indicated attribute class must derive from , either directly or indirectly. - - Attribute classes have positional and named parameters. Each public constructor for an attribute class defines a valid sequence of positional parameters for that class. Named parameters are defined by the non-static, public, and read-write fields or properties of the attribute class. - - The three properties of are set by defining the following parameters: - -- - - This positional parameter specifies the program elements that the indicated attribute can be placed on. The set of all possible elements that you can place an attribute on is listed in the enumeration. You can combine several values using a bitwise OR operation to get the desired combination of valid program elements. - -- - - This named parameter specifies whether the indicated attribute can be specified more than once for a given program element. - -- - - This named parameter specifies whether the indicated attribute can be inherited by derived classes and overriding members. - - For more information about using attributes, see and [Attributes](/dotnet/standard/attributes/). - + on your attribute class. The indicated attribute class must derive from , either directly or indirectly. + + Attribute classes have positional and named parameters. Each public constructor for an attribute class defines a valid sequence of positional parameters for that class. Named parameters are defined by the non-static, public, and read-write fields or properties of the attribute class. + + The three properties of are set by defining the following parameters: + +- + + This positional parameter specifies the program elements that the indicated attribute can be placed on. The set of all possible elements that you can place an attribute on is listed in the enumeration. You can combine several values using a bitwise OR operation to get the desired combination of valid program elements. + +- + + This named parameter specifies whether the indicated attribute can be specified more than once for a given program element. + +- + + This named parameter specifies whether the indicated attribute can be inherited by derived classes and overriding members. + + For more information about using attributes, see and [Attributes](/dotnet/standard/attributes/). + ]]> @@ -138,23 +138,20 @@ The set of values combined using a bitwise OR operation to indicate which program elements are valid. Initializes a new instance of the class with the specified list of , the value, and the value. - values using a bitwise OR operation to get the desired combination of valid program elements. - - For default property values, see the , , and properties. - - - -## Examples - The definition of the DispId attribute illustrates the use of a bitwise OR operation to combine several values. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp" id="Snippet1"::: + values using a bitwise OR operation to get the desired combination of valid program elements. + + For default property values, see the , , and properties. + +## Examples + The definition of the DispId attribute illustrates the use of a bitwise OR operation to combine several values. + :::code language="csharp" source="~/snippets/csharp/System/AttributeUsageAttribute/.ctor/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/FS/source.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -204,11 +201,11 @@ if more than one instance is allowed to be specified; otherwise, . The default is . - @@ -258,32 +255,32 @@ if the attribute can be inherited by derived classes and overriding members; otherwise, . The default is . - property determines: - -- Whether classes derived from a base class tagged with the attribute to which the attribute is applied inherit that attribute. - -- Whether methods of derived classes that override a base class method tagged with the attribute to which the attribute is applied inherit that attribute. (If a class inherits a base class member, it also inherits any attributes applied to that member.) - - - -## Examples - The following example illustrates the difference between an attribute to which an attribute with an property value of `true` is applied and one to which attribute with an property value of `false` is applied. The example defines two attributes, `InheritedAttribute` and `NotInheritedAttribute`. Both attributes can apply to classes and methods. Because the property of the attribute applied to `InheritedAttribute` is `true`, it is inherited by derived classes and the members of derived classes that override the base class method. On the other hand, because the property of the attribute applied to `NotInheritedAttribute` is `false`, it is not inherited by derived classes and the members of derived classes that override the base class method. - + property determines: + +- Whether classes derived from a base class tagged with the attribute to which the attribute is applied inherit that attribute. + +- Whether methods of derived classes that override a base class method tagged with the attribute to which the attribute is applied inherit that attribute. (If a class inherits a base class member, it also inherits any attributes applied to that member.) + + + +## Examples + The following example illustrates the difference between an attribute to which an attribute with an property value of `true` is applied and one to which attribute with an property value of `false` is applied. The example defines two attributes, `InheritedAttribute` and `NotInheritedAttribute`. Both attributes can apply to classes and methods. Because the property of the attribute applied to `InheritedAttribute` is `true`, it is inherited by derived classes and the members of derived classes that override the base class method. On the other hand, because the property of the attribute applied to `NotInheritedAttribute` is `false`, it is not inherited by derived classes and the members of derived classes that override the base class method. + :::code language="csharp" source="~/snippets/csharp/System/AttributeUsageAttribute/Inherited/Inherited1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.AttributeUsageAttribute.Inherited/fs/Inherited1.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.AttributeUsageAttribute.Inherited/vb/Inherited1.vb" id="Snippet1"::: - - The example then defines two base classes. The first, `BaseA`, has a single method, `MethodA`. The second, `BaseB`, has a single method, `MethodB`. `BaseA` and `MethodA` are tagged with the `InheritedAttribute` attribute, and `BaseB` and `MethodB` are tagged with the `NotInheritedAttribute` attribute. `DerivedA` inherits from `BaseA` and overrides its `MethodA` method. `DerivedB` inherits from `BaseB` and overrides its `MethodB` method. - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.AttributeUsageAttribute.Inherited/vb/Inherited1.vb" id="Snippet1"::: + + The example then defines two base classes. The first, `BaseA`, has a single method, `MethodA`. The second, `BaseB`, has a single method, `MethodB`. `BaseA` and `MethodA` are tagged with the `InheritedAttribute` attribute, and `BaseB` and `MethodB` are tagged with the `NotInheritedAttribute` attribute. `DerivedA` inherits from `BaseA` and overrides its `MethodA` method. `DerivedB` inherits from `BaseB` and overrides its `MethodB` method. + :::code language="csharp" source="~/snippets/csharp/System/AttributeUsageAttribute/Inherited/Inherited1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.AttributeUsageAttribute.Inherited/fs/Inherited1.fs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.AttributeUsageAttribute.Inherited/vb/Inherited1.vb" id="Snippet2"::: - - As the output from the example shows, `DerivedA` and `DerivedA.MethodA` inherit the `InheritedAttribute` attribute, but `DerivedB` and `DerivedB.MethodB` do not inherit the `NotInheritedAttribute` attribute. - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.AttributeUsageAttribute.Inherited/vb/Inherited1.vb" id="Snippet2"::: + + As the output from the example shows, `DerivedA` and `DerivedA.MethodA` inherit the `InheritedAttribute` attribute, but `DerivedB` and `DerivedB.MethodB` do not inherit the `NotInheritedAttribute` attribute. + ]]> diff --git a/xml/System/BitConverter.xml b/xml/System/BitConverter.xml index e68f4142bdf..921c1847916 100644 --- a/xml/System/BitConverter.xml +++ b/xml/System/BitConverter.xml @@ -115,7 +115,6 @@ ## Examples The following code example illustrates the use of several class methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/Overview/bitconv.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.Class/FS/bitconv.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/bitconv.vb" id="Snippet1"::: @@ -188,7 +187,6 @@ ## Examples The following code example converts the bit patterns of several values to values with the `DoubleToInt64Bits` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/DoubleToInt64Bits/dbltobits.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/FS/dbltobits.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/VB/dbltobits.vb" id="Snippet2"::: @@ -311,7 +309,6 @@ ## Examples The following example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesbool.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/FS/bytesbool.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/VB/bytesbool.vb" id="Snippet1"::: @@ -378,7 +375,6 @@ ## Examples The following code example converts the bit patterns of values (Unicode characters) to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/byteschar.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/FS/byteschar.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/VB/byteschar.vb" id="Snippet2"::: @@ -451,7 +447,6 @@ ## Examples The following code example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesdouble.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/FS/bytesdouble.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/VB/bytesdouble.vb" id="Snippet4"::: @@ -597,7 +592,6 @@ ## Examples The following code example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesint16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/FS/bytesint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/VB/bytesint16.vb" id="Snippet3"::: @@ -670,7 +664,6 @@ ## Examples The following code example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesint32.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/FS/bytesint32.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/VB/bytesint32.vb" id="Snippet2"::: @@ -743,7 +736,6 @@ ## Examples The following example calls the method to convert each element in an array to a arrays. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesint64.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/FS/bytesint64.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/VB/bytesint64.vb" id="Snippet1"::: @@ -816,7 +808,6 @@ ## Examples The following code example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytessingle.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/FS/bytessingle.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/VB/bytessingle.vb" id="Snippet3"::: @@ -930,7 +921,6 @@ ## Examples The following code example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesuint16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/FS/bytesuint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/VB/bytesuint16.vb" id="Snippet3"::: @@ -1003,7 +993,6 @@ ## Examples The following code example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesuint32.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/FS/bytesuint32.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/VB/bytesuint32.vb" id="Snippet2"::: @@ -1076,7 +1065,6 @@ ## Examples The following code example converts the bit patterns of values to arrays with the `GetBytes` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/GetBytes/bytesuint64.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/FS/bytesuint64.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/VB/bytesuint64.vb" id="Snippet1"::: @@ -1312,7 +1300,6 @@ ## Examples The following code example converts the bit patterns of several values to values with the `Int64BitsToDouble` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/DoubleToInt64Bits/bitstodbl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/FS/bitstodbl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/VB/bitstodbl.vb" id="Snippet1"::: @@ -1377,7 +1364,6 @@ ## Examples The following code example illustrates the use of the `IsLittleEndian` field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/Overview/littleend.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.Class/FS/littleend.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/littleend.vb" id="Snippet2"::: @@ -1576,7 +1562,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToBoolean` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToBoolean/batobool.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/FS/batobool.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/VB/batobool.vb" id="Snippet1"::: @@ -1692,7 +1677,6 @@ ## Examples The following code example converts elements of arrays to values (Unicode characters) with the `ToChar` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToBoolean/batochar.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/FS/batochar.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/VB/batochar.vb" id="Snippet2"::: @@ -1816,7 +1800,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToDouble` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToBoolean/batodouble.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/FS/batodouble.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/VB/batodouble.vb" id="Snippet3"::: @@ -2105,7 +2088,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToInt16` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToInt16/batoint16.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/FS/batoint16.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/VB/batoint16.vb" id="Snippet1"::: @@ -2352,7 +2334,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToInt64` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToInt16/batoint64.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/FS/batoint64.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/VB/batoint64.vb" id="Snippet3"::: @@ -2476,7 +2457,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToSingle` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToBoolean/batosingle.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/FS/batosingle.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/VB/batosingle.vb" id="Snippet4"::: @@ -2561,7 +2541,6 @@ ## Examples The following code example converts arrays to objects with the `ToString` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToString/batostring.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToString/FS/batostring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToString/VB/batostring.vb" id="Snippet1"::: @@ -2631,7 +2610,6 @@ ## Examples The following code example converts the part of a array starting at the specified `startIndex` to a with the `ToString` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToString/batostringii.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToString/FS/batostringii.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToString/VB/batostringii.vb" id="Snippet2"::: @@ -2705,7 +2683,6 @@ ## Examples The following example uses the method to convert part of a byte array, starting at the specified `startIndex` and with the specified `length`, to a string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToString/batostringii.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToString/FS/batostringii.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToString/VB/batostringii.vb" id="Snippet2"::: @@ -2929,7 +2906,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToUInt16` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToUInt16/batouint16.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/FS/batouint16.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/VB/batouint16.vb" id="Snippet1"::: @@ -3059,7 +3035,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToUInt32` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToUInt16/batouint32.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/FS/batouint32.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/VB/batouint32.vb" id="Snippet2"::: @@ -3189,7 +3164,6 @@ ## Examples The following code example converts elements of arrays to values with the `ToUInt64` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/BitConverter/ToUInt16/batouint64.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/FS/batouint64.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/VB/batouint64.vb" id="Snippet3"::: diff --git a/xml/System/Boolean.xml b/xml/System/Boolean.xml index d605eb24868..aa16e1888d6 100644 --- a/xml/System/Boolean.xml +++ b/xml/System/Boolean.xml @@ -201,7 +201,6 @@ This method implements the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -700,7 +699,6 @@ The `value` parameter, optionally preceded or trailed by white space, must conta The following code example illustrates the use of method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/Parse/booleanmembers.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/Parse/booleanmembers.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Boolean/VB/booleanmembers.vb" id="Snippet2"::: @@ -1972,7 +1970,6 @@ This method returns the constants "True" or "False". The following example illustrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/Parse/booleanmembers.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/Parse/booleanmembers.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Boolean/VB/booleanmembers.vb" id="Snippet1"::: diff --git a/xml/System/Buffer.xml b/xml/System/Buffer.xml index f5198903357..24154408605 100644 --- a/xml/System/Buffer.xml +++ b/xml/System/Buffer.xml @@ -64,24 +64,21 @@ Manipulates arrays of primitive types. - only affects arrays of primitive types; this class does not apply to objects. Each primitive type is treated as a series of bytes without regard to any behavior or limitation associated with the primitive type. - - provides methods to copy bytes from one array of primitive types to another array of primitive types, get a byte from an array, set a byte in an array, and obtain the length of an array. This class provides better performance for manipulating primitive types than similar methods in the class. - - is applicable to the following primitive types: , , , , , , , , , , , , , and . - - - -## Examples - The following code example illustrates the use of several `Buffer` class methods. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp" id="Snippet1"::: + only affects arrays of primitive types; this class does not apply to objects. Each primitive type is treated as a series of bytes without regard to any behavior or limitation associated with the primitive type. + + provides methods to copy bytes from one array of primitive types to another array of primitive types, get a byte from an array, set a byte in an array, and obtain the length of an array. This class provides better performance for manipulating primitive types than similar methods in the class. + + is applicable to the following primitive types: , , , , , , , , , , , , , and . + +## Examples + The following code example illustrates the use of several `Buffer` class methods. + :::code language="csharp" source="~/snippets/csharp/System/Buffer/Overview/buffer.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/FS/buffer.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Buffer.BlockCopy/VB/buffer.vb" id="Snippet1"::: + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Buffer.BlockCopy/VB/buffer.vb" id="Snippet1"::: ]]> @@ -147,50 +144,45 @@ The number of bytes to copy. Copies a specified number of bytes from a source array starting at a particular offset to a destination array starting at a particular offset. - method accesses the bytes in the `src` parameter array using offsets into memory, not programming constructs such as indexes or upper and lower array bounds. For example, if in the programming language of your application you declare an array with a zero-based lower bound of -50, and then pass the array and an offset of 5 to the method, the first array element the method will access is the second element of the array, which is at index -49. Furthermore, which byte of array element -49 is accessed first depends on the endianness of the computer that is executing your application. - - As its name suggests, the method copies a block of bytes as a whole, rather than copying one byte at a time. Therefore, if `src` and `dst` reference the same array, and the range from `srcOffset` + `count` -1 overlaps the range from `dstOffset` + `count` - 1, the values of the overlapping bytes are not overwritten before they are copied to the destination. In the following example, the values of bytes 0-16 in an array named `arr` are copied to bytes 12-28. Despite the overlapping range, the values of the source bytes are successfully copied. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp" id="Snippet3"::: + method accesses the bytes in the `src` parameter array using offsets into memory, not programming constructs such as indexes or upper and lower array bounds. For example, if in the programming language of your application you declare an array with a zero-based lower bound of -50, and then pass the array and an offset of 5 to the method, the first array element the method will access is the second element of the array, which is at index -49. Furthermore, which byte of array element -49 is accessed first depends on the endianness of the computer that is executing your application. + + As its name suggests, the method copies a block of bytes as a whole, rather than copying one byte at a time. Therefore, if `src` and `dst` reference the same array, and the range from `srcOffset` + `count` -1 overlaps the range from `dstOffset` + `count` - 1, the values of the overlapping bytes are not overwritten before they are copied to the destination. In the following example, the values of bytes 0-16 in an array named `arr` are copied to bytes 12-28. Despite the overlapping range, the values of the source bytes are successfully copied. + :::code language="csharp" source="~/snippets/csharp/System/Buffer/Overview/overlap1.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/FS/overlap1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Buffer.BlockCopy/VB/overlap1.vb" id="Snippet3"::: - - In the following example, the values of bytes 12-28 in an array named `arr` are copied to bytes 0-16. Again, despite the overlapping range, the values of the source bytes are successfully copied. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp" id="Snippet4"::: + + In the following example, the values of bytes 12-28 in an array named `arr` are copied to bytes 0-16. Again, despite the overlapping range, the values of the source bytes are successfully copied. + :::code language="csharp" source="~/snippets/csharp/System/Buffer/Overview/overlap1.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/FS/overlap1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Buffer.BlockCopy/VB/overlap1.vb" id="Snippet4"::: - - - -## Examples - The following example copies regions of arrays by using the method. For each operation, it lists the source and destination arrays as both an array of values and as a sequence of bytes. The example illustrates the importance of considering a system's endianness when working with the method: Because Windows systems are little-endian, the lower-order bytes of a primitive data type's value precede the higher-order bytes. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp" id="Snippet2"::: + +## Examples + The following example copies regions of arrays by using the method. For each operation, it lists the source and destination arrays as both an array of values and as a sequence of bytes. The example illustrates the importance of considering a system's endianness when working with the method: Because Windows systems are little-endian, the lower-order bytes of a primitive data type's value precede the higher-order bytes. + :::code language="csharp" source="~/snippets/csharp/System/Buffer/Overview/bcopy.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/FS/bcopy.fs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Buffer.BlockCopy/VB/bcopy.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Buffer.BlockCopy/VB/bcopy.vb" id="Snippet2"::: + ]]> or is . - or is not an array of primitives. - - -or- - - The number of bytes in is less than plus . - - -or- - + or is not an array of primitives. + + -or- + + The number of bytes in is less than plus . + + -or- + The number of bytes in is less than plus . , , or is less than 0. @@ -249,16 +241,15 @@ Returns the number of bytes in the specified array. The number of bytes in the array. - @@ -324,21 +315,20 @@ Retrieves the byte at the specified location in the specified array. The byte at the specified location in the array. - @@ -417,13 +407,13 @@ The target address. The number of bytes available in the destination memory block. The number of bytes to copy. - Copies a number of bytes specified as a long integer value from one address in memory to another. - + Copies a number of bytes specified as a long integer value from one address in memory to another. + This API is not CLS-compliant. - @@ -487,15 +477,15 @@ The target address. The number of bytes available in the destination memory block. The number of bytes to copy. - Copies a number of bytes specified as an unsigned long integer value from one address in memory to another. - + Copies a number of bytes specified as an unsigned long integer value from one address in memory to another. + This API is not CLS-compliant. - @@ -558,21 +548,20 @@ A value to assign. Assigns a specified value to a byte at a particular location in a specified array. - diff --git a/xml/System/Byte.xml b/xml/System/Byte.xml index 02912cd187e..3bda7fb98f0 100644 --- a/xml/System/Byte.xml +++ b/xml/System/Byte.xml @@ -400,12 +400,9 @@ Consult your programming language's documentation to determine whether its compiler performs implicit widening conversions on numeric types. - - ## Examples The following code example demonstrates generic and non-generic versions of the `CompareTo` method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -492,7 +489,6 @@ ## Examples The following code example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/CompareTo/systembyte.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte Examples/FS/systembyte.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte Examples/VB/systembyte.vb" id="Snippet3"::: @@ -725,7 +721,6 @@ ## Examples The following code example determines whether the first value is equal to the second value, and whether the first value is equal to the boxed version of the second value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/Equals/eq.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.byte.equals/fs/eq.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.equals/vb/eq.vb" id="Snippet1"::: @@ -1264,7 +1259,6 @@ For , this method matches the IEEE 754: ## Examples The following example demonstrates how to use the field to screen variable inputs for values that are outside the range of possible byte values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/CompareTo/systembyte.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte Examples/FS/systembyte.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte Examples/VB/systembyte.vb" id="Snippet1"::: @@ -1376,7 +1370,6 @@ For , this method matches the IEEE 754: ## Examples The following example demonstrates how to use the field to screen variable inputs for values that are outside the range of possible byte values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/CompareTo/systembyte.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte Examples/FS/systembyte.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte Examples/VB/systembyte.vb" id="Snippet1"::: @@ -1471,7 +1464,6 @@ For , this method matches the IEEE 754: ## Examples The following example demonstrates how to convert a string value into a byte value using the method. The resulting byte value is then displayed to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/Parse/parse.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.Parse/FS/parse.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.Parse/VB/parse.vb" id="Snippet1"::: @@ -1686,7 +1678,6 @@ For , this method matches the IEEE 754: ## Examples The following example parses string representations of `Byte` values with the method. The current culture for the example is en-US. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/Parse/parse.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.Parse/FS/parse.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.Parse/VB/parse.vb" id="Snippet3"::: @@ -1804,7 +1795,6 @@ For , this method matches the IEEE 754: ## Examples The following example parses string representations of `Byte` values with the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/Parse/parse.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.Parse/FS/parse.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.Parse/VB/parse.vb" id="Snippet2"::: @@ -2041,7 +2031,6 @@ For , this method matches the IEEE 754: ## Examples The following code example parses string representations of `Byte` values with this overload of the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/Parse/parse.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.Parse/FS/parse.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.Parse/VB/parse.vb" id="Snippet4"::: @@ -6084,7 +6073,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example displays an array of byte values. Note that the method is not called explicitly in the example. Instead, it is called implicitly, because of the use of the [composite formatting](/dotnet/standard/base-types/composite-formatting) feature, the F# example uses [string interpolation](/dotnet/fsharp/language-reference/interpolated-strings). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/ToString/NewByteMembers.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.ToString/FS/NewByteMembers.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.ToString/VB/NewByteMembers.vb" id="Snippet2"::: @@ -6185,7 +6173,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example iterates an array of byte values and displays each of them to the console by calling the method with different format providers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/ToString/NewByteMembers.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.ToString/FS/NewByteMembers.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.ToString/VB/NewByteMembers.vb" id="Snippet3"::: @@ -6281,7 +6268,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example initializes a value and displays it to the console using each of the supported standard format strings and a custom format string. The example is run with en-US as the current culture. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/ToString/NewByteMembers.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.ToString/FS/NewByteMembers.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.ToString/VB/NewByteMembers.vb" id="Snippet4"::: @@ -6387,7 +6373,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example uses the standard "N" format string and four different objects to display the string representation of a byte value to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/ToString/NewByteMembers.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.ToString/FS/NewByteMembers.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.ToString/VB/NewByteMembers.vb" id="Snippet5"::: @@ -6751,7 +6736,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example calls the method with a number of different string values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/TryParse/TryParse.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.TryParse/fs/TryParse.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.TryParse/vb/TryParse.vb" id="Snippet1"::: @@ -7122,7 +7106,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example calls the method with a number of different string values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/TryParse/TryParse2.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Byte.TryParse/fs/TryParse2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Byte.TryParse/vb/TryParse2.vb" id="Snippet2"::: diff --git a/xml/System/Char.xml b/xml/System/Char.xml index 85f20a2807d..48d1fbf5ad6 100644 --- a/xml/System/Char.xml +++ b/xml/System/Char.xml @@ -261,7 +261,6 @@ . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp" id="Snippet23"::: :::code language="csharp" source="~/snippets/csharp/System/Char/Overview/charstructure.cs" interactive="try-dotnet" id="Snippet23"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char/FS/charstructure.fs" id="Snippet23"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char [Type Level]/VB/charstructure.vb" id="Snippet23"::: @@ -371,7 +370,6 @@ The following code example demonstrates some of the methods in . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp" id="Snippet19"::: :::code language="csharp" source="~/snippets/csharp/System/Char/CompareTo/compareto.cs" interactive="try-dotnet" id="Snippet19"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.CompareTo/FS/compareto.fs" id="Snippet19"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.CompareTo/VB/compareto.vb" id="Snippet19"::: @@ -535,7 +532,6 @@ The following code example demonstrates some of the methods in and methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/ConvertFromUtf32/utf.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/char.cvtutf32/FS/utf.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/char.cvtutf32/VB/utf.vb" id="Snippet1"::: @@ -566,7 +562,6 @@ The following code example demonstrates some of the methods in and methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/ConvertFromUtf32/utf.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/char.cvtutf32/FS/utf.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/char.cvtutf32/VB/utf.vb" id="Snippet1"::: @@ -843,7 +838,6 @@ The following code example demonstrates some of the methods in . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp" id="Snippet20"::: :::code language="csharp" source="~/snippets/csharp/System/Char/Equals/equals.cs" interactive="try-dotnet" id="Snippet20"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.Equals/FS/equals.fs" id="Snippet20"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.Equals/VB/equals.vb" id="Snippet20"::: @@ -977,7 +971,6 @@ The following code example demonstrates some of the methods in . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/GetNumericValue/getnumericvalue.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.GetNumericValue/FS/getnumericvalue.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.GetNumericValue/VB/getnumericvalue.vb" id="Snippet1"::: @@ -1062,7 +1055,6 @@ The following code example demonstrates some of the methods in . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/GetNumericValue/getnumericvalue.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.GetNumericValue/FS/getnumericvalue.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.GetNumericValue/VB/getnumericvalue.vb" id="Snippet1"::: @@ -1135,7 +1127,6 @@ The following code example demonstrates some of the methods in . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/GetUnicodeCategory/getunicodecategory.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/FS/getunicodecategory.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/VB/getunicodecategory.vb" id="Snippet1"::: @@ -1795,7 +1786,6 @@ The method does not validate that `maxInclusive` is greater than or equal ## Examples The following example lists the Unicode code point of each of the control characters. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsControl/IsControl1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsControl/FS/IsControl1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsControl/VB/IsControl1.vb" id="Snippet1"::: @@ -1866,7 +1856,6 @@ The method does not validate that `maxInclusive` is greater than or equal ## Examples The following example enumerates the characters in a string and determines whether any are control characters. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsControl/IsControl2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsControl/FS/IsControl2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsControl/VB/IsControl2.vb" id="Snippet2"::: @@ -1898,7 +1887,6 @@ The method does not validate that `maxInclusive` is greater than or equal ## Examples The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsDigit/isdigit.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsDigit/FS/isdigit.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsDigit/VB/isdigit.vb" id="Snippet4"::: @@ -2061,7 +2049,6 @@ The method does not validate that `maxInclusive` is greater than or equal ## Examples The following code example demonstrates the , , and methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsHighSurrogate/sur.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/char.surrogate/FS/sur.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/char.surrogate/VB/sur.vb" id="Snippet1"::: @@ -2222,7 +2209,6 @@ The method does not validate that `maxInclusive` is greater than or equal The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsLetter/isletter.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsLetter/FS/isletter.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsLetter/VB/isletter.vb" id="Snippet5"::: @@ -2401,7 +2387,6 @@ The following code example demonstrates . ## Examples The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsLetterOrDigit/isletterordigit.cs" interactive="try-dotnet" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/FS/isletterordigit.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/VB/isletterordigit.vb" id="Snippet6"::: @@ -2564,7 +2549,6 @@ The following code example demonstrates . ## Examples The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsLower/islower.cs" interactive="try-dotnet" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsLower/FS/islower.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsLower/VB/islower.vb" id="Snippet7"::: @@ -2725,7 +2709,6 @@ The following code example demonstrates . ## Examples The following code example demonstrates the , , and methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsHighSurrogate/sur.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/char.surrogate/FS/sur.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/char.surrogate/VB/sur.vb" id="Snippet1"::: @@ -2938,7 +2921,6 @@ The following code example demonstrates . ## Examples The following example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsNumber/isnumber.cs" interactive="try-dotnet" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsNumber/FS/isnumber.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsNumber/VB/isnumber.vb" id="Snippet8"::: @@ -3029,7 +3011,6 @@ The following code example demonstrates . ## Examples The following example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsNumber/isnumber.cs" interactive="try-dotnet" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsNumber/FS/isnumber.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsNumber/VB/isnumber.vb" id="Snippet8"::: @@ -3160,7 +3141,6 @@ The following code example demonstrates . ## Examples The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsPunctuation/ispunctuation.cs" interactive="try-dotnet" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsPunctuation/FS/ispunctuation.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsPunctuation/VB/ispunctuation.vb" id="Snippet9"::: @@ -3589,7 +3569,6 @@ The following code example demonstrates . ## Examples The following example lists the objects that are classified as separator characters. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsSeparator/isseparator1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsSeparator/FS/isseparator1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsSeparator/VB/isseparator1.vb" id="Snippet1"::: @@ -3677,7 +3656,6 @@ The following code example demonstrates . ## Examples The following example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsSeparator/isseparator.cs" interactive="try-dotnet" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsSeparator/FS/isseparator.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsSeparator/VB/isseparator.vb" id="Snippet10"::: @@ -3709,7 +3687,6 @@ The following code example demonstrates . ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp" id="Snippet11"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsSurrogate/issurrogate.cs" interactive="try-dotnet" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsSurrogate/FS/issurrogate.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsSurrogate/VB/issurrogate.vb" id="Snippet11"::: @@ -3865,7 +3842,6 @@ The following code example demonstrates . ## Examples The following code example demonstrates the , , and methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsHighSurrogate/sur.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/char.surrogate/FS/sur.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/char.surrogate/VB/sur.vb" id="Snippet1"::: @@ -4037,7 +4013,6 @@ The following code example demonstrates . ## Examples The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp" id="Snippet12"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsSymbol/issymbol.cs" interactive="try-dotnet" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsSymbol/FS/issymbol.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsSymbol/VB/issymbol.vb" id="Snippet12"::: @@ -4388,7 +4363,6 @@ The following code example demonstrates . ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp" id="Snippet14"::: :::code language="csharp" source="~/snippets/csharp/System/Char/IsWhiteSpace/iswhitespace.cs" interactive="try-dotnet" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/FS/iswhitespace.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/VB/iswhitespace.vb" id="Snippet14"::: @@ -4707,7 +4681,6 @@ The following code example demonstrates . ## Examples The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp" id="Snippet15"::: :::code language="csharp" source="~/snippets/csharp/System/Char/Parse/parse.cs" interactive="try-dotnet" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.Parse/FS/parse.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.Parse/VB/parse.vb" id="Snippet15"::: @@ -9206,7 +9179,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp" id="Snippet16"::: :::code language="csharp" source="~/snippets/csharp/System/Char/ToLower/tolower.cs" interactive="try-dotnet" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.ToLower/FS/tolower.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.ToLower/VB/tolower.vb" id="Snippet16"::: @@ -9431,7 +9403,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following code example demonstrates . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp" id="Snippet17"::: :::code language="csharp" source="~/snippets/csharp/System/Char/ToString/tostring.cs" interactive="try-dotnet" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Char.ToString/FS/tostring.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.ToString/VB/tostring.vb" id="Snippet17"::: @@ -9915,7 +9886,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following code example demonstrates overloads of the method for several base types, and the method for the base type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Char/TryParse/tp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/T.TryParse/FS/tp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.TryParse/VB/tp.vb" id="Snippet1"::: diff --git a/xml/System/CharEnumerator.xml b/xml/System/CharEnumerator.xml index 1709d852659..42064ab1eb7 100644 --- a/xml/System/CharEnumerator.xml +++ b/xml/System/CharEnumerator.xml @@ -98,14 +98,12 @@ ## Examples The following example uses the class to enumerate the individual characters in a string. It instantiates a object by calling the method, moves from one character to the next by calling the method, and displays the current character by retrieving the value of the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/CharEnumerator/Overview/CharEnumerator1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.CharEnumerator.Class/fs/CharEnumerator1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.CharEnumerator.Class/vb/CharEnumerator1.vb" id="Snippet1"::: Note, however, that the same operation can be performed somewhat more intuitively by using `foreach` (in C#) or `For Each` (in Visual Basic), as the following example shows. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/CharEnumerator/Overview/CharEnumerator1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.CharEnumerator.Class/fs/CharEnumerator1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.CharEnumerator.Class/vb/CharEnumerator1.vb" id="Snippet2"::: @@ -239,14 +237,12 @@ ## Examples The following example uses the class to enumerate the individual characters in a string. It instantiates a object by calling the method, moves from one character to the next by calling the method, and displays the current character by retrieving the value of the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/CharEnumerator/Overview/CharEnumerator1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.CharEnumerator.Class/fs/CharEnumerator1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.CharEnumerator.Class/vb/CharEnumerator1.vb" id="Snippet1"::: Note, however, that the same operation can be performed somewhat more intuitively by using `foreach` (in C#) or `For Each` (in Visual Basic), as the following example shows. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/CharEnumerator/Overview/CharEnumerator1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.CharEnumerator.Class/fs/CharEnumerator1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.CharEnumerator.Class/vb/CharEnumerator1.vb" id="Snippet2"::: @@ -366,14 +362,12 @@ ## Examples The following example uses the class to enumerate the individual characters in a string. It instantiates a object by calling the method, moves from one character to the next by calling the method, and displays the current character by retrieving the value of the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/CharEnumerator/Overview/CharEnumerator1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.CharEnumerator.Class/fs/CharEnumerator1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.CharEnumerator.Class/vb/CharEnumerator1.vb" id="Snippet1"::: Note, however, that the same operation can be performed somewhat more intuitively by using `foreach` (in C#) or `For Each` (in Visual Basic), as the following example shows. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/CharEnumerator/Overview/CharEnumerator1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.CharEnumerator.Class/fs/CharEnumerator1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.CharEnumerator.Class/vb/CharEnumerator1.vb" id="Snippet2"::: diff --git a/xml/System/Comparison`1.xml b/xml/System/Comparison`1.xml index 4548e6b7462..fa4e2613f88 100644 --- a/xml/System/Comparison`1.xml +++ b/xml/System/Comparison`1.xml @@ -74,47 +74,46 @@ The first object to compare. The second object to compare. Represents the method that compares two objects of the same type. - A signed integer that indicates the relative values of and , as shown in the following table. - - Value - - Meaning - - Less than 0 - - is less than . - - 0 - - equals . - - Greater than 0 - - is greater than . - + A signed integer that indicates the relative values of and , as shown in the following table. + + Value + + Meaning + + Less than 0 + + is less than . + + 0 + + equals . + + Greater than 0 + + is greater than . + - method overload of the class and the method overload of the class to sort the elements of an array or list. - - - -## Examples - The following code example demonstrates the use of the delegate with the method overload. - - The code example defines an alternative comparison method for strings, named `CompareDinosByLength`. This method works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used. - - A of strings is created and populated with four strings, in no particular order. The list also includes an empty string and a null reference. The list is displayed, sorted using a generic delegate representing the `CompareDinosByLength` method, and displayed again. + method overload of the class and the method overload of the class to sort the elements of an array or list. + + + +## Examples + The following code example demonstrates the use of the delegate with the method overload. + + The code example defines an alternative comparison method for strings, named `CompareDinosByLength`. This method works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used. + + A of strings is created and populated with four strings, in no particular order. The list also includes an empty string and a null reference. The list is displayed, sorted using a generic delegate representing the `CompareDinosByLength` method, and displayed again. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ComparisonT/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_SortComparison/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortComparison/vb/source.vb" id="Snippet1"::: - The following example uses the delegate to sort the elements of a collection of `CityInfo` objects. `CityInfo` is an application-defined class that contains information about a city and its population. The example defines three methods, `CompareByName`, `CompareByPopulation`, and `CompareByNames`, that offer three different ways of ordering the `CityInfo` objects. Each method is assigned to the `comparison` argument of the method. - + The following example uses the delegate to sort the elements of a collection of `CityInfo` objects. `CityInfo` is an application-defined class that contains information about a city and its population. The example defines three methods, `CompareByName`, `CompareByPopulation`, and `CompareByNames`, that offer three different ways of ordering the `CityInfo` objects. Each method is assigned to the `comparison` argument of the method. + :::code language="csharp" source="~/snippets/csharp/System/ComparisonT/Overview/comparisont1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.comparison`1/fs/comparisont1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.comparison`1/vb/comparisont1.vb" id="Snippet1"::: diff --git a/xml/System/Console.xml b/xml/System/Console.xml index 60aabe3b375..ed6a5ffbade 100644 --- a/xml/System/Console.xml +++ b/xml/System/Console.xml @@ -224,12 +224,9 @@ wraps a call to the Windows [Beep function](/windows/win32/api/utilapiset/nf-utilapiset-beep). Whether produces a sound on versions of Windows before Windows 7 depends on the presence of a 8254 programmable interval timer chip. Starting with Windows 7, it depends on the default sound device. - - ## Examples The following example demonstrates the method. The example accepts a number from 1 through 9 as a command line argument, and plays the beep that number of times. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Beep/beep.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.beep/FS/beep.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.beep/VB/beep.vb" id="Snippet1"::: @@ -302,7 +299,6 @@ ## Examples This example demonstrates the method by playing the first few notes of a song through the console speaker. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Beep/b2.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.beep2/FS/b2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.beep2/VB/b2.vb" id="Snippet1"::: @@ -399,7 +395,6 @@ ## Examples This example demonstrates the and properties. The example reports the dimensions of an operating system window set to a buffer size of 300 rows and 85 columns. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/BufferHeight/hw.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.bufferHW/FS/hw.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.bufferHW/VB/hw.vb" id="Snippet1"::: @@ -499,7 +494,6 @@ ## Examples This example demonstrates the and properties. The example reports the dimensions of an operating system window set to a buffer size of 300 rows and 85 columns. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/BufferHeight/hw.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.bufferHW/FS/hw.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.bufferHW/VB/hw.vb" id="Snippet1"::: @@ -610,7 +604,6 @@ ## Examples The following example demonstrates how the event is used. When you press Ctrl+C, the read operation is interrupted and the `myHandler` event handler is invoked. Upon entry to the event handler, the property is `false`, which means that the current process will terminate when the event handler terminates. However, the event handler sets the property to `true`, which means that the process will not terminate and the read operation will resume. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/CancelKeyPress/ckp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cancelkeypress/fs/ckp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: @@ -753,7 +746,6 @@ This example demonstrates the and properties, and the and methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "|", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Clear/lts.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cursorLTS/FS/lts.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb" id="Snippet1"::: @@ -833,7 +825,6 @@ ## Examples This example demonstrates the and properties, and the and methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "|", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Clear/lts.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cursorLTS/FS/lts.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb" id="Snippet1"::: @@ -928,7 +919,6 @@ ## Examples This example demonstrates the property. The example increases the size of the cursor each time any console key is pressed, then restores the cursor to its original size before terminating. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/CursorSize/csize.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cursorsize/FS/csize.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cursorsize/VB/csize.vb" id="Snippet1"::: @@ -1011,7 +1001,6 @@ ## Examples This example demonstrates the and properties, and the and methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "|", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Clear/lts.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cursorLTS/FS/lts.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb" id="Snippet1"::: @@ -1102,7 +1091,6 @@ ## Examples This example demonstrates the property. The example makes the cursor visible if the first column of input is a '+' character or invisible if the input is a '-' character. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/CursorVisible/vis.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cursorvis/FS/vis.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cursorvis/VB/vis.vb" id="Snippet1"::: @@ -1176,7 +1164,6 @@ ## Examples The following example is a command line utility named ExpandTabs that replaces tab characters in a text file with four spaces, the value defined by the `tabSize` variable. It redirects the standard input and output streams to files, but uses the property to write the standard error stream to the console. It can be launched from the command line by supplying the name of the file that contains tab characters and the name of the output file. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Error/expandtabsex.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Console-EXPANDTABSEX/FS/expandtabsex.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Console-EXPANDTABSEX/VB/expandtabsex.vb" id="Snippet1"::: @@ -1426,7 +1413,6 @@ Columns are numbered from left to right starting at 0. Rows are numbered from to ## Examples The following sample illustrates the use of the `In` property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/In/consolein.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/consolein/FS/consolein.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/consolein/VB/consolein.vb" id="Snippet1"::: @@ -1728,7 +1714,6 @@ Columns are numbered from left to right starting at 0. Rows are numbered from to ## Examples The following example demonstrates how to use the property to create a loop that runs until a key is pressed. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/KeyAvailable/ka.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.keyavailable/FS/ka.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.keyavailable/VB/ka.vb" id="Snippet1"::: @@ -2333,7 +2318,6 @@ This method can be used to reacquire the standard input stream after it has been The following example illustrates the use of the `OpenStandardInput` method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/OpenStandardInput/decode.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/FS/decode.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.OpenStandartInput/VB/decode.vb" id="Snippet1"::: @@ -2474,7 +2458,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the method. It replaces four consecutive space characters in a string with a tab character. To run it, you must supply two command-line arguments. The first is the name of an existing text file to redirect the standard input stream to. The second is the name of a file to redirect the standard output stream to. This file need not exist. If it does, its contents will be overwritten. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/OpenStandardOutput/inserttabs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/FS/inserttabs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb" id="Snippet1"::: @@ -2539,7 +2522,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the method. It replaces four consecutive space characters in a string with a tab character. To run it, you must supply two command line arguments. The first is the name of an existing text file to redirect the standard input stream to. The second is the name of a file to redirect the standard output stream to. This file need not exist. If it does, its contents will be overwritten. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/OpenStandardOutput/inserttabs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/FS/inserttabs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb" id="Snippet1"::: @@ -2778,7 +2760,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Read/read.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.read/FS/read.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.read/VB/read.vb" id="Snippet1"::: @@ -2879,7 +2860,6 @@ This method can be used to reacquire the standard output stream after it has bee The following example uses the method to display information about which key the user pressed. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/ReadKey/rk.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.readkey1/FS/rk.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: @@ -2978,7 +2958,6 @@ This method can be used to reacquire the standard output stream after it has bee The following example uses the method to display information about the key pressed by a user without echoing that key to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/ReadKey/rkbool.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.readkey2/FS/rkbool.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey2/VB/rkbool.vb" id="Snippet1"::: @@ -3053,7 +3032,6 @@ This method can be used to reacquire the standard output stream after it has bee One of the most common uses of the method is to pause program execution before clearing the console and displaying new information to it, or to prompt the user to press the Enter key before terminating the application. The following example illustrates this. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Console/ReadLine/ReadLineSimple.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.ReadLine/fs/ReadLineSimple.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.ReadLine/vb/ReadLineSimple.vb" id="Snippet6"::: @@ -3089,7 +3067,6 @@ This method can be used to reacquire the standard output stream after it has bee If the Ctrl+Z key combination (followed by Enter on Windows) is pressed when the method is reading input from the console, the method returns `null`. This enables the user to prevent further keyboard input when the method is called in a loop. The following example illustrates this scenario. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/ReadLine/ReadLine2.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.ReadLine/fs/ReadLine2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.ReadLine/vb/ReadLine2.vb" id="Snippet1"::: @@ -3097,7 +3074,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example requires two command line arguments: the name of an existing text file, and the name of a file to write the output to. It opens the existing text file and redirects the standard input from the keyboard to that file. It also redirects the standard output from the console to the output file. It then uses the method to read each line in the file, replaces every sequence of four spaces with a tab character, and uses the method to write the result to the output file. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/OpenStandardOutput/inserttabs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/FS/inserttabs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb" id="Snippet1"::: @@ -3252,7 +3228,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the , , , , , , and properties; and the , , and methods. The example draws a grid pattern in the screen buffer based on the screen buffer width. Then the example moves the console window in response to which of the UP ARROW, DOWN ARROW, LEFT ARROW, or RIGHT ARROW console keys is pressed. The grid pattern helps you see the movement of the console window relative to the screen buffer. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetBufferSize/wlt.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.windowLT/VB/wlt.vb" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.windowLT/FS/wlt.fs" id="Snippet1"::: @@ -3356,7 +3331,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples This example demonstrates the and properties, and the and methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of "+", "|", and "-" strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Clear/lts.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cursorLTS/FS/lts.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cursorLTS/VB/lts.vb" id="Snippet1"::: @@ -3438,7 +3412,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example shows how to redirect the standard error stream to a file. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetError/SetError1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.SetError/fs/SetError1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.SetError/vb/SetError1.vb" id="Snippet1"::: @@ -3529,7 +3502,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the method. It replaces four consecutive space characters in a string with a tab character. To run it, you must supply two command line arguments. The first is the name of an existing text file to redirect the standard input stream to. The second is the name of a file to redirect the standard output stream to. This file need not exist. If it does, its contents will be overwritten. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/OpenStandardOutput/inserttabs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/FS/inserttabs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb" id="Snippet1"::: @@ -3599,7 +3571,6 @@ This method can be used to reacquire the standard output stream after it has bee A that encapsulates a can be used to send output to a file. For example: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetOut/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.console.setout/fs/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.console.setout/vb/source.vb" id="Snippet1"::: @@ -3609,7 +3580,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the method. It replaces four consecutive space characters in a string with a tab character. To run it, you must supply two command line arguments. The first is the name of an existing text file to redirect the standard input stream to. The second is the name of a file to redirect the standard output stream to. This file need not exist. If it does, its contents will be overwritten. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/OpenStandardOutput/inserttabs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-INSERTTABS/FS/inserttabs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-INSERTTABS/VB/inserttabs.vb" id="Snippet1"::: @@ -3689,7 +3659,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the , , , , , , and properties; and the , , and methods. The example draws a grid pattern in the screen buffer based on the screen buffer width. Then the example moves the console window in response to which of the UP ARROW, DOWN ARROW, LEFT ARROW, or RIGHT ARROW console keys is pressed. The grid pattern helps you see the movement of the console window relative to the screen buffer. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetBufferSize/wlt.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.windowLT/VB/wlt.vb" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.windowLT/FS/wlt.fs" id="Snippet1"::: @@ -3788,7 +3757,6 @@ This method can be used to reacquire the standard output stream after it has bee The example reports the dimensions of a console window set to 85 columns and 43 rows, then waits for a key to be pressed. When any key is pressed, the dimensions of the console window are halved, the new dimensions are reported, and the example waits for another key press. Finally, when any key is pressed, the console window is restored to its original dimensions and the example terminates. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetWindowSize/sws.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.setwindowsize/FS/sws.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.setwindowsize/VB/sws.vb" id="Snippet1"::: @@ -3884,7 +3852,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples This example demonstrates the property. The example displays the current title of the operating system window, waits for a key press, then displays a new title. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Title/mytitle.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.title/FS/mytitle.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.title/VB/mytitle.vb" id="Snippet1"::: @@ -3977,7 +3944,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/ReadKey/rk.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.readkey1/FS/rk.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: @@ -4087,7 +4053,6 @@ This method can be used to reacquire the standard output stream after it has bee The example reports the dimensions of a console window set to 85 columns and 43 rows, then waits for a key press. When any key is pressed, the dimensions of the console window are halved, the new dimensions are reported, and the example waits for another key press. Finally, when any key is pressed the console window is restored to its original dimensions and the example terminates. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetWindowSize/sws.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.setwindowsize/FS/sws.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.setwindowsize/VB/sws.vb" id="Snippet1"::: @@ -4176,7 +4141,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example opens an 80-column console window and defines a buffer area that is 120 columns wide. It displays information on window and buffer size, and then waits for the user to press either the LEFT ARROW key or the RIGHT ARROW key. In the former case, it decrements the value of the property by one if the result is a legal value. In the latter case, it increases the value of the property by one if the result would be legal. Note that the example does not have to handle an , because it checks that the value to be assigned to the property is not negative and does not cause the sum of the and properties to exceed the property value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/WindowLeft/windowleft1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.console.windowleft/fs/windowleft1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.console.windowleft/vb/windowleft1.vb" id="Snippet1"::: @@ -4257,7 +4221,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the , , , , , , and properties; and the , , and methods. The example draws a grid pattern in the screen buffer based on the screen buffer width. Then the example moves the console window in response to which of the UP ARROW, DOWN ARROW, LEFT ARROW, or RIGHT ARROW console keys is pressed. The grid pattern helps you see the movement of the console window relative to the screen buffer. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetBufferSize/wlt.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.windowLT/VB/wlt.vb" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.windowLT/FS/wlt.fs" id="Snippet1"::: @@ -4370,7 +4333,6 @@ This method can be used to reacquire the standard output stream after it has bee The example reports the dimensions of a console window set to 85 columns and 43 rows, then waits for a key press. When any key is pressed, the dimensions of the console window are halved, the new dimensions are reported, and the example waits for another key press. Finally, when any key is pressed the console window is restored to its original dimensions and the example terminates. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/SetWindowSize/sws.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.setwindowsize/FS/sws.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.setwindowsize/VB/sws.vb" id="Snippet1"::: @@ -4453,7 +4415,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -4514,7 +4475,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -4630,7 +4590,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -4696,7 +4655,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -4762,7 +4720,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -4828,7 +4785,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -4895,7 +4851,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -4988,7 +4943,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -5055,7 +5009,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -5127,7 +5080,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -5199,7 +5151,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -5298,14 +5249,12 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example uses the `WriteLine` method to demonstrate the standard formatting specifiers for numbers, dates, and enumerations. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/wl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.writelineFmt1/fs/wl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.writelineFmt1/vb/wl.vb" id="Snippet1"::: The following example illustrates the use of the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -5646,14 +5595,12 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example uses the `WriteLine` method to demonstrate the standard formatting specifiers for numbers, dates, and enumerations. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/wl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.writelineFmt1/fs/wl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.writelineFmt1/vb/wl.vb" id="Snippet1"::: The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -5758,14 +5705,12 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example uses the `WriteLine` method to demonstrate the standard formatting specifiers for numbers, dates, and enumerations. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/wl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.writelineFmt1/fs/wl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.writelineFmt1/vb/wl.vb" id="Snippet1"::: The following example illustrates the use of the `Write` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/reformat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console-REFORMAT/FS/reformat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console-REFORMAT/VB/reformat.vb" id="Snippet1"::: @@ -5862,7 +5807,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example illustrates the use of variable parameters with the method. The method is called with a composite format string and five format items. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp" id="Snippet3"::: ]]> @@ -5947,7 +5891,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The example changes the line terminator from its default value of "\r\n" or `vbCrLf` to "\r\n\r\n" or `vbCrLf` + `vbCrLf`. It then calls the and methods to display output to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Console/WriteLine/newline1.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.WriteLine/FS/newline1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.WriteLine/VB/newline1.vb" id="Snippet2"::: @@ -6017,7 +5960,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example generates ten random integers and uses the method to indicate whether they are even. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Console/WriteLine/writeline_boolean1.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.WriteLine/FS/writeline_boolean1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.WriteLine/VB/writeline_boolean1.vb" id="Snippet4"::: @@ -6476,7 +6418,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example uses the method to display each value in an object array to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Console/WriteLine/writeline_obj1.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.WriteLine/FS/writeline_obj1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.WriteLine/VB/writeline_obj1.vb" id="Snippet3"::: @@ -6639,7 +6580,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The example changes the line terminator from its default value of "\r\n" or `vbCrLf` to "\r\n\r\n" or `vbCrLf` + `vbCrLf`. It then calls the and methods to display output to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Console/WriteLine/newline1.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Console.WriteLine/FS/newline1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Console.WriteLine/VB/newline1.vb" id="Snippet2"::: @@ -7001,7 +6941,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the standard formatting specifiers for numbers, dates, and enumerations. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/wl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.writelineFmt1/fs/wl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.writelineFmt1/vb/wl.vb" id="Snippet1"::: @@ -7235,7 +7174,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the standard formatting specifiers for numbers, dates, and enumerations. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/wl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.writelineFmt1/fs/wl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.writelineFmt1/vb/wl.vb" id="Snippet1"::: @@ -7348,7 +7286,6 @@ This method can be used to reacquire the standard output stream after it has bee ## Examples The following example demonstrates the standard formatting specifiers for numbers, dates, and enumerations. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/Write/wl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.writelineFmt1/fs/wl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.writelineFmt1/vb/wl.vb" id="Snippet1"::: @@ -7448,8 +7385,6 @@ This method can be used to reacquire the standard output stream after it has bee For more information about the line terminator, see the Remarks section of the method that takes no parameters. - - ## Examples The following example illustrates the use of variable arguments with the method. The method is called with a composite format string and five format items. diff --git a/xml/System/ConsoleCancelEventArgs.xml b/xml/System/ConsoleCancelEventArgs.xml index f3fc91cddbb..06e6f1304b6 100644 --- a/xml/System/ConsoleCancelEventArgs.xml +++ b/xml/System/ConsoleCancelEventArgs.xml @@ -61,7 +61,6 @@ ## Examples The following example demonstrates how to use the class to handle an event. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/CancelKeyPress/ckp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cancelkeypress/fs/ckp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: @@ -122,7 +121,6 @@ ## Examples The following example demonstrates how to use the property to handle an event. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/CancelKeyPress/ckp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cancelkeypress/fs/ckp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: @@ -182,7 +180,6 @@ ## Examples The following example demonstrates how to use the property to handle an event. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Console/CancelKeyPress/ckp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cancelkeypress/fs/ckp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: diff --git a/xml/System/ConsoleCancelEventHandler.xml b/xml/System/ConsoleCancelEventHandler.xml index 3221a96d317..1e266232ed0 100644 --- a/xml/System/ConsoleCancelEventHandler.xml +++ b/xml/System/ConsoleCancelEventHandler.xml @@ -60,21 +60,18 @@ A object that contains the event data. Represents the method that will handle the event of a . - delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see [Handling and Raising Events](/dotnet/standard/events/). - - - -## Examples - The following code example demonstrates how to use the class to handle an event. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp" id="Snippet1"::: + delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see [Handling and Raising Events](/dotnet/standard/events/). + +## Examples + The following code example demonstrates how to use the class to handle an event. + :::code language="csharp" source="~/snippets/csharp/System/Console/CancelKeyPress/ckp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cancelkeypress/fs/ckp.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/ConsoleKey.xml b/xml/System/ConsoleKey.xml index 7d99cf6dcd0..2ada2cca609 100644 --- a/xml/System/ConsoleKey.xml +++ b/xml/System/ConsoleKey.xml @@ -50,21 +50,18 @@ Specifies the standard keys on a console. - enumeration is typically used in the nfo structure, which is returned by the method to indicate which key on the console has been pressed. - - - -## Examples - The following example uses the enumeration to indicate to the user which key the user had pressed. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp" id="Snippet1"::: + enumeration is typically used in the nfo structure, which is returned by the method to indicate which key on the console has been pressed. + +## Examples + The following example uses the enumeration to indicate to the user which key the user had pressed. + :::code language="csharp" source="~/snippets/csharp/System/ConsoleKey/Overview/ConsoleKey1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ConsoleKey/fs/ConsoleKey1.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ConsoleKey/vb/ConsoleKey1.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ConsoleKey/vb/ConsoleKey1.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/ConsoleKeyInfo.xml b/xml/System/ConsoleKeyInfo.xml index 1f61ed5f758..891effcec0d 100644 --- a/xml/System/ConsoleKeyInfo.xml +++ b/xml/System/ConsoleKeyInfo.xml @@ -64,23 +64,22 @@ Describes the console key that was pressed, including the character represented by the console key and the state of the SHIFT, ALT, and CTRL modifier keys. - type is not intended to be created by users. Instead, it is returned to the user in response to calling the method. - - The object describes the constant and Unicode character, if any, that correspond to the pressed console key. The object also describes, in a bitwise combination of values, whether one or more SHIFT, ALT, or CTRL modifier keys was pressed simultaneously with the console key. - - - -## Examples - The following example demonstrates using a object in a read operation. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp" id="Snippet1"::: + type is not intended to be created by users. Instead, it is returned to the user in response to calling the method. + + The object describes the constant and Unicode character, if any, that correspond to the pressed console key. The object also describes, in a bitwise combination of values, whether one or more SHIFT, ALT, or CTRL modifier keys was pressed simultaneously with the console key. + + + +## Examples + The following example demonstrates using a object in a read operation. + :::code language="csharp" source="~/snippets/csharp/System/Console/ReadKey/rk.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.readkey1/FS/rk.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: + ]]> @@ -137,13 +136,13 @@ to indicate that a CTRL key was pressed; otherwise, . Initializes a new instance of the structure using the specified character, console key, and modifier keys. - method. - - The type does not specify whether the left or right SHIFT, ALT, or CTRL modifier key was pressed. - + method. + + The type does not specify whether the left or right SHIFT, ALT, or CTRL modifier key was pressed. + ]]> The numeric value of the parameter is less than 0 or greater than 255. @@ -208,13 +207,13 @@ if is equal to the current object; otherwise, . - objects are equal if their corresponding , , and properties are equal. - - The method performs slightly better than the method because it does not have to convert `obj` to an object. - + objects are equal if their corresponding , , and properties are equal. + + The method performs slightly better than the method because it does not have to convert `obj` to an object. + ]]> @@ -271,21 +270,20 @@ if is a object and is equal to the current object; otherwise, . - objects are equal if their corresponding , , and properties are equal. - - - -## Examples - The following example demonstrates the method. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp" id="Snippet1"::: + objects are equal if their corresponding , , and properties are equal. + + + +## Examples + The following example demonstrates the method. + :::code language="csharp" source="~/snippets/csharp/System/ConsoleKeyInfo/Equals/equals.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/fs/equals.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/vb/equals.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/vb/equals.vb" id="Snippet1"::: + ]]> @@ -330,21 +328,20 @@ Returns the hash code for the current object. A 32-bit signed integer hash code. - method is not suitable for distinguishing one object from another. If your application needs a unique hash code, override the method with your own method. - - - -## Examples - The following example demonstrates the method. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp" id="Snippet1"::: + method is not suitable for distinguishing one object from another. If your application needs a unique hash code, override the method with your own method. + + + +## Examples + The following example demonstrates the method. + :::code language="csharp" source="~/snippets/csharp/System/ConsoleKeyInfo/GetHashCode/hash.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/fs/hash.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/vb/hash.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/vb/hash.vb" id="Snippet1"::: + ]]> @@ -388,16 +385,15 @@ Gets the console key represented by the current object. A value that identifies the console key that was pressed. - property in a read operation. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp" id="Snippet1"::: + property in a read operation. + :::code language="csharp" source="~/snippets/csharp/System/Console/ReadKey/rk.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.readkey1/FS/rk.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: + ]]> @@ -441,20 +437,20 @@ Gets the Unicode character represented by the current object. An object that corresponds to the console key represented by the current object. - property is \U0000. - - - -## Examples - The following example uses the property to add the characters input by the user into a string. The example ignores special keys other than **ENTER**, **ESC**, and **BACKSPACE**. - + property is \U0000. + + + +## Examples + The following example uses the property to add the characters input by the user into a string. The example ignores special keys other than **ENTER**, **ESC**, and **BACKSPACE**. + :::code language="csharp" source="~/snippets/csharp/System/ConsoleKeyInfo/KeyChar/keychar1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.consolekeyinfo.keychar/fs/keychar1.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.consolekeyinfo.keychar/vb/keychar1.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.consolekeyinfo.keychar/vb/keychar1.vb" id="Snippet1"::: + ]]> @@ -498,16 +494,15 @@ Gets a bitwise combination of values that specifies one or more modifier keys pressed simultaneously with the console key. A bitwise combination of the enumeration values. There is no default value. - property in a read operation. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp" id="Snippet1"::: + property in a read operation. + :::code language="csharp" source="~/snippets/csharp/System/Console/ReadKey/rk.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.readkey1/FS/rk.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: + ]]> @@ -558,11 +553,11 @@ if is equal to ; otherwise, . - objects are equal if their corresponding , , and properties are equal. - + objects are equal if their corresponding , , and properties are equal. + The equivalent method for this operator is .]]> @@ -613,11 +608,11 @@ if is not equal to ; otherwise, . - objects are equal if their corresponding , , and properties are equal. - + objects are equal if their corresponding , , and properties are equal. + ]]> diff --git a/xml/System/ConsoleModifiers.xml b/xml/System/ConsoleModifiers.xml index 1ae04d23c7f..909239a9869 100644 --- a/xml/System/ConsoleModifiers.xml +++ b/xml/System/ConsoleModifiers.xml @@ -54,23 +54,20 @@ Represents the SHIFT, ALT, and CTRL modifier keys on a keyboard. - enumeration is used in conjunction with the type. - - - -## Examples - The following code example reads a key and determines whether one or more modifier keys was pressed. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp" id="Snippet1"::: + enumeration is used in conjunction with the type. + +## Examples + The following code example reads a key and determines whether one or more modifier keys was pressed. + :::code language="csharp" source="~/snippets/csharp/System/Console/ReadKey/rk.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.readkey1/FS/rk.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.readkey1/VB/rk.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/ConsoleSpecialKey.xml b/xml/System/ConsoleSpecialKey.xml index 686f7e0f3fb..747a498ccba 100644 --- a/xml/System/ConsoleSpecialKey.xml +++ b/xml/System/ConsoleSpecialKey.xml @@ -50,23 +50,20 @@ Specifies combinations of modifier and console keys that can interrupt the current process. - property returns the enumeration type. - - Simultaneously pressing certain key combinations signals the operating system to interrupt the currently running process. The two valid key combinations are plus BREAK (CTRL+BREAK) and plus (CTRL+C). - - - -## Examples - The following code example displays the value that invokes the associated event handler. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp" id="Snippet1"::: + property returns the enumeration type. + + Simultaneously pressing certain key combinations signals the operating system to interrupt the currently running process. The two valid key combinations are plus BREAK (CTRL+BREAK) and plus (Ctrl+C). + +## Examples + The following code example displays the value that invokes the associated event handler. + :::code language="csharp" source="~/snippets/csharp/System/Console/CancelKeyPress/ckp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/console.cancelkeypress/fs/ckp.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/console.cancelkeypress/vb/ckp.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/Convert.xml b/xml/System/Convert.xml index 9aca9dac108..9a6d3bec974 100644 --- a/xml/System/Convert.xml +++ b/xml/System/Convert.xml @@ -169,12 +169,9 @@ This method uses the current thread's culture for the conversion. - - ## Examples The following example illustrates the use of the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/convertchangetype.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/convertchangetype.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/convertchangetype/VB/convertchangetype.vb" id="Snippet1"::: @@ -282,7 +279,6 @@ ## Examples The following example illustrates how to use the method to change an to the type specified by the parameter, if possible. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype01.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype01.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype01.vb" id="Snippet2"::: @@ -391,14 +387,12 @@ ## Examples The following example defines a `Temperature` class that implements the interface. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype03.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype03.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype03.vb" id="Snippet3"::: The following example creates an instance of the `Temperature` class and calls the method to convert it to the basic numeric types supported by .NET and to a . It illustrates that the method wraps a call to the source type's implementation. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype03.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype03.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype03.vb" id="Snippet4"::: @@ -510,7 +504,6 @@ ## Examples The following example defines a custom format provider named `InterceptProvider` that indicates when its method is called and returns a for the fr-FR culture and a object for the en-US culture. This format provider is used in all calls to the method. The example then creates an array with a and a value and makes repeated calls to with each value and each member of the enumeration. The example illustrates when the method uses the parameter and also illustrates the use of the `provider` parameter to perform culture-sensitive formatting. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype00.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype00.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype00.vb" id="Snippet1"::: @@ -672,7 +665,6 @@ ## Examples The following example demonstrates the use of the method to decode UUencoded (base-64) data and save it as binary output. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/class1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/class1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/VB/class1.vb" id="Snippet3"::: @@ -681,7 +673,6 @@ If an integral number of 3-byte groups does not exist, the remaining bytes are effectively padded with zeros to form a complete group. In this example, the value of the last byte is hexadecimal FF. The first 6 bits are equal to decimal 63, which corresponds to the base-64 digit "/" at the end of the output, and the next 2 bits are padded with zeros to yield decimal 48, which corresponds to the base-64 digit, "w". The last two 6-bit values are padding and correspond to the valueless padding character, "=". - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/tb64ca.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/tb64ca.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/convert.tobase64chararray/VB/tb64ca.vb" id="Snippet1"::: @@ -1200,7 +1191,6 @@ ## Examples The following example demonstrates using the method to UUencode (encode in base 64) a binary stream, then save the encoding to a file. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/class1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/class1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/VB/class1.vb" id="Snippet2"::: @@ -1310,7 +1300,6 @@ If an integral number of 3-byte groups does not exist, the remaining bytes are effectively padded with zeros to form a complete group. In this example, the value of the last byte is hexadecimal FF. The first 6 bits are equal to decimal 63, which corresponds to the base-64 digit "/" at the end of the output, and the next 2 bits are padded with zeros to yield decimal 48, which corresponds to the base-64 digit, "w". The last two 6-bit values are padding and correspond to the valueless padding character, "=". - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/tb64ca.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/tb64ca.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/convert.tobase64chararray/VB/tb64ca.vb" id="Snippet1"::: @@ -1734,7 +1723,6 @@ If an integral number of 3-byte groups does not exist, the remaining bytes are effectively padded with zeros to form a complete group. In this example, the value of the last byte is hexadecimal FF. The first 6 bits are equal to decimal 63, which corresponds to the base-64 digit "/" at the end of the output, and the next 2 bits are padded with zeros to yield decimal 48, which corresponds to the base-64 digit, "w". The last two 6-bit values are padding and correspond to the valueless padding character, "=". - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBase64String/tb64s.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBase64String/tb64s.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/convert.tobase64string/VB/tb64s.vb" id="Snippet1"::: @@ -1875,7 +1863,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet12"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet12"::: @@ -1986,7 +1973,6 @@ ## Examples The following example demonstrates that an attempt to convert a value to a Boolean type throws . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet20"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet20"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet20"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet20"::: @@ -2051,7 +2037,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet2"::: @@ -2116,7 +2101,6 @@ ## Examples The following example converts a Boolean to a and a to a Boolean value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet1"::: @@ -2181,7 +2165,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet3"::: @@ -2246,7 +2229,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet4"::: @@ -2311,7 +2293,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet5"::: @@ -2384,7 +2365,6 @@ ## Examples The following example converts an array of object values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet11"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet11"::: @@ -2463,7 +2443,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet6"::: @@ -2528,7 +2507,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet7"::: @@ -2608,7 +2586,6 @@ ## Examples The following example uses the method to convert various strings to Boolean values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/ToBoolean1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/ToBoolean1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/ToBoolean1.vb" id="Snippet1"::: @@ -2681,7 +2658,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet8"::: @@ -2752,7 +2728,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet9"::: @@ -2823,7 +2798,6 @@ ## Examples The following example converts an array of values to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" interactive="try-dotnet-method" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToBoolean/vb/toboolean2.vb" id="Snippet10"::: @@ -2903,7 +2877,6 @@ ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the method. This method returns `true` if any of the non-discarded array values are non-zero. The object determines how elements are discarded for this calculation. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/VB/objectifp.vb" id="Snippet1"::: @@ -3059,7 +3032,6 @@ ## Examples The following example illustrates the conversion of to values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.tobyte/vb/tobyte1.vb" id="Snippet1"::: @@ -3291,7 +3263,6 @@ ## Remarks The following example converts a value to a and a value to a . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet18"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet18"::: @@ -3357,7 +3328,6 @@ ## Examples The following example converts a value to a and a value to a . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet2"::: @@ -3763,7 +3733,6 @@ ## Examples The following example converts a value to a . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet19"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet19"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet19"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet19"::: @@ -4589,7 +4558,6 @@ ## Examples The following example attempts to convert a to , and throws on failure. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet17"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet17"::: @@ -4830,7 +4798,6 @@ ## Examples The following example attempts to convert a long integer to a , and throws a on failure. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet8"::: @@ -5382,7 +5349,6 @@ ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToChar` method. This method returns a character whose Unicode value is the average of the array of values, using the object that implements to determine how to calculate the average. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/VB/objectifp.vb" id="Snippet1"::: @@ -5472,7 +5438,6 @@ ## Examples The following example converts a string representation of a value with the `ToChar` method, using an object that displays the type of the format provider for which it is called. The example shows that the format provider is not referenced. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/stringnonnum.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/stringnonnum.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/VB/stringnonnum.vb" id="Snippet2"::: @@ -6655,7 +6620,6 @@ ## Examples The following example converts a value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet18"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet18"::: @@ -6716,7 +6680,6 @@ ## Examples The following example attempts to convert a value to , and throws upon failure. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet17"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet17"::: @@ -6891,7 +6854,6 @@ ## Examples The following example converts a value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet5"::: @@ -7084,7 +7046,6 @@ ## Examples The following example converts an value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet10"::: @@ -7376,7 +7337,6 @@ ## Examples The following example illustrates the use of `ToDecimal`. It attempts to convert a to a , and throws the possible exceptions that may arise during the conversion. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet15"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet15"::: @@ -7829,7 +7789,6 @@ ## Examples The following example converts a value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet1"::: @@ -7892,7 +7851,6 @@ ## Examples The following example converts a value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet2"::: @@ -8054,7 +8012,6 @@ ## Examples The following example converts a value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet5"::: @@ -8232,7 +8189,6 @@ ## Examples The following example converts an value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet3"::: @@ -8503,7 +8459,6 @@ ## Examples The following example converts a value to a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet6"::: @@ -8857,7 +8812,6 @@ ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToDouble` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/VB/objectifp.vb" id="Snippet1"::: @@ -10063,7 +10017,6 @@ ## Examples The following example converts string representations of 16-bit integers with the `ToInt16` method, using default formatting. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToSInts_String/VB/toint16.vb" id="Snippet3"::: @@ -10351,7 +10304,6 @@ ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToInt16` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/VB/objectifp.vb" id="Snippet1"::: @@ -10430,7 +10382,6 @@ ## Examples The following example converts string representations of 16-bit integers with the `ToInt16` method, using an object. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToSInts_String/VB/toint16.vb" id="Snippet3"::: @@ -11672,7 +11623,6 @@ ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToInt32` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/VB/objectifp.vb" id="Snippet1"::: @@ -11824,14 +11774,12 @@ Because the negative sign is not supported for non-base 10 numeric representations, the method assumes that negative numbers use two's complement representation. In other words, the method always interprets the highest-order binary bit of an integer (bit 31) as its sign bit. As a result, it is possible to write code in which a non-base 10 number that is out of the range of the data type is converted to an value without the method throwing an exception. The following example increments by one, converts the resulting number to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0x80000000 converts to -2147483648." - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.BaseConversion/vb/Conversion.vb" id="Snippet1"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method is using the appropriate numeric representation to interpret a particular value. As the following example illustrates, you can ensure that the method handles overflows appropriately by first retrieving the sign of the numeric value before converting it to its hexadecimal string representation. Throw an exception if the original value was positive but the conversion back to an integer yields a negative value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.BaseConversion/vb/Conversion.vb" id="Snippet2"::: @@ -12977,7 +12925,6 @@ ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToInt64` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/VB/objectifp.vb" id="Snippet1"::: @@ -14082,7 +14029,6 @@ ## Examples The following example converts string representations of values with the `ToSByte` method, using default formatting. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/tosbyte.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/tosbyte.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToSInts_String/VB/tosbyte.vb" id="Snippet4"::: @@ -14477,7 +14423,6 @@ ## Examples The following example converts string representations of values with the `ToSByte` method, using an object. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/tosbyte.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/tosbyte.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToSInts_String/VB/tosbyte.vb" id="Snippet4"::: @@ -15997,7 +15942,6 @@ ## Examples The following example converts a to a . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet14"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet14"::: @@ -16132,7 +16076,6 @@ ## Examples The following example converts a to a . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet15"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet15"::: @@ -16200,7 +16143,6 @@ ## Examples The following example converts a to a . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert Snippets/VB/system.convert snippet.vb" id="Snippet7"::: @@ -16971,7 +16913,6 @@ ## Examples The following example converts a value to a with the `ToString` method, using an object that displays the type of the format provider for which it is called. The example shows that the object is not referenced. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/nonnumeric.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/nonnumeric.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/VB/nonnumeric.vb" id="Snippet2"::: @@ -17204,7 +17145,6 @@ ## Examples The following example converts a value to a with the `ToString` method, using an object that displays the type of the format provider for which it is called. The example shows that the object is not referenced. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/nonnumeric.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/nonnumeric.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/VB/nonnumeric.vb" id="Snippet2"::: @@ -18208,7 +18148,6 @@ ## Examples The following example calls the `ToString` method with a parameter. The method returns the unmodified without referencing the object. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/nonnumeric.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/nonnumeric.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/VB/nonnumeric.vb" id="Snippet2"::: diff --git a/xml/System/Converter`2.xml b/xml/System/Converter`2.xml index 6c8405f30c1..b4c5412d8ab 100644 --- a/xml/System/Converter`2.xml +++ b/xml/System/Converter`2.xml @@ -82,29 +82,27 @@ Represents a method that converts an object from one type to another type. The that represents the converted . - method of the class and the method of the class to convert each element of the collection from one type to another. - - - -## Examples - This section contains two code examples. The first demonstrates the delegate with the method of the class, and the second demonstrates the delegate with the method of the generic class. - - Example 1 - - The following code example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates an array of structures, creates a `Converter` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. Both lists are displayed. + method of the class and the method of the class to convert each element of the collection from one type to another. + + + +## Examples + This section contains two code examples. The first demonstrates the delegate with the method of the class, and the second demonstrates the delegate with the method of the generic class. + + Example 1 + + The following code example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates an array of structures, creates a `Converter` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. Both lists are displayed. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Array/ConvertAllTInput,TOutput/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Array_ConvertAll/vb/source.vb" id="Snippet1"::: - Example 2 - - The following code example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates a of structures, creates a `Converter` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. Both lists are displayed. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp" id="Snippet1"::: + Example 2 + + The following code example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates a of structures, creates a `Converter` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. Both lists are displayed. + :::code language="csharp" source="~/snippets/csharp/System/ConverterTInput,TOutput/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_ConvertAll/vb/source.vb" id="Snippet1"::: diff --git a/xml/System/DateTime.xml b/xml/System/DateTime.xml index c8b649bb31d..48a5311fb4a 100644 --- a/xml/System/DateTime.xml +++ b/xml/System/DateTime.xml @@ -208,12 +208,9 @@ For applications in which portability of date and time data or a limited degree of time zone awareness is important, you can use the corresponding constructor. - - ## Examples The following example demonstrates one of the constructors. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/datetime.ctor_Int64/FS/ticks.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/.ctor/ticks.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/datetime.ctor_Int64/VB/ticks.vb" id="Snippet1"::: @@ -1654,7 +1651,6 @@ For applications in which portability of date and time data or a limited degree ## Examples The following example demonstrates the method. It calculates the day of the week that is 36 days (864 hours) from this moment. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.Add/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Add/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.Add/VB/class1.vb" id="Snippet1"::: @@ -1728,7 +1724,6 @@ For applications in which portability of date and time data or a limited degree ## Examples The following example uses the method to determine the day of the week 36 days after the current date. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.AddDays/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/AddDays/class1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.AddDays/VB/class1.vb" id="Snippet1"::: @@ -1991,7 +1986,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example uses the method to add a number of whole and fractional values to a date and time. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/AddMinutes/addminutes1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.datetime.addminutes/fs/addminutes1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.datetime.addminutes/vb/addminutes1.vb" id="Snippet1"::: @@ -2560,7 +2554,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.CompareTo/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/CompareTo/class1.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.CompareTo/VB/class1.vb" id="Snippet1"::: @@ -2634,7 +2627,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example uses the property to extract the date component of a value with its time component set to zero (or 0:00:00, or midnight). It also illustrates that, depending on the format string used when displaying the value, the time component can continue to appear in formatted output. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Date/Date1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Date/fs/Date1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Date/vb/Date1.vb" id="Snippet1"::: @@ -2704,7 +2696,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Day/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1"::: @@ -2774,7 +2765,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example demonstrates the property and the enumeration. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.DayOfWeek/FS/dow.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/DayOfWeek/dow.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.DayOfWeek/VB/dow.vb" id="Snippet1"::: @@ -2906,7 +2896,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example demonstrates how to use the method to determine the number of days in July 2001, February 1998 (a non-leap year), and February 1996 (a leap year). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.DaysInMonth/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/DaysInMonth/class1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.DaysInMonth/VB/class1.vb" id="Snippet1"::: @@ -3229,7 +3218,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.Equals/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Equals/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.Equals/VB/class1.vb" id="Snippet1"::: @@ -3353,7 +3341,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.FromFileTime/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/FromFileTime/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.FromFileTime/VB/class1.vb" id="Snippet1"::: @@ -3584,7 +3571,6 @@ The value parameter is rounded to the nearest integer. ## Examples The following example demonstrates the method. It displays the string representation of a date using all possible standard date and time formats in the computer's current culture, which in this case is en-US. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/GetDateTimeFormats/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.GetDateTimeFormats/VB/class1.vb" id="Snippet1"::: @@ -3875,7 +3861,6 @@ July, 2009 ## Examples The following example demonstrates the method. It displays the string representation of a date using all possible standard date and time formats for the fr-FR culture. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/FS/class1.fs" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/GetDateTimeFormats/class1.cs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.GetDateTimeFormats/VB/class1.vb" id="Snippet2"::: @@ -4244,7 +4229,6 @@ juillet 2009 ## Examples The following example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Day/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1"::: @@ -4618,7 +4602,6 @@ juillet 2009 ## Examples The following example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Day/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1"::: @@ -4681,7 +4664,6 @@ juillet 2009 ## Examples The following example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Day/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1"::: @@ -4806,7 +4788,6 @@ juillet 2009 ## Examples The following example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Day/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1"::: @@ -4893,7 +4874,6 @@ juillet 2009 ## Remarks The property returns a value that represents the current date and time on the local computer. Note that there is a difference between a value, which represents the number of ticks that have elapsed since midnight of January 1, 0001, and the string representation of that value, which expresses a date and time value in a culture-specific-specific format. For information on formatting date and time values, see the method. The following example displays the short date and time string in a number of culture-specific formats. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Now/now1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.datetime.now/fs/now1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.datetime.now/vb/now1.vb" id="Snippet2"::: @@ -4912,7 +4892,6 @@ juillet 2009 ## Examples The following example uses the and properties to retrieve the current local date and time and the current universal coordinated (UTC) date and time. It then uses the formatting conventions of a number of cultures to display the strings, along with the values of their properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Now/now2.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.datetime.now/fs/now2.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.datetime.now/vb/now2.vb" id="Snippet3"::: @@ -4977,7 +4956,6 @@ juillet 2009 ## Examples The following example demonstrates the addition operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime Operators/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/op_Addition/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime Operators/VB/class1.vb" id="Snippet1"::: @@ -5057,7 +5035,6 @@ juillet 2009 ## Examples The following example demonstrates the equality operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime Operators/FS/class1.fs" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/op_Addition/class1.cs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime Operators/VB/class1.vb" id="Snippet2"::: @@ -5479,7 +5456,6 @@ juillet 2009 ## Examples The following example demonstrates the method and the subtraction operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.Subtraction/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/op_Subtraction/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.Subtraction/VB/class1.vb" id="Snippet1"::: @@ -5550,7 +5526,6 @@ juillet 2009 ## Examples The following example demonstrates the method and the subtraction operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.Subtraction/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/op_Subtraction/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.Subtraction/VB/class1.vb" id="Snippet1"::: @@ -6736,7 +6711,6 @@ The following example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Day/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1"::: @@ -6904,7 +6878,6 @@ The following example demonstrates the method and the subtraction operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.Subtraction/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/op_Subtraction/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.Subtraction/VB/class1.vb" id="Snippet1"::: @@ -6994,7 +6967,6 @@ The following example demonstrates the method and the subtraction operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.Subtraction/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/op_Subtraction/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.Subtraction/VB/class1.vb" id="Snippet1"::: @@ -8272,7 +8244,6 @@ In general, the ticks represent the time according to the time zone specified by ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.ToFileTime/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/ToFileTime/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.ToFileTime/VB/class1.vb" id="Snippet1"::: @@ -8432,7 +8403,6 @@ In general, the ticks represent the time according to the time zone specified by ## Examples The following example demonstrates the method. Note that the exact output depends on the current culture and the local time zone of the system on which it is run. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/ToLocalTime/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/VB/class1.vb" id="Snippet1"::: @@ -9228,7 +9198,6 @@ The following example illustrates how the string representation of a value using the invariant . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/FS/source.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/ToString/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/VB/source.vb" id="Snippet1"::: @@ -9329,7 +9298,6 @@ The following example illustrates how the string representation of a method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/FS/class1.fs" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/ToLocalTime/class1.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/VB/class1.vb" id="Snippet1"::: @@ -9622,7 +9590,6 @@ The following example illustrates how the string representation of a method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/TryParse/TryParse1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.TryParse/fs/TryParse1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.TryParse/vb/TryParse1.vb" id="Snippet1"::: @@ -10485,7 +10452,6 @@ The following example illustrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/Day/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/FS/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1"::: diff --git a/xml/System/DayOfWeek.xml b/xml/System/DayOfWeek.xml index 99dcc0e3325..f070ca8c127 100644 --- a/xml/System/DayOfWeek.xml +++ b/xml/System/DayOfWeek.xml @@ -60,23 +60,22 @@ Specifies the day of the week. - enumeration represents the day of the week in calendars that have seven days per week. The value of the constants in this enumeration ranges from Sunday to Saturday. If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday). + + This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. For example, this enumeration is the type of the property value for the and properties. + + The members of the enumeration are not localized. To return the localized name of the day of the week, call the or the method with either the "ddd" or "dddd" format strings. The former format string produces the abbreviated weekday name; the latter produces the full weekday name. + +## Examples + The following example demonstrates the property and the enumeration. -## Remarks - The enumeration represents the day of the week in calendars that have seven days per week. The value of the constants in this enumeration ranges from Sunday to Saturday. If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday). - - This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. For example, this enumeration is the type of the property value for the and properties. - - The members of the enumeration are not localized. To return the localized name of the day of the week, call the or the method with either the "ddd" or "dddd" format strings. The former format string produces the abbreviated weekday name; the latter produces the full weekday name. - -## Examples - The following example demonstrates the property and the enumeration. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/DateTime/DayOfWeek/dow.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/DateTime.DayOfWeek/FS/dow.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/DateTime.DayOfWeek/VB/dow.vb" id="Snippet1"::: - + ]]> diff --git a/xml/System/Decimal.xml b/xml/System/Decimal.xml index e3e2bc3a8c5..66ac5ba54fa 100644 --- a/xml/System/Decimal.xml +++ b/xml/System/Decimal.xml @@ -348,12 +348,9 @@ ## Remarks This constructor rounds `value` to 15 significant digits using rounding to nearest. This is done even if the number has more than 15 digits and the less significant digits are zero. - - ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctordo.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctordo.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/VB/ctordo.vb" id="Snippet2"::: @@ -416,7 +413,6 @@ ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with an value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctori.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctori.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/VB/ctori.vb" id="Snippet1"::: @@ -494,7 +490,6 @@ ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with an array of four values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctoriarr.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctoriarr.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/VB/ctoriarr.vb" id="Snippet1"::: @@ -559,7 +554,6 @@ ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with an value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctorl.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctorl.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/VB/ctorl.vb" id="Snippet3"::: @@ -660,7 +654,6 @@ ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctors.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctors.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/VB/ctors.vb" id="Snippet1"::: @@ -729,7 +722,6 @@ ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctorui.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctorui.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/VB/ctorui.vb" id="Snippet2"::: @@ -792,7 +784,6 @@ ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with a value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctorul.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctorul.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/VB/ctorul.vb" id="Snippet4"::: @@ -863,7 +854,6 @@ ## Examples The following code example creates several `Decimal` numbers using the constructor overload that initializes a `Decimal` structure with three value words, a sign, and a scale factor. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/.ctor/ctoriiibby.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/.ctor/ctoriiibby.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/VB/ctoriiibby.vb" id="Snippet2"::: @@ -978,7 +968,6 @@ ## Remarks The following code sample illustrates the use of `Add` : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/Overview/source.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/Overview/source.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Decimal Example/VB/source.vb" id="Snippet5"::: @@ -1297,7 +1286,6 @@ ## Examples The following code example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -1390,7 +1378,6 @@ ## Examples The following code example compares several `Decimal` and other objects to a reference `Decimal` value using the `CompareTo` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/CompareTo/cto_eq_obj.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/CompareTo/cto_eq_obj.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/VB/cto_eq_obj.vb" id="Snippet1"::: @@ -1934,7 +1921,6 @@ ## Examples The following code example compares several `Decimal` and other objects to a reference `Decimal` value using the `Equals` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/CompareTo/cto_eq_obj.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/CompareTo/cto_eq_obj.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/VB/cto_eq_obj.vb" id="Snippet1"::: @@ -2013,7 +1999,6 @@ ## Examples The following code example compares several `Decimal` values to a reference `Decimal` value using the static `Equals` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/CompareTo/comp_equal.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/CompareTo/comp_equal.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/VB/comp_equal.vb" id="Snippet2"::: @@ -2155,7 +2140,6 @@ ## Examples The following code example uses the `FromOACurrency` method to convert fields that contain OLE Automation Currency values to the equivalent `Decimal` numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/FromOACurrency/fromoacurrency.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/FromOACurrency/fromoacurrency.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.OACurrency/VB/fromoacurrency.vb" id="Snippet2"::: @@ -2238,7 +2222,6 @@ ## Examples The following example uses the `GetBits` method to convert several `Decimal` values to their equivalent binary representations. It then displays the decimal values and the hexadecimal value of the elements in the array returned by the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/GetBits/getbits.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/GetBits/getbits.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/VB/getbits.vb" id="Snippet2"::: @@ -2394,7 +2377,6 @@ ## Examples The following code example uses the `GetTypeCode` method to return the type code for `Decimal` value type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/GetBits/gettypecode.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/GetBits/gettypecode.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/VB/gettypecode.vb" id="Snippet3"::: @@ -2831,7 +2813,6 @@ For , this method matches the IE ## Examples The following code sample illustrates the use of `MaxValue` : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/Overview/source.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/Overview/source.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Decimal Example/VB/source.vb" id="Snippet2"::: @@ -2989,7 +2970,6 @@ For , this method matches the IE ## Examples The following code example illustrates the use of the `MinusOne` field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/MinusOne/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/MinusOne/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Fields/VB/fields.vb" id="Snippet1"::: @@ -3054,7 +3034,6 @@ For , this method matches the IE ## Examples The following code example illustrates the use of the `MinValue` field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/MinusOne/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/MinusOne/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Fields/VB/fields.vb" id="Snippet1"::: @@ -3127,7 +3106,6 @@ For , this method matches the IE ## Examples The following code example creates several pairs of `Decimal` values and calculates their products with the `Multiply` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/Multiply/mul_div_rem.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/Multiply/mul_div_rem.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/VB/mul_div_rem.vb" id="Snippet1"::: @@ -3196,7 +3174,6 @@ For , this method matches the IE ## Examples The following code example uses the `Negate` method to change the sign of several `Decimal` values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/Negate/floor_neg_trunc.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/Negate/floor_neg_trunc.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/VB/floor_neg_trunc.vb" id="Snippet1"::: @@ -3252,7 +3229,6 @@ For , this method matches the IE ## Examples The following code example illustrates the use of the `One` field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/MinusOne/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/MinusOne/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Fields/VB/fields.vb" id="Snippet1"::: @@ -3640,7 +3616,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctos_byte.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctos_byte.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctos_byte.vb" id="Snippet4"::: @@ -3777,7 +3752,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctosgl_dbl.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctosgl_dbl.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctosgl_dbl.vb" id="Snippet5"::: @@ -3844,7 +3818,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctou_int16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctou_int16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctou_int16.vb" id="Snippet3"::: @@ -3912,7 +3885,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctou_int32.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctou_int32.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctou_int32.vb" id="Snippet2"::: @@ -3979,7 +3951,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctou_int64.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctou_int64.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctou_int64.vb" id="Snippet1"::: @@ -4055,7 +4026,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/tosbyte.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/tosbyte.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.decimal.operators.explicit/vb/tosbyte.vb" id="Snippet1"::: @@ -4126,7 +4096,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/tosingle1.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/tosingle1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.decimal.operators.explicit/vb/tosingle1.vb" id="Snippet2"::: @@ -4200,7 +4169,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctou_int16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctou_int16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctou_int16.vb" id="Snippet3"::: @@ -4276,7 +4244,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctou_int32.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctou_int32.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctou_int32.vb" id="Snippet2"::: @@ -4353,7 +4320,6 @@ For , this method matches the IE ## Examples The following example converts numbers to values by using the explicit to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/ctou_int64.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/ctou_int64.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvTo/VB/ctou_int64.vb" id="Snippet1"::: @@ -4418,7 +4384,6 @@ For , this method matches the IE The following example converts values to numbers by using the to conversion operator. This conversion requires the op_Explicit operator in Visual Basic. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/cfromdouble.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/cfromdouble.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/VB/cfromdouble.vb" id="Snippet2"::: @@ -4486,7 +4451,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers by using the to conversion operator. This conversion requires the op_Explicit operator in Visual Basic. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/cfromsingle.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/cfromsingle.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/VB/cfromsingle.vb" id="Snippet3"::: @@ -4733,7 +4697,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfrombyte.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfrombyte.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/VB/cfrombyte.vb" id="Snippet4"::: @@ -4798,7 +4761,6 @@ For , this method matches the IE ## Examples The following example converts values (Unicode characters) to numbers. This conversion requires the op_Implicit operator in Visual Basic, but not in C# and C++. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Explicit/cfromchar.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Explicit/cfromchar.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/VB/cfromchar.vb" id="Snippet1"::: @@ -4863,7 +4825,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers. This conversion requires the op_Implicit operator in Visual Basic, but not in C# and C++. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfromint16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfromint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/VB/cfromint16.vb" id="Snippet3"::: @@ -4928,7 +4889,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfromint32.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfromint32.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/VB/cfromint32.vb" id="Snippet2"::: @@ -4993,7 +4953,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfromint64.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfromint64.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/VB/cfromint64.vb" id="Snippet1"::: @@ -5066,7 +5025,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfromsbyte.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfromsbyte.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/VB/cfromsbyte.vb" id="Snippet4"::: @@ -5139,7 +5097,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfromuint16.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfromuint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/VB/cfromuint16.vb" id="Snippet3"::: @@ -5212,7 +5169,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfromuint32.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfromuint32.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/VB/cfromuint32.vb" id="Snippet2"::: @@ -5285,7 +5241,6 @@ For , this method matches the IE ## Examples The following example converts values to numbers by using the to conversion operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/op_Implicit/cfromuint64.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/op_Implicit/cfromuint64.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/VB/cfromuint64.vb" id="Snippet1"::: @@ -7150,7 +7105,6 @@ It is recommended that a function return `1`, `0`, and `-1`, respectively. ## Examples The following example illustrates the use of `Subtract`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/Overview/source.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/Overview/source.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Decimal Example/VB/source.vb" id="Snippet4"::: @@ -9967,7 +9921,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following code example converts `Decimal` numbers to values using `ToDouble` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/ToDouble/tosgl_dbl.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/ToDouble/tosgl_dbl.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.ToXXX/VB/tosgl_dbl.vb" id="Snippet5"::: @@ -10245,7 +10198,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following code example uses the `ToOACurrency` method to convert `Decimal` numbers to the equivalent OLE Automation Currency values that are contained in fields. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/FromOACurrency/tooacurrency.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/FromOACurrency/tooacurrency.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.OACurrency/VB/tooacurrency.vb" id="Snippet1"::: @@ -10395,7 +10347,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following code example converts `Decimal` numbers to values using the `ToSingle` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/ToDouble/tosgl_dbl.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/ToDouble/tosgl_dbl.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.ToXXX/VB/tosgl_dbl.vb" id="Snippet5"::: @@ -10496,7 +10447,6 @@ This member is an explicit interface member implementation. It can be used only The following example displays the amount of money in an account. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/Overview/source.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/Overview/source.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Decimal Example/VB/source.vb" id="Snippet5"::: @@ -11129,7 +11079,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following code example uses the `Truncate` method to discard the fractional digits of several `Decimal` values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/Negate/floor_neg_trunc.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/Negate/floor_neg_trunc.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/VB/floor_neg_trunc.vb" id="Snippet1"::: @@ -11919,7 +11868,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following code example illustrates the use of the `Zero` field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Decimal/MinusOne/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Decimal/MinusOne/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Fields/VB/fields.vb" id="Snippet1"::: diff --git a/xml/System/Double.xml b/xml/System/Double.xml index 49786fbe5be..15797b5b48d 100644 --- a/xml/System/Double.xml +++ b/xml/System/Double.xml @@ -1156,7 +1156,6 @@ This computes `arctan(x) / π` in the interval `[-0.5, +0.5]`. method for several value and reference types. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: ]]> @@ -2643,7 +2642,6 @@ A return value of `false` does not imply that : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet11"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" interactive="try-dotnet-method" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet11"::: @@ -2778,7 +2776,6 @@ This method correctly handles floating-point values and so `2.0` and `3.0` will ## Examples The following code example illustrates the use of : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet8"::: @@ -2894,15 +2891,12 @@ This method correctly handles floating-point values and so `2.0` and `3.0` will ## Examples The following code example illustrates the use of : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet13"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet13"::: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet4"::: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet9"::: @@ -3117,7 +3111,6 @@ A return value of `false` does not imply that : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet12"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet12"::: @@ -3868,7 +3861,6 @@ For this method matches the IEEE 754:2 ## Examples The following code example illustrates the use of : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Double/Overview/source.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/Overview/source.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Double Example/VB/source.vb" id="Snippet2"::: @@ -4167,7 +4159,6 @@ For this method matches the IEEE 754:2 ## Examples The following code example illustrates the use of : - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Double/Overview/source.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/Overview/source.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Double Example/VB/source.vb" id="Snippet2"::: @@ -4283,7 +4274,6 @@ Use the method to determine whether a value is not The following example illustrates the use of . -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" interactive="try-dotnet-method" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet7"::: @@ -4348,7 +4338,6 @@ Use to determine whether a value eval The following code example illustrates the use of : -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" interactive="try-dotnet-method" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet9"::: @@ -4861,7 +4850,6 @@ If a separator is encountered in the `s` parameter during a parse operation, and ## Examples The following example illustrates the use of the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Double/Overview/source.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/Overview/source.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Double Example/VB/source.vb" id="Snippet5"::: @@ -5593,7 +5581,6 @@ Use to determine whether a value eval The following code example illustrates the use of : -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" interactive="try-dotnet-method" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet10"::: @@ -9360,7 +9347,6 @@ Tau is approximately 6.2831853071795864769. The following example illustrates the use of . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Double/CompareTo/doublesample.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/CompareTo/doublesample.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double/VB/doublesample.vb" id="Snippet3"::: @@ -9487,7 +9473,6 @@ Tau is approximately 6.2831853071795864769. The following example illustrates the use of , taking a and an as parameters. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Double/Overview/source.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/Overview/source.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Double Example/VB/source.vb" id="Snippet4"::: @@ -9598,7 +9583,6 @@ Tau is approximately 6.2831853071795864769. The following example displays several values using the supported standard numeric format specifiers together with three custom numeric format strings. One of those custom format strings illustrates how to pad a value with leading zeros. In addition, the example uses precision specifiers with each standard format specifier except for "R". The values of the precision specifiers range from 0 to 3. To convert the numeric values to strings, the example uses the formatting conventions of the en-US culture. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Double/ToString/ToString1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/ToString/ToString1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double.ToString/vb/ToString1.vb" id="Snippet3"::: @@ -9717,14 +9701,12 @@ Tau is approximately 6.2831853071795864769. ## Examples The following example displays a value using each of the supported standard numeric format specifiers for several different cultures. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Double/ToString/ToString1.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/ToString/ToString1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Double.ToString/vb/ToString1.vb" id="Snippet4"::: The following example illustrates the use of , taking a and an as parameters. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Double/Overview/source.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Double/Overview/source.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Double Example/VB/source.vb" id="Snippet4"::: diff --git a/xml/System/Enum.xml b/xml/System/Enum.xml index 71556131620..39d7c18a181 100644 --- a/xml/System/Enum.xml +++ b/xml/System/Enum.xml @@ -214,7 +214,6 @@ ## Examples The following example illustrates the use of `CompareTo` in the context of `Enum`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/CompareTo/EnumCompareTo.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/CompareTo/EnumCompareTo.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enumcompareto/VB/EnumCompareTo.vb" id="Snippet1"::: @@ -301,7 +300,6 @@ ## Examples The following example illustrates the use of the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/Equals/EnumEquals.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/Equals/EnumEquals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enumequals/VB/EnumEquals.vb" id="Snippet1"::: @@ -397,7 +395,6 @@ ## Examples The following example illustrates the use of `Format` in the context of `Enum`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/Format/EnumFormat.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/Format/EnumFormat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enumformat/VB/EnumFormat.vb" id="Snippet1"::: @@ -543,7 +540,6 @@ ## Examples The following example illustrates the use of `GetName`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/GetName/EnumGetName.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/GetName/EnumGetName.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enumgetname/VB/EnumGetName.vb" id="Snippet1"::: @@ -682,7 +678,6 @@ ## Examples The following example illustrates the use of the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/GetNames/EnumGetNames.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/GetNames/EnumGetNames.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enumgetnames/VB/EnumGetNames.vb" id="Snippet1"::: @@ -960,7 +955,6 @@ ## Examples The following example illustrates the use of . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/GetValues/EnumGetValues.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/GetValues/EnumGetValues.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enumgetvalues/VB/EnumGetValues.vb" id="Snippet1"::: @@ -1507,7 +1501,6 @@ ## Examples The following example uses the method to parse an array of strings that are created by calling the method. It also uses the method to parse an enumeration value that consists of a bit field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/Parse/EnumParse.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/Parse/EnumParse.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enumparse/VB/EnumParse.vb" id="Snippet1"::: @@ -3720,7 +3713,6 @@ ## Examples The following example demonstrates converting an enumerated value to a string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/ToString/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/ToString/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/VB/source.vb" id="Snippet1"::: @@ -3885,7 +3877,6 @@ ## Examples The following example demonstrates how to convert an enumerated value to a string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Enum/ToString/tostr.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Enum/ToString/tostr.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/enum.tostring/VB/tostr.vb" id="Snippet1"::: diff --git a/xml/System/Environment+SpecialFolder.xml b/xml/System/Environment+SpecialFolder.xml index 94ec53afb30..2ac063278da 100644 --- a/xml/System/Environment+SpecialFolder.xml +++ b/xml/System/Environment+SpecialFolder.xml @@ -58,25 +58,24 @@ Specifies enumerated constants used to retrieve directory paths to system special folders. - method returns the locations associated with this enumeration. The locations of these folders can have different values on different operating systems, the user can change some of the locations, and the locations are localized. + + For more information about special folders, see the [KNOWNFOLDERID](/windows/desktop/shell/knownfolderid) constants in the Windows documentation. + + + +## Examples + The following example shows how to use with the method to get the System directory. -## Remarks - The system special folders are folders such as **Program Files**, **Programs**, **System**, or **Startup**, which contain common information. Special folders are set by default by the system, or explicitly by the user, when installing a version of Windows. - - The method returns the locations associated with this enumeration. The locations of these folders can have different values on different operating systems, the user can change some of the locations, and the locations are localized. - - For more information about special folders, see the [KNOWNFOLDERID](/windows/desktop/shell/knownfolderid) constants in the Windows documentation. - - - -## Examples - The following example shows how to use with the method to get the System directory. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment+SpecialFolder/Overview/getfolderpath.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment+SpecialFolder/Overview/getfolderpath.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.GetFolderPath/VB/getfolderpath.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.GetFolderPath/VB/getfolderpath.vb" id="Snippet1"::: + ]]> @@ -535,8 +534,8 @@ 43 - The directory for components that are shared across applications. - + The directory for components that are shared across applications. + To get the x86 common program files directory in a non-x86 process, use the member. @@ -1546,8 +1545,8 @@ 38 - The program files directory. - + The program files directory. + In a non-x86 process, passing to the method returns the path for non-x86 programs. To get the x86 program files directory in a non-x86 process, use the member. diff --git a/xml/System/Environment.xml b/xml/System/Environment.xml index b126fd1cbe6..7c8a065ca48 100644 --- a/xml/System/Environment.xml +++ b/xml/System/Environment.xml @@ -80,7 +80,6 @@ ## Examples The following example displays a list of information about the current environment. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/Overview/env0.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/Overview/env0.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/environment.class/VB/env0.vb" id="Snippet1"::: @@ -149,7 +148,6 @@ ## Examples The following example displays its own command line. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/CommandLine/commandline.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/CommandLine/commandline.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/environment.CommandLine/VB/commandline.vb" id="Snippet1"::: @@ -260,7 +258,6 @@ ## Examples The following example demonstrates setting the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/CurrentDirectory/Vars1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/CurrentDirectory/Vars1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Environment/VB/Vars1.vb" id="Snippet4"::: @@ -593,7 +590,6 @@ Invalid argument ## Examples The following example shows how to obtain the system drive and system root variables. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/ExpandEnvironmentVariables/expandenvironmentvariables.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/ExpandEnvironmentVariables/expandenvironmentvariables.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/VB/expandenvironmentvariables.vb" id="Snippet1"::: @@ -856,7 +852,6 @@ In .NET 5 and later versions, for single-file publishing, the first element is t ## Examples The following example displays the application's command line arguments. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/GetCommandLineArgs/getcommandlineargs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/GetCommandLineArgs/getcommandlineargs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.GetCommandLineArgs/VB/getcommandlineargs.vb" id="Snippet1"::: @@ -938,7 +933,6 @@ In .NET 5 and later versions, for single-file publishing, the first element is t method to retrieve the `windir` environment variable, which contains the path of the Windows directory. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/CurrentDirectory/Vars1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/CurrentDirectory/Vars1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Environment/VB/Vars1.vb" id="Snippet4"::: @@ -1126,7 +1120,6 @@ On Unix-like systems, the `GetEnvironmentVariables` method retrieves the name an The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/GetEnvironmentVariables/getenvironmentvariables.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/GetEnvironmentVariables/getenvironmentvariables.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.GetEnvironmentVariables/VB/getenvironmentvariables.vb" id="Snippet1"::: @@ -1301,7 +1294,6 @@ The following example creates environment variables for the method to return and display the path associated with the `folder` parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment+SpecialFolder/Overview/getfolderpath.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment+SpecialFolder/Overview/getfolderpath.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.GetFolderPath/VB/getfolderpath.vb" id="Snippet1"::: @@ -1446,7 +1438,6 @@ The following example creates environment variables for the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/GetLogicalDrives/getlogicaldrives.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/GetLogicalDrives/getlogicaldrives.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.GetLogicalDrives/VB/getlogicaldrives.vb" id="Snippet1"::: @@ -1704,7 +1695,6 @@ The following example creates environment variables for the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/ProcessorCount/pc.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/ProcessorCount/pc.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/environment.processorcount/VB/pc.vb" id="Snippet1"::: @@ -2347,7 +2335,6 @@ The following example creates environment variables for the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/StackTrace/stacktrace.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/StackTrace/stacktrace.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.StackTrace/VB/stacktrace.vb" id="Snippet1"::: @@ -2412,7 +2399,6 @@ The following example creates environment variables for the property. The property cycles between , which is a negative number, and once every 49.8 days. This code sample removes the sign bit to yield a nonnegative number that cycles between zero and once every 24.9 days. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Environment/TickCount/tickcount.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Environment/TickCount/tickcount.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Environment.TickCount/VB/tickcount.vb" id="Snippet1"::: @@ -2709,7 +2694,6 @@ The following example creates environment variables for the class. An instance of the event data class is passed to the event handler for the `ThresholdReached` event. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/EventArgs/Overview/programwithdata.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/EventArgs/Overview/programwithdata.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/eventsoverview/vb/module1withdata.vb" id="Snippet6"::: diff --git a/xml/System/EventHandler`1.xml b/xml/System/EventHandler`1.xml index a0792d082ef..20e53d225e0 100644 --- a/xml/System/EventHandler`1.xml +++ b/xml/System/EventHandler`1.xml @@ -110,7 +110,6 @@ The event model in .NET is based on having an event delegate that connects an ev The following example shows an event named `ThresholdReached`. The event is associated with an delegate. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/EventArgs/Overview/programwithdata.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/EventArgs/Overview/programwithdata.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/eventsoverview/vb/module1withdata.vb" id="Snippet6"::: diff --git a/xml/System/Exception.xml b/xml/System/Exception.xml index dd0a989c77b..740738bbda3 100644 --- a/xml/System/Exception.xml +++ b/xml/System/Exception.xml @@ -168,7 +168,6 @@ ## Examples The following code example derives an `Exception` that uses a predefined message. The code demonstrates the use of the parameterless constructor for the derived class and the base `Exception` class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/new.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/new.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Ctor/VB/new.vb" id="Snippet1"::: @@ -238,7 +237,6 @@ ## Examples The following code example derives an `Exception` for a specific condition. The code demonstrates the use of the constructor that takes a caller-specified message as a parameter, for both the derived class and the base `Exception` class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/news.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/news.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Ctor/VB/news.vb" id="Snippet2"::: @@ -312,7 +310,6 @@ ## Examples The following code example defines a derived serializable `Exception` class. The code forces a divide-by-0 error and then creates an instance of the derived exception using the (, ) constructor. The code serializes the instance to a file, deserializes the file into a new exception, which it throws, and then catches and displays the exception's data. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/getobjdata.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/getobjdata.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.GetObjectData/VB/getobjdata.vb" id="Snippet1"::: @@ -390,7 +387,6 @@ ## Examples The following code example derives an `Exception` for a specific condition. The code demonstrates the use of the constructor that takes a message and an inner exception as parameters, for both the derived class and the base `Exception` class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/newsi.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/newsi.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Ctor/VB/newsi.vb" id="Snippet3"::: @@ -455,7 +451,6 @@ property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/Data/data.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/Data/data.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/exception.data/VB/data.vb" id="Snippet1"::: @@ -525,7 +520,6 @@ The following example demonstrates how to add and retrieve information using the ## Examples The following code example defines two derived `Exception` classes. It forces an exception and then throws it again with each of the derived classes. The code shows the use of the `GetBaseException` method to retrieve the original exception. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/GetBaseException/getbaseexc.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/GetBaseException/getbaseexc.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.GetBaseException/VB/getbaseexc.vb" id="Snippet1"::: @@ -609,7 +603,6 @@ The following example demonstrates how to add and retrieve information using the ## Examples The following code example defines a derived serializable `Exception` class that implements `GetObjectData`, which makes minor changes to two properties and then calls the base class to perform the serialization. The example forces a divide-by-0 error and then creates an instance of the derived exception. The code serializes the instance to a file, deserializes the file into a new exception, which it throws, and then catches and displays the exception's data. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/.ctor/getobjdata.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/.ctor/getobjdata.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.GetObjectData/VB/getobjdata.vb" id="Snippet1"::: @@ -735,7 +728,6 @@ The following example demonstrates how to add and retrieve information using the ## Examples The following code example throws an `Exception` that sets the `HelpLink` property in its constructor and then catches the exception and displays `HelpLink`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1"::: @@ -804,7 +796,6 @@ The following example demonstrates how to add and retrieve information using the ## Examples The following code example defines a derived `Exception` class that sets the `HResult` property to a custom value in its constructor. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/HResult/hresult.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HResult/hresult.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.HResult/VB/hresult.vb" id="Snippet1"::: @@ -880,7 +871,6 @@ The following example demonstrates how to add and retrieve information using the ## Examples The following example demonstrates throwing and catching an exception that references an inner exception. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/InnerException/innerex.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/InnerException/innerex.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/InnerEx/VB/innerex.vb" id="Snippet1"::: @@ -957,7 +947,6 @@ The value of the property is included in the inf The following code example throws and then catches an exception and displays the exception's text message using the property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1"::: @@ -1103,7 +1092,6 @@ The following code example throws and then catches an ex ## Examples The following example throws an `Exception` that sets the `Source` property in its constructor and then catches the exception and displays `Source`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1"::: @@ -1182,7 +1170,6 @@ The following code example throws and then catches an ex ## Examples The following code example throws an `Exception` and then catches it and displays a stack trace using the `StackTrace` property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1"::: @@ -1263,7 +1250,6 @@ The following code example throws and then catches an ex ## Examples The following code example throws an `Exception` and then catches it and displays the originating method using the `TargetSite` property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/HelpLink/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/HelpLink/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1"::: @@ -1341,7 +1327,6 @@ The following code example throws and then catches an ex ## Examples The following example causes an exception and displays the result of calling on that exception. Note that the method is called implicitly when the Exception class instance appears in the argument list of the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Exception/ToString/ToStringEx1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Exception/ToString/ToStringEx1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.exception.tostring/vb/ToStringEx1.vb" id="Snippet1"::: diff --git a/xml/System/FlagsAttribute.xml b/xml/System/FlagsAttribute.xml index 4b4d17a8568..cffdd42d07f 100644 --- a/xml/System/FlagsAttribute.xml +++ b/xml/System/FlagsAttribute.xml @@ -111,14 +111,12 @@ ## Examples The following example defines a `PhoneService` enumeration that represents forms of communication provided by a telephone company. It initializes three variables representing the service provided to three different households, and then indicates which households have no service, which households have only cell phone service, and which households have both cell phone and land line service. Finally, it implicitly calls the method to display the types of service provided to each household. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/FlagsAttribute/Overview/flags1.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/FlagsAttribute/Overview/flags1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.FlagsAttribute/VB/flags1.vb" id="Snippet2"::: The following example illustrates the use of the `FlagsAttribute` attribute and shows the effect on the method of using `FlagsAttribute` on an declaration. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/FlagsAttribute/Overview/flags.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/FlagsAttribute/Overview/flags.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.FlagsAttribute/VB/flags.vb" id="Snippet1"::: diff --git a/xml/System/Func`2.xml b/xml/System/Func`2.xml index e56571764b9..8dccd8c4841 100644 --- a/xml/System/Func`2.xml +++ b/xml/System/Func`2.xml @@ -97,48 +97,47 @@ Encapsulates a method that has one parameter and returns a value of the type specified by the parameter. The return value of the method that this delegate encapsulates. - [!NOTE] -> To reference a method that has one parameter and returns `void` (or in Visual Basic, that is declared as a `Sub` rather than as a `Function`), use the generic delegate instead. - - When you use the delegate, you do not have to explicitly define a delegate that encapsulates a method with a single parameter. For example, the following code explicitly declares a delegate named `ConvertMethod` and assigns a reference to the `UppercaseString` method to its delegate instance. - +> To reference a method that has one parameter and returns `void` (or in Visual Basic, that is declared as a `Sub` rather than as a `Function`), use the generic delegate instead. + + When you use the delegate, you do not have to explicitly define a delegate that encapsulates a method with a single parameter. For example, the following code explicitly declares a delegate named `ConvertMethod` and assigns a reference to the `UppercaseString` method to its delegate instance. + :::code language="csharp" source="~/snippets/csharp/System/FuncT,TResult/Overview/Delegate.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Func~2/fs/Delegate.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~2/vb/Delegate.vb" id="Snippet1"::: - - The following example simplifies this code by instantiating the delegate instead of explicitly defining a new delegate and assigning a named method to it. - + + The following example simplifies this code by instantiating the delegate instead of explicitly defining a new delegate and assigning a named method to it. + :::code language="csharp" source="~/snippets/csharp/System/FuncT,TResult/Overview/Func2_1.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Func~2/fs/Func2_1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~2/vb/Func2_1.vb" id="Snippet2"::: - - You can also use the delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).) - + + You can also use the delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).) + :::code language="csharp" source="~/snippets/csharp/System/FuncT,TResult/Overview/Anon.cs" interactive="try-dotnet-method" id="Snippet3"::: - - You can also assign a lambda expression to a delegate, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions (VB)](/dotnet/visual-basic/programming-guide/language-features/procedures/lambda-expressions), [Lambda Expressions (C#)](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions) and [Lambda Expressions (F#)](/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword).) - + + You can also assign a lambda expression to a delegate, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions (VB)](/dotnet/visual-basic/programming-guide/language-features/procedures/lambda-expressions), [Lambda Expressions (C#)](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions) and [Lambda Expressions (F#)](/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword).) + :::code language="csharp" source="~/snippets/csharp/System/FuncT,TResult/Overview/Lambda.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Func~2/fs/Lambda.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~2/vb/Lambda.vb" id="Snippet4"::: - - The underlying type of a lambda expression is one of the generic `Func` delegates. This makes it possible to pass a lambda expression as a parameter without explicitly assigning it to a delegate. In particular, because many methods of types in the namespace have parameters, you can pass these methods a lambda expression without explicitly instantiating a delegate. - - - -## Examples - The following example demonstrates how to declare and use a delegate. This example declares a variable and assigns it a lambda expression that converts the characters in a string to uppercase. The delegate that encapsulates this method is subsequently passed to the method to change the strings in an array of strings to uppercase. + + The underlying type of a lambda expression is one of the generic `Func` delegates. This makes it possible to pass a lambda expression as a parameter without explicitly assigning it to a delegate. In particular, because many methods of types in the namespace have parameters, you can pass these methods a lambda expression without explicitly instantiating a delegate. + + + +## Examples + The following example demonstrates how to declare and use a delegate. This example declares a variable and assigns it a lambda expression that converts the characters in a string to uppercase. The delegate that encapsulates this method is subsequently passed to the method to change the strings in an array of strings to uppercase. :::code language="csharp" source="~/snippets/csharp/System/FuncT,TResult/Overview/Example.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Func~2/fs/Example.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~2/vb/Example.vb" id="Snippet5"::: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp" id="Snippet6"::: - + ]]> Lambda Expressions (C# Programming Guide) diff --git a/xml/System/GC.xml b/xml/System/GC.xml index 2ee79693b83..4eb5def36da 100644 --- a/xml/System/GC.xml +++ b/xml/System/GC.xml @@ -64,7 +64,6 @@ method to perform a collection on all generations of memory. The code generates a number of unused objects, and then calls the method to clean them from memory. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/Collect/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/Collect/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.GC.Collect Example/VB/class1.vb" id="Snippet1"::: @@ -480,7 +477,6 @@ Skipping zero-initialization using this API only has a material performance bene ## Examples The following example demonstrates how to use the method to perform a collection on individual layers of memory. The code generates a number of unused objects, and then calls the method to clean them from memory. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/Overview/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/Overview/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.gc.collect int example/VB/class1.vb" id="Snippet1"::: @@ -1101,7 +1097,6 @@ Starting in .NET 8, this method might return for ob The following example demonstrates how to use the method to determine the age of an object. The example then performs garbage collections to clean up memory and compare the pre and post collection memory totals in the console. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/Overview/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/Overview/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.gc.collect int example/VB/class1.vb" id="Snippet1"::: @@ -1170,7 +1165,6 @@ Starting in .NET 8, this method might return for ob The following example demonstrates the use of the method to determine the age of a weak reference object. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/GetGeneration/systemgcgetgenerationweak.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/GetGeneration/systemgcgetgenerationweak.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/VB/systemgcgetgenerationweak.vb" id="Snippet1"::: @@ -1284,7 +1278,6 @@ The following example demonstrates the use of the method to get and display the number of bytes currently allocated in managed memory. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/Overview/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/Overview/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.gc.collect int example/VB/class1.vb" id="Snippet1"::: @@ -1395,7 +1388,6 @@ The following example demonstrates the use of the method is called. The object persists for the 30-second duration of the `Main` method, despite calls to the and methods. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/KeepAlive/gckeepalive.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/KeepAlive/gckeepalive.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/VB/gckeepalive.vb" id="Snippet1"::: @@ -1470,7 +1462,6 @@ The following example demonstrates the use of the property to display the largest generation number currently in use. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/Overview/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/Overview/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.gc.collect int example/VB/class1.vb" id="Snippet1"::: @@ -1612,7 +1603,6 @@ The following example demonstrates the use of the method to finalize an object a second time after garbage collection. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/ReRegisterForFinalize/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/ReRegisterForFinalize/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/VB/class1.vb" id="Snippet1"::: @@ -2295,7 +2284,6 @@ If `obj` does not have a finalizer or the GC has already signaled the finalizer ## Examples The following example shows how to use this method to determine whether a full, blocking garbage collection is approaching. Whenever the status of the notification is , the user method `OnFullGCApproachNotify` is called to perform actions in response to the approaching collection. This code example is part of a larger example provided for [Garbage Collection Notifications](/dotnet/standard/garbage-collection/notifications) topic. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/GC/CancelFullGCNotification/Program.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/CancelFullGCNotification/Program.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GCNotification/vb/program.vb" id="Snippet3"::: @@ -2478,7 +2466,6 @@ If `obj` does not have a finalizer or the GC has already signaled the finalizer ## Examples The following example shows how to use this method to determine whether a full garbage collection has completed. Whenever the status of the notification is , the user method `OnFullGCCompletedNotify` is called to perform actions in response to the completed collection. This code example is part of a larger example provided for [Garbage Collection Notifications](/dotnet/standard/garbage-collection/notifications) topic. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/GC/CancelFullGCNotification/Program.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/CancelFullGCNotification/Program.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GCNotification/vb/program.vb" id="Snippet4"::: @@ -2651,7 +2638,6 @@ If `obj` does not have a finalizer or the GC has already signaled the finalizer ## Examples The following example demonstrates how to use the method to suspend the current thread until finalization of all the collected objects is complete. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/GC/WaitForPendingFinalizers/class1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/WaitForPendingFinalizers/class1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/VB/class1.vb" id="Snippet1"::: diff --git a/xml/System/GCNotificationStatus.xml b/xml/System/GCNotificationStatus.xml index 24d2ebc8aea..f18a68f6349 100644 --- a/xml/System/GCNotificationStatus.xml +++ b/xml/System/GCNotificationStatus.xml @@ -49,21 +49,20 @@ Provides information about the current registration for notification of the next full garbage collection. - method to register for a full garbage collection notification. Then use the method or the method to return a enumeration that contains the status of the notification. + + + +## Examples + The following example obtains a enumeration from the method. If the enumeration returns Succeeded, it calls the custom method `OnFullGCApproachNotify` to perform actions in response to the approaching full garbage collection. This code example is part of a larger example provided for [Garbage Collection Notifications](/dotnet/standard/garbage-collection/notifications) topic. -## Remarks - Use the method to register for a full garbage collection notification. Then use the method or the method to return a enumeration that contains the status of the notification. - - - -## Examples - The following example obtains a enumeration from the method. If the enumeration returns Succeeded, it calls the custom method `OnFullGCApproachNotify` to perform actions in response to the approaching full garbage collection. This code example is part of a larger example provided for [Garbage Collection Notifications](/dotnet/standard/garbage-collection/notifications) topic. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/GC/CancelFullGCNotification/Program.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/GC/CancelFullGCNotification/Program.fs" id="Snippet8"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GCNotification/vb/program.vb" id="Snippet8"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GCNotification/vb/program.vb" id="Snippet8"::: + ]]> Garbage Collection Notifications diff --git a/xml/System/IAsyncResult.xml b/xml/System/IAsyncResult.xml index 44f763f5c26..8bdd3451f1f 100644 --- a/xml/System/IAsyncResult.xml +++ b/xml/System/IAsyncResult.xml @@ -75,10 +75,9 @@ For more information and more examples of calling methods asynchronously by using delegates, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/TestMethod.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/TestMethod.vb" id="Snippet1"::: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp" id="Snippet3"::: + :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/waithandle.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/WaitHandle.vb" id="Snippet3"::: @@ -150,10 +149,8 @@ For more information about how this callback example works, and more examples of calling methods asynchronously by using delegates, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/TestMethod.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/TestMethod.vb" id="Snippet1"::: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/callback.cs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/callback.vb" id="Snippet5"::: @@ -227,10 +224,8 @@ For more information and more examples of calling methods asynchronously by using delegates, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/TestMethod.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/TestMethod.vb" id="Snippet1"::: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/waithandle.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/WaitHandle.vb" id="Snippet3"::: @@ -362,10 +357,8 @@ For more information and more examples of calling methods asynchronously by using delegates, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/TestMethod.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/TestMethod.vb" id="Snippet1"::: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/IAsyncResult/Overview/polling.cs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/polling.vb" id="Snippet4"::: diff --git a/xml/System/IComparable.xml b/xml/System/IComparable.xml index a0aa66f0126..6249a5bbcb8 100644 --- a/xml/System/IComparable.xml +++ b/xml/System/IComparable.xml @@ -74,7 +74,6 @@ ## Examples The following example illustrates the implementation of and the requisite method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IComparable/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/IComparable/Overview/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IComparable Example/VB/source.vb" id="Snippet1"::: @@ -165,7 +164,6 @@ ## Examples The following example illustrates the use of to compare a `Temperature` object implementing with another object. The `Temperature` object implements by simply wrapping a call to the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IComparable/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/IComparable/Overview/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IComparable Example/VB/source.vb" id="Snippet1"::: diff --git a/xml/System/IComparable`1.xml b/xml/System/IComparable`1.xml index f359a3dba4a..dde4cbe1db1 100644 --- a/xml/System/IComparable`1.xml +++ b/xml/System/IComparable`1.xml @@ -59,29 +59,28 @@ The type of object to compare. Defines a generalized comparison method that a value type or class implements to create a type-specific comparison method for ordering or sorting its instances. - , that indicates whether the position of the current instance in the sort order is before, after, or the same as a second object of the same type. Typically, the method is not called directly from developer code. Instead, it is called automatically by methods such as and . - - Typically, types that provide an implementation also implement the interface. The interface defines the method, which determines the equality of instances of the implementing type. - - The implementation of the method must return an that has one of three values, as shown in the following table. - -|Value|Meaning| -|-----------|-------------| -|Less than zero|This object precedes the object specified by the method in the sort order.| -|Zero|This current instance occurs in the same position in the sort order as the object specified by the method argument.| -|Greater than zero|This current instance follows the object specified by the method argument in the sort order.| - - All numeric types (such as and ) implement , as do , , and . Custom types should also provide their own implementation of to enable object instances to be ordered or sorted. - - - -## Examples - The following example illustrates the implementation of for a simple `Temperature` object. The example creates a collection of strings with `Temperature` object keys, and adds several pairs of temperatures and strings to the list out of sequence. In the call to the method, the collection uses the implementation to sort the list entries, which are then displayed in order of increasing temperature. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp" id="Snippet1"::: + , that indicates whether the position of the current instance in the sort order is before, after, or the same as a second object of the same type. Typically, the method is not called directly from developer code. Instead, it is called automatically by methods such as and . + + Typically, types that provide an implementation also implement the interface. The interface defines the method, which determines the equality of instances of the implementing type. + + The implementation of the method must return an that has one of three values, as shown in the following table. + +|Value|Meaning| +|-----------|-------------| +|Less than zero|This object precedes the object specified by the method in the sort order.| +|Zero|This current instance occurs in the same position in the sort order as the object specified by the method argument.| +|Greater than zero|This current instance follows the object specified by the method argument in the sort order.| + + All numeric types (such as and ) implement , as do , , and . Custom types should also provide their own implementation of to enable object instances to be ordered or sorted. + + + +## Examples + The following example illustrates the implementation of for a simple `Temperature` object. The example creates a collection of strings with `Temperature` object keys, and adds several pairs of temperatures and strings to the list out of sequence. In the call to the method, the collection uses the implementation to sort the list entries, which are then displayed in order of increasing temperature. + :::code language="csharp" source="~/snippets/csharp/System/IComparableT/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/IComparableT/Overview/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IComparable`1 Example/VB/source.vb" id="Snippet1"::: @@ -89,8 +88,8 @@ ]]> - Replace the type parameter of the interface with the type that is implementing this interface. - + Replace the type parameter of the interface with the type that is implementing this interface. + If you implement , you should overload the , , , and operators to return values that are consistent with . In addition, you should also implement . See the article for complete information. @@ -149,41 +148,40 @@ An object to compare with this instance. Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. - A value that indicates the relative order of the objects being compared. The return value has these meanings: - - Value - - Meaning - - Less than zero - - This instance precedes in the sort order. - - Zero - - This instance occurs in the same position in the sort order as . - - Greater than zero - - This instance follows in the sort order. - + A value that indicates the relative order of the objects being compared. The return value has these meanings: + + Value + + Meaning + + Less than zero + + This instance precedes in the sort order. + + Zero + + This instance occurs in the same position in the sort order as . + + Greater than zero + + This instance follows in the sort order. + - provides a strongly typed comparison method for ordering members of a generic collection object. Because of this, it is usually not called directly from developer code. Instead, it is called automatically by methods such as and . - - This method is only a definition and must be implemented by a specific class or value type to have effect. The meaning of the comparisons specified in the Return Values section ("precedes", "occurs in the same position as", and "follows) depends on the particular implementation. - - By definition, any object compares greater than `null`, and two null references compare equal to each other. - - - -## Examples - The following code example illustrates the implementation of for a simple `Temperature` object. The example creates a collection of strings with `Temperature` object keys, and adds several pairs of temperatures and strings to the list out of sequence. In the call to the method, the collection uses the implementation to sort the list entries, which are then displayed in order of increasing temperature. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp" id="Snippet1"::: + provides a strongly typed comparison method for ordering members of a generic collection object. Because of this, it is usually not called directly from developer code. Instead, it is called automatically by methods such as and . + + This method is only a definition and must be implemented by a specific class or value type to have effect. The meaning of the comparisons specified in the Return Values section ("precedes", "occurs in the same position as", and "follows) depends on the particular implementation. + + By definition, any object compares greater than `null`, and two null references compare equal to each other. + + + +## Examples + The following code example illustrates the implementation of for a simple `Temperature` object. The example creates a collection of strings with `Temperature` object keys, and adds several pairs of temperatures and strings to the list out of sequence. In the call to the method, the collection uses the implementation to sort the list entries, which are then displayed in order of increasing temperature. + :::code language="csharp" source="~/snippets/csharp/System/IComparableT/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/IComparableT/Overview/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IComparable`1 Example/VB/source.vb" id="Snippet1"::: @@ -191,16 +189,16 @@ ]]> - For objects A, B, and C, the following must be true: - - A.CompareTo(A) is required to return zero. - - If A.CompareTo(B) returns zero, then B.CompareTo(A) is required to return zero. - - If A.CompareTo(B) returns zero and B.CompareTo(C) returns zero, then A.CompareTo(C) is required to return zero. - - If A.CompareTo(B) returns a value other than zero, then B.CompareTo(A) is required to return a value of the opposite sign. - + For objects A, B, and C, the following must be true: + + A.CompareTo(A) is required to return zero. + + If A.CompareTo(B) returns zero, then B.CompareTo(A) is required to return zero. + + If A.CompareTo(B) returns zero and B.CompareTo(C) returns zero, then A.CompareTo(C) is required to return zero. + + If A.CompareTo(B) returns a value other than zero, then B.CompareTo(A) is required to return a value of the opposite sign. + If A.CompareTo(B) returns a value that is not equal to zero, and B.CompareTo(C) returns a value of the same sign as , then A.CompareTo(C) is required to return a value of the same sign as and . diff --git a/xml/System/IConvertible.xml b/xml/System/IConvertible.xml index 2da2ab95fdf..456800d4bd8 100644 --- a/xml/System/IConvertible.xml +++ b/xml/System/IConvertible.xml @@ -56,23 +56,22 @@ Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value. - , , , , , , , , , , , , , , and . - - If there is no meaningful conversion to a common language runtime type, then a particular interface method implementation throws . For example, if this interface is implemented on a Boolean type, the implementation of the method throws an exception because there is no meaningful equivalent to a Boolean type. - - The common language runtime typically exposes the interface through the class. The common language runtime also uses the interface internally, in explicit interface implementations, to simplify the code used to support conversions in the class and basic common language runtime types. - - In addition to the interface, the .NET Framework provides classes called type converters for converting user-defined data types to other data types. For more information, see the [Generalized Type Conversion](/previous-versions/visualstudio/visual-studio-2013/yy580hbd(v=vs.120)) topic. - - - -## Examples - The following code sample demonstrates an implementation of for a Complex number class, allowing it to be cast first as a and then calling the static members on that . + , , , , , , , , , , , , , , and . + + If there is no meaningful conversion to a common language runtime type, then a particular interface method implementation throws . For example, if this interface is implemented on a Boolean type, the implementation of the method throws an exception because there is no meaningful equivalent to a Boolean type. + + The common language runtime typically exposes the interface through the class. The common language runtime also uses the interface internally, in explicit interface implementations, to simplify the code used to support conversions in the class and basic common language runtime types. + + In addition to the interface, the .NET Framework provides classes called type converters for converting user-defined data types to other data types. For more information, see the [Generalized Type Conversion](/previous-versions/visualstudio/visual-studio-2013/yy580hbd(v=vs.120)) topic. + + + +## Examples + The following code sample demonstrates an implementation of for a Complex number class, allowing it to be cast first as a and then calling the static members on that . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IConvertible/Overview/iconvertible.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/IConvertible/Overview/iconvertible.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IConvertible/VB/iconvertible.vb" id="Snippet1"::: @@ -80,8 +79,8 @@ ]]> - If you implement the interface, your implementation will be called automatically by the method if the parameter is an instance of your implementing type and the parameter is a common language runtime type. - + If you implement the interface, your implementation will be called automatically by the method if the parameter is an instance of your implementing type and the parameter is a common language runtime type. + Most conversion methods have a parameter of type that represents either the current culture () or a specific culture. For the most part, the implementations of the base types ignore this parameter. However, you can choose whether to use it in your code. Type Conversion in the .NET Framework diff --git a/xml/System/IDisposable.xml b/xml/System/IDisposable.xml index bfa05e20f35..da64d286a97 100644 --- a/xml/System/IDisposable.xml +++ b/xml/System/IDisposable.xml @@ -58,7 +58,6 @@ interface. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IDisposable/Overview/idisposabledispose.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/IDisposable/Overview/idisposabledispose.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/VB/idisposabledispose.vb" id="Snippet1":::id="Snippet1"::: @@ -143,7 +142,6 @@ ## Examples The following example shows how you can implement the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/IDisposable/Overview/idisposabledispose.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/IDisposable/Overview/idisposabledispose.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/VB/idisposabledispose.vb" id="Snippet1"::: diff --git a/xml/System/Int16.xml b/xml/System/Int16.xml index 9048209a11d..5f39bdd7eb0 100644 --- a/xml/System/Int16.xml +++ b/xml/System/Int16.xml @@ -453,7 +453,6 @@ ## Examples The following code example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -926,7 +925,6 @@ ## Examples The following code example illustrates the use of `Equals` in the context of `Int16`, comparing two short values and returning `true` if they represent the same number, or `false` if they do not. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int16/Equals/int16_equals.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Int16_Equals/FS/int16_equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Int16_Equals/VB/int16_equals.vb" id="Snippet1"::: @@ -1494,7 +1492,6 @@ For this method matches the IEE ## Examples The following example uses the property to prevent an when converting to an value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int16/MaxValue/MaxValue.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int16.MaxValue/fs/MaxValue.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int16.MaxValue/vb/MaxValue.vb" id="Snippet1"::: @@ -1657,7 +1654,6 @@ For this method matches the IEE ## Examples The following example uses the property to prevent an when converting to an value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int16/MaxValue/MaxValue.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int16.MaxValue/fs/MaxValue.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int16.MaxValue/vb/MaxValue.vb" id="Snippet1"::: @@ -1752,7 +1748,6 @@ For this method matches the IEE ## Examples The following example demonstrates how to convert a string value into a 16-bit signed integer value using the method. The resulting integer value is then displayed to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int16/Parse/Parse.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int16.Parse/fs/Parse.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int16.Parse/vb/Parse.vb" id="Snippet1"::: @@ -1963,7 +1958,6 @@ For this method matches the IEE ## Examples The following example uses the method to parse the string representations of values using the en-US culture. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Int16/Parse/Parse2.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int16.Parse/fs/Parse2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int16.Parse/vb/Parse2.vb" id="Snippet2"::: @@ -2077,7 +2071,6 @@ For this method matches the IEE ## Examples The following example parses string representations of values with the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Int16/Parse/Parse.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int16.Parse/fs/Parse.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int16.Parse/vb/Parse.vb" id="Snippet4"::: @@ -2310,7 +2303,6 @@ For this method matches the IEE ## Examples The following example uses a variety of `style` and `provider` parameters to parse the string representations of values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Int16/Parse/Parse.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int16.Parse/fs/Parse.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int16.Parse/vb/Parse.vb" id="Snippet3"::: diff --git a/xml/System/Int32.xml b/xml/System/Int32.xml index f45bc195dfa..45ab67c50fb 100644 --- a/xml/System/Int32.xml +++ b/xml/System/Int32.xml @@ -966,7 +966,6 @@ ## Examples The following example illustrates the use of `Equals` in the context of `Int32`, comparing two `int` values and returning `true` if they represent the same number, or `false` if they do not. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/Equals/int32_equals.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Int32_Equals/FS/int32_equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Int32_Equals/VB/int32_equals.vb" id="Snippet1"::: @@ -1547,7 +1546,6 @@ For this method matches the IEE ## Examples The following example uses the property to prevent an when converting to an value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/MaxValue/maxvalue1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.int32.maxvalue/fs/maxvalue1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.int32.maxvalue/vb/maxvalue1.vb" id="Snippet1"::: @@ -1708,7 +1706,6 @@ For this method matches the IEE ## Examples The following example uses the property to prevent an when converting to an value. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/MaxValue/maxvalue1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.int32.maxvalue/fs/maxvalue1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.int32.maxvalue/vb/maxvalue1.vb" id="Snippet1"::: @@ -1803,7 +1800,6 @@ For this method matches the IEE ## Examples The following example demonstrates how to convert a string value into a 32-bit signed integer value using the method. The resulting integer value is then displayed to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/Parse/Parse1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.Parse/fs/Parse1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.Parse/vb/Parse1.vb" id="Snippet1"::: @@ -2017,7 +2013,6 @@ For this method matches the IEE ## Examples The following example uses the method to parse the string representations of several values. The current culture for the example is en-US. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/Parse/Parse2.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.Parse/fs/Parse2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.Parse/vb/Parse2.vb" id="Snippet2"::: @@ -2374,7 +2369,6 @@ For this method matches the IEE ## Examples The following example uses a variety of `style` and `provider` parameters to parse the string representations of values. It also illustrates some of the different ways the same string can be interpreted depending on the culture whose formatting information is used for the parsing operation. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/Parse/Parse3.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.Parse/fs/Parse3.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.Parse/vb/Parse3.vb" id="Snippet3"::: @@ -6227,7 +6221,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example displays an value using the default method. It also displays the string representations of the value that results from using a number of standard format specifiers. The examples are displayed using the formatting conventions of the en-US culture. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/ToString/ToString.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.ToString/fs/ToString.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.ToString/vb/ToString.vb" id="Snippet1"::: @@ -6341,7 +6334,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example displays the string representation of an value using objects that represent several different cultures. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/ToString/ToString.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.ToString/fs/ToString.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.ToString/vb/ToString.vb" id="Snippet2"::: @@ -6448,7 +6440,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example displays an value using each of the supported standard numeric format specifiers, together with two custom numeric format strings. In converting the numeric values to strings, the example uses the formatting conventions of the en-US culture. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/ToString/ToString.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.ToString/fs/ToString.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.ToString/vb/ToString.vb" id="Snippet3"::: @@ -6565,7 +6556,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example displays a positive and a negative value using each of the supported standard numeric format specifiers for three different cultures. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/ToString/ToString.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.ToString/fs/ToString.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.ToString/vb/ToString.vb" id="Snippet4"::: @@ -6923,7 +6913,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example calls the method with a number of different string values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/TryParse/TryParse1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.TryParse/fs/TryParse1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.TryParse/vb/TryParse1.vb" id="Snippet1"::: @@ -7316,7 +7305,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example calls the method with a number of different string and values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Int32/TryParse/TryParse2.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Int32.TryParse/fs/TryParse2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Int32.TryParse/vb/TryParse2.vb" id="Snippet2"::: diff --git a/xml/System/Int64.xml b/xml/System/Int64.xml index 72a56423a2a..b4116894319 100644 --- a/xml/System/Int64.xml +++ b/xml/System/Int64.xml @@ -474,7 +474,6 @@ ## Examples The following code example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -946,7 +945,6 @@ ## Examples The following code example illustrates the use of `Equals` in the context of `Int64`, comparing two long values and returning `true` if they represent the same number, or `false` if they do not. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Int64/Equals/int64_equals.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/Int64_Equals/FS/int64_equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Int64_Equals/VB/int64_equals.vb" id="Snippet1"::: diff --git a/xml/System/Math.xml b/xml/System/Math.xml index bb9a4cead23..f8c1d4c0409 100644 --- a/xml/System/Math.xml +++ b/xml/System/Math.xml @@ -67,7 +67,6 @@ ## Examples The following example uses several mathematical and trigonometric functions from the class to calculate the inner angles of a trapezoid. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Overview/mathsample.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Overview/mathsample.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MathSample/VB/mathsample.vb" id="Snippet1"::: @@ -729,7 +728,6 @@ ## Examples The following example uses the method to assist in the computation of the inner angles of a given trapezoid. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Overview/mathsample.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Overview/mathsample.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MathSample/VB/mathsample.vb" id="Snippet1"::: @@ -866,7 +864,6 @@ ## Examples The following example uses to assist in the computation of the inner angles of a given trapezoid. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Overview/mathsample.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Overview/mathsample.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MathSample/VB/mathsample.vb" id="Snippet1"::: @@ -1003,7 +1000,6 @@ ## Examples The following example demonstrates how to calculate the arctangent of a value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Atan/atan.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Atan/atan.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.atanx/VB/atan.vb" id="Snippet1"::: @@ -1103,7 +1099,6 @@ ## Examples The following example demonstrates how to calculate the arctangent of an angle and a vector. The resulting value is displayed in the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Atan/atan.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Atan/atan.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.atanx/VB/atan.vb" id="Snippet1"::: @@ -1226,7 +1221,6 @@ ## Examples The following example demonstrates the use of the method to calculate the product of two integer values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/BigMul/bigmul.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/BigMul/bigmul.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.bigmul/VB/bigmul.vb" id="Snippet1"::: @@ -2706,7 +2700,6 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969 ## Examples The following example uses to evaluate certain trigonometric identities for selected angles. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Cos/sincos.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Cos/sincos.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.SinCos/VB/sincos.vb" id="Snippet1"::: @@ -2782,7 +2775,6 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969 ## Examples The following example uses to evaluate certain hyperbolic identities for selected values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Cosh/sinhcosh.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Cosh/sinhcosh.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.SinhCosh/VB/sinhcosh.vb" id="Snippet1"::: @@ -3526,7 +3518,6 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969 ## Examples The following example compares with the value calculated from a power series. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/E/efield.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/E/efield.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.E/VB/efield.vb" id="Snippet1"::: @@ -3606,7 +3597,6 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969 ## Examples The following example uses to evaluate certain exponential and logarithmic identities for selected values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Exp/exp.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Exp/exp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.Exp/VB/exp.vb" id="Snippet1"::: @@ -4246,7 +4236,6 @@ Remainder = (Math.Abs(dividend) - (Math.Abs(divisor) * ## Examples The following example uses to evaluate certain logarithmic identities for selected values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/LogMethod/loggen.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/LogMethod/loggen.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.Log_Overloads/VB/loggen.vb" id="Snippet1"::: @@ -4425,7 +4414,6 @@ Remainder = (Math.Abs(dividend) - (Math.Abs(divisor) * The following example demonstrates how to use the method to return and display the greater of two variables: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Max/max.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Max/max.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.max/VB/max.vb" id="Snippet1"::: @@ -5319,7 +5307,6 @@ The following example demonstrates how to use the meth The following example demonstrates how to use the method to return and display the smaller of two variables: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Min/min.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Min/min.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.min/VB/min.vb" id="Snippet1"::: @@ -6251,7 +6238,6 @@ The following example demonstrates how to use the meth ## Examples The following example uses to assist in the computation of the inner angles of a given trapezoid. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Overview/mathsample.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Overview/mathsample.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MathSample/VB/mathsample.vb" id="Snippet1"::: @@ -6760,7 +6746,6 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7968 The following example demonstrates rounding to the nearest integer value. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Round/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Round/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Math.Round Example/VB/source.vb" id="Snippet1"::: @@ -7012,7 +6997,6 @@ If the value of the `value` argument is method to determine the sign of a value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Sign/sign.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Sign/sign.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.sign/VB/sign.vb" id="Snippet1"::: @@ -7531,7 +7514,6 @@ The following example demonstrates how to use the method to determine the sign of a value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Sign/sign.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Sign/sign.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.sign/VB/sign.vb" id="Snippet1"::: @@ -7620,7 +7602,6 @@ The following example demonstrates how to use the method to determine the sign of an value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Sign/sign.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Sign/sign.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.sign/VB/sign.vb" id="Snippet1"::: @@ -7707,7 +7688,6 @@ The following example demonstrates how to use the method to determine the sign of an value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Sign/sign.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Sign/sign.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.sign/VB/sign.vb" id="Snippet1"::: @@ -7794,7 +7774,6 @@ The following example demonstrates how to use the method to determine the sign of an value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Sign/sign.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Sign/sign.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.sign/VB/sign.vb" id="Snippet1"::: @@ -7959,7 +7938,6 @@ The following example demonstrates how to use the method to determine the sign of an value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Sign/sign.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Sign/sign.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.sign/VB/sign.vb" id="Snippet1"::: @@ -8046,7 +8024,6 @@ The following example demonstrates how to use the method to determine the sign of a value and display it to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Sign/sign.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Sign/sign.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/math.sign/VB/sign.vb" id="Snippet1"::: @@ -8124,7 +8101,6 @@ The following example demonstrates how to use the to evaluate certain trigonometric identities for selected angles. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Cos/sincos.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Cos/sincos.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.SinCos/VB/sincos.vb" id="Snippet1"::: @@ -8261,7 +8237,6 @@ The following example demonstrates how to use the to evaluate certain hyperbolic identities for selected values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Cosh/sinhcosh.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Cosh/sinhcosh.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.SinhCosh/VB/sinhcosh.vb" id="Snippet1"::: @@ -8423,7 +8398,6 @@ The following example demonstrates how to use the to evaluate certain hyperbolic tangent identities for selected values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Math/Tanh/tanh.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Math/Tanh/tanh.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Math.Tanh/VB/tanh.vb" id="Snippet1"::: diff --git a/xml/System/MissingFieldException.xml b/xml/System/MissingFieldException.xml index a740717dc63..dd667e70991 100644 --- a/xml/System/MissingFieldException.xml +++ b/xml/System/MissingFieldException.xml @@ -83,7 +83,6 @@ ## Examples This example shows what happens if you attempt to use reflection to call a method that does not exist and access a field that does not exist. The application recovers by catching the , , and . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/MissingFieldException/Overview/MissingMethodException.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/MissingFieldException/Overview/MissingMethodException.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MissingMethodException/vb/missingmethodexception.vb" id="Snippet1"::: @@ -443,7 +442,6 @@ ## Examples The following example demonstrates the property. This code example is part of a larger example provided for the class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/MissingFieldException/Overview/MissingMethodException.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/MissingFieldException/Overview/MissingMethodException.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MissingMethodException/vb/missingmethodexception.vb" id="Snippet3"::: diff --git a/xml/System/MissingMemberException.xml b/xml/System/MissingMemberException.xml index 019557a71c2..b0e5b1b47a7 100644 --- a/xml/System/MissingMemberException.xml +++ b/xml/System/MissingMemberException.xml @@ -87,7 +87,6 @@ ## Examples This example shows what happens if you attempt to use reflection to call a method that does not exist and access a field that does not exist. The application recovers by catching the , , and . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/MissingFieldException/Overview/MissingMethodException.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/MissingFieldException/Overview/MissingMethodException.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MissingMethodException/vb/missingmethodexception.vb" id="Snippet1"::: @@ -625,7 +624,6 @@ ## Examples The following example demonstrates the property. This code example is part of a larger example provided for the class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/MissingFieldException/Overview/MissingMethodException.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/MissingFieldException/Overview/MissingMethodException.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MissingMethodException/vb/missingmethodexception.vb" id="Snippet4"::: diff --git a/xml/System/MissingMethodException.xml b/xml/System/MissingMethodException.xml index a890bb97a84..9d5982ff7ee 100644 --- a/xml/System/MissingMethodException.xml +++ b/xml/System/MissingMethodException.xml @@ -88,7 +88,6 @@ The exact timing of when statically referenced methods are loaded is unspecified ## Examples This example shows what happens if you attempt to use reflection to call a method that does not exist and access a field that does not exist. The application recovers by catching the , , and . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/MissingFieldException/Overview/MissingMethodException.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/MissingFieldException/Overview/MissingMethodException.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MissingMethodException/vb/missingmethodexception.vb" id="Snippet1"::: @@ -452,7 +451,6 @@ The exact timing of when statically referenced methods are loaded is unspecified ## Examples The following example demonstrates the property. This code example is part of a larger example provided for the class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/MissingFieldException/Overview/MissingMethodException.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/MissingFieldException/Overview/MissingMethodException.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MissingMethodException/vb/missingmethodexception.vb" id="Snippet2"::: diff --git a/xml/System/MulticastDelegate.xml b/xml/System/MulticastDelegate.xml index 8c90ef3831b..3e31888cdc5 100644 --- a/xml/System/MulticastDelegate.xml +++ b/xml/System/MulticastDelegate.xml @@ -89,7 +89,6 @@ The `Test.Main` method is the application entry point. It instantiates a `StringContainer` object, populates it with strings, and creates two `CheckAndDisplayDelegate` delegates, `conStart` and `vowelStart`, that invoke a single method. It then calls the method to create the `multipleDelegates` delegate, which initially contains the `ConStart` and `VowelStart` delegates. Note that when the `multipleDelegates` delegate is invoked, it displays all the strings in the collection in their original order. This is because each letter is passed separately to each delegate, and each letter meets the filtering criteria of only one of the two delegates. Finally, after calls to and , `multipleDelegates` contains two `conStart` delegates. When it is invoked, each string in the `StringContainer` object is displayed twice. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/MulticastDelegate/Overview/delegatestring.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/MulticastDelegate/Overview/delegatestring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Multicast Delegate Introduction/VB/delegatestring.vb" id="Snippet1"::: diff --git a/xml/System/NonSerializedAttribute.xml b/xml/System/NonSerializedAttribute.xml index a71f9bcbc83..d7047ce1383 100644 --- a/xml/System/NonSerializedAttribute.xml +++ b/xml/System/NonSerializedAttribute.xml @@ -77,38 +77,37 @@ Indicates that a field of a serializable class should not be serialized. This class cannot be inherited. - or classes to serialize an object, use the attribute to prevent a field from being serialized. For example, you can use this attribute to prevent the serialization of sensitive data. - - The target objects for the attribute are public and private fields of a serializable class. By default, classes are not serializable unless they are marked with . During the serialization process all the public and private fields of a class are serialized by default. Fields marked with are excluded during serialization. If you are using the class to serialize an object, use the class to get the same functionality. Alternatively, implement the interface to explicitly control the serialization process. Note that classes that implement must still be marked with . - - To apply the class to an event, set the attribute location to field, as shown in the following C# code. - -```csharp -[field:NonSerializedAttribute()] -public event ChangedEventHandler Changed; -``` - - If a field is not serialized, but it still requires a default value that must be supplied after deserialization, you can create a method that supplies the field with a value, then apply the to the method. - + or classes to serialize an object, use the attribute to prevent a field from being serialized. For example, you can use this attribute to prevent the serialization of sensitive data. + + The target objects for the attribute are public and private fields of a serializable class. By default, classes are not serializable unless they are marked with . During the serialization process all the public and private fields of a class are serialized by default. Fields marked with are excluded during serialization. If you are using the class to serialize an object, use the class to get the same functionality. Alternatively, implement the interface to explicitly control the serialization process. Note that classes that implement must still be marked with . + + To apply the class to an event, set the attribute location to field, as shown in the following C# code. + +```csharp +[field:NonSerializedAttribute()] +public event ChangedEventHandler Changed; +``` + + If a field is not serialized, but it still requires a default value that must be supplied after deserialization, you can create a method that supplies the field with a value, then apply the to the method. + For more information about using attributes, see [Attributes](/dotnet/standard/attributes/). > [!NOTE] > This attribute does not apply to JSON serialization using . - -## Examples - The following example demonstrates SOAP serialization of an object marked with the attribute, and the behavior of a field marked with the in the serialized object. - + +## Examples + The following example demonstrates SOAP serialization of an object marked with the attribute, and the behavior of a field marked with the in the serialized object. + > [!NOTE] -> The code uses the class to serialize the object. The class is found in the system.runtime.serialization.formatters.soap.dll file, which is not loaded by default into a project. To run the code, you must add a reference to the DLL to your project. +> The code uses the class to serialize the object. The class is found in the system.runtime.serialization.formatters.soap.dll file, which is not loaded by default into a project. To run the code, you must add a reference to the DLL to your project. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/NonSerializedAttribute/Overview/s.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/NonSerializedAttribute/Overview/s.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/SerializationAttributes/VB/s.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/SerializationAttributes/VB/s.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/Nullable`1.xml b/xml/System/Nullable`1.xml index cb52029dd56..1f0ec33bc6d 100644 --- a/xml/System/Nullable`1.xml +++ b/xml/System/Nullable`1.xml @@ -70,7 +70,6 @@ :::code language="csharp" source="~/snippets/csharp/System/Object/Overview/ObjectX.cs" interactive="try-dotnet" id="snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Object/Overview/ObjectX.fs" id="snippet1"::: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp" id="snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ObjectX/vb/objectX.vb" id="snippet1"::: ]]> @@ -538,7 +537,6 @@ For an additional example that overrides the me The following code example demonstrates that returns the runtime type of the current instance. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Object/GetType/gettype.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Object/GetType/gettype.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ECMA-System.Object.GetType/VB/gettype.vb" id="Snippet1"::: @@ -715,7 +713,6 @@ To illustrate the difference between a shallow and a deep copy operation, consid The following example uses to determine if two objects are the same instance. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Object/ReferenceEquals/referenceequals.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Object/ReferenceEquals/referenceequals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/vb/referenceequals.vb" id="Snippet1"::: diff --git a/xml/System/ObjectDisposedException.xml b/xml/System/ObjectDisposedException.xml index 3597c4ae365..e01f9ef315a 100644 --- a/xml/System/ObjectDisposedException.xml +++ b/xml/System/ObjectDisposedException.xml @@ -87,7 +87,6 @@ ## Examples The following example demonstrates an error that causes the `ObjectDisposedException` exception to be thrown. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ObjectDisposedException/Overview/objdispexc.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/ObjectDisposedException/Overview/objdispexc.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ObjDispEx/VB/objdispexc.vb" id="Snippet1"::: diff --git a/xml/System/OperatingSystem.xml b/xml/System/OperatingSystem.xml index a9b63d2aa77..b39dc3f722b 100644 --- a/xml/System/OperatingSystem.xml +++ b/xml/System/OperatingSystem.xml @@ -206,7 +206,6 @@ ## Examples The following code example illustrates the use of the method to make a copy of an object. The clone is compared with the original object to show that they are not the same object. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/OperatingSystem/Clone/clone.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/OperatingSystem/Clone/clone.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.OperatingSystem.Clone/VB/clone.vb" id="Snippet1"::: @@ -1125,7 +1124,6 @@ ## Examples The following code example creates several objects and displays the property for each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/OperatingSystem/Platform/plat_ver.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/OperatingSystem/Platform/plat_ver.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/VB/plat_ver.vb" id="Snippet1"::: @@ -1187,7 +1185,6 @@ ## Examples The following code example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/OperatingSystem/ServicePack/sp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/OperatingSystem/ServicePack/sp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/OperatingSystem.ServicePack/VB/sp.vb" id="Snippet1"::: @@ -1251,7 +1248,6 @@ For a list of Windows operating system versions and their corresponding version ## Examples The following code example illustrates the use of the method to display objects. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/OperatingSystem/ToString/ctor_tostr.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/OperatingSystem/ToString/ctor_tostr.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/VB/ctor_tostr.vb" id="Snippet1"::: @@ -1314,7 +1310,6 @@ For a list of Windows operating system versions and their corresponding version ## Examples The following code example creates several objects and displays the property for each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/OperatingSystem/Platform/plat_ver.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/OperatingSystem/Platform/plat_ver.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/VB/plat_ver.vb" id="Snippet1"::: @@ -1376,7 +1371,6 @@ For a list of Windows operating system versions and their corresponding version ## Examples The following code example demonstrates the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/OperatingSystem/VersionString/osvs.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/OperatingSystem/VersionString/osvs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/OperatingSystem.VersionString/VB/osvs.vb" id="Snippet1"::: diff --git a/xml/System/PlatformID.xml b/xml/System/PlatformID.xml index cc45e4e6207..9b80370990e 100644 --- a/xml/System/PlatformID.xml +++ b/xml/System/PlatformID.xml @@ -63,21 +63,20 @@ Identifies the operating system, or platform, supported by an assembly. - and properties to obtain the `PlatformID` enumeration for the currently executing operating system or development platform. Use the `PlatformID` enumeration to help determine whether the current operating system or development platform supports your application. - - You can use the underlying integer value of each `PlatformID` enumeration member as the `PlatformId` argument for the [SignTool.exe (Sign Tool)](/dotnet/framework/tools/signtool-exe) utility. - -## Examples + and properties to obtain the `PlatformID` enumeration for the currently executing operating system or development platform. Use the `PlatformID` enumeration to help determine whether the current operating system or development platform supports your application. + + You can use the underlying integer value of each `PlatformID` enumeration member as the `PlatformId` argument for the [SignTool.exe (Sign Tool)](/dotnet/framework/tools/signtool-exe) utility. + +## Examples The following example demonstrates using the `PlatformID` class to identify the currently executing operating system: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/PlatformID/Overview/pid.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/PlatformID/Overview/pid.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/platformID.class/VB/pid.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/platformID.class/VB/pid.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/Random.xml b/xml/System/Random.xml index 274ec708bea..354f4df0fcd 100644 --- a/xml/System/Random.xml +++ b/xml/System/Random.xml @@ -77,14 +77,12 @@ , , and methods to generate sequences of random numbers within different ranges. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Overview/Random2.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random/fs/Random2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random/vb/Random2.vb" id="Snippet2"::: The following example generates a random integer that it uses as an index to retrieve a string value from an array. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Overview/next1.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Next/FS/next1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Next/VB/next1.vb" id="Snippet3"::: @@ -239,7 +237,6 @@ The following example uses the parameterless constructor to instantiate three objects with the class constructor that takes a seed parameter and generates a sequence of random integers and doubles. The example illustrates that the same sequence is generated when the object is created again with the constructor and seed parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Random/.ctor/ctor.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Ctor/FS/ctor.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Ctor/VB/ctor.vb" id="Snippet1"::: @@ -604,14 +601,12 @@ The following example uses the parameterless constructor to instantiate three method to generate 10 random numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Overview/next3.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Next/FS/next3.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Next/VB/next3.vb" id="Snippet5"::: The following example derives a class from to generate a sequence of random numbers whose distribution differs from the uniform distribution generated by the method of the base class. It overrides the method to provide the distribution of random numbers, and overrides the method to use series of random numbers. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Next/sample.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Sample/VB/sample.vb" id="Snippet1"::: @@ -682,14 +677,12 @@ The following example uses the parameterless constructor to instantiate three method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Overview/next.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Next/FS/next.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Next/VB/next.vb" id="Snippet1"::: The following example generates a random integer that it uses as an index to retrieve a string value from an array. Because the highest index of the array is one less than its length, the value of the property is supplied as a the `maxValue` parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Overview/next1.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Next/FS/next1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Next/VB/next1.vb" id="Snippet3"::: @@ -764,14 +757,12 @@ The following example uses the parameterless constructor to instantiate three method to generate random integers with three distinct ranges. Note that the exact output from the example depends on the system-supplied seed value passed to the class constructor. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Overview/Next2.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Next/FS/Next2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Next/VB/next2.vb" id="Snippet2"::: The following example generates a random integer that it uses as an index to retrieve a string value from an array. Because the highest index of the array is one less than its length, the value of the property is supplied as a the `maxValue` parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Overview/next4.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Next/FS/next4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Next/VB/next4.vb" id="Snippet4"::: @@ -847,7 +838,6 @@ The following example uses the parameterless constructor to instantiate three method to fill an array of bytes with random byte values. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Random/NextBytes/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/VB/source.vb" id="Snippet1"::: @@ -977,7 +967,6 @@ Each element of the span of bytes is set to a random number greater than or equa The following example uses the method to generate sequences of random doubles. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Random/.ctor/ctor.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Ctor/FS/ctor.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Ctor/VB/ctor.vb" id="Snippet1"::: @@ -1209,7 +1198,6 @@ Each element of the span of bytes is set to a random number greater than or equa ## Examples The following example derives a class from and overrides the method to generate a distribution of random numbers. This distribution is different than the uniform distribution generated by the method of the base class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Random/Next/sample.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Random.Sample/FS/sample.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Random.Sample/VB/sample.vb" id="Snippet1"::: diff --git a/xml/System/RuntimeTypeHandle.xml b/xml/System/RuntimeTypeHandle.xml index 56126d50150..deee6649b87 100644 --- a/xml/System/RuntimeTypeHandle.xml +++ b/xml/System/RuntimeTypeHandle.xml @@ -86,7 +86,6 @@ ## Examples The following example demonstrates how to obtain a from a type or from an object, and how to turn the handle back into a type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/RuntimeTypeHandle/Overview/type_gettypehandle.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/RuntimeTypeHandle/Overview/type_gettypehandle.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetTypeHandle/VB/type_gettypehandle.vb" id="Snippet1"::: diff --git a/xml/System/SByte.xml b/xml/System/SByte.xml index 0406727fc52..3fcd1ee0b8f 100644 --- a/xml/System/SByte.xml +++ b/xml/System/SByte.xml @@ -536,7 +536,6 @@ ## Examples The following example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: diff --git a/xml/System/SerializableAttribute.xml b/xml/System/SerializableAttribute.xml index 0b9a0d5a856..7dde21553eb 100644 --- a/xml/System/SerializableAttribute.xml +++ b/xml/System/SerializableAttribute.xml @@ -73,30 +73,29 @@ Indicates that a class can be serialized using binary or XML serialization. This class cannot be inherited. - attribute to a type to indicate that instances of this type can be serialized using binary or XML serialization. The common language runtime throws if any type in the graph of objects being serialized does not have the attribute applied. - - Apply the attribute even if the class also implements the interface to control the binary serialization process. - - When you apply the attribute to a type, all private and public fields are serialized by default. You can control binary serialization more granularly by implementing the interface to override the serialization process. - - Or you can exclude fields from serialization by applying the attribute to the field. If a field of a binary-serializable type contains a pointer, a handle, or some other data structure that is specific to a particular environment, and cannot be meaningfully reconstituted in a different environment, then you might want to apply the attribute to that field. - + attribute to a type to indicate that instances of this type can be serialized using binary or XML serialization. The common language runtime throws if any type in the graph of objects being serialized does not have the attribute applied. + + Apply the attribute even if the class also implements the interface to control the binary serialization process. + + When you apply the attribute to a type, all private and public fields are serialized by default. You can control binary serialization more granularly by implementing the interface to override the serialization process. + + Or you can exclude fields from serialization by applying the attribute to the field. If a field of a binary-serializable type contains a pointer, a handle, or some other data structure that is specific to a particular environment, and cannot be meaningfully reconstituted in a different environment, then you might want to apply the attribute to that field. + For more information about using attributes, see [Attributes](/dotnet/standard/attributes/). For more information about binary serialization, see . > [!NOTE] > This attribute does not apply to JSON serialization using . + +## Examples + The following example demonstrates SOAP serialization of an object that's marked with the attribute. -## Examples - The following example demonstrates SOAP serialization of an object that's marked with the attribute. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/NonSerializedAttribute/Overview/s.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/NonSerializedAttribute/Overview/s.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/SerializationAttributes/VB/s.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/SerializationAttributes/VB/s.vb" id="Snippet1"::: + ]]> diff --git a/xml/System/Single.xml b/xml/System/Single.xml index c44df155936..67f14363b1a 100644 --- a/xml/System/Single.xml +++ b/xml/System/Single.xml @@ -1147,7 +1147,6 @@ This computes `arctan(x) / π` in the interval `[-0.5, +0.5]`. method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet16"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet16"::: @@ -1229,7 +1228,6 @@ The following code example demonstrates the me method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -1882,7 +1880,6 @@ This is known as Euler's number and is approximately 2.7182818284590452354. ## Examples The following code example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet17"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet17"::: @@ -2656,7 +2653,6 @@ A return value of `false` does not imply that method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet11"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" interactive="try-dotnet-method" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet11"::: @@ -2791,7 +2787,6 @@ This method correctly handles floating-point values and so `2.0` and `3.0` will ## Examples The following code example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet8"::: @@ -2913,7 +2908,6 @@ This method correctly handles floating-point values and so `2.0` and `3.0` will ## Examples The following code example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet13"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" interactive="try-dotnet-method" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet13"::: @@ -3134,7 +3128,6 @@ A return value of `false` does not imply that method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet12"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" interactive="try-dotnet-method" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet12"::: @@ -3885,7 +3878,6 @@ For this method matches the IEEE 754:2 ## Examples The following code example demonstrates the constant. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet4"::: @@ -4186,7 +4178,6 @@ For this method matches the IEEE 754:2 ## Examples The following code example demonstrates the constant. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet5"::: @@ -4305,7 +4296,6 @@ For this method matches the IEEE 754:2 ## Examples The following example demonstrates the constant. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" interactive="try-dotnet-method" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet7"::: @@ -4372,7 +4362,6 @@ For this method matches the IEEE 754:2 ## Examples The following code example demonstrates the constant. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" interactive="try-dotnet-method" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet9"::: @@ -5622,7 +5611,6 @@ Pi is approximately 3.1415926535897932385. ## Examples The following code example demonstrates the constant. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" interactive="try-dotnet-method" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet10"::: @@ -9390,7 +9378,6 @@ Tau is approximately 6.2831853071795864769. The following code example illustrates the use of the method along with the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Single/CompareTo/singlesample.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Single/CompareTo/singlesample.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Single/VB/singlesample.vb" id="Snippet3"::: diff --git a/xml/System/String.xml b/xml/System/String.xml index 2bbfc51f2d7..63308a422ad 100644 --- a/xml/System/String.xml +++ b/xml/System/String.xml @@ -826,7 +826,6 @@ In C#, the property is an indexer. In Visual Basic ## Examples The following example demonstrates how you can use this indexer in a routine to validate a string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Chars/uri_ishexdigit.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Chars/uri_ishexdigit.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Uri_IsHexDigit/VB/uri_ishexdigit.vb" id="Snippet1"::: @@ -1016,14 +1015,12 @@ The comparison terminates when an inequality is discovered or both strings have Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet10"::: Compare the path name to "file" using an ordinal comparison. The correct code to do this is as follows: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet11"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet11"::: @@ -1031,14 +1028,12 @@ Compare the path name to "file" using an ordinal comparison. The correct code to ## Examples The following example calls the method to compare three sets of strings. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp" id="Snippet18"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/compare02.cs" interactive="try-dotnet-method" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/compare02.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/compare02.vb" id="Snippet18"::: In the following example, the `ReverseStringComparer` class demonstrates how you can evaluate two strings with the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/ArrayListSample.cs" interactive="try-dotnet" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/ArrayListSample.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ArrayList/VB/ArrayListSample.vb" id="Snippet7"::: @@ -1150,14 +1145,12 @@ The comparison terminates when an inequality is discovered or both strings have Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet12"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet12"::: Compare the path name to "file" using an ordinal comparison. The correct code to do this is as follows: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet13"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet13"::: @@ -1165,7 +1158,6 @@ Compare the path name to "file" using an ordinal comparison. The correct code to ## Examples The following example demonstrates that the method is equivalent to using or when comparing strings. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp" id="Snippet18"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/compare02.cs" interactive="try-dotnet-method" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/compare02.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/compare02.vb" id="Snippet18"::: @@ -1273,14 +1265,12 @@ The comparison terminates when an inequality is discovered or both strings have Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet16"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet16"::: Compare the path name to "file" using an ordinal comparison. The correct code to do this is as follows: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet17"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet17"::: @@ -1288,7 +1278,6 @@ Compare the path name to "file" using an ordinal comparison. The correct code to ## Examples The following example compares three versions of the letter "I". The results are affected by the choice of culture, whether case is ignored, and whether an ordinal comparison is performed. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/cmpcmp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/cmpcmp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.CompareCmp/vb/cmpcmp.vb" id="Snippet1"::: @@ -1396,14 +1385,12 @@ The comparison terminates when an inequality is discovered or both strings have Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet14"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet14"::: Compare the path name to "file" using an ordinal comparison. The correct code to do this is as follows: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet15"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet15"::: @@ -1411,7 +1398,6 @@ Compare the path name to "file" using an ordinal comparison. The correct code to ## Examples The following example demonstrates how culture can affect a comparison. In Czech - Czech Republic culture, "ch" is a single character that is greater than "d". However, in English - United States culture, "ch" consists of two characters, and "c" is less than "d". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/string.comp4.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/string.comp4.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.comp4/VB/string.comp4.vb" id="Snippet1"::: @@ -1524,7 +1510,6 @@ The comparison terminates when an inequality is discovered or both strings have ## Examples The following example compares two strings in three different ways: Use linguistic comparison for the en-US culture; using linguistic case-sensitive comparison for the en-US culture; and using an ordinal comparison. It illustrates how the three methods of comparison produce three different results. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/Example.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/Example.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/Example.vb" id="Snippet1"::: @@ -1635,14 +1620,12 @@ The comparison terminates when an inequality is discovered or both substrings ha Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet2"::: Compare the path name to "file" using an ordinal comparison. The correct code to do this is as follows: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet3"::: @@ -1650,7 +1633,6 @@ Compare the path name to "file" using an ordinal comparison. The correct code to ## Examples The following example compares two substrings. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/comp3.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/comp3.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.compare3/VB/comp3.vb" id="Snippet1"::: @@ -1772,14 +1754,12 @@ The comparison terminates when an inequality is discovered or both substrings ha Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet4"::: The path name needs to be compared in an invariant manner. The correct code to do this is as follows. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet5"::: @@ -1787,7 +1767,6 @@ The path name needs to be compared in an invariant manner. The correct code to d ## Examples The following example performs two comparisons of two substrings that only differ in case. The first comparison ignores case and the second comparison considers case. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/comp4.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/comp4.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.compare4/VB/comp4.vb" id="Snippet1"::: @@ -1912,14 +1891,12 @@ The comparison terminates when an inequality is discovered or both substrings ha Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet8"::: Compare the path name to "file" using an ordinal comparison. The correct code to do this is as follows: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet9"::: @@ -1927,7 +1904,6 @@ Compare the path name to "file" using an ordinal comparison. The correct code to ## Examples The following example compares two substrings. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/comp3.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/comp3.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.compare3/VB/comp3.vb" id="Snippet1"::: @@ -2050,14 +2026,12 @@ The comparison terminates when an inequality is discovered or both substrings ha Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter "i" in "file". -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet6"::: Compare the path name to "file" using an ordinal comparison. The correct code to do this is as follows: -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/remarks.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/remarks.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Compare/vb/remarks.vb" id="Snippet7"::: @@ -2065,7 +2039,6 @@ Compare the path name to "file" using an ordinal comparison. The correct code to ## Examples The following example compares two substrings using different cultures and ignoring the case of the substrings. The choice of culture affects how the letter "I" is compared. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Compare/comp5.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Compare/comp5.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.compare5/VB/comp5.vb" id="Snippet1"::: @@ -2313,7 +2286,6 @@ Because is a ## Examples The following example performs and ordinal comparison of two strings that only differ in case. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/CompareOrdinal/comp0.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/CompareOrdinal/comp0.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.compareordinal/VB/comp0.vb" id="Snippet1"::: @@ -2423,7 +2395,6 @@ Because is a ## Examples This following example demonstrates that and use different sort orders. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/CompareOrdinal/stringcompareordinal.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/CompareOrdinal/stringcompareordinal.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/StringCompareOrdinal/VB/stringcompareordinal.vb" id="Snippet1"::: @@ -2553,7 +2524,6 @@ For more information about the behavior of this method, see the Remarks section ## Examples The following example uses the method with an . Because it attempts to compare a instance to a `TestClass` object, the method throws an . -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/CompareTo/extostring.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/CompareTo/extostring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ExToString/VB/extostring.vb" id="Snippet1"::: @@ -2672,14 +2642,12 @@ This method implements the method to compare the current string instance with another string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/CompareTo/stringcompareto.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/CompareTo/stringcompareto.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/StringCompareTo/VB/stringcompareto.vb" id="Snippet1"::: The following example demonstrates generic and non-generic versions of the CompareTo method for several value and reference types. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -2870,7 +2838,6 @@ The method represents `arg0` as a str ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Concat/string.concat5.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Concat/string.concat5.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.concat5/VB/string.concat5.vb" id="Snippet1"::: @@ -3135,7 +3102,6 @@ An string is used in pla ## Examples The following example demonstrates the use of the method with a array. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Concat/stringconcat3.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Concat/stringconcat3.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringconcat3/VB/stringconcat3.vb" id="Snippet1"::: @@ -3210,7 +3176,6 @@ If either of the arguments is an array reference, the method concatenates a stri ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Concat/string.concat5.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Concat/string.concat5.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.concat5/VB/string.concat5.vb" id="Snippet1"::: @@ -3333,7 +3298,6 @@ An string is used in pla ## Examples The following example concatenates a person's first, middle, and last name. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Concat/stringconcat4.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Concat/stringconcat4.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringconcat4/VB/stringconcat4.vb" id="Snippet1"::: @@ -3405,7 +3369,6 @@ The method concatenates `arg0`, `arg1`, and `arg2` by calling the parameterless ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Concat/string.concat5.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Concat/string.concat5.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.concat5/VB/string.concat5.vb" id="Snippet1"::: @@ -3530,7 +3493,6 @@ The method concatenates `str0`, `str1`, and `str2`; it does not add any delimite ## Examples The following example uses the method to concatenate three strings and displays the result. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/String/Concat/Concat6.cs" interactive="try-dotnet" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Concat/Concat6.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.string.concat/vb/Concat6.vb" id="Snippet6"::: @@ -3949,7 +3911,6 @@ If you are interested in the position of the substring `value` in the current in ## Examples The following example determines whether the string "fox" is a substring of a familiar quotation. If "fox" is found in the string, it also displays its starting position. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Contains/cont.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Contains/cont.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.contains/VB/cont.vb" id="Snippet1"::: @@ -4242,7 +4203,6 @@ This method copies `count` characters from the `sourceIndex` position of this in ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/CopyTo/stringcopyto.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/CopyTo/stringcopyto.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringcopyto/VB/stringcopyto.vb" id="Snippet1"::: @@ -4627,7 +4587,6 @@ The following example indicates whether each string in an array ends with a peri The following example defines a `StripEndTags` method that uses the method to remove HTML end tags from the end of a line. Note that the `StripEndTags` method is called recursively to ensure that multiple HTML end tags at the end of the line are removed. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/EndsWith/stringendswith.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/EndsWith/stringendswith.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringendswith/VB/stringendswith.vb" id="Snippet1"::: @@ -4710,7 +4669,6 @@ The method compares the `value` parameter to th ## Examples The following example determines whether a string ends with a particular substring. The results are affected by the choice of culture, whether case is ignored, and whether an ordinal comparison is performed. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/EndsWith/ewcmp.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/EndsWith/ewcmp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.EndsWithCmp/vb/ewcmp.vb" id="Snippet1"::: @@ -4927,7 +4885,6 @@ This method performs an ordinal (case-sensitive and culture-insensitive) compari ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Equals/equals.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Equals/equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.equals/VB/equals.vb" id="Snippet1"::: @@ -5091,7 +5048,6 @@ This method performs an ordinal (case-sensitive and culture-insensitive) compari ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Equals/equals.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Equals/equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.equals/VB/equals.vb" id="Snippet1"::: @@ -5358,7 +5314,6 @@ This method uses the [composite formatting feature](/dotnet/standard/base-types/ The following example uses the method to embed an individual's age in the middle of a string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/FormatException/Overview/format7.cs" interactive="try-dotnet-method" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/FormatException/Overview/format7.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Format/vb/format7.vb" id="Snippet7"::: @@ -5465,14 +5420,12 @@ This method uses the [composite formatting feature](/dotnet/standard/base-types/ This example creates a string that contains data on the high and low temperature on a particular date. The composite format string has five format items in the C# example and six in the Visual Basic example. Two of the format items define the width of their corresponding value's string representation, and the first format item also includes a standard date and time format string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/FormatException/Overview/format5.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/FormatException/Overview/format5.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Format/vb/format5.vb" id="Snippet5"::: You can also pass the objects to be formatted as an array rather than as an argument list. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/FormatException/Overview/format_paramarray1.cs" interactive="try-dotnet" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/FormatException/Overview/format_paramarray1.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Format/vb/format_paramarray1.vb" id="Snippet10"::: @@ -6045,7 +5998,6 @@ This method uses the [composite formatting feature](/dotnet/standard/base-types/ This example uses the method to display time and temperature data stored in a generic object. Note that the format string has three format items, although there are only two objects to format. This is because the first object in the list (a date and time value) is used by two format items: The first format item displays the time, and the second displays the date. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/FormatException/Overview/formatexample4.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/FormatException/Overview/formatexample4.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Format/vb/formatexample4.vb" id="Snippet6"::: @@ -6231,7 +6183,6 @@ This method uses the [composite formatting feature](/dotnet/standard/base-types/ This example uses the method to create a string that illustrates the result of a Boolean `And` operation with two integer values. Note that the format string includes six format items, but the method has only three items in its parameter list, because each item is formatted in two different ways. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/FormatException/Overview/format4.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/FormatException/Overview/format4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Format/vb/format4.vb" id="Snippet4"::: @@ -6594,7 +6545,6 @@ This method enables you to iterate the individual characters in a string. For ex ## Examples The following example iterates the characters in several strings and displays information about their individual characters. It uses the language iteration construct rather than a call to the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/GetEnumerator/getenumerator.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/GetEnumerator/getenumerator.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.GetEnumerator/VB/getenumerator.vb" id="Snippet1"::: @@ -6715,7 +6665,6 @@ For additional information about the use of hash codes and the `GetHashCode` met ## Examples The following example demonstrates the method using various input strings. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/GetHashCode/gethashcode.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/GetHashCode/gethashcode.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.GetHashCode/VB/gethashcode.vb" id="Snippet1"::: @@ -6959,7 +6908,6 @@ The `GetPinnableReference` method returns a character that can be used for pinni ## Examples The following example displays the enumerated constant for the type. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/GetTypeCode/gtc.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/GetTypeCode/gtc.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.gettypecode/VB/gtc.vb" id="Snippet1"::: @@ -7044,7 +6992,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example demonstrates how you can search a for a character using the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/indexof_c.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/indexof_c.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.IndexOf/VB/indexof_c.vb" id="Snippet5"::: @@ -7120,14 +7067,12 @@ Character sets include ignorable characters, which are characters that are not c ## Examples The following example searches for the "n" in "animal". Because string indexes begin at zero rather than one, the method indicates that the "n" is at position 1. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp" id="Snippet12"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/simple1.cs" interactive="try-dotnet-method" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/simple1.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.IndexOf/VB/simple1.vb" id="Snippet12"::: The following example uses the method to determine the starting position of an animal name in a sentence. It then uses this position to insert an adjective that describes the animal into the sentence. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/stringinsert.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/stringinsert.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringinsert/VB/stringinsert.vb" id="Snippet1"::: @@ -7213,7 +7158,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/ixof1.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/ixof1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.indexof1/VB/ixof1.vb" id="Snippet1"::: @@ -7347,7 +7291,6 @@ Character sets include ignorable characters, which are characters that are not c ## Examples The following example searches for all occurrences of a specified string within a target string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/stringindexof4.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/stringindexof4.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringindexof4/VB/stringindexof4.vb" id="Snippet1"::: @@ -7526,7 +7469,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/indexofcii.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/indexofcii.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.IndexOf/VB/indexofcii.vb" id="Snippet1"::: @@ -7617,7 +7559,6 @@ Character sets include ignorable characters, which are characters that are not c ## Examples The following example finds the index of all occurrences of the string "he" within a substring of another string. Note that the number of characters to be searched must be recalculated for each search iteration. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/ixof8.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/ixof8.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.indexof8/VB/ixof8.vb" id="Snippet1"::: @@ -7996,7 +7937,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example finds the index of the occurrence of any character of the string "is" within a substring of another string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOfAny/ixany2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOfAny/ixany2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.indexofany2/VB/ixany2.vb" id="Snippet1"::: @@ -8090,7 +8030,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example finds the index of the occurrence of any character of the string "aid" within a substring of another string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOfAny/ixany3.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOfAny/ixany3.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.indexofany3/VB/ixany3.vb" id="Snippet1"::: @@ -8187,7 +8126,6 @@ The following example inserts a space character in the fourth character position The following console application prompts the users to enter one or more adjectives to describe two animals. It then calls the method to insert the text entered by the user into a string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IndexOf/stringinsert.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IndexOf/stringinsert.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringinsert/VB/stringinsert.vb" id="Snippet1"::: @@ -8267,7 +8205,6 @@ The following console application prompts the users to enter one or more adjecti method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Join/stringjoin.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Join/stringjoin.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringjoin/VB/stringjoin.vb" id="Snippet1"::: @@ -9474,7 +9407,6 @@ If `separator` is `null`, an empty string ( method is used ## Examples The following example finds the index of all occurrences of a string in substring, working from the end of the substring to the start of the substring. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/LastIndexOf/lastixof8.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/LastIndexOf/lastixof8.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.LastIndexOf8/VB/lastixof8.vb" id="Snippet1"::: @@ -10574,7 +10502,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example finds the index of the last occurrence of any character in the string "is" within another string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/LastIndexOfAny/lastixany1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/LastIndexOfAny/lastixany1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.LastIndexOfAny1/VB/lastixany1.vb" id="Snippet1"::: @@ -10652,7 +10579,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example finds the index of the last occurrence of any character in the string "is" within a substring of another string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/LastIndexOfAny/lastixany2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/LastIndexOfAny/lastixany2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.LastIndexOfAny2/VB/lastixany2.vb" id="Snippet1"::: @@ -10739,7 +10665,6 @@ This method performs an ordinal (culture-insensitive) search, where a character ## Examples The following example finds the index of the last occurrence of any character in the string "aid" within a substring of another string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/LastIndexOfAny/lastixany3.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/LastIndexOfAny/lastixany3.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.LastIndexOfAny3/VB/lastixany3.vb" id="Snippet1"::: @@ -10817,7 +10742,6 @@ The property returns the number of property returns 7, which indicates that it includes the six alphabetic characters as well as the null character. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Overview/System.String.Class.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Overview/System.String.Class.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Class/vb/System.String.Class.vb" id="Snippet1"::: @@ -10825,7 +10749,6 @@ In some languages, such as C and C++, a null character indicates the end of a st ## Examples The following example demonstrates the property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Length/length.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Length/length.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.length/VB/length.vb" id="Snippet1"::: @@ -10849,7 +10772,6 @@ The following example demonstrates the property. ## Examples The following example normalizes a string to each of four normalization forms, confirms the string was normalized to the specified normalization form, then lists the code points in the normalized string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/IsNormalized/norm.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/IsNormalized/norm.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.normalize/VB/norm.vb" id="Snippet1"::: @@ -11077,7 +10999,6 @@ The method defines the operation of the equa ## Examples The following example demonstrates the equality operator. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/op_Equality/equalityop.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/op_Equality/equalityop.fs" id="Snippet1"::: @@ -11202,7 +11123,6 @@ The operator in turn calls the static method pads the beginning of the ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/PadLeft/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/PadLeft/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic String.PadLeft Example/VB/source.vb" id="Snippet1"::: @@ -11357,7 +11276,6 @@ The method pads the beg ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/PadLeft/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/PadLeft/source1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/VB/source.vb" id="Snippet1"::: @@ -11445,7 +11363,6 @@ The method pads the end of the retur ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/PadRight/source.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/PadRight/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic String.PadRight Example/VB/source.vb" id="Snippet1"::: @@ -11519,7 +11436,6 @@ The method pads the en ## Examples The following example demonstrates the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/PadRight/source1.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/PadRight/source1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/VB/source.vb" id="Snippet1"::: @@ -11604,7 +11520,6 @@ In the .NET Framework, strings are zero-based. The value of the `startIndex` par ## Examples The following example demonstrates the method. The next-to-last case removes all text starting from the specified index through the end of the string. The last case removes three characters starting from the specified index. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Remove/r.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Remove/r.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.remove/VB/r.vb" id="Snippet1"::: @@ -11693,7 +11608,6 @@ In the .NET Framework, strings are zero-based. The value of the `startIndex` par ## Examples The following example demonstrates how you can remove the middle name from a complete name. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Remove/stringremove.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Remove/stringremove.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringremove/VB/stringremove.vb" id="Snippet1"::: @@ -11800,7 +11714,6 @@ Because this method returns the modified string, you can chain together successi ## Examples The following example creates a comma separated value list by substituting commas for the blanks between a series of numbers. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Replace/string.replace1.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Replace/string.replace1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.replace1/VB/string.replace1.vb" id="Snippet1"::: @@ -11903,7 +11816,6 @@ Because this method returns the modified string, you can chain together successi ## Examples The following example demonstrates how you can use the method to correct a spelling error. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Replace/stringreplace.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Replace/stringreplace.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringreplace/VB/stringreplace.vb" id="Snippet1"::: @@ -12684,7 +12596,6 @@ In addition, if the same set of characters is used to split strings in multiple ## Examples The following example uses the enumeration to include or exclude substrings generated by the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Split/options.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Split/options.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/system/string.split/omit.vb" id="Snippet1"::: @@ -13041,7 +12952,6 @@ In addition, if the same set of characters is used to split strings in multiple The following example uses the enumeration to include or exclude substrings generated by the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Split/options.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Split/options.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/system/string.split/omit.vb" id="Snippet1"::: @@ -13232,7 +13142,6 @@ In addition, if the same set of characters is used to split strings in multiple The following example uses the enumeration to include or exclude substrings generated by the method. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Split/options.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Split/options.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/system/string.split/omit.vb" id="Snippet1"::: @@ -13363,7 +13272,6 @@ This method performs a word (case-sensitive and culture-sensitive) comparison us The following example defines a `StripStartTags` method that uses the method to remove HTML start tags from the beginning of a string. Note that the `StripStartTags` method is called recursively to ensure that multiple HTML start tags at the beginning of the line are removed. The example does not remove HTML tags embedded in a string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/StartsWith/stringstartswith.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/StartsWith/stringstartswith.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringstartswith/VB/stringstartswith.vb" id="Snippet1"::: @@ -13445,14 +13353,12 @@ The method compares the `value` parameter to ## Examples The following example searches for the string "the" at the beginning of a longer string that begins with the word "The". As the output from the example shows, a call to the method that performs a culture-insensitive but case-sensitive comparison fails to match the string, while a call that performs a culture- and case-insensitive comparison matches the string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/String/StartsWith/StartsWith2.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/StartsWith/StartsWith2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.string.startswith/vb/StartsWith2.vb" id="Snippet2"::: The following example determines whether a string starts with a particular substring. It initializes a two-dimensional string array. The first element in the second dimension contains a string, and the second element contains the string to search for at the start of the first string. The results are affected by the choice of culture, whether case is ignored, and whether an ordinal comparison is performed. Note that when the string instance contains a ligature, culture-sensitive comparisons with its consecutive characters successfully match. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/StartsWith/startswith1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/StartsWith/startswith1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.string.startswith/vb/startswith1.vb" id="Snippet1"::: @@ -13624,7 +13530,6 @@ If `startIndex` is equal to zero, the method returns the original string unchang ## Examples The following example demonstrates obtaining a substring from a string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/String/Substring/Substring10.cs" interactive="try-dotnet-method" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Substring/Substring10.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring10.vb" id="Snippet10"::: @@ -13944,7 +13849,6 @@ For more information about the behavior of this method, see the Remarks section The following example uses the method with an . Because it attempts to compare a instance to a `TestClass` object, the method throws an . -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/CompareTo/extostring.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/CompareTo/extostring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ExToString/VB/extostring.vb" id="Snippet1"::: @@ -13991,7 +13895,6 @@ The following example uses the method with an The following example displays the enumerated constant for the type. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/GetTypeCode/gtc.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/GetTypeCode/gtc.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.gettypecode/VB/gtc.vb" id="Snippet1"::: @@ -15356,7 +15259,6 @@ For more information, see [Character Encoding in .NET](/dotnet/standard/base-typ ## Examples The following example converts a substring within a string to an array of characters, then enumerates and displays the elements of the array. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/ToCharArray/tocharry1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/ToCharArray/tocharry1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.ToCharArray1/VB/tocharry1.vb" id="Snippet1"::: @@ -15448,7 +15350,6 @@ The casing operation that results from calling the m method.Note that the example does not explicitly call the method. Instead, the method is called implicitly by the [composite formatting](/dotnet/standard/base-types/composite-formatting) feature. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/ToString/string.tostring.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/ToString/string.tostring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.tostring/VB/string.tostring.vb" id="Snippet1"::: @@ -15849,7 +15748,6 @@ The casing operation that results from calling the method to convert a series of one-character strings that contain each character in the Basic Latin, Latin-1 Supplement, and Latin Extended-A character sets. It then displays each string whose uppercase character is different from its lowercase character. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/ToUpper/ToUpperEx.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/ToUpper/ToUpperEx.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.ToUpper/vb/ToUpperEx.vb" id="Snippet1"::: @@ -16097,7 +15995,6 @@ White-space characters are defined by the Unicode standard. The `Trim` method re The following example uses the method to remove any extra white space from strings entered by the user before concatenating them. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/String/Trim/Trim2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Trim/Trim2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Trim/vb/Trim2.vb" id="Snippet2"::: @@ -16247,7 +16144,6 @@ If `trimChars` is `null` or an empty array, this method removes any leading or t The following example uses the `Trim(System.Char[])` method to remove space, asterisk (*), and apostrophe (') characters from a string. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Trim/Trim1.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Trim/Trim1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Trim/vb/Trim1.vb" id="Snippet1"::: diff --git a/xml/System/StringComparer.xml b/xml/System/StringComparer.xml index b3c5a221823..e9bc1525870 100644 --- a/xml/System/StringComparer.xml +++ b/xml/System/StringComparer.xml @@ -90,7 +90,6 @@ method of the class. The example illustrates how different objects sort three versions of the Latin letter I. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/StringComparer/Overview/omni.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/StringComparer/Overview/omni.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.StringComparer/vb/omni.vb" id="Snippet1"::: @@ -365,7 +364,6 @@ The following example demonstrates the properties and the method of the class. The example illustrates how different objects sort three versions of the Latin letter I. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/StringComparer/Overview/omni.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/StringComparer/Overview/omni.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.StringComparer/vb/omni.vb" id="Snippet1"::: @@ -491,7 +489,6 @@ The following example demonstrates the properties and the method of the class. The example illustrates how different objects sort three versions of the Latin letter I. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/StringComparer/Overview/omni.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/StringComparer/Overview/omni.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.StringComparer/vb/omni.vb" id="Snippet1"::: @@ -944,7 +941,6 @@ The following example demonstrates the properties and the method of the class. The example illustrates how different objects sort three versions of the Latin letter I. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/StringComparer/Overview/omni.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/StringComparer/Overview/omni.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.StringComparer/vb/omni.vb" id="Snippet1"::: @@ -1182,7 +1178,6 @@ A "well-known ordinal comparer" describes a comparer that behaves identically to ## Examples The following code example demonstrates the properties and the method of the class. The example illustrates how different objects sort three versions of the Latin letter I. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/StringComparer/Overview/omni.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/StringComparer/Overview/omni.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.StringComparer/vb/omni.vb" id="Snippet1"::: @@ -1248,7 +1243,6 @@ A "well-known ordinal comparer" describes a comparer that behaves identically to ## Examples The following code example demonstrates the properties and the method of the class. The example illustrates how different objects sort three versions of the Latin letter I. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/StringComparer/Overview/omni.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/StringComparer/Overview/omni.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.StringComparer/vb/omni.vb" id="Snippet1"::: diff --git a/xml/System/StringSplitOptions.xml b/xml/System/StringSplitOptions.xml index f6b079edd23..cebc7cc1073 100644 --- a/xml/System/StringSplitOptions.xml +++ b/xml/System/StringSplitOptions.xml @@ -72,7 +72,6 @@ The `TrimEntries` field is only available in .NET 5 and later versions. The following example shows how the `StringSplitOptions` enumeration is used to include or exclude substrings generated by the method: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/String/Split/options.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/String/Split/options.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/system/string.split/omit.vb" id="Snippet1"::: diff --git a/xml/System/TimeSpan.xml b/xml/System/TimeSpan.xml index 7d5a81ec7ec..9a224ec6456 100644 --- a/xml/System/TimeSpan.xml +++ b/xml/System/TimeSpan.xml @@ -199,7 +199,6 @@ The following example instantiates a object that represen ## Examples The following example creates several objects using the constructor overload that initializes a to a specified number of ticks. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/.ctor/ctorl.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/.ctor/ctorl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Ctor/VB/ctorl.vb" id="Snippet1"::: @@ -272,7 +271,6 @@ The following example instantiates a object that represen ## Examples The following example creates several objects using the constructor overload that initializes a to a specified number of hours, minutes, and seconds. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/.ctor/ctoriii.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/.ctor/ctoriii.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Ctor/VB/ctoriii.vb" id="Snippet2"::: @@ -342,7 +340,6 @@ The following example instantiates a object that represen ## Examples The following example creates several objects using the constructor overload that initializes a to a specified number of days, hours, minutes, and seconds. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/.ctor/ctoriiii.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/.ctor/ctoriiii.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Ctor/VB/ctoriiii.vb" id="Snippet3"::: @@ -414,7 +411,6 @@ The following example instantiates a object that represen ## Examples The following example creates several objects using the constructor overload that initializes a to a specified number of days, hours, minutes, seconds, and milliseconds. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/.ctor/ctoriiiii.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/.ctor/ctoriiiii.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Ctor/VB/ctoriiiii.vb" id="Snippet4"::: @@ -726,7 +722,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example compares several structures and other objects to a reference structure using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/CompareTo/cto_eq_obj.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/CompareTo/cto_eq_obj.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/VB/cto_eq_obj.vb" id="Snippet1"::: @@ -817,7 +812,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -881,7 +875,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects and displays the property of each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Days/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Days/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Properties/VB/properties.vb" id="Snippet1"::: @@ -1025,7 +1018,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example applies the method to several objects. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Duration/dura_nega_una.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Duration/dura_nega_una.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/VB/dura_nega_una.vb" id="Snippet1"::: @@ -1110,7 +1102,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example compares several and other objects to a reference using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/CompareTo/cto_eq_obj.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/CompareTo/cto_eq_obj.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/VB/cto_eq_obj.vb" id="Snippet1"::: @@ -1182,7 +1173,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -1248,7 +1238,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example compares several objects to a reference object using the static method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/CompareTo/comp_equal.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/CompareTo/comp_equal.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/VB/comp_equal.vb" id="Snippet2"::: @@ -1321,7 +1310,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/FromDays/fromdays.cs" interactive="try-dotnet" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/FromDays/fromdays.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.From/VB/fromdays.vb" id="Snippet6"::: @@ -1484,7 +1472,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/FromDays/fromhours.cs" interactive="try-dotnet" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/FromDays/fromhours.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.From/VB/fromhours.vb" id="Snippet5"::: @@ -1724,7 +1711,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects by using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/FromDays/frommillisec.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/FromDays/frommillisec.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.From/VB/frommillisec.vb" id="Snippet2"::: @@ -1880,7 +1866,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/FromDays/fromminutes.cs" interactive="try-dotnet" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/FromDays/fromminutes.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.From/VB/fromminutes.vb" id="Snippet4"::: @@ -2039,7 +2024,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/FromDays/fromseconds.cs" interactive="try-dotnet" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/FromDays/fromseconds.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.From/VB/fromseconds.vb" id="Snippet3"::: @@ -2198,7 +2182,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/FromDays/fromticks.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/FromDays/fromticks.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.From/VB/fromticks.vb" id="Snippet1"::: @@ -2267,7 +2250,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example generates the hash codes of several objects using the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/GetHashCode/hashcode.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/GetHashCode/hashcode.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/VB/hashcode.vb" id="Snippet1"::: @@ -2331,7 +2313,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example creates several objects and displays the property of each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Days/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Days/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Properties/VB/properties.vb" id="Snippet1"::: @@ -2426,7 +2407,6 @@ The specified `days`, `hours`, `minutes`, `seconds`, `milliseconds`, and `micros ## Examples The following example references and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: @@ -2671,7 +2651,6 @@ The property represents whole microseconds, ## Examples The following example creates several objects and displays the property of each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Days/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Days/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Properties/VB/properties.vb" id="Snippet1"::: @@ -2853,7 +2832,6 @@ The property represents whole microseconds, ## Examples The following example creates several objects and displays the property of each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Days/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Days/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Properties/VB/properties.vb" id="Snippet1"::: @@ -2976,7 +2954,6 @@ The property represents whole microseconds, ## Examples The following example references and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: @@ -3153,7 +3130,6 @@ The value of this constant is 100. ## Examples The following example applies the method to several objects. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Duration/dura_nega_una.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Duration/dura_nega_una.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/VB/dura_nega_una.vb" id="Snippet1"::: @@ -3374,7 +3350,6 @@ The value of this constant is 100. ## Examples The following example compares several objects to a reference using the operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/op_Equality/relationalops.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/op_Equality/relationalops.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/VB/relationalops.vb" id="Snippet1"::: @@ -3447,7 +3422,6 @@ The value of this constant is 100. ## Examples The following example compares several objects to a reference using the operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/op_Equality/relationalops.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/op_Equality/relationalops.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/VB/relationalops.vb" id="Snippet1"::: @@ -3519,7 +3493,6 @@ The value of this constant is 100. ## Examples The following example compares several objects to a reference using the operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/op_Equality/relationalops.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/op_Equality/relationalops.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/VB/relationalops.vb" id="Snippet1"::: @@ -3591,7 +3564,6 @@ The value of this constant is 100. ## Examples The following example compares several objects to a reference using the operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/op_Equality/relationalops.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/op_Equality/relationalops.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/VB/relationalops.vb" id="Snippet1"::: @@ -3663,7 +3635,6 @@ The value of this constant is 100. ## Examples The following example compares several objects to a reference using the operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/op_Equality/relationalops.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/op_Equality/relationalops.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/VB/relationalops.vb" id="Snippet1"::: @@ -3735,7 +3706,6 @@ The value of this constant is 100. ## Examples The following example compares several objects to a reference using the operator. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/op_Equality/relationalops.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/op_Equality/relationalops.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/VB/relationalops.vb" id="Snippet1"::: @@ -3951,7 +3921,6 @@ The value of this constant is 100. ## Examples The following example applies the operator to several objects. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Duration/dura_nega_una.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Duration/dura_nega_una.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/VB/dura_nega_una.vb" id="Snippet1"::: @@ -4013,7 +3982,6 @@ The value of this constant is 100. ## Examples The following example applies the operator to several objects. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Duration/dura_nega_una.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Duration/dura_nega_una.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/VB/dura_nega_una.vb" id="Snippet1"::: @@ -4894,7 +4862,6 @@ The following example defines an array of objects and displays the property of each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Days/properties.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Days/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Properties/VB/properties.vb" id="Snippet1"::: @@ -5161,7 +5128,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example creates several objects and displays the property of each. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/Days/properties.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/Days/properties.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Properties/VB/properties.vb" id="Snippet1"::: @@ -5229,7 +5195,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example references and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: @@ -5296,7 +5261,6 @@ This member is an explicit interface member implementation. It can be used only ## Examples The following example references and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: @@ -5401,7 +5365,6 @@ The value of this constant is 10. ## Examples The following example references and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: @@ -5468,7 +5431,6 @@ The value of this constant is 10. ## Examples The following example references and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: @@ -5535,7 +5497,6 @@ The value of this constant is 10. ## Examples The following example references and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: @@ -7390,7 +7351,6 @@ The following example defines an array of field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeSpan/MaxValue/fields.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeSpan/MaxValue/fields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeSpan.Fields/VB/fields.vb" id="Snippet1"::: diff --git a/xml/System/TimeZone.xml b/xml/System/TimeZone.xml index 9e77ce7da08..bc340fb27f9 100644 --- a/xml/System/TimeZone.xml +++ b/xml/System/TimeZone.xml @@ -67,27 +67,24 @@ Represents a time zone. - [!IMPORTANT] -> Whenever possible, use the class instead of the class. - - You can use the class to retrieve information about the current time zone, and to convert times from local time to Coordinated Universal Time (UTC) or vice versa. However, you cannot use the class to represent time zones other than the local zone or to handle date and time conversions from one time zone to another. For this purpose, use the class. You can use this class to retrieve information on any time zone defined on the local system, to create custom time zones, and to convert times from one time zone to another. - - The class supports only a single daylight saving time adjustment rule for the local time zone. As a result, the class can accurately report daylight saving time information or convert between UTC and local time only for the period in which the latest adjustment rule is in effect. In contrast, the class supports multiple adjustment rules, which makes it possible to work with historic time zone data. - - - -## Examples - The following example references and displays selected `TimeZone` class elements. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1"::: +> Whenever possible, use the class instead of the class. + + You can use the class to retrieve information about the current time zone, and to convert times from local time to Coordinated Universal Time (UTC) or vice versa. However, you cannot use the class to represent time zones other than the local zone or to handle date and time conversions from one time zone to another. For this purpose, use the class. You can use this class to retrieve information on any time zone defined on the local system, to create custom time zones, and to convert times from one time zone to another. + + The class supports only a single daylight saving time adjustment rule for the local time zone. As a result, the class can accurately report daylight saving time information or convert between UTC and local time only for the period in which the latest adjustment rule is in effect. In contrast, the class supports multiple adjustment rules, which makes it possible to work with historic time zone data. + +## Examples + The following example references and displays selected `TimeZone` class elements. + :::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: + ]]> @@ -174,20 +171,19 @@ Gets the time zone of the current computer. A object that represents the current local time zone. - property corresponds to the property. Whenever possible, use the property. - - - -## Examples - The following example references the `CurrentTimeZone` property and displays the names for standard time and daylight saving time for the local time zone. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1"::: + property corresponds to the property. Whenever possible, use the property. + + + +## Examples + The following example references the `CurrentTimeZone` property and displays the names for standard time and daylight saving time for the local time zone. + :::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: + ]]> @@ -235,22 +231,21 @@ Gets the daylight saving time zone name. The daylight saving time zone name. - property corresponds to the property. Whenever possible, use the property. - - - -## Examples - The following example references and displays the `DaylightName` property of the current time zone. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1"::: + property corresponds to the property. Whenever possible, use the property. + + + +## Examples + The following example references and displays the `DaylightName` property of the current time zone. + :::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: + ]]> @@ -299,13 +294,13 @@ Returns the daylight saving time period for a particular year. A object that contains the start and end date for daylight saving time in . - object, where the value of and is , and the value of is a initialized to 0 ticks. - + object, where the value of and is , and the value of is a initialized to 0 ticks. + ]]> @@ -359,24 +354,24 @@ Returns the Coordinated Universal Time (UTC) offset for the specified local time. The Coordinated Universal Time (UTC) offset from . - property. If the value of the property is or , the method returns the offset of the local time zone. If the value of the property is , the method returns an offset equal to . - - If the local time zone observes daylight saving time, applies the current adjustment rule to `time` when determining the offset of the local time zone. That is, the offset returned by reflects whether `time` falls in the time zone's standard time or its daylight saving time. - + property. If the value of the property is or , the method returns the offset of the local time zone. If the value of the property is , the method returns an offset equal to . + + If the local time zone observes daylight saving time, applies the current adjustment rule to `time` when determining the offset of the local time zone. That is, the offset returned by reflects whether `time` falls in the time zone's standard time or its daylight saving time. + > [!NOTE] -> The method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the UTC offset of a local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule. - - The method corresponds to the method. Whenever possible, use the method. - - Because the date and time value represented by `time` and this value's offset from UTC are not tightly coupled, a local or unspecified date and time value can return a different offset value when run on different computers or when run on the same computer under different time zones. If this behavior is undesirable, use a value instead. The data type tightly couples a date and time value with its offset from UTC. - +> The method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the UTC offset of a local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule. + + The method corresponds to the method. Whenever possible, use the method. + + Because the date and time value represented by `time` and this value's offset from UTC are not tightly coupled, a local or unspecified date and time value can return a different offset value when run on different computers or when run on the same computer under different time zones. If this behavior is undesirable, use a value instead. The data type tightly couples a date and time value with its offset from UTC. + ]]> @@ -436,13 +431,13 @@ if is in a daylight saving time period; otherwise, . - class supports a single daylight saving time adjustment rule, the method applies the current adjustment rule to any date, regardless of whether the adjustment rule was in effect on that date. Assuming that the operating system itself has accurate historic daylight saving time data, a more accurate result is available by using the method. Whenever possible, use the method. - + class supports a single daylight saving time adjustment rule, the method applies the current adjustment rule to any date, regardless of whether the adjustment rule was in effect on that date. Assuming that the operating system itself has accurate historic daylight saving time data, a more accurate result is available by using the method. Whenever possible, use the method. + ]]> @@ -494,11 +489,11 @@ if is in ; otherwise, . - method provides the same functionality as this overload of the method. Whenever possible, use the method. - + method provides the same functionality as this overload of the method. Whenever possible, use the method. + ]]> @@ -545,20 +540,19 @@ Gets the standard time zone name. The standard time zone name. - property corresponds to the property. Whenever possible, use the property. - - - -## Examples - The following example references and displays the `StandardName` property of the current time zone. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1"::: + property corresponds to the property. Whenever possible, use the property. + + + +## Examples + The following example references and displays the `StandardName` property of the current time zone. + :::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1"::: + ]]> An attempt was made to set this property to . @@ -608,31 +602,31 @@ Returns the local time that corresponds to a specified date and time value. A object whose value is the local time that corresponds to . - value returned by this method. - -|`time` parameter|Behavior|Return value| -|----------------------|--------------|------------------| -|A Coordinated Universal Time (UTC) time ().|Converts the time from UTC to the local time.|A object whose value is the local time that corresponds to `time`.| -|A local time ().|No conversion necessary.|The same value represented by the `time` parameter.| -|An unspecified time ().|Assumes that the time is UTC and converts it from UTC to the local time.|A object whose value is the local time that corresponds to `time`.| - - If the local time zone observes daylight saving time, applies the current adjustment rule to `time` when performing the conversion. - + value returned by this method. + +|`time` parameter|Behavior|Return value| +|----------------------|--------------|------------------| +|A Coordinated Universal Time (UTC) time ().|Converts the time from UTC to the local time.|A object whose value is the local time that corresponds to `time`.| +|A local time ().|No conversion necessary.|The same value represented by the `time` parameter.| +|An unspecified time ().|Assumes that the time is UTC and converts it from UTC to the local time.|A object whose value is the local time that corresponds to `time`.| + + If the local time zone observes daylight saving time, applies the current adjustment rule to `time` when performing the conversion. + > [!NOTE] -> The method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the local time corresponding to a particular UTC time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule. - - The method corresponds to the method with its `destinationTimeZone` parameter set to . Whenever possible, use the method. - +> The method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the local time corresponding to a particular UTC time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule. + + The method corresponds to the method with its `destinationTimeZone` parameter set to . Whenever possible, use the method. + ]]> - Although it is not required, in most cases derived classes running under the .NET Framework version 2.0 should override the default implementation of this method. In the .NET Framework versions 1.0 and 1.1, the method called the method and adjusted for daylight saving time when returning the local time. However, starting with the .NET Framework 2.0, the behavior of the default implementation depends on the property of the parameter. If its value is , this method returns unchanged. If its value is either or , this method assumes is UTC and converts it to the local system time without calling the method. - - The following code provides a simple override of the default implementation of the method. In this code, the variable represents a private instance of the class: - + Although it is not required, in most cases derived classes running under the .NET Framework version 2.0 should override the default implementation of this method. In the .NET Framework versions 1.0 and 1.1, the method called the method and adjusted for daylight saving time when returning the local time. However, starting with the .NET Framework 2.0, the behavior of the default implementation depends on the property of the parameter. If its value is , this method returns unchanged. If its value is either or , this method assumes is UTC and converts it to the local system time without calling the method. + + The following code provides a simple override of the default implementation of the method. In this code, the variable represents a private instance of the class: + :::code language="csharp" source="~/snippets/csharp/System/TimeZone/ToLocalTime/TimeZone_ToLocalTime.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.ToLocalTime/VB/TimeZone_ToLocalTime.vb" id="Snippet1"::: @@ -682,20 +676,20 @@ Returns the Coordinated Universal Time (UTC) that corresponds to a specified time. A object whose value is the Coordinated Universal Time (UTC) that corresponds to . - applies the current adjustment rule to the `time` parameter when performing the conversion. - + applies the current adjustment rule to the `time` parameter when performing the conversion. + > [!NOTE] -> The method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the Coordinated Universal Time (UTC) corresponding to a particular local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule. - - If the `time` parameter is an ambiguous time, the method assumes that it is a standard time. (An ambiguous time is one that can map either to a standard time or to a daylight saving time in the local time zone.) If `time` is an invalid time, the method simply subtracts the local time from the local time zone's UTC offset to return UTC. (An invalid time is one that does not exist because of the application of daylight saving time adjustment rules.) - - Because `time` is interpreted in relation to the current time zone on the current system, the date and time returned by this method can differ if an application is run on different computers or on the same computer with different time zones. For cases in which a date and time value must represent a single, unambiguous point in time, use a value to represent the local time. - - The method corresponds to the method overload with a parameter whose property does not equal . Whenever possible, use the method overload. - +> The method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the Coordinated Universal Time (UTC) corresponding to a particular local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule. + + If the `time` parameter is an ambiguous time, the method assumes that it is a standard time. (An ambiguous time is one that can map either to a standard time or to a daylight saving time in the local time zone.) If `time` is an invalid time, the method simply subtracts the local time from the local time zone's UTC offset to return UTC. (An invalid time is one that does not exist because of the application of daylight saving time adjustment rules.) + + Because `time` is interpreted in relation to the current time zone on the current system, the date and time returned by this method can differ if an application is run on different computers or on the same computer with different time zones. For cases in which a date and time value must represent a single, unambiguous point in time, use a value to represent the local time. + + The method corresponds to the method overload with a parameter whose property does not equal . Whenever possible, use the method overload. + ]]> diff --git a/xml/System/TimeoutException.xml b/xml/System/TimeoutException.xml index a346fa5d0c3..20bcd483eb7 100644 --- a/xml/System/TimeoutException.xml +++ b/xml/System/TimeoutException.xml @@ -84,7 +84,6 @@ ## Examples The following code example demonstrates the use of in conjunction with members of the class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TimeoutException/Overview/to.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/TimeoutException/Overview/to.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TimeoutException.class/VB/to.vb" id="Snippet1"::: diff --git a/xml/System/Type.xml b/xml/System/Type.xml index b44d441489a..df029068488 100644 --- a/xml/System/Type.xml +++ b/xml/System/Type.xml @@ -99,7 +99,6 @@ To identify the overload signature, the code example creates a temporary array c The code example uses the to invoke the method on the string "Hello, World!", and displays the result. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/Overview/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/Overview/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type/vb/source.vb" id="Snippet1"::: @@ -254,7 +253,6 @@ The code example uses the to invoke the represents a constructed generic type, the base type reflects the generic arguments. For example, consider the following declarations: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/BaseType/remarks.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/BaseType/remarks.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.type.basetype/vb/remarks.vb" id="Snippet1"::: @@ -524,7 +520,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples The following example demonstrates using the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/BaseType/testbasetype.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/BaseType/testbasetype.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TestBaseType/VB/testbasetype.vb" id="Snippet1"::: @@ -600,7 +595,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples 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 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 property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/ContainsGenericParameters/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/ContainsGenericParameters/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/VB/source.vb" id="Snippet1"::: @@ -684,7 +678,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples 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 property for the method's generic type parameter. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/DeclaringMethod/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/DeclaringMethod/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MethodInfo.Generics/VB/source.vb" id="Snippet1"::: @@ -759,7 +752,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 If the current object represents a type parameter of a generic method, this property returns the type that contains the generic method definition. If the type is generic, the generic type definition is returned. That is, the following code returns the generic type definition of the generic class, which contains the generic method: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/DeclaringType/remarks.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/DeclaringType/remarks.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.type.declaringtype/vb/remarks.vb" id="Snippet1"::: @@ -777,7 +769,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples This example displays the declaring type of a method in a derived class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/DeclaringType/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/DeclaringType/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/VB/source.vb" id="Snippet1"::: @@ -865,7 +856,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples The following example gets the default binder from the `DefaultBinder` property, and invokes a member of MyClass by passing the `DefaultBinder` value as a parameter to . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/DefaultBinder/type_defaultbinder.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/DefaultBinder/type_defaultbinder.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_DefaultBinder/VB/type_defaultbinder.vb" id="Snippet1"::: @@ -961,7 +951,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples The following code example shows the `EmptyTypes` field used in one of the `GetConstructor` methods to get a constructor that takes no parameters. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/EmptyTypes/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/EmptyTypes/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/VB/source.vb" id="Snippet1"::: @@ -1190,7 +1179,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples The following example gets the `FilterAttribute` delegate, passes it as a parameter to the method, and displays the specified members and their attributes. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/FilterAttribute/type_filterattribute.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/FilterAttribute/type_filterattribute.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_FilterAttribute/VB/type_filterattribute.vb" id="Snippet1"::: @@ -1251,7 +1239,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples The following code example gets the methods associated with the user-defined `Application` type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/FilterName/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/FilterName/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.FilterName Example/VB/source.vb" id="Snippet1"::: @@ -1312,7 +1299,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples The following example gets the `MemberFilter` delegate, passes it as a parameter to the method, and displays the methods and their attributes of the `String` class that begin with the letter "c", disregarding the case. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/FilterNameIgnoreCase/type_filternameignorecase.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/FilterNameIgnoreCase/type_filternameignorecase.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_FilterNameIgnoreCase/VB/type_filternameignorecase.vb" id="Snippet1"::: @@ -1406,7 +1392,6 @@ TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3 ## Examples The following example finds the specified interface implemented or inherited by the specified type, and then displays the interface names. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/FindInterfaces/type_findinterfaces.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/FindInterfaces/type_findinterfaces.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_FindInterfaces/VB/type_findinterfaces.vb" id="Snippet1"::: @@ -1542,7 +1527,6 @@ The `filter` argument can be a custom delegate of type property and the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GenericParameterAttributes/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GenericParameterAttributes/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/VB/source.vb" id="Snippet1"::: @@ -1799,7 +1781,6 @@ The `filter` argument can be a custom delegate of type property, it's necessary to identify the generic type or method a type parameter belongs to. For example, consider the return value of the generic method `GetSomething` in the following code: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GenericParameterPosition/remarks.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GenericParameterPosition/remarks.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.type.genericparameterposition/vb/remarks.vb" id="Snippet1"::: @@ -1814,7 +1795,6 @@ The `filter` argument can be a custom delegate of type , 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 property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/ContainsGenericParameters/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/ContainsGenericParameters/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/VB/source.vb" id="Snippet1"::: @@ -1943,7 +1923,6 @@ The `filter` argument can be a custom delegate of type object, and displays the constructor signature. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetConstructor/type_getconstructor.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetConstructor/type_getconstructor.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetConstructor/VB/type_getconstructor.vb" id="Snippet1"::: @@ -2282,7 +2260,6 @@ The `filter` argument can be a custom delegate of type object, and displays the constructor signature. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetConstructor/type_getconstructor2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetConstructor/type_getconstructor2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetConstructor2/VB/type_getconstructor2.vb" id="Snippet1"::: @@ -2445,7 +2422,6 @@ The `filter` argument can be a custom delegate of type object, and displays the constructor signature. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetConstructor/type_getconstructor3.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetConstructor/type_getconstructor3.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetConstructor3/VB/type_getconstructor3.vb" id="Snippet1"::: @@ -2618,7 +2594,6 @@ The `filter` argument can be a custom delegate of type overload from a class that has two instance constructors and one static constructor. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetConstructors/source1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetConstructors/source1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/VB/source1.vb" id="Snippet1"::: @@ -2635,7 +2610,6 @@ False To find static constructors, use the overload, and pass it the combination (logical OR) of , , , , as shown in the following code example: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetConstructors/source2.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetConstructors/source2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/VB/source2.vb" id="Snippet2"::: @@ -2923,7 +2897,6 @@ If the current represents a generic type parameter, the represents a generic type parameter, the represents a generic type parameter, the object and gets the event for a button class for the specified event. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetEvent/type_getevent.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetEvent/type_getevent.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetEvent/VB/type_getevent.vb" id="Snippet1"::: @@ -3465,7 +3436,6 @@ If the current represents a generic type parameter, the method to search a type for a public or non-public event named "Click" that is not `static` (`Shared` in Visual Basic). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetEvent/type_getevent1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetEvent/type_getevent1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/type_getevent1/VB/type_getevent1.vb" id="Snippet1"::: @@ -3581,7 +3551,6 @@ If the current represents a generic type parameter, the represents a generic type parameter, the represents a generic type parameter, the object for the field, and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetField/type_getfield.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetField/type_getfield.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetField/VB/type_getfield.vb" id="Snippet1"::: @@ -3914,7 +3881,6 @@ If the current represents a generic type parameter, the object for the field that matches the specified binding flags, and displays the value of the field. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetField/type_getfield.cs" interactive="try-dotnet" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetField/type_getfield.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetField/VB/type_getfield.vb" id="Snippet2"::: @@ -4027,7 +3993,6 @@ If the current represents a generic type parameter, the method does ## Examples The following example shows a use of the `GetFields(BindingFlags)` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetFields/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetFields/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/VB/source.vb" id="Snippet1"::: @@ -4316,7 +4280,6 @@ In .NET 6 and earlier versions, the method does This code example is part of a larger example provided for the property. See the larger example for sample output. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsGenericParameter/source.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsGenericParameter/source.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/VB/source.vb" id="Snippet2"::: @@ -4381,7 +4344,6 @@ In .NET 6 and earlier versions, the method does ## Examples The following code example defines a generic type `Test` with two type parameters that have different constraints. When the program executes, the constraints are examined using the property and the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GenericParameterAttributes/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GenericParameterAttributes/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/VB/source.vb" id="Snippet1"::: @@ -4460,7 +4422,6 @@ In .NET 6 and earlier versions, the method does ## Examples The following code example creates an instance of a constructed type by using ordinary instance creation and then uses the and methods to retrieve the constructed type and the generic type definition. This example uses the generic type; the constructed type represents a of `Test` objects with string keys. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetGenericTypeDefinition/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetGenericTypeDefinition/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/VB/source.vb" id="Snippet1"::: @@ -4539,7 +4500,6 @@ In .NET 6 and earlier versions, the method does ## Examples The following example displays the hash code of the `System.Windows.Forms.Button` class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetHashCode/type_gethashcode_getfields.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetHashCode/type_gethashcode_getfields.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetHashCode_GetFields/VB/type_gethashcode_getfields.vb" id="Snippet1"::: @@ -4643,7 +4603,6 @@ In .NET 6 and earlier versions, the method does The code example also demonstrates the method overload and the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetInterface/type_getinterface.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetInterface/type_getinterface.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetInterface/VB/type_getinterface.vb" id="Snippet1"::: @@ -4747,7 +4706,6 @@ In .NET 6 and earlier versions, the method does The code example also demonstrates the method overload and the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetInterface/type_getinterface.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetInterface/type_getinterface.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetInterface/VB/type_getinterface.vb" id="Snippet2"::: @@ -4930,7 +4888,6 @@ The current instance or argument is an open ge `vbc type_getinterfaces1.vb /r:System.Web.dll /r:System.dll` - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetInterfaces/type_getinterfaces1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetInterfaces/type_getinterfaces1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetInterfaces1/VB/type_getinterfaces1.vb" id="Snippet1"::: @@ -5047,7 +5004,6 @@ The current instance or argument is an open ge ## Examples The following example displays all the members of the `String` class that start with the letter C. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMember/type_getmember.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMember/type_getmember.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMember/VB/type_getmember.vb" id="Snippet1"::: @@ -5168,7 +5124,6 @@ The current instance or argument is an open ge ## Examples The following example displays all the public static members of the `myString` class that start with the letter C. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMember/type_getmember.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMember/type_getmember.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMember/VB/type_getmember.vb" id="Snippet2"::: @@ -5289,7 +5244,6 @@ The current instance or argument is an open ge ## Examples The following example displays all the methods of the `myString` class that start with the letter C. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMember/type_getmember.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMember/type_getmember.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMember/VB/type_getmember.vb" id="Snippet3"::: @@ -5412,7 +5366,6 @@ Members include properties, methods, constructors, fields, events, and nested ty ## Examples The following code example demonstrates how to use the method overload to collect information about all public members of a specified class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMembers/type_getmembers1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMembers/type_getmembers1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMembers1/VB/type_getmembers1.vb" id="Snippet1"::: @@ -5529,7 +5482,6 @@ In .NET 6 and earlier versions, the method does ## Examples The following code example demonstrates how to use the method overload to collect information about all public instance members of a specified class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMembers/type_getmembers2.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMembers/type_getmembers2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMembers2/VB/type_getmembers2.vb" id="Snippet1"::: @@ -5694,7 +5646,6 @@ This method can be used to find a constructed generic member given a member from ## Examples The following example gets a method named `MethodA`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMethod/type_getmethod1.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMethod/type_getmethod1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMethod1/VB/type_getmethod1.vb" id="Snippet1"::: @@ -5828,7 +5779,6 @@ This method can be used to find a constructed generic member given a member from ## Examples The following example gets the method that matches the specified binding flags. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMethod/type_getmethod2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMethod/type_getmethod2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMethod2/VB/type_getmethod2.vb" id="Snippet1"::: @@ -5937,7 +5887,6 @@ This method can be used to find a constructed generic member given a member from > [!NOTE] > The Visual C# 2005 example requires the `/unsafe` compiler option. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMethod/type_getmethod4.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetMethod/type_getmethod4.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMethod4/VB/type_getmethod4.vb" id="Snippet1"::: @@ -6487,7 +6436,6 @@ One of the elements in the array is array is represents a type parameter in the definition ## Examples The following example creates a class with two public methods and one protected method, creates a `Type` object corresponding to `MyTypeClass`, gets all public and non-public methods, and displays their names. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetMethods/type_getmethods2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetMethods2/VB/type_getmethods2.vb" id="Snippet1"::: @@ -7660,7 +7606,6 @@ If the current represents a type parameter in the definition ## Examples The following example defines a nested class and a `struct` in `MyClass`, and then obtains objects of the nested types using the type of `MyClass`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetNestedTypes/type_getnestedtypes.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetNestedTypes/VB/type_getnestedtypes.vb" id="Snippet1"::: @@ -7762,7 +7707,6 @@ If the current represents a type parameter in the definition ## Examples The following example creates two nested public classes and two nested protected classes, and displays information for classes that match the specified binding constraints. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetNestedTypes/type_getnestedclassesabs.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetNestedClassesAbs/VB/type_getnestedclassesabs.vb" id="Snippet1"::: @@ -7919,7 +7863,6 @@ If the current represents a type parameter in the definition ## Examples The following example demonstrates the use of the `GetProperties` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetProperties/type_gettypecode.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetProperties/type_gettypecode.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetTypeCode/VB/type_gettypecode.vb" id="Snippet2"::: @@ -8028,7 +7971,6 @@ In .NET 6 and earlier versions, the method d ## Examples The following example defines a class named `PropertyClass` that includes six properties: two are public, one is private, one is protected, one is internal (`Friend` in Visual Basic), and one is protected internal (`Protected Friend` in Visual Basic). It then displays some basic property information (the property name and type, whether it's read/write, and the visibility of its `get` and `set` accessors) for the properties that match the specified binding constraints. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetProperties/type_getproperties2.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetProperties/type_getproperties2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperties2/VB/type_getproperties2.vb" id="Snippet1"::: @@ -8121,7 +8063,6 @@ In .NET 6 and earlier versions, the method d property of `System.Int32`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetType/type_gettype.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetType/type_gettype.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetType/VB/type_gettype.vb" id="Snippet1"::: @@ -9420,7 +9356,6 @@ Type.GetType("System.Collections.Generic.Dictionary`2[System.String,[MyType,MyAs ## Examples The following example retrieves the type of `System.Int32` and uses that type object to display the property of `System.Int32`. If a type object refers to an assembly that does not exist, this example throws an exception. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetType/type_gettype.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetType/type_gettype.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetType/VB/type_gettype.vb" id="Snippet1"::: @@ -10142,7 +10077,6 @@ Calling this method overload is the same as calling the method to list the types of the elements of an array. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetProperties/type_gettypecode.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetProperties/type_gettypecode.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetTypeCode/VB/type_gettypecode.vb" id="Snippet3"::: @@ -10213,7 +10147,6 @@ Calling this method overload is the same as calling the enumeration can be used. In a decision block inside the `WriteObjectInfo` method, the of an parameter is examined, and an appropriate message is written to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetTypeCode/iconvertible.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetTypeCode/iconvertible.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TypeCode/VB/iconvertible.vb" id="Snippet2"::: @@ -10739,7 +10672,6 @@ Calling this method overload is the same as calling the method to get a object from a provided by the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetTypeFromHandle/type_gettypefromhandle.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetTypeFromHandle/type_gettypefromhandle.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_GetTypeFromHandle/VB/type_gettypefromhandle.vb" id="Snippet1"::: @@ -10911,7 +10843,6 @@ Calling this method overload is the same as calling the structure using the `GUID` property of the `Type` class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GUID/type_guid.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GUID/type_guid.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_Guid/VB/type_guid.vb" id="Snippet1"::: @@ -11291,7 +11218,6 @@ Calling this method overload is the same as calling the property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsAutoLayout/type_isautolayout.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsAutoLayout/type_isautolayout.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsAutoLayout/VB/type_isautolayout.vb" id="Snippet1"::: @@ -12762,7 +12682,6 @@ GetType(Array).IsAssignableFrom(type) ## Examples The following example demonstrates a use of the `IsByRef` property to check whether a specified type is passed by reference. The example defines the class `MyTypeDelegator`, which overrides the `HasElementTypeImpl` method. The main class checks for the `HasElementType` property and displays the element type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/HasElementTypeImpl/type_haselementtypeimpl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/HasElementTypeImpl/type_haselementtypeimpl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_HasElementTypeImpl/VB/type_haselementtypeimpl.vb" id="Snippet1"::: @@ -12921,7 +12840,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example creates an instance of a type and indicates whether the type is a class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsClass/type_isclass.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsClass/type_isclass.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsClass/VB/type_isclass.vb" id="Snippet1"::: @@ -13155,7 +13073,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example demonstrates the `IsContextful`, , and properties of the class. It checks whether the given type can be hosted in the context, whether it can be marshaled by reference, and whether the type is a primitive data type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsContextful/type_iscontextful.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsContextful/type_iscontextful.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsContextful/VB/type_iscontextful.vb" id="Snippet1"::: @@ -13218,7 +13135,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example demonstrates a use of the `IsContextfulImpl` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsContextfulImpl/type_iscontextfulimpl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsContextfulImpl/type_iscontextfulimpl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsContextfulImpl/VB/type_iscontextfulimpl.vb" id="Snippet1"::: @@ -13296,7 +13212,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example demonstrates how to use the `IsEnum` property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsEnum/testisenum.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsEnum/testisenum.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TestIsEnum/VB/testisenum.vb" id="Snippet1"::: @@ -13623,7 +13538,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example uses the property to test for generic type parameters in a generic type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetGenericArguments/source.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/GetGenericArguments/source.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.IsGenericParameter/VB/source.vb" id="Snippet2"::: @@ -13698,7 +13612,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance The following code example and table illustrate some of these terms and invariants. The `Derived` class is of particular interest because its base type is a constructed type that has a mixture of types and type parameters in its type argument list. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsGenericType/remarks.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsGenericType/remarks.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.IsGenericType/vb/remarks.vb" id="Snippet2"::: @@ -13719,7 +13632,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following code example displays the value of the , , , and properties for the types described in the Remarks section. For explanations of the property values, see the accompanying table in Remarks. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsGenericType/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsGenericType/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.IsGenericType/vb/source.vb" id="Snippet1"::: @@ -13785,7 +13697,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example displays information about a type, including whether or not it's a generic type definition. Information is displayed for a constructed type, for its generic type definition, and for an ordinary type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsGenericParameter/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsGenericParameter/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/VB/source.vb" id="Snippet1"::: @@ -13963,7 +13874,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example demonstrates the use of the `IsInstanceOfType` method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsInstanceOfType/testisinstanceoftype.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsInstanceOfType/testisinstanceoftype.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TestIsInstanceOfType/VB/testisinstanceoftype.vb" id="Snippet1"::: @@ -14035,7 +13945,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example creates an interface, checks for the interface type, and indicates whether a class has the `IsInterface` property set. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsInterface/type_isinterface.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsInterface/type_isinterface.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsInterface/VB/type_isinterface.vb" id="Snippet1"::: @@ -14109,7 +14018,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example creates an instance of a class for which the enumeration value in the class has been set, checks for the property, and displays the result. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsLayoutSequential/type_islayoutsequential.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsLayoutSequential/type_islayoutsequential.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsLayoutSequential/VB/type_islayoutsequential.vb" id="Snippet1"::: @@ -14170,7 +14078,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example demonstrates the , `IsMarshalByRef`, and properties of the class. It checks whether the given type can be hosted in the context, whether it can be marshaled by reference, and whether the type is a primitive data type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsContextful/type_iscontextful.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsContextful/type_iscontextful.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsContextful/VB/type_iscontextful.vb" id="Snippet1"::: @@ -14231,7 +14138,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example determines whether the given type is marshaled by reference and displays the result. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsMarshalByRefImpl/type_ismarshalbyrefimpl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsMarshalByRefImpl/type_ismarshalbyrefimpl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsMarshalByRefImpl/VB/type_ismarshalbyrefimpl.vb" id="Snippet1"::: @@ -14766,14 +14672,12 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples This example uses the `IsNotPublic` property to get the visibility of the type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsNotPublic/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsNotPublic/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/VB/source.vb" id="Snippet1"::: The following code example demonstrates why you cannot use `IsPublic` and `IsNotPublic` for nested classes. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsNotPublic/source.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsNotPublic/source.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/VB/source.vb" id="Snippet2"::: @@ -14853,7 +14757,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example shows a use of the `IsPointer` property. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/HasElementTypeImpl/type_haselementtypeimpl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/HasElementTypeImpl/type_haselementtypeimpl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_HasElementTypeImpl/VB/type_haselementtypeimpl.vb" id="Snippet1"::: @@ -14962,7 +14865,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example demonstrates the , , and `IsPrimitive` properties of the class. It checks whether the given type can be hosted in the context, whether it can be marshaled by reference, and whether the type is a primitive data type. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsContextful/type_iscontextful.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsContextful/type_iscontextful.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsContextful/VB/type_iscontextful.vb" id="Snippet1"::: @@ -15035,7 +14937,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example determines whether the given type is a primitive type and displays the result. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsPrimitiveImpl/type_isprimitiveimpl.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsPrimitiveImpl/type_isprimitiveimpl.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsPrimitiveImpl/VB/type_isprimitiveimpl.vb" id="Snippet1"::: @@ -15120,7 +15021,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example creates an instance of `MyTestClass`, checks for the `IsPublic` property, and displays the result. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsPublic/type_ispublic.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsPublic/type_ispublic.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type.IsPublic/VB/type_ispublic.vb" id="Snippet1"::: @@ -15185,7 +15085,6 @@ Byref-like structures are declared using `ref struct` keyword in C#. An instance ## Examples The following example creates an instance of a `sealed` class, checks for the `IsSealed` property, and displays the result. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/IsSealed/type_issealed.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/IsSealed/type_issealed.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_IsSealed/VB/type_issealed.vb" id="Snippet1"::: @@ -15446,7 +15345,6 @@ Types that are defined in the .NET Standard are not marked with method to create a constructed type from the generic type definition for the type. The constructed type represents a of `Test` objects with string keys. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/MakeGenericType/source.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/MakeGenericType/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.BindGenericParameters/VB/source.vb" id="Snippet1"::: @@ -16568,7 +16461,6 @@ The following example uses the method to c ## Examples The following code example creates array, `ref` (`ByRef` in Visual Basic), and pointer types for the `Test` class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/MakeByRefType/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/MakeByRefType/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Type.MakeXxxType/VB/source.vb" id="Snippet1"::: @@ -16641,7 +16533,6 @@ The following example uses the method to c ## Examples The following code example shows the `MemberType` field as a parameter to the `GetMember` method: - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/MemberType/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/MemberType/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.MemberType Example/VB/source.vb" id="Snippet1"::: @@ -16703,7 +16594,6 @@ The following example uses the method to c ## Examples The following code example shows the use of the `Missing` field to invoke a method with its default arguments. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/Missing/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/Missing/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.Missing Example/VB/source.vb" id="Snippet1"::: @@ -16775,7 +16665,6 @@ The following example uses the method to c ## Examples This following example demonstrates a use of the and `Module` properties and the method of . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/Module/type_tostring.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/Module/type_tostring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_ToString/VB/type_tostring.vb" id="Snippet1"::: @@ -16882,7 +16771,6 @@ The following example uses the method to c ## Examples This following example demonstrates a use of the `Namespace` and properties and the method of . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/Module/type_tostring.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/Module/type_tostring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_ToString/VB/type_tostring.vb" id="Snippet1"::: @@ -17060,7 +16948,6 @@ The following example uses the method to c ## Examples This example displays the reflected type of a nested class. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/ReflectedType/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/ReflectedType/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/VB/source.vb" id="Snippet1"::: @@ -17254,7 +17141,6 @@ The following example uses the method to c ## Examples The following code example first defines a class, a structure, and a structure with special layout attributes (the structures are nested within the class). The example then uses the property to obtain a for each type, and displays the properties of the attributes. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/StructLayoutAttribute/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/StructLayoutAttribute/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type.StructLayoutAttribute/VB/source.vb" id="Snippet1"::: @@ -17522,7 +17408,6 @@ The following example uses the method to c ## Examples This following example demonstrates a use of the and properties and the `ToString` method of . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/Module/type_tostring.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/Module/type_tostring.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_ToString/VB/type_tostring.vb" id="Snippet1"::: @@ -17597,7 +17482,6 @@ The following example uses the method to c ## Examples The following example returns the handle of the corresponding type and passes the handle to a method that gets the type from the handle and displays it. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Type/TypeHandle/type_typehandle.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Type/TypeHandle/type_typehandle.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Type_TypeHandle/VB/type_typehandle.vb" id="Snippet1"::: diff --git a/xml/System/TypeCode.xml b/xml/System/TypeCode.xml index e7e63870615..79e2c45adf7 100644 --- a/xml/System/TypeCode.xml +++ b/xml/System/TypeCode.xml @@ -58,22 +58,21 @@ Specifies the type of an object. - method on classes that implement the interface to obtain the type code for an instance of that class. + + Otherwise, call an object's method to obtain its object, then call the `Type` object's method to obtain the object's type code. + + + +## Examples + The following code example demonstrates how the enumeration can be used. In a decision block inside the WriteObjectInfo method, the of an parameter is examined, and an appropriate message is written to the console. -## Remarks - Call the method on classes that implement the interface to obtain the type code for an instance of that class. - - Otherwise, call an object's method to obtain its object, then call the `Type` object's method to obtain the object's type code. - - - -## Examples - The following code example demonstrates how the enumeration can be used. In a decision block inside the WriteObjectInfo method, the of an parameter is examined, and an appropriate message is written to the console. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Type/GetTypeCode/iconvertible.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TypeCode/VB/iconvertible.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TypeCode/VB/iconvertible.vb" id="Snippet2"::: + ]]> diff --git a/xml/System/TypeLoadException.xml b/xml/System/TypeLoadException.xml index 97c0a9ca586..c1acc22de96 100644 --- a/xml/System/TypeLoadException.xml +++ b/xml/System/TypeLoadException.xml @@ -80,9 +80,9 @@ is thrown when the common language runtime cannot find the assembly, the type within the assembly, or cannot load the type. The property contains more detailed information that can help you identify the cause of the exception. + is thrown when the common language runtime cannot find the assembly or the type within the assembly, or cannot load the type. The property contains more detailed information that can help you identify the cause of the exception. - uses the HRESULT COR_E_TYPELOAD, that has the value 0x80131522. + uses the HRESULT COR_E_TYPELOAD, which has the value 0x80131522. For a list of initial property values for an instance of , see the constructors. @@ -223,7 +223,6 @@ The exact timing of when statically referenced types are loaded is unspecified. ## Examples The following code example demonstrates the constructor. It contains a method that generates a with a custom message, and displays the error message to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_constructor2.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TypeLoadException_Constructor2/VB/typeloadexception_constructor2.vb" id="Snippet1"::: @@ -296,7 +295,6 @@ The exact timing of when statically referenced types are loaded is unspecified. ## Examples The following example generates an exception, and serializes the exception data to a file, and then reconstitutes the exception. For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_getobjectdata.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TypeLoadException_GetObjectData/VB/typeloadexception_getobjectdata.vb" id="Snippet1"::: @@ -369,7 +367,6 @@ The exact timing of when statically referenced types are loaded is unspecified. ## Examples The following code example demonstrates the constructor. It contains a method that generates a , catches that exception, and throws a new with a custom message, including the original as the inner exception. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_constructor3.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TypeLoadException_Constructor3/VB/typeloadexception_constructor3.vb" id="Snippet1"::: @@ -453,7 +450,6 @@ The exact timing of when statically referenced types are loaded is unspecified. The following example generates an exception, and serializes the exception data to a file, and then reconstitutes the exception. For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_getobjectdata.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TypeLoadException_GetObjectData/VB/typeloadexception_getobjectdata.vb" id="Snippet1"::: @@ -525,7 +521,6 @@ The exact timing of when statically referenced types are loaded is unspecified. ## Examples The following example attempts to load a non-existent type from the mscorlib assembly. The resulting exception is caught, and the and values are displayed. For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TypeLoadException/Message/typeloadexception_typename.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TypeLoadException_TypeName/VB/typeloadexception_typename.vb" id="Snippet1"::: @@ -581,7 +576,6 @@ The exact timing of when statically referenced types are loaded is unspecified. ## Examples The following example attempts to load a non-existent type from the mscorlib assembly. The resulting exception is caught, and the and values are displayed. For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/TypeLoadException/Message/typeloadexception_typename.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/TypeLoadException_TypeName/VB/typeloadexception_typename.vb" id="Snippet1"::: diff --git a/xml/System/UInt16.xml b/xml/System/UInt16.xml index db975025c06..9d7acbc6ba6 100644 --- a/xml/System/UInt16.xml +++ b/xml/System/UInt16.xml @@ -411,7 +411,6 @@ ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/UInt16/CompareTo/source.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/UInt16/CompareTo/source.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/UInt16 Example/VB/source.vb" id="Snippet3"::: @@ -506,7 +505,6 @@ ## Examples The following example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -792,7 +790,6 @@ ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/UInt16/Equals/uint16_equals.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UInt16/Equals/uint16_equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/UInt16_Equals/VB/uint16_equals.vb" id="Snippet1"::: diff --git a/xml/System/UInt32.xml b/xml/System/UInt32.xml index a2bb9dcf274..1ff9412de2d 100644 --- a/xml/System/UInt32.xml +++ b/xml/System/UInt32.xml @@ -445,7 +445,6 @@ ## Examples The following code example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/UInt32/CompareTo/source.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/UInt32/CompareTo/source.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/UInt32 Example/VB/source.vb" id="Snippet3"::: @@ -540,7 +539,6 @@ ## Examples The following code example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -832,7 +830,6 @@ ## Examples The following code example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/UInt32/Equals/uint32_equals.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UInt32/Equals/uint32_equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/UInt32_Equals/VB/uint32_equals.vb" id="Snippet1"::: @@ -1445,7 +1442,6 @@ For this method matches the IEEE 754:2 ## Examples The following example demonstrates how to use the field to display the smallest possible value of a variable. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/UInt32/CompareTo/source.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/UInt32/CompareTo/source.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/UInt32 Example/VB/source.vb" id="Snippet2"::: diff --git a/xml/System/UInt64.xml b/xml/System/UInt64.xml index ea0fd2688c8..2b91e1ea13a 100644 --- a/xml/System/UInt64.xml +++ b/xml/System/UInt64.xml @@ -443,7 +443,6 @@ ## Examples The following code example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/UInt64/CompareTo/source.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/UInt64/CompareTo/source.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/UInt64 Example/VB/source.vb" id="Snippet3"::: @@ -538,7 +537,6 @@ ## Examples The following code example demonstrates generic and nongeneric versions of the method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -900,7 +898,6 @@ ## Examples The following example demonstrates the method. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/UInt64/Equals/uint64_equals.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UInt64/Equals/uint64_equals.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/UInt64_Equals/VB/uint64_equals.vb" id="Snippet1"::: diff --git a/xml/System/UnhandledExceptionEventArgs.xml b/xml/System/UnhandledExceptionEventArgs.xml index ed1b0c95836..410b67c95c4 100644 --- a/xml/System/UnhandledExceptionEventArgs.xml +++ b/xml/System/UnhandledExceptionEventArgs.xml @@ -175,7 +175,6 @@ ## Examples The following example demonstrates the 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. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/AppDomain/UnhandledException/unhandledexception.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/UnhandledException/unhandledexception.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AppDomain_UnhandledException/VB/unhandledexception.vb" id="Snippet1"::: diff --git a/xml/System/Uri.xml b/xml/System/Uri.xml index 6ddc0ee3c45..44207b6a580 100644 --- a/xml/System/Uri.xml +++ b/xml/System/Uri.xml @@ -104,7 +104,6 @@ class and uses it to perform a GET request with . -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/Overview/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/Overview/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic Uri Example/VB/source.vb" id="Snippet1"::: @@ -203,7 +202,6 @@ The following code snippet shows example values of the various properties on the ## Examples The following example creates a instance with the URI `http://www.contoso.com/`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic Uri.Uri Example/VB/source.vb" id="Snippet1"::: @@ -453,7 +451,6 @@ The following code snippet shows example values of the various properties on the ## Examples The following example creates a instance for the URI `http://www.contoso.com/Hello%20World.htm`. Because the contained URI is completely escaped and is in canonical form, the `dontEscape` parameter can be set to `true`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/source1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/source1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic Uri.Uri1 Example/VB/source.vb" id="Snippet1"::: @@ -751,7 +748,6 @@ The following code snippet shows example values of the various properties on the ## Examples The following example creates a new instance of the class by combining the relative URIs `http://www.contoso.com` and `catalog/shownew.htm` to form the absolute URI `http://www.contoso.com/catalog/shownew.htm`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/source2.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/source2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic Uri.Uri3 Example/VB/source.vb" id="Snippet1"::: @@ -873,7 +869,6 @@ The following code snippet shows example values of the various properties on the ## Examples This example creates an absolute instance, `absoluteUri`, and a relative instance, `relativeUri`. A new instance, `combinedUri`, is then created from these two instances. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs" interactive="try-dotnet-method" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/nclurienhancements.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriEnhancements/VB/nclurienhancements.vb" id="Snippet2"::: @@ -1017,7 +1012,6 @@ The URI formed by combining and and and and and and instance from a string. It illustrates the difference between the value returned from , which returns the host name or address specified in the URI, and the value returned from , which returns an address that is safe to use in DNS resolution. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/nclurienhancements.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriEnhancements/VB/nclurienhancements.vb" id="Snippet4"::: @@ -1789,7 +1777,6 @@ If you used an escaped string to construct this instance (for example, `"http:// ## Examples This example creates two instances from strings and compares them to determine whether they represent the same value. `address1` and `address2` are the same because the portion is ignored for this comparison. The outcome is written to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet8"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet8"::: @@ -2210,7 +2197,6 @@ If you used an escaped string to construct this instance (for example, `"http:// ## Examples The following example creates a instance and writes the fragment information to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet4"::: @@ -2271,7 +2257,6 @@ If you used an escaped string to construct this instance (for example, `"http:// ## Examples The following example determines whether a character is a hexadecimal character and, if it is, writes the corresponding decimal value to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet1"::: @@ -2400,7 +2385,6 @@ If you used an escaped string to construct this instance (for example, `"http:// ## Examples The following example creates a instance and writes the hash code to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet4"::: @@ -2479,7 +2463,6 @@ The following examples show a URI and the results of calling instance and writes the path to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet4"::: @@ -2583,7 +2566,6 @@ The following examples show a URI and the results of calling instance and writes the to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet9"::: @@ -3016,7 +2995,6 @@ The following examples show a URI and the results of calling instance that represents a base instance. It then creates a second instance from a string. It calls to determine whether the base instance is the base of the second instance. The outcome is written to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs" interactive="try-dotnet-method" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/nclurienhancements.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriEnhancements/VB/nclurienhancements.vb" id="Snippet6"::: @@ -3076,7 +3054,6 @@ The following examples show a URI and the results of calling instance and checks whether it uses the default port. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet4"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet4"::: @@ -3198,7 +3175,6 @@ The following examples show a URI and the results of calling instance and determines whether it is a file URI. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet6"::: @@ -3260,7 +3236,6 @@ The following examples show a URI and the results of calling instance and determines whether it references a local host. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet6"::: @@ -3506,7 +3479,6 @@ The following examples show a URI and the results of calling instance and determines whether it is a UNC path. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet6"::: @@ -3727,7 +3699,6 @@ The following examples show a URI and the results of calling instance and writes the local path to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet6"::: @@ -3817,7 +3788,6 @@ The following examples show a URI and the results of calling instances. The difference in the path information is written to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet3"::: @@ -3894,7 +3864,6 @@ The following examples show a URI and the results of calling instances. The difference in the path information is written to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet3"::: @@ -3964,7 +3933,6 @@ The following examples show a URI and the results of calling instances from strings and compares them to determine whether they represent the same value. `Address1` and `Address2` are the same because the portion is ignored for this comparison. The outcome is written to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/nclurienhancements.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriEnhancements/VB/nclurienhancements.vb" id="Snippet5"::: @@ -4031,7 +3999,6 @@ The following examples show a URI and the results of calling instances from strings and compares them to determine whether they represent the same value. `Address2` and `Address3` are not the same because `Address3` contains a that is not found in `Address2`. The outcome is written to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/nclurienhancements.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriEnhancements/VB/nclurienhancements.vb" id="Snippet5"::: @@ -4098,7 +4065,6 @@ The following examples show a URI and the results of calling instance from a string. It illustrates the difference between the value returned from , which returns the string that was passed to the constructor, and from a call to , which returns the canonical form of the string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs" interactive="try-dotnet-method" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/nclurienhancements.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriEnhancements/VB/nclurienhancements.vb" id="Snippet3"::: @@ -4218,7 +4184,6 @@ The following examples show a URI and the results of calling , , and an address. A instance is then created from the string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet17"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet17"::: @@ -4566,7 +4527,6 @@ The following examples show a URI and the results of calling instance with 3 segments and displays the segments on the screen. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet5"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet5"::: @@ -4772,7 +4732,6 @@ The following examples show a URI and the results of calling instance from a string. It illustrates the difference between the value returned from , which returns the string that was passed to the constructor, and from a call to , which returns the canonical form of the string. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet7"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet7"::: @@ -5398,7 +5357,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet10"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet10"::: @@ -5450,7 +5408,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet15"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet15"::: @@ -5532,7 +5489,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet14"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet14"::: @@ -5584,7 +5540,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet9"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet9"::: @@ -5636,7 +5591,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet16"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet16"::: @@ -5688,7 +5642,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet11"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet11"::: @@ -5818,7 +5771,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet12"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet12"::: @@ -5873,7 +5825,6 @@ The following examples show a URI and the results of calling instance and determines whether the scheme is . - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet13"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet13"::: @@ -6084,7 +6035,6 @@ The following examples show a URI and the results of calling instance and determines whether it was fully escaped when it was created. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet18"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet18"::: @@ -6144,7 +6094,6 @@ The following examples show a URI and the results of calling instance and writes the user information to the console. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp" id="Snippet18"::: :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLUriExamples/VB/uriexamples.vb" id="Snippet18"::: diff --git a/xml/System/UriBuilder.xml b/xml/System/UriBuilder.xml index bb7ea2b09d2..33c6b913197 100644 --- a/xml/System/UriBuilder.xml +++ b/xml/System/UriBuilder.xml @@ -64,13 +64,13 @@ Provides a custom constructor for uniform resource identifiers (URIs) and modifies URIs for the class. - class provides a convenient way to modify the contents of a instance without creating a new instance for each modification. - - The properties provide read/write access to the read-only properties so that they can be modified. - + class provides a convenient way to modify the contents of a instance without creating a new instance for each modification. + + The properties provide read/write access to the read-only properties so that they can be modified. + ]]> @@ -129,22 +129,22 @@ Initializes a new instance of the class. - class with its properties initialized as follows. - -|Property|Initial Value| -|--------------|-------------------| -|Fragment|| -|Host|"loopback"| -|Password|| -|Path|"/"| -|Port|-1| -|Query|| -|Scheme|"http"| -|UserName|| - + class with its properties initialized as follows. + +|Property|Initial Value| +|--------------|-------------------| +|Fragment|| +|Host|"loopback"| +|Password|| +|Path|"/"| +|Port|-1| +|Query|| +|Scheme|"http"| +|UserName|| + ]]> @@ -201,30 +201,30 @@ A URI string. Initializes a new instance of the class with the specified URI. - class with the , , , , , , and properties set as specified in `uri`. - - If `uri` does not specify a scheme, the scheme defaults to "http:". - + class with the , , , , , , and properties set as specified in `uri`. + + If `uri` does not specify a scheme, the scheme defaults to "http:". + ]]> is . - is a zero-length string or contains only spaces. - - -or- - - The parsing routine detected a scheme in an invalid form. - - -or- - - The parser detected more than two consecutive slashes in a URI that does not use the "file" scheme. - - -or- - + is a zero-length string or contains only spaces. + + -or- + + The parsing routine detected a scheme in an invalid form. + + -or- + + The parser detected more than two consecutive slashes in a URI that does not use the "file" scheme. + + -or- + is not a valid URI. Note: In .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead. @@ -276,11 +276,11 @@ Note: In An instance of the class. Initializes a new instance of the class with the specified instance. - class with the , , , , , , and properties set as specified in `uri`. - + class with the , , , , , , and properties set as specified in `uri`. + ]]> @@ -335,19 +335,18 @@ Note: In A DNS-style domain name or IP address. Initializes a new instance of the class with the specified scheme and host. - instance is initialized with the property set to `schemeName` and the property set to `hostName`. is initialized to the value -1 to indicate the default port for the scheme should be used, and the property is set to the slash character (/). + +## Examples + The following example creates a instance that contains the URI `http://www.contoso.com/`. -## Examples - The following example creates a instance that contains the URI `http://www.contoso.com/`. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/UriBuilder/.ctor/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UriBuilder/.ctor/source.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -402,21 +401,20 @@ Note: In An IP port number for the service. Initializes a new instance of the class with the specified scheme, host, and port. - instance is initialized with the property set to `schemeName`, the property set to `hostName`, and the property set to `portNumber`. The property is set to the slash character (/). - + instance is initialized with the property set to `schemeName`, the property set to `hostName`, and the property set to `portNumber`. The property is set to the slash character (/). + If the `portNumber` is set to a value of -1, this indicates that the default port value for the scheme will be used to connect to the host. - -## Examples - The following example creates a instance that contains the URI `http://www.contoso.com:8080/`. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp" id="Snippet1"::: + +## Examples + The following example creates a instance that contains the URI `http://www.contoso.com:8080/`. + :::code language="csharp" source="~/snippets/csharp/System/UriBuilder/.ctor/source1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UriBuilder/.ctor/source1.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -475,21 +473,20 @@ Note: In The path to the Internet resource. Initializes a new instance of the class with the specified scheme, host, port number, and path. - instance is initialized with the property set to `schemeName`, the property set to `hostName`, the property set to `portNumber`, and the property set to `pathValue`. - + instance is initialized with the property set to `schemeName`, the property set to `hostName`, the property set to `portNumber`, and the property set to `pathValue`. + If the `portNumber` is set to a value of -1, this indicates that the default port value for the scheme will be used to connect to the host. - -## Examples - The following example creates a instance that contains the URI `http://www.contoso.com:8080/index.htm`. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp" id="Snippet1"::: + +## Examples + The following example creates a instance that contains the URI `http://www.contoso.com:8080/index.htm`. + :::code language="csharp" source="~/snippets/csharp/System/UriBuilder/.ctor/source2.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UriBuilder/.ctor/source2.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -550,21 +547,20 @@ Note: In A query string or fragment identifier. Initializes a new instance of the class with the specified scheme, host, port number, path, and query string or fragment identifier. - instance is initialized with the property set to `schemeName`, the property set to `hostName`, the property set to `portNumber`, and the property set to `pathValue`. If `extraValue` begins with a number sign (#), then is set to `extraValue`. If `extraValue` begins with a question mark (?), then is set to `extraValue`. - + instance is initialized with the property set to `schemeName`, the property set to `hostName`, the property set to `portNumber`, and the property set to `pathValue`. If `extraValue` begins with a number sign (#), then is set to `extraValue`. If `extraValue` begins with a question mark (?), then is set to `extraValue`. + If the `portNumber` is set to a value of -1, this indicates that the default port value for the scheme will be used to connect to the host. - -## Examples - The following example creates a instance that contains the URI `http://www.contoso.com:8080/index.htm#top`. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp" id="Snippet1"::: + +## Examples + The following example creates a instance that contains the URI `http://www.contoso.com:8080/index.htm#top`. + :::code language="csharp" source="~/snippets/csharp/System/UriBuilder/.ctor/source3.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UriBuilder/.ctor/source3.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -631,11 +627,11 @@ Note: In if represents the same as the constructed by this instance; otherwise, . - method compares a specified instance with the instance built by the instance. If the two are the same, the method returns `true`. - + method compares a specified instance with the instance built by the instance. If the two are the same, the method returns `true`. + ]]> @@ -691,8 +687,8 @@ Note: In property contains any text following a fragment marker (#) in the URI, including the marker itself. When setting the property: @@ -703,14 +699,13 @@ The property contains any text following a fra > [!NOTE] > To append a value to an existing fragment in .NET Framework, you must remove the leading fragment marker before setting the property with the new value. This is because .NET Framework always prepends the fragment marker when setting the property. .NET 5 (and .NET Core) and later versions are tolerant to a leading fragment marker, and will only prepend one if necessary. -## Examples - The following example creates the URI `"http://www.contoso.com/index.htm#main"`. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp" id="Snippet1"::: +## Examples + The following example creates the URI `"http://www.contoso.com/index.htm#main"`. + :::code language="csharp" source="~/snippets/csharp/System/UriBuilder/Fragment/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UriBuilder/Fragment/source.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -761,15 +756,15 @@ The property contains any text following a fra Returns the hash code for the URI. The hash code generated for the URI. - A and B are guaranteed to be the same when A.Equals(B) is `true`. - - This method implements . - + A and B are guaranteed to be the same when A.Equals(B) is `true`. + + This method implements . + ]]> @@ -825,11 +820,11 @@ The property contains any text following a fra Gets or sets the Domain Name System (DNS) host name or IP address of a server. The DNS host name or IP address of the server. - property contains the fully qualified DNS host name or IP address of the server. - + property contains the fully qualified DNS host name or IP address of the server. + ]]> @@ -938,13 +933,13 @@ The property contains any text following a fra Gets or sets the path to the resource referenced by the URI. The path to the resource referenced by the URI. - property contains the path information that the server uses to resolve requests for information. Typically, this is the path to the desired information on the server's file system. It can also indicate the application or script that the server must run to provide the information. - - The path information does not include the scheme, host name, or query portion of the URI. The property always returns at least a slash (/). - + property contains the path information that the server uses to resolve requests for information. Typically, this is the path to the desired information on the server's file system. It can also indicate the application or script that the server must run to provide the information. + + The path information does not include the scheme, host name, or query portion of the URI. The property always returns at least a slash (/). + ]]> @@ -1000,11 +995,11 @@ The property contains any text following a fra Gets or sets the port number of the URI. The port number of the URI. - property returns the value of -1 to indicate that the default port value for the protocol scheme will be used to connect to the host. If the property is set to a value of -1, this indicates that the default port value for the protocol scheme will be used to connect to the host. - + property returns the value of -1 to indicate that the default port value for the protocol scheme will be used to connect to the host. If the property is set to a value of -1, this indicates that the default port value for the protocol scheme will be used to connect to the host. + ]]> The port cannot be set to a value less than -1 or greater than 65,535. @@ -1063,8 +1058,8 @@ The property contains any text following a fra Gets or sets any query information included in the URI, including the leading '?' character if not empty. The query information included in the URI. - property contains any query information included in the URI. Query information is separated from the path information by a question mark (?) and continues to the end of the URI. The query information that's returned includes the leading question mark. When setting the property: @@ -1072,7 +1067,7 @@ The property contains any query information included in - In .NET Framework, a question mark is always prepended to the string, even if the string already starts with a question mark. - In .NET 5 (and .NET Core) and later versions, a question mark is prepended to the string if it's not already present. -The query information is escaped according to RFC 2396. +The query information is escaped according to RFC 2396. > [!NOTE] > To append a value to existing query information in .NET Framework, you must remove the leading question mark before setting the property with the new value. This is because .NET Framework always prepends the question mark when setting the property. .NET 5 (and .NET Core) and later versions are tolerant to a leading question mark, and will only prepend one if necessary. @@ -1081,10 +1076,9 @@ The query information is escaped according to RFC 2396. The following example sets the property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/UriBuilder/Query/main.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/UriBuilder/Query/main.fs" id="Snippet1"::: - + ]]> @@ -1142,21 +1136,21 @@ The following example sets the property. Gets or sets the scheme name of the URI. The scheme of the URI. - property. - -|Scheme|Description| -|------------|-----------------| -|file|The resource is a file on the local computer.| -|ftp|The resource is accessed through FTP.| -|gopher|The resource is accessed through the Gopher protocol.| -|http|The resource is accessed through HTTP.| -|https|The resource is accessed through SSL-encrypted HTTP.| -|mailto|The resource is an email address and is accessed through SMTP.| -|news|The resource is accessed through NNTP.| - + property. + +|Scheme|Description| +|------------|-----------------| +|file|The resource is a file on the local computer.| +|ftp|The resource is accessed through FTP.| +|gopher|The resource is accessed through the Gopher protocol.| +|http|The resource is accessed through HTTP.| +|https|The resource is accessed through SSL-encrypted HTTP.| +|mailto|The resource is an email address and is accessed through SMTP.| +|news|The resource is accessed through NNTP.| + ]]> The scheme cannot be set to an invalid scheme name. @@ -1210,8 +1204,8 @@ The following example sets the property. Returns the display string for the specified instance. The string that contains the unescaped display string of the . - property value if one of the following conditions is true: @@ -1220,7 +1214,7 @@ The display string contains the property value if - The port was specified when the was constructed using one of the constructors that accept a port number parameter. In either case, the display string does not contain the property value if the port number was set to a value of -1 (for the default port). - + ]]> The instance has a bad password. @@ -1274,15 +1268,15 @@ Note: In instance constructed by the specified instance. The URI constructed by the . - property contains the created by the . Any changes made to the properties are reflected in the property. - + property contains the created by the . Any changes made to the properties are reflected in the property. + ]]> The URI constructed by the properties is invalid. - + Note: In .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead. diff --git a/xml/System/ValueType.xml b/xml/System/ValueType.xml index 6ff1b0f168f..f26efe8b250 100644 --- a/xml/System/ValueType.xml +++ b/xml/System/ValueType.xml @@ -214,7 +214,6 @@ When you call the method on a Windows Runtime method can be overridden by a derived value type. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ValueType/Equals/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/ValueType/Equals/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ValueType.Equals Example/VB/source.vb" id="Snippet1"::: @@ -288,7 +287,6 @@ When you call the method on a Windows Run method can be overridden by a derived value type. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/ValueType/Equals/source.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/ValueType/Equals/source.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ValueType.Equals Example/VB/source.vb" id="Snippet1"::: diff --git a/xml/System/Version.xml b/xml/System/Version.xml index 18f6a379d0b..e4f75803657 100644 --- a/xml/System/Version.xml +++ b/xml/System/Version.xml @@ -444,7 +444,6 @@ The following example uses the ## Examples The following code example demonstrates the constructor, and , , , , , and properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Version/.ctor/rev.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Version/.ctor/rev.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.version.revision/vb/rev.vb" id="Snippet1"::: @@ -508,7 +507,6 @@ The following example uses the ## Examples The following code example demonstrates the constructor, and , , , , , and properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Version/.ctor/rev.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Version/.ctor/rev.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.version.revision/vb/rev.vb" id="Snippet1"::: @@ -759,7 +757,6 @@ The following example uses the ## Examples The following code example demonstrates generic and nongeneric versions of the `CompareTo` method for several value and reference types. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Boolean/CompareTo/cat.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Boolean/CompareTo/cat.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/T.CompareTo/VB/cat.vb" id="Snippet1"::: @@ -958,7 +955,6 @@ The following example uses the ## Examples The following code example demonstrates the constructor, and , , , , , and properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Version/.ctor/rev.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Version/.ctor/rev.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.version.revision/vb/rev.vb" id="Snippet1"::: @@ -1073,7 +1069,6 @@ The following example uses the ## Examples The following code example demonstrates the constructor, and the , , , , , and properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Version/.ctor/rev.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Version/.ctor/rev.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.version.revision/vb/rev.vb" id="Snippet1"::: @@ -1136,7 +1131,6 @@ The following example uses the ## Examples The following code example demonstrates the constructor, and , , , , , and properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Version/.ctor/rev.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Version/.ctor/rev.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.version.revision/vb/rev.vb" id="Snippet1"::: @@ -1197,7 +1191,6 @@ The following example uses the ## Examples The following code example demonstrates the constructor, and the , , , , , and properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Version/.ctor/rev.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Version/.ctor/rev.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.version.revision/vb/rev.vb" id="Snippet1"::: @@ -1782,7 +1775,6 @@ where `major`, `minor`, `build`, and `revision` are the string representations o ## Examples The following code example demonstrates the constructor, and , , , , , and properties. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System/Version/.ctor/rev.cs" interactive="try-dotnet" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Version/.ctor/rev.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.version.revision/vb/rev.vb" id="Snippet1"::: From 39a034c2fb91f1c91d9bf87ee58c19a1487bb274 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Sat, 31 May 2025 08:03:38 -0700 Subject: [PATCH 2/4] delete system snippet files --- .../CPP/class1.cpp | 317 ---------- .../CPP/cfromchar.cpp | 26 - .../CPP/cfromdouble.cpp | 66 -- .../CPP/cfromsingle.cpp | 66 -- .../CPP/cfromint16.cpp | 23 - .../CPP/cfromint32.cpp | 23 - .../CPP/cfromint64.cpp | 24 - .../CPP/cfromsbyte.cpp | 23 - .../CPP/cfrombyte.cpp | 23 - .../CPP/cfromuint16.cpp | 23 - .../CPP/cfromuint32.cpp | 24 - .../CPP/cfromuint64.cpp | 24 - .../System.Decimal.ConvTo/CPP/ctos_byte.cpp | 43 -- .../System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp | 31 - .../System.Decimal.ConvTo/CPP/ctou_int16.cpp | 88 --- .../System.Decimal.ConvTo/CPP/ctou_int32.cpp | 88 --- .../System.Decimal.ConvTo/CPP/ctou_int64.cpp | 88 --- .../cpp/Substring10.cpp | 35 -- .../system.Action/cpp/action.cpp | 42 -- .../system.Action~1/cpp/action`1.cpp | 36 -- .../system.Action~1/cpp/delegate.cpp | 34 - .../CPP/arrayasreadonly.cpp | 116 ---- .../system.Array.Clone/CPP/arrayclone.cpp | 73 --- .../CPP/System.Array.Resize.cpp | 83 --- .../system.Array.Sort/CPP/arraysort.cpp | 119 ---- .../system.Array.Sort2/CPP/arraysort2.cpp | 109 ---- .../system.Array.SyncRoot/cpp/source.cpp | 22 - .../system.ArraySegment/CPP/arraysegment.cpp | 126 ---- .../system.ArrayTypeMismatch/CPP/class1.cpp | 68 -- .../CPP/array_getenumerator.cpp | 42 -- .../CPP/array_getsetvalue.cpp | 47 -- .../system.Attribute.Equals/CPP/equals.cpp | 124 ---- .../CPP/getcustattrparam.cpp | 130 ---- .../CPP/getcustattrprminh.cpp | 152 ----- .../system.Attribute.TypeId/CPP/typeid.cpp | 136 ---- .../system.BitConverter.Class/CPP/bitconv.cpp | 44 -- .../CPP/littleend.cpp | 19 - .../CPP/bitstodbl.cpp | 67 -- .../CPP/dbltobits.cpp | 71 --- .../CPP/bytesbool.cpp | 23 - .../CPP/byteschar.cpp | 46 -- .../CPP/bytesdouble.cpp | 64 -- .../CPP/bytessingle.cpp | 64 -- .../CPP/bytesint16.cpp | 32 - .../CPP/bytesint32.cpp | 34 - .../CPP/bytesint64.cpp | 42 -- .../CPP/bytesuint16.cpp | 42 -- .../CPP/bytesuint32.cpp | 44 -- .../CPP/bytesuint64.cpp | 48 -- .../CPP/batostring.cpp | 51 -- .../CPP/batostringii.cpp | 65 -- .../CPP/batobool.cpp | 30 - .../CPP/batochar.cpp | 59 -- .../CPP/batodouble.cpp | 96 --- .../CPP/batosingle.cpp | 93 --- .../CPP/batoint16.cpp | 55 -- .../CPP/batoint64.cpp | 85 --- .../CPP/batouint16.cpp | 54 -- .../CPP/batouint32.cpp | 56 -- .../CPP/batouint64.cpp | 78 --- .../system.Boolean/CPP/booleanmembers.cpp | 26 - .../system.Buffer.BlockCopy/CPP/bcopy.cpp | 137 ---- .../system.Buffer.BlockCopy/CPP/buffer.cpp | 62 -- .../system.Buffer.BlockCopy/CPP/overlap1.cpp | 37 -- .../system.Buffer.Bytes/CPP/bytelength.cpp | 52 -- .../system.Buffer.Bytes/CPP/getbyte.cpp | 83 --- .../system.Buffer.Bytes/CPP/setbyte.cpp | 71 --- .../system.Byte Examples/CPP/systembyte.cpp | 106 ---- .../system.Byte.Parse/cpp/parse.cpp | 162 ----- .../CPP/newbytemembers.cpp | 29 - .../CPP/newbytemembers2.cpp | 79 --- .../system.Byte.TryParse/cpp/tryparse.cpp | 37 -- .../system.Byte.TryParse/cpp/tryparse2.cpp | 75 --- .../CPP/charstructure.cpp | 26 - .../system.Char.CompareTo/CPP/compareto.cpp | 13 - .../system.Char.Equals/CPP/equals.cpp | 12 - .../CPP/getnumericvalue.cpp | 11 - .../CPP/getunicodecategory.cpp | 13 - .../system.Char.IsControl/CPP/iscontrol1.cpp | 35 -- .../system.Char.IsControl/CPP/iscontrol2.cpp | 22 - .../system.Char.IsDigit/CPP/isdigit.cpp | 11 - .../system.Char.IsLetter/CPP/isletter.cpp | 11 - .../CPP/isletterordigit.cpp | 11 - .../system.Char.IsLower/CPP/islower.cpp | 11 - .../system.Char.IsNumber/CPP/isnumber.cpp | 11 - .../CPP/ispunctuation.cpp | 11 - .../CPP/isseparator.cpp | 11 - .../CPP/isseparator1.cpp | 36 -- .../CPP/issurrogate.cpp | 11 - .../system.Char.IsSymbol/CPP/issymbol.cpp | 11 - .../CPP/iswhitespace.cpp | 11 - .../system.Char.Parse/CPP/parse.cpp | 9 - .../system.Char.ToLower/CPP/tolower.cpp | 12 - .../system.Char.ToString/CPP/tostring.cpp | 11 - .../cpp/charenumerator1.cpp | 75 --- .../CPP/inserttabs.cpp | 63 -- .../system.Console-REFORMAT/CPP/reformat.cpp | 72 --- .../CPP/decode.cpp | 20 - .../cpp/ReadLineSimple.cpp | 20 - .../system.Console.ReadLine/cpp/readline2.cpp | 28 - .../system.Console.SetError/cpp/seterror1.cpp | 32 - .../system.Console.WriteLine/CPP/newline1.cpp | 39 -- .../CPP/writeline_boolean1.cpp | 22 - .../CPP/writeline_obj1.cpp | 18 - .../system.ConsoleKey/cpp/consolekey.cpp | 72 --- .../cpp/consolekeyinfo.equals.cpp | 101 --- .../cpp/hash.cpp | 85 --- .../CPP/system.convert snippet.cpp | 593 ------------------ .../cpp/toint_str_int32.cpp | 45 -- .../cpp/toboolean1.cpp | 37 -- .../cpp/toboolean2.cpp | 303 --------- .../CPP/stringnonnum.cpp | 75 --- .../CPP/toint16.cpp | 105 ---- .../CPP/tosbyte.cpp | 100 --- .../CPP/nonnumeric.cpp | 94 --- .../CPP/objectifp.cpp | 458 -------------- .../system.DateTime.Date/cpp/date1.cpp | 22 - .../system.DateTime.Minute etc/CPP/class1.cpp | 31 - .../cpp/datetime.tryparse1.cpp | 37 -- .../CPP/comp_equal.cpp | 65 -- .../CPP/cto_eq_obj.cpp | 88 --- .../CPP/ctoriarr.cpp | 117 ---- .../CPP/ctoriiibby.cpp | 108 ---- .../system.Decimal.Ctor.Ints/CPP/ctori.cpp | 47 -- .../system.Decimal.Ctor.Ints/CPP/ctorl.cpp | 47 -- .../system.Decimal.Ctor.Ints/CPP/ctorui.cpp | 47 -- .../system.Decimal.Ctor.Ints/CPP/ctorul.cpp | 47 -- .../system.Decimal.Ctor.Reals/CPP/ctordo.cpp | 73 --- .../system.Decimal.Ctor.Reals/CPP/ctors.cpp | 73 --- .../system.Decimal.Fields/CPP/fields.cpp | 46 -- .../CPP/floor_neg_trunc.cpp | 66 -- .../CPP/getbits.cpp | 56 -- .../CPP/gettypecode.cpp | 25 - .../CPP/mul_div_rem.cpp | 76 --- .../CPP/fromoacurrency.cpp | 59 -- .../CPP/tooacurrency.cpp | 82 --- .../system.Decimal.ToXXX/CPP/tosgl_dbl.cpp | 60 -- .../system.Double.ToString/cpp/tostring1.cpp | 63 -- .../system.Double.ToString/cpp/tostring3.cpp | 223 ------- .../system.Double/CPP/doublesample.cpp | 150 ----- .../system.Environment/CPP/Vars1.cpp | 24 - .../system.Exception.Ctor/CPP/new.cpp | 108 ---- .../system.Exception.Ctor/CPP/news.cpp | 116 ---- .../system.Exception.Ctor/CPP/newsi.cpp | 109 ---- .../CPP/getbaseexc.cpp | 137 ---- .../system.Exception.HResult/CPP/hresult.cpp | 70 --- .../CPP/exception_properties.vcxproj | 123 ---- .../CPP/properties.cpp | 121 ---- .../system.FlagsAttribute/CPP/flags.cpp | 79 --- .../system.FlagsAttribute/CPP/flags1.cpp | 75 --- .../system.Func~2/cpp/Example.cpp | 44 -- .../system.GC.Collect Example/CPP/class1.cpp | 31 - .../CPP/systemgcgetgenerationweak.cpp | 72 --- .../CPP/gckeepalive.cpp | 108 ---- .../CPP/class1.cpp | 64 -- .../CPP/class1.cpp | 70 --- .../system.IConvertible/CPP/iconvertible.cpp | 144 ----- .../CPP/idisposabledispose.cpp | 80 --- .../system.Int16.MaxValue/cpp/minvalue.cpp | 30 - .../system.Int16.Parse/cpp/parse1.cpp | 54 -- .../system.Int16.Parse/cpp/parse2.cpp | 87 --- .../system.Int16.Parse/cpp/parse3.cpp | 62 -- .../system.Int16.Parse/cpp/parse4.cpp | 66 -- .../system.Int32.Parse/cpp/parse1.cpp | 40 -- .../system.Int32.Parse/cpp/parse2.cpp | 50 -- .../system.Int32.Parse/cpp/parse3.cpp | 61 -- .../system.Int32.ToString/cpp/ToString1.cpp | 26 - .../system.Int32.ToString/cpp/ToString2.cpp | 22 - .../system.Int32.ToString/cpp/ToString3.cpp | 56 -- .../system.Int32.ToString/cpp/ToString4.cpp | 60 -- .../cpp/int32.tryparse1.cpp | 43 -- .../cpp/int32.tryparse2.cpp | 100 --- .../system.Math.E/CPP/efield.cpp | 66 -- .../system.Math.Exp/CPP/exp.cpp | 96 --- .../system.Math.Log_Overloads/CPP/loggen.cpp | 66 -- .../system.Math.SinCos/CPP/sincos.cpp | 120 ---- .../system.Math.SinhCosh/CPP/sinhcosh.cpp | 115 ---- .../system.Math.Tanh/CPP/tanh.cpp | 87 --- .../CPP/clone.cpp | 56 -- .../CPP/ctor_tostr.cpp | 60 -- .../CPP/plat_ver.cpp | 64 -- .../system.Random.Ctor/CPP/ctor.cpp | 95 --- .../system.Random.Next/CPP/next.cpp | 99 --- .../system.Random.Next/CPP/next1.cpp | 27 - .../system.Random.Next/CPP/next2.cpp | 47 -- .../system.Random.Next/CPP/next3.cpp | 35 -- .../system.Random.Next/CPP/next4.cpp | 27 - .../system.Random.Sample/cpp/sampleex.cpp | 149 ----- .../system.Random/cpp/random2.cpp | 54 -- .../system.Single/CPP/singlesample.cpp | 163 ----- .../cpp/system.string.class.cpp | 10 - .../system.String.Compare/cpp/compare02.cpp | 30 - .../system.String.Compare/cpp/example.cpp | 65 -- .../system.String.Compare/cpp/remarks.cpp | 197 ------ .../system.String.CompareCmp/cpp/cmpcmp.cpp | 140 ----- .../system.String.EndsWithCmp/cpp/ewcmp.cpp | 83 --- .../system.String.Equality/CPP/equalityop.cpp | 28 - .../system.String.Format/cpp/format4.cpp | 24 - .../system.String.Format/cpp/format5.cpp | 33 - .../system.String.Format/cpp/format7.cpp | 41 -- .../cpp/format_paramarray1.cpp | 48 -- .../cpp/formatexample2.cpp | 77 --- .../cpp/formatexample4.cpp | 32 - .../cpp/formatoverload1.cpp | 20 - .../cpp/formatoverload2.cpp | 41 -- .../cpp/formatsyntax1.cpp | 16 - .../system.String.Format/cpp/interceptor2.cpp | 122 ---- .../system.String.Format/cpp/starting1.cpp | 80 --- .../system.String.Format/cpp/starting2.cpp | 37 -- .../CPP/getenumerator.cpp | 69 -- .../CPP/gethashcode.cpp | 43 -- .../system.String.IndexOf/CPP/indexof_c.cpp | 33 - .../system.String.IndexOf/CPP/indexofcii.cpp | 61 -- .../system.String.IndexOf/CPP/simple1.cpp | 15 - .../CPP/inequalityop.cpp | 28 - .../system.String.ToUpper/cpp/ToUpperEx.cpp | 82 --- .../system.String.Trim/cpp/trim1.cpp | 16 - .../system.String.Trim/cpp/trim2.cpp | 30 - .../system.StringComparer/cpp/omni.cpp | 139 ---- .../CPP/comp_equal.cpp | 64 -- .../CPP/cto_eq_obj.cpp | 78 --- .../system.TimeSpan.Ctor/CPP/ctoriii.cpp | 45 -- .../system.TimeSpan.Ctor/CPP/ctoriiii.cpp | 42 -- .../system.TimeSpan.Ctor/CPP/ctoriiiii.cpp | 51 -- .../system.TimeSpan.Ctor/CPP/ctorl.cpp | 54 -- .../CPP/dura_nega_una.cpp | 48 -- .../system.TimeSpan.Fields/CPP/fields.cpp | 58 -- .../system.TimeSpan.From/CPP/fromdays.cpp | 58 -- .../system.TimeSpan.From/CPP/fromhours.cpp | 58 -- .../system.TimeSpan.From/CPP/frommillisec.cpp | 58 -- .../system.TimeSpan.From/CPP/fromminutes.cpp | 58 -- .../system.TimeSpan.From/CPP/fromseconds.cpp | 58 -- .../system.TimeSpan.From/CPP/fromticks.cpp | 58 -- .../CPP/hashcode.cpp | 73 --- .../CPP/properties.cpp | 88 --- .../CPP/relationalops.cpp | 76 --- .../system.TimeZone.Class/CPP/tzclass.cpp | 61 -- .../CPP/source.cpp | 100 --- .../CPP/source.cpp | 70 --- .../CPP/source.cpp | 108 ---- .../CPP/source.cpp | 101 --- .../system.Type.IsGenericType/cpp/remarks.cpp | 21 - .../system.Type.IsGenericType/cpp/source.cpp | 110 ---- .../CPP/source.cpp | 101 --- .../system.Type.IsVisible/CPP/source.cpp | 36 -- .../system.Type.MakeXxxType/CPP/source.cpp | 82 --- .../system.Type/cpp/source.cpp | 27 - .../system.TypeCode/CPP/iconvertible.cpp | 153 ----- .../system.action.delegate/cpp/delegate.cpp | 42 -- .../cpp/delegate.vcxproj | 89 --- .../cpp/remarks.cpp | 18 - .../system.array.foreach/cpp/source.cpp | 40 -- .../system.array.getlength/cpp/source.cpp | 64 -- .../system.array.getupperbound/cpp/source.cpp | 65 -- .../system.byte.equals/cpp/eq.cpp | 24 - .../system.console.setout/cpp/source.cpp | 29 - .../cpp/windowleft1.cpp | 53 -- .../system.console.write/cpp/con_write.cpp | 23 - .../cpp/changetype00.cpp | 98 --- .../cpp/changetype03.cpp | 239 ------- .../cpp/changetype_01.cpp | 21 - .../system.convert.tobyte/cpp/tobyte1.cpp | 19 - .../cpp/addminutes1.cpp | 33 - .../system.datetime.now/cpp/now1.cpp | 23 - .../system.datetime.now/cpp/now2.cpp | 42 -- .../cpp/tosbyte.cpp | 43 -- .../cpp/tosingle1.cpp | 31 - .../cpp/ToStringEx1.cpp | 47 -- .../CPP/class1.cpp | 54 -- .../system.int32.maxvalue/cpp/maxvalue1.cpp | 29 - .../system.nullableOfT.class/cpp/tarow.cpp | 80 --- .../system.object.tostring/cpp/tostring1.cpp | 11 - .../system.object.tostring/cpp/tostring2.cpp | 18 - .../system.object.tostring/cpp/tostring3.cpp | 29 - .../system.string.concat/cpp/Concat6.cpp | 15 - .../system.string.ctor/cpp/assignment.cpp | 18 - .../system.string.ctor/cpp/char1_ctor.cpp | 20 - .../system.string.ctor/cpp/char2_ctor.cpp | 32 - .../system.string.ctor/cpp/chptrctor_null.cpp | 24 - .../system.string.ctor/cpp/ptrctor_null.cpp | 27 - .../cpp/NullString1.cpp | 32 - .../cpp/isnullorempty1.cpp | 18 - .../cpp/StartsWith2.cpp | 23 - .../cpp/startswith1.cpp | 54 -- .../system.type.basetype/cpp/remarks.cpp | 11 - .../system.type.declaringtype/cpp/remarks.cpp | 12 - .../cpp/remarks.cpp | 18 - .../cpp/remarks.cpp | 26 - .../system.version.revision/cpp/rev.cpp | 32 - 289 files changed, 18306 deletions(-) delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp deleted file mode 100644 index 5b668e808cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp +++ /dev/null @@ -1,317 +0,0 @@ -using namespace System; -using namespace System::IO; - -ref class Coder -{ -private: - String^ inputFileName; - String^ outputFileName; - -public: - Coder( String^ inFile, String^ outFile ) - { - inputFileName = (String^)(inFile->Clone()); - outputFileName = (String^)(outFile->Clone()); - } - - // -public: - void EncodeWithString() - { - FileStream^ inFile; - array^ binaryData; - - try - { - inFile = gcnew FileStream( inputFileName, - FileMode::Open, - FileAccess::Read ); - binaryData = gcnew array((int)(inFile->Length)); - long bytesRead = inFile->Read( binaryData, 0, - (int)inFile->Length ); - inFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or reading from it. - Console::WriteLine( " {0}", exp->Message ); - return; - } - - // Convert the binary input into Base64 UUEncoded output. - String^ base64String; - try - { - base64String = Convert::ToBase64String( binaryData, - 0, - binaryData->Length ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Binary data array is null." ); - return; - } - - // Write the UUEncoded version to the output file. - StreamWriter^ outFile; - try - { - outFile = gcnew StreamWriter( outputFileName, - false, - Text::Encoding::ASCII ); - outFile->Write( base64String ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - - // Error creating stream or writing to it. - Console::WriteLine( " {0}", exp->Message ); - } - } - // - - // -public: - void EncodeWithCharArray() - { - FileStream^ inFile; - array^binaryData; - - try - { - inFile = gcnew FileStream( inputFileName, - FileMode::Open, - FileAccess::Read ); - binaryData = gcnew array((int)(inFile->Length)); - long bytesRead = inFile->Read( binaryData, 0, - (int)inFile->Length ); - inFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or reading from it. - Console::WriteLine( "{0}", exp->Message ); - return; - } - - // Convert the binary input into Base64 UUEncoded output. - // Each 3 Byte sequence in the source data becomes a 4 Byte - // sequence in the character array. - long arrayLength = (long)((4.0 / 3.0) * binaryData->Length); - - // If array length is not divisible by 4, go up to the next - // multiple of 4. - if ( arrayLength % 4 != 0 ) - { - arrayLength += 4 - arrayLength % 4; - } - - array^ base64CharArray = gcnew array(arrayLength); - try - { - Convert::ToBase64CharArray( binaryData, - 0, - binaryData->Length, - base64CharArray, 0 ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Binary data array is null." ); - return; - } - catch ( ArgumentOutOfRangeException^ ) - { - Console::WriteLine( "Char Array is not large enough." ); - return; - } - - // Write the UUEncoded version to the output file. - StreamWriter^ outFile; - try - { - outFile = gcnew StreamWriter( outputFileName, - false, - Text::Encoding::ASCII ); - outFile->Write( base64CharArray ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or writing to it. - Console::WriteLine( " {0}", exp->Message ); - } - } - // - - // -public: - void DecodeWithCharArray() - { - StreamReader^ inFile; - array^base64CharArray; - try - { - inFile = gcnew StreamReader( inputFileName, - Text::Encoding::ASCII ); - base64CharArray = gcnew array((int)(inFile->BaseStream->Length)); - inFile->Read( base64CharArray, 0, (int)inFile->BaseStream->Length ); - inFile->Close(); - } - catch ( Exception^ exp ) - { - - // Error creating stream or reading from it. - Console::WriteLine( "{0}", exp->Message ); - return; - } - - // Convert the Base64 UUEncoded input into binary output. - array^binaryData; - try - { - binaryData = Convert::FromBase64CharArray( base64CharArray, - 0, - base64CharArray->Length ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Base 64 character array is null." ); - return; - } - catch ( FormatException^ ) - { - Console::WriteLine( "Base 64 Char Array length is not " + - "4 or is not an even multiple of 4." ); - return; - } - - // Write out the decoded data. - FileStream^ outFile; - try - { - outFile = gcnew FileStream( outputFileName, - FileMode::Create, - FileAccess::Write ); - outFile->Write( binaryData, 0, binaryData->Length ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or writing to it. - Console::WriteLine( "{0}", exp->Message ); - } - } - // - - // -public: - void DecodeWithString() - { - StreamReader^ inFile; - String^ base64String; - try - { - array^base64CharArray; - inFile = gcnew StreamReader( inputFileName, - Text::Encoding::ASCII ); - base64CharArray = gcnew array((int)(inFile->BaseStream->Length)); - inFile->Read( base64CharArray, 0, (int)inFile->BaseStream->Length ); - base64String = gcnew String( base64CharArray ); - } - catch ( Exception^ exp ) - { - // Error creating stream or reading from it. - Console::WriteLine( "{0}", exp->Message ); - return; - } - - // Convert the Base64 UUEncoded input into binary output. - array^binaryData; - try - { - binaryData = Convert::FromBase64String( base64String ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Base 64 String^ is null." ); - return; - } - catch ( FormatException^ ) - { - Console::WriteLine( "Base 64 String^ length is not " + - "4 or is not an even multiple of 4." ); - return; - } - - // Write out the decoded data. - FileStream^ outFile; - try - { - outFile = gcnew FileStream( outputFileName, - FileMode::Create, - FileAccess::Write ); - outFile->Write( binaryData, 0, binaryData->Length ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or writing to it. - Console::WriteLine( "{0}", exp->Message ); - } - } - // -}; - -void main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length != 5 ) - { - Console::WriteLine( "Usage: UUCodeC -d | -e " + - "-s | -c inputFile outputFile" ); - return; - } - - String^ inputFileName = args[ 3 ]; - String^ outputFileName = args[ 4 ]; - Coder^ coder = gcnew Coder( inputFileName,outputFileName ); - - if ( args[ 1 ] == "-d" ) - { - if ( args[ 2 ] == "-s" ) - { - coder->DecodeWithString(); - } - else if ( args[ 2 ] == "-c" ) - { - coder->DecodeWithCharArray(); - } - else - { - Console::WriteLine( "Second arg must be -s or -c" ); - return; - } - } - else - if ( args[ 1 ] == "-e" ) - { - if ( args[ 2 ] == "-s" ) - { - coder->EncodeWithString(); - } - else if ( args[ 2 ] == "-c" ) - { - coder->EncodeWithCharArray(); - } - else - { - Console::WriteLine( "Second arg must be -s or -c" ); - return; - } - } - else - { - Console::WriteLine( "First arg must be -d or -e" ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp deleted file mode 100644 index a03e6c881a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of Char values. - array^ values = { L'\0', L' ', L'*', L'A', L'a', - L'{', L'Æ' }; - - // Convert each Char value to a Decimal. - for each (wchar_t value in values) { - Decimal decValue = value; - Console::WriteLine("'{0}' ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// This example displays the following output: -// ' ' (Decimal) --> 0 (Decimal) -// ' ' (Decimal) --> 32 (Decimal) -// '*' (Decimal) --> 42 (Decimal) -// 'A' (Decimal) --> 65 (Decimal) -// 'a' (Decimal) --> 97 (Decimal) -// '{' (Decimal) --> 123 (Decimal) -// 'A' (Decimal) --> 195 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp deleted file mode 100644 index f923cdfb25d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example of the explicit conversion from double to Decimal. -using namespace System; -#define formatter "{0,25:E16}{1,33}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the double argument; catch exceptions that are thrown. -void DecimalFromDouble( double argument ) -{ - Object^ decValue; - - // Convert the double argument to a Decimal value. - try - { - decValue = (Decimal)argument; - } - catch ( Exception^ ex ) - { - decValue = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, decValue ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversion from double " - "to Decimal \ngenerates the following output.\n" ); - Console::WriteLine( formatter, "double argument", "Decimal value" ); - Console::WriteLine( formatter, "---------------", "-------------" ); - - // Convert double values and display the results. - DecimalFromDouble( 1.234567890123E-30 ); - DecimalFromDouble( 1.2345678901234E-25 ); - DecimalFromDouble( 1.23456789012345E-20 ); - DecimalFromDouble( 1.234567890123456E-10 ); - DecimalFromDouble( 1.2345678901234567 ); - DecimalFromDouble( 1.23456789012345678E+12 ); - DecimalFromDouble( 1.234567890123456789E+28 ); - DecimalFromDouble( 1.234567890123456789E+30 ); -} - -/* -This example of the explicit conversion from double to Decimal -generates the following output. - - double argument Decimal value - --------------- ------------- - 1.2345678901230000E-030 0 - 1.2345678901233999E-025 0.0000000000000000000000001235 - 1.2345678901234499E-020 0.0000000000000000000123456789 - 1.2345678901234560E-010 0.000000000123456789012346 - 1.2345678901234567E+000 1.23456789012346 - 1.2345678901234568E+012 1234567890123.46 - 1.2345678901234568E+028 12345678901234600000000000000 - 1.2345678901234569E+030 OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp deleted file mode 100644 index 2b8674f5b9b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example of the explicit conversion from float to Decimal. -using namespace System; -#define formatter "{0,16:E7}{1,33}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the float argument; catch exceptions that are thrown. -void DecimalFromSingle( float argument ) -{ - Object^ decValue; - - // Convert the float argument to a Decimal value. - try - { - decValue = (Decimal)argument; - } - catch ( Exception^ ex ) - { - decValue = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, decValue ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversion from float " - "to Decimal \ngenerates the following output.\n" ); - Console::WriteLine( formatter, "float argument", "Decimal value" ); - Console::WriteLine( formatter, "--------------", "-------------" ); - - // Convert float values and display the results. - DecimalFromSingle( 1.2345E-30F ); - DecimalFromSingle( 1.2345E-26F ); - DecimalFromSingle( 1.23456E-22F ); - DecimalFromSingle( 1.23456E-12F ); - DecimalFromSingle( 1.234567F ); - DecimalFromSingle( 1.234567E+12F ); - DecimalFromSingle( 1.2345678E+28F ); - DecimalFromSingle( 1.2345678E+30F ); -} - -/* -This example of the explicit conversion from float to Decimal -generates the following output. - - float argument Decimal value - -------------- ------------- - 1.2345000E-030 0 - 1.2345000E-026 0.0000000000000000000000000123 - 1.2345600E-022 0.000000000000000000000123456 - 1.2345600E-012 0.00000000000123456 - 1.2345671E+000 1.234567 - 1.2345670E+012 1234567000000 - 1.2345678E+028 12345680000000000000000000000 - 1.2345678E+030 OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp deleted file mode 100644 index 6d1843e5d96..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 16-bit integer values. - array^ values = { Int16::MinValue, Int16::MaxValue, - 0xFFF, 12345, -10000 }; - // Convert each value to a Decimal. - for each (Int16 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -32768 (Int16) --> -32768 (Decimal) -// 32767 (Int16) --> 32767 (Decimal) -// 4095 (Int16) --> 4095 (Decimal) -// 12345 (Int16) --> 12345 (Decimal) -// -10000 (Int16) --> -10000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp deleted file mode 100644 index 02af50b7b64..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 32-bit integer values. - array^ values = { Int32::MinValue, Int32::MaxValue, - 0xFFFFFF, 123456789, -1000000000 }; - // Convert each value to a Decimal. - for each (Int32 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -2147483648 (Int32) --> -2147483648 (Decimal) -// 2147483647 (Int32) --> 2147483647 (Decimal) -// 16777215 (Int32) --> 16777215 (Decimal) -// 123456789 (Int32) --> 123456789 (Decimal) -// -1000000000 (Int32) --> -1000000000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp deleted file mode 100644 index 6276b339c09..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 64-bit integer values. - array^ values = { Int64::MinValue, Int64::MaxValue, - 0xFFFFFFFFFFFF, 123456789123456789, - -1000000000000000 }; - // Convert each value to a Decimal. - for each (Int64 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -9223372036854775808 (Int64) --> -9223372036854775808 (Decimal) -// 9223372036854775807 (Int64) --> 9223372036854775807 (Decimal) -// 281474976710655 (Int64) --> 281474976710655 (Decimal) -// 123456789123456789 (Int64) --> 123456789123456789 (Decimal) -// -1000000000000000 (Int64) --> -1000000000000000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp deleted file mode 100644 index 7dc5e10fb54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 8-bit signed integer values. - array^ values = { SByte::MinValue, SByte::MaxValue, - 0x3F, 123, -100 }; - // Convert each value to a Decimal. - for each (SByte value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -128 (SByte) --> -128 (Decimal) -// 127 (SByte) --> 127 (Decimal) -// 63 (SByte) --> 63 (Decimal) -// 123 (SByte) --> 123 (Decimal) -// -100 (SByte) --> -100 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp deleted file mode 100644 index f1aeb921e60..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of byte values. - array^ values = { Byte::MinValue, Byte::MaxValue, - 0x3F, 123, 200 }; - // Convert each value to a Decimal. - for each (Byte value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (Byte) --> 0 (Decimal) -// 255 (Byte) --> 255 (Decimal) -// 63 (Byte) --> 63 (Decimal) -// 123 (Byte) --> 123 (Decimal) -// 200 (Byte) --> 200 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp deleted file mode 100644 index 05b5707b713..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 16-bit unsigned integer values. - array^ values = { UInt16::MinValue, UInt16::MaxValue, - 0xFFF, 12345, 40000 }; - // Convert each value to a Decimal. - for each (UInt16 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (UInt16) --> 0 (Decimal) -// 65535 (UInt16) --> 65535 (Decimal) -// 4095 (UInt16) --> 4095 (Decimal) -// 12345 (UInt16) --> 12345 (Decimal) -// 40000 (UInt16) --> 40000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp deleted file mode 100644 index 66304c49b67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 32-bit unsigned integer values. - array^ values = { UInt32::MinValue, UInt32::MaxValue, - 0xFFFFFF, 123456789, 4000000000 }; - // Convert each value to a Decimal. - for each (UInt32 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (UInt32) --> 0 (Decimal) -// 4294967295 (UInt32) --> 4294967295 (Decimal) -// 16777215 (UInt32) --> 16777215 (Decimal) -// 123456789 (UInt32) --> 123456789 (Decimal) -// 4000000000 (UInt32) --> 4000000000 (Decimal) -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp deleted file mode 100644 index 83f40b676ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 64-bit unsigned integer values. - array^ values = { UInt64::MinValue, UInt64::MaxValue, - 0xFFFFFFFFFFFF, 123456789123456789, - 1000000000000000 }; - // Convert each value to a Decimal. - for each (UInt64 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (UInt64) --> 0 (Decimal) -// 18446744073709551615 (UInt64) --> 18446744073709551615 (Decimal) -// 281474976710655 (UInt64) --> 281474976710655 (Decimal) -// 123456789123456789 (UInt64) --> 123456789123456789 (Decimal) -// 1000000000000000 (UInt64) --> 1000000000000000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp deleted file mode 100644 index b129d97d402..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of decimal values. - array^ values = { Decimal::Parse("78"), - Decimal(78000,0,0,false,3), - Decimal::Parse("78.999"), - Decimal::Parse("255.999"), - Decimal::Parse("256"), - Decimal::Parse("127.999"), - Decimal::Parse("128"), - Decimal::Parse("-0.999"), - Decimal::Parse("-1"), - Decimal::Parse("-128.999"), - Decimal::Parse("-129") }; - for each (Decimal value in values) { - try { - Byte byteValue = (Byte) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, byteValue, - byteValue.GetType()->Name); - } - catch (OverflowException^ e) { - Console::WriteLine("OverflowException: Cannot convert {0}", - value); - } - } -} -// The example displays the following output: -// 78 (Decimal) --> 78 (Byte) -// 78.000 (Decimal) --> 78 (Byte) -// 78.999 (Decimal) --> 78 (Byte) -// 255.999 (Decimal) --> 255 (Byte) -// OverflowException: Cannot convert 256 -// 127.999 (Decimal) --> 127 (Byte) -// 128 (Decimal) --> 128 (Byte) -// -0.999 (Decimal) --> 0 (Byte) -// OverflowException: Cannot convert -1 -// OverflowException: Cannot convert -128.999 -// OverflowException: Cannot convert -129 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp deleted file mode 100644 index b9c5dfa766d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of Decimal values. - array^ values = { Decimal::Parse("0.0000000000000000000000000001"), - Decimal::Parse("0.0000000000123456789123456789"), - Decimal::Parse("123"), - Decimal(123000000, 0, 0, false, 6), - Decimal::Parse("123456789.123456789"), - Decimal::Parse("123456789123456789123456789"), - Decimal::MinValue, Decimal::MaxValue }; - // Convert each value to a double. - for each (Decimal value in values) { - double dblValue = (double) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, dblValue, - dblValue.GetType()->Name); - } -} -// The example displays the following output: -// 0.0000000000000000000000000001 (Decimal) --> 1E-28 (Double) -// 0.0000000000123456789123456789 (Decimal) --> 1.23456789123457E-11 (Double) -// 123 (Decimal) --> 123 (Double) -// 123.000000 (Decimal) --> 123 (Double) -// 123456789.123456789 (Decimal) --> 123456789.123457 (Double) -// 123456789123456789123456789 (Decimal) --> 1.23456789123457E+26 (Double) -// -79228162514264337593543950335 (Decimal) --> -7.92281625142643E+28 (Double) -// 79228162514264337593543950335 (Decimal) --> 7.92281625142643E+28 (Double) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp deleted file mode 100644 index ba9c3b99b99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the explicit conversions from Decimal to short and -// Decimal to unsigned short. -using namespace System; -#define formatter "{0,16}{1,19}{2,19}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the Decimal argument; catch exceptions that are thrown. -void DecimalToU_Int16( Decimal argument ) -{ - Object^ Int16Value; - Object^ UInt16Value; - - // Convert the argument to a short value. - try - { - Int16Value = (short)argument; - } - catch ( Exception^ ex ) - { - Int16Value = GetExceptionType( ex ); - } - - - // Convert the argument to an unsigned short value. - try - { - UInt16Value = (unsigned short)argument; - } - catch ( Exception^ ex ) - { - UInt16Value = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, Int16Value, UInt16Value ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversions from Decimal to " - "short \nand Decimal to unsigned short generates the " - "following output. \nIt displays several converted Decimal " - "values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "short", "unsigned short" ); - Console::WriteLine( formatter, "----------------", "-----", "--------------" ); - - // Convert Decimal values and display the results. - DecimalToU_Int16( Decimal::Parse( "123" ) ); - DecimalToU_Int16( Decimal(123000,0,0,false,3) ); - DecimalToU_Int16( Decimal::Parse( "123.999" ) ); - DecimalToU_Int16( Decimal::Parse( "65535.999" ) ); - DecimalToU_Int16( Decimal::Parse( "65536" ) ); - DecimalToU_Int16( Decimal::Parse( "32767.999" ) ); - DecimalToU_Int16( Decimal::Parse( "32768" ) ); - DecimalToU_Int16( Decimal::Parse( "-0.999" ) ); - DecimalToU_Int16( Decimal::Parse( "-1" ) ); - DecimalToU_Int16( Decimal::Parse( "-32768.999" ) ); - DecimalToU_Int16( Decimal::Parse( "-32769" ) ); -} - -/* -This example of the explicit conversions from Decimal to short -and Decimal to unsigned short generates the following output. -It displays several converted Decimal values. - -Decimal argument short unsigned short ----------------- ----- -------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 65535.999 OverflowException 65535 - 65536 OverflowException OverflowException - 32767.999 32767 32767 - 32768 OverflowException 32768 - -0.999 0 0 - -1 -1 OverflowException - -32768.999 -32768 OverflowException - -32769 OverflowException OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp deleted file mode 100644 index 02cb0e6339f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the explicit conversions from Decimal to int and -// Decimal to unsigned int. -using namespace System; -#define formatter "{0,17}{1,19}{2,19}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the Decimal argument; catch exceptions that are thrown. -void DecimalToU_Int32( Decimal argument ) -{ - Object^ Int32Value; - Object^ UInt32Value; - - // Convert the argument to an int value. - try - { - Int32Value = (int)argument; - } - catch ( Exception^ ex ) - { - Int32Value = GetExceptionType( ex ); - } - - - // Convert the argument to an unsigned int value. - try - { - UInt32Value = (unsigned int)argument; - } - catch ( Exception^ ex ) - { - UInt32Value = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, Int32Value, UInt32Value ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversions from Decimal to " - "int \nand Decimal to unsigned int generates the " - "following output. \nIt displays several converted Decimal " - "values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "int", "unsigned int" ); - Console::WriteLine( formatter, "----------------", "---", "------------" ); - - // Convert Decimal values and display the results. - DecimalToU_Int32( Decimal::Parse( "123" ) ); - DecimalToU_Int32( Decimal(123000,0,0,false,3) ); - DecimalToU_Int32( Decimal::Parse( "123.999" ) ); - DecimalToU_Int32( Decimal::Parse( "4294967295.999" ) ); - DecimalToU_Int32( Decimal::Parse( "4294967296" ) ); - DecimalToU_Int32( Decimal::Parse( "2147483647.999" ) ); - DecimalToU_Int32( Decimal::Parse( "2147483648" ) ); - DecimalToU_Int32( Decimal::Parse( "-0.999" ) ); - DecimalToU_Int32( Decimal::Parse( "-1" ) ); - DecimalToU_Int32( Decimal::Parse( "-2147483648.999" ) ); - DecimalToU_Int32( Decimal::Parse( "-2147483649" ) ); -} - -/* -This example of the explicit conversions from Decimal to int -and Decimal to unsigned int generates the following output. -It displays several converted Decimal values. - - Decimal argument int unsigned int - ---------------- --- ------------ - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 4294967295.999 OverflowException 4294967295 - 4294967296 OverflowException OverflowException - 2147483647.999 2147483647 2147483647 - 2147483648 OverflowException 2147483648 - -0.999 0 0 - -1 -1 OverflowException - -2147483648.999 -2147483648 OverflowException - -2147483649 OverflowException OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp deleted file mode 100644 index 5beaab71f7f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the explicit conversions from Decimal to __int64 and -// Decimal to unsigned __int64. -using namespace System; -#define formatter "{0,25}{1,22}{2,22}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the Decimal argument; catch exceptions that are thrown. -void DecimalToU_Int64( Decimal argument ) -{ - Object^ Int64Value; - Object^ UInt64Value; - - // Convert the argument to an __int64 value. - try - { - Int64Value = (__int64)argument; - } - catch ( Exception^ ex ) - { - Int64Value = GetExceptionType( ex ); - } - - - // Convert the argument to an unsigned __int64 value. - try - { - UInt64Value = (unsigned __int64)argument; - } - catch ( Exception^ ex ) - { - UInt64Value = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, Int64Value, UInt64Value ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversions from Decimal to " - "__int64 \nand Decimal to unsigned __int64 generates the " - "following output. \nIt displays several converted Decimal " - "values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "__int64", "unsigned __int64" ); - Console::WriteLine( formatter, "----------------", "-------", "----------------" ); - - // Convert Decimal values and display the results. - DecimalToU_Int64( Decimal::Parse( "123" ) ); - DecimalToU_Int64( Decimal(123000,0,0,false,3) ); - DecimalToU_Int64( Decimal::Parse( "123.999" ) ); - DecimalToU_Int64( Decimal::Parse( "18446744073709551615.999" ) ); - DecimalToU_Int64( Decimal::Parse( "18446744073709551616" ) ); - DecimalToU_Int64( Decimal::Parse( "9223372036854775807.999" ) ); - DecimalToU_Int64( Decimal::Parse( "9223372036854775808" ) ); - DecimalToU_Int64( Decimal::Parse( "-0.999" ) ); - DecimalToU_Int64( Decimal::Parse( "-1" ) ); - DecimalToU_Int64( Decimal::Parse( "-9223372036854775808.999" ) ); - DecimalToU_Int64( Decimal::Parse( "-9223372036854775809" ) ); -} - -/* -This example of the explicit conversions from Decimal to __int64 -and Decimal to unsigned __int64 generates the following output. -It displays several converted Decimal values. - - Decimal argument __int64 unsigned __int64 - ---------------- ------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp deleted file mode 100644 index ffc578df28f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -int main() -{ - array^info = { "Name: Felica Walker", "Title: Mz.", - "Age: 47", "Location: Paris", "Gender: F"}; - int found = 0; - Console::WriteLine("The initial values in the array are:"); - for each (String^ s in info) - Console::WriteLine(s); - - Console::WriteLine("\nWe want to retrieve only the key information. That is:"); - for each (String^ s in info) { - found = s->IndexOf(": "); - Console::WriteLine(" {0}", s->Substring(found + 2)); - } -} -// The example displays the following output: -// The initial values in the array are: -// Name: Felica Walker -// Title: Mz. -// Age: 47 -// Location: Paris -// Gender: F -// -// We want to retrieve only the key information. That is: -// Felica Walker -// Mz. -// 47 -// Paris -// F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp deleted file mode 100644 index df9aa3a8a84..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Action.cpp : main project file. - -//#include "stdafx.h" - -// -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Name -{ -private: - String^ instanceName; - -public: - Name(String^ name) - { - instanceName = name; - } - - void DisplayToConsole() - { - Console::WriteLine(this->instanceName); - } - - void DisplayToWindow() - { - MessageBox::Show(this->instanceName); - } -}; - - -int main() -{ - Name^ testName = gcnew Name(L"Koani"); - System::Action^ showMethod; - showMethod += gcnew Action(testName, &Name::DisplayToWindow); - showMethod(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp deleted file mode 100644 index c593825b090..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Action`1.cpp : main project file. - -//#include "stdafx.h" - -// -#using - -using namespace System; -using namespace System::Windows::Forms; - -namespace ActionExample -{ - public ref class Message - { - public: - static void ShowWindowsMessage(String^ message) - { - MessageBox::Show(message); - } - }; -} - -int main() -{ - Action^ messageTarget; - - if (Environment::GetCommandLineArgs()->Length > 1) - messageTarget = gcnew Action(&ActionExample::Message::ShowWindowsMessage); - else - messageTarget = gcnew Action(&Console::WriteLine); - - messageTarget("Hello, World!"); - return 0; -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp deleted file mode 100644 index 143680f77d9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Delegate.cpp : main project file. - -//#include "stdafx.h" - -// -#using - -using namespace System; -using namespace System::Windows::Forms; - -public delegate void DisplayMessage(String^ message); - -public ref class TestCustomDelegate -{ -public: - static void ShowWindowsMessage(String^ message) - { - MessageBox::Show(message); - } -}; - -int main() -{ - DisplayMessage^ messageTarget; - - if (Environment::GetCommandLineArgs()->Length > 1) - messageTarget = gcnew DisplayMessage(&TestCustomDelegate::ShowWindowsMessage); - else - messageTarget = gcnew DisplayMessage(&Console::WriteLine); - - messageTarget(L"Hello World!"); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp deleted file mode 100644 index bc76d292564..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// The following example wraps an array in a read-only IList. -#using - -// -using namespace System; -using namespace System::Collections::Generic; - -namespace Samples -{ - public ref class SamplesArray - { - public: - static void Work() - { - - // Create and initialize a new string array. - array ^ textArray = - {"The", "quick", "brown", "fox"}; - - // Display the values of the array. - Console::WriteLine("The string array initially contains " - "the following values:"); - PrintIndexAndValues(textArray); - - // Create a read-only IList wrapper around the array. - IList ^ textList = Array::AsReadOnly(textArray); - - // Display the values of the read-only IList. - Console::WriteLine("The read-only IList contains " - "the following values:"); - PrintIndexAndValues(textList); - - // Attempt to change a value through the wrapper. - try - { - textList[3] = "CAT"; - } - catch (NotSupportedException^ ex) - { - Console::WriteLine("{0} - {1}", ex->GetType(), - ex->Message); - Console::WriteLine(); - } - - - // Change a value in the original array. - textArray[2] = "RED"; - - // Display the values of the array. - Console::WriteLine("After changing the third element," - "the string array contains the following values:"); - PrintIndexAndValues(textArray); - - // Display the values of the read-only IList. - Console::WriteLine("After changing the third element, the" - " read-only IList contains the following values:"); - PrintIndexAndValues(textList); - } - - static void PrintIndexAndValues(array^ textArray) - { - for (int i = 0; i < textArray->Length; i++) - { - Console::WriteLine(" [{0}] : {1}", i, textArray[i]); - } - Console::WriteLine(); - } - - static void PrintIndexAndValues(IList^ textList) - { - for (int i = 0; i < textList->Count; i++) - { - Console::WriteLine(" [{0}] : {1}", i, textList[i]); - } - Console::WriteLine(); - } - }; -} - -int main() -{ - Samples::SamplesArray::Work(); - -} - -/* -This code produces the following output. - -The string array initially contains the following values: -[0] : The -[1] : quick -[2] : brown -[3] : fox - -The read-only IList contains the following values: -[0] : The -[1] : quick -[2] : brown -[3] : fox - -System.NotSupportedException - Collection is read-only. - -After changing the third element, the string array contains the following values: -[0] : The -[1] : quick -[2] : RED -[3] : fox - -After changing the third element, the read-only IList contains the following values: -[0] : The -[1] : quick -[2] : RED -[3] : fox - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp deleted file mode 100644 index cbcd2d14244..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// The following code example clones a CultureInfo array and demonstrates the behavior of a shallow copy. -// -using namespace System; -using namespace System::Globalization; -void PrintIndexAndValues( Array^ myArray ); -int main() -{ - - // Create and initialize a new CultureInfo array. - CultureInfo^ ci0 = gcnew CultureInfo( "ar-SA",false ); - CultureInfo^ ci1 = gcnew CultureInfo( "en-US",false ); - CultureInfo^ ci2 = gcnew CultureInfo( "fr-FR",false ); - CultureInfo^ ci3 = gcnew CultureInfo( "ja-JP",false ); - array^arrCI = {ci0,ci1,ci2,ci3}; - - // Create a clone of the CultureInfo array. - array^arrCIClone = (array^)arrCI->Clone(); - - // Replace an element in the clone array. - CultureInfo^ ci4 = gcnew CultureInfo( "th-TH",false ); - arrCIClone[ 0 ] = ci4; - - // Display the contents of the original array. - Console::WriteLine( "The original array contains the following values:" ); - PrintIndexAndValues( arrCI ); - - // Display the contents of the clone array. - Console::WriteLine( "The clone array contains the following values:" ); - PrintIndexAndValues( arrCIClone ); - - // Display the DateTimeFormatInfo.DateSeparator for the fourth element in both arrays. - Console::WriteLine( "Before changes to the clone:" ); - Console::WriteLine( " Original: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCI[ 3 ]->Name, arrCI[ 3 ]->DateTimeFormat->DateSeparator ); - Console::WriteLine( " Clone: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCIClone[ 3 ]->Name, arrCIClone[ 3 ]->DateTimeFormat->DateSeparator ); - - // Replace the DateTimeFormatInfo.DateSeparator for the fourth element in the clone array. - arrCIClone[ 3 ]->DateTimeFormat->DateSeparator = "-"; - - // Display the DateTimeFormatInfo.DateSeparator for the fourth element in both arrays. - Console::WriteLine( "After changes to the clone:" ); - Console::WriteLine( " Original: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCI[ 3 ]->Name, arrCI[ 3 ]->DateTimeFormat->DateSeparator ); - Console::WriteLine( " Clone: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCIClone[ 3 ]->Name, arrCIClone[ 3 ]->DateTimeFormat->DateSeparator ); -} - -void PrintIndexAndValues( Array^ myArray ) -{ - for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) - Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); -} - -/* -This code produces the following output. - -The original array contains the following values: - [0]: ar-SA - [1]: en-US - [2]: fr-FR - [3]: ja-JP -The clone array contains the following values: - [0]: th-TH - [1]: en-US - [2]: fr-FR - [3]: ja-JP -Before changes to the clone: - Original: The DateTimeFormatInfo.DateSeparator for ja-JP is /. - Clone: The DateTimeFormatInfo.DateSeparator for ja-JP is /. -After changes to the clone: - Original: The DateTimeFormatInfo.DateSeparator for ja-JP is -. - Clone: The DateTimeFormatInfo.DateSeparator for ja-JP is -. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp deleted file mode 100644 index 3bba94a2dc6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -// The following example shows how resizing affects the array. -// -using namespace System; -static void PrintIndexAndValues(array^myArr) -{ - for(int i = 0; i < myArr->Length; i++) - { - Console::WriteLine(L" [{0}] : {1}", i, myArr[i]); - } - Console::WriteLine(); -} - -int main() -{ - - // Create and initialize a new string array. - array^myArr = {L"The", L"quick", L"brown", L"fox", - L"jumps", L"over", L"the", L"lazy", L"dog"}; - - // Display the values of the array. - Console::WriteLine( - L"The string array initially contains the following values:"); - PrintIndexAndValues(myArr); - - // Resize the array to a bigger size (five elements larger). - Array::Resize(myArr, myArr->Length + 5); - - // Display the values of the array. - Console::WriteLine(L"After resizing to a larger size, "); - Console::WriteLine(L"the string array contains the following values:"); - PrintIndexAndValues(myArr); - - // Resize the array to a smaller size (four elements). - Array::Resize(myArr, 4); - - // Display the values of the array. - Console::WriteLine(L"After resizing to a smaller size, "); - Console::WriteLine(L"the string array contains the following values:"); - PrintIndexAndValues(myArr); - return 1; -} - -/* -This code produces the following output. - -The string array initially contains the following values: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After resizing to a larger size, -the string array contains the following values: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - [9] : - [10] : - [11] : - [12] : - [13] : - -After resizing to a smaller size, -the string array contains the following values: - [0] : The - [1] : quick - [2] : brown - [3] : fox - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp deleted file mode 100644 index a3cb3dea791..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp +++ /dev/null @@ -1,119 +0,0 @@ - -// The following example shows how to sort the values in an array using the default comparer -// and a custom comparer that reverses the sort order. - -// -using namespace System; -using namespace System::Collections; - -public ref class ReverseComparer : IComparer -{ -public: - // Call CaseInsensitiveComparer::Compare with the parameters reversed. - virtual int Compare(Object^ x, Object^ y) = IComparer::Compare - { - return ((gcnew CaseInsensitiveComparer)->Compare(y, x)); - } -}; - -void DisplayValues(array^ arr) -{ - for (int i = arr->GetLowerBound(0); i <= arr->GetUpperBound(0); i++) - Console::WriteLine( " [{0}] : {1}", i, arr[ i ] ); - - Console::WriteLine(); -} - -int main() -{ - // Create and initialize a new array. and a new custom comparer. - array^ words = { "The","QUICK","BROWN","FOX","jumps", - "over","the","lazy","dog" }; - // Instantiate the reverse comparer. - IComparer^ revComparer = gcnew ReverseComparer(); - - // Display the values of the Array. - Console::WriteLine( "The original order of elements in the array:" ); - DisplayValues(words); - - // Sort a section of the array using the default comparer. - Array::Sort(words, 1, 3); - Console::WriteLine( "After sorting elements 1-3 by using the default comparer:"); - DisplayValues(words); - - // Sort a section of the array using the reverse case-insensitive comparer. - Array::Sort(words, 1, 3, revComparer); - Console::WriteLine( "After sorting elements 1-3 by using the reverse case-insensitive comparer:"); - DisplayValues(words); - - // Sort the entire array using the default comparer. - Array::Sort(words); - Console::WriteLine( "After sorting the entire array by using the default comparer:"); - DisplayValues(words); - - // Sort the entire array by using the reverse case-insensitive comparer. - Array::Sort(words, revComparer); - Console::WriteLine( "After sorting the entire array using the reverse case-insensitive comparer:"); - DisplayValues(words); -} - -/* -This code produces the following output. - -The Array initially contains the following values: - [0] : The - [1] : QUICK - [2] : BROWN - [3] : FOX - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After sorting a section of the Array using the default comparer: - [0] : The - [1] : BROWN - [2] : FOX - [3] : QUICK - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After sorting a section of the Array using the reverse case-insensitive comparer: - [0] : The - [1] : QUICK - [2] : FOX - [3] : BROWN - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After sorting the entire Array using the default comparer: - [0] : BROWN - [1] : dog - [2] : FOX - [3] : jumps - [4] : lazy - [5] : over - [6] : QUICK - [7] : the - [8] : The - -After sorting the entire Array using the reverse case-insensitive comparer: - [0] : the - [1] : The - [2] : QUICK - [3] : over - [4] : lazy - [5] : jumps - [6] : FOX - [7] : dog - [8] : BROWN - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp deleted file mode 100644 index ef9afc50bc2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// The following example shows how to sort two associated arrays -// where the first array contains the keys and the second array contains the values. -// Sorts are done using the default comparer and a custom comparer that reverses the sort order. - -// -using namespace System; -using namespace System::Collections; - -public ref class myReverserClass: public IComparer -{ -private: - - // Calls CaseInsensitiveComparer::Compare with the parameters reversed. - virtual int Compare( Object^ x, Object^ y ) = IComparer::Compare - { - return ((gcnew CaseInsensitiveComparer)->Compare( y, x )); - } -}; - -void PrintKeysAndValues( array^myKeys, array^myValues ) -{ - for ( int i = 0; i < myKeys->Length; i++ ) - { - Console::WriteLine( " {0, -10}: {1}", myKeys[ i ], myValues[ i ] ); - } - Console::WriteLine(); -} - -int main() -{ - // Creates and initializes a new Array and a new custom comparer. - array^myKeys = {"red","GREEN","YELLOW","BLUE","purple","black","orange"}; - array^myValues = {"strawberries","PEARS","LIMES","BERRIES","grapes","olives","cantaloupe"}; - IComparer^ myComparer = gcnew myReverserClass; - - // Displays the values of the Array. - Console::WriteLine( "The Array initially contains the following values:" ); - PrintKeysAndValues( myKeys, myValues ); - - // Sorts a section of the Array using the default comparer. - Array::Sort( myKeys, myValues, 1, 3 ); - Console::WriteLine( "After sorting a section of the Array using the default comparer:" ); - - // Sorts a section of the Array using the reverse case-insensitive comparer. - Array::Sort( myKeys, myValues, 1, 3, myComparer ); - Console::WriteLine( "After sorting a section of the Array using the reverse case-insensitive comparer:" ); - PrintKeysAndValues( myKeys, myValues ); - - // Sorts the entire Array using the default comparer. - Array::Sort( myKeys, myValues ); - Console::WriteLine( "After sorting the entire Array using the default comparer:" ); - PrintKeysAndValues( myKeys, myValues ); - - // Sorts the entire Array using the reverse case-insensitive comparer. - Array::Sort( myKeys, myValues, myComparer ); - Console::WriteLine( "After sorting the entire Array using the reverse case-insensitive comparer:" ); - PrintKeysAndValues( myKeys, myValues ); -} - -/* -This code produces the following output. - -The Array initially contains the following values: - red : strawberries - GREEN : PEARS - YELLOW : LIMES - BLUE : BERRIES - purple : grapes - black : olives - orange : cantaloupe - -After sorting a section of the Array using the default comparer: - red : strawberries - BLUE : BERRIES - GREEN : PEARS - YELLOW : LIMES - purple : grapes - black : olives - orange : cantaloupe - -After sorting a section of the Array using the reverse case-insensitive comparer: - red : strawberries - YELLOW : LIMES - GREEN : PEARS - BLUE : BERRIES - purple : grapes - black : olives - orange : cantaloupe - -After sorting the entire Array using the default comparer: - black : olives - BLUE : BERRIES - GREEN : PEARS - orange : cantaloupe - purple : grapes - red : strawberries - YELLOW : LIMES - -After sorting the entire Array using the reverse case-insensitive comparer: - YELLOW : LIMES - red : strawberries - purple : grapes - orange : cantaloupe - GREEN : PEARS - BLUE : BERRIES - black : olives - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp deleted file mode 100644 index 8133ae99134..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -using namespace System; -using namespace System::Threading; - -int main() -{ -// - Array^ myArray = gcnew array { 1, 2, 4 }; - try - { - Monitor::Enter(myArray->SyncRoot); - - for each (Int32 item in myArray) - Console::WriteLine(item); - } - finally - { - Monitor::Exit(myArray->SyncRoot); - } -// - - return 1; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp deleted file mode 100644 index f8fd837a057..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// The following code example passes an ArraySegment to a method. - -// -using namespace System; - - -namespace Sample -{ - public ref class SampleArray - { - public: - static void Work() - { - - // Create and initialize a new string array. - array ^ words = {"The", "quick", "brown", - "fox", "jumps", "over", "the", "lazy", "dog"}; - - // Display the initial contents of the array. - Console::WriteLine("The first array segment" - " (with all the array's elements) contains:"); - PrintIndexAndValues(words); - - // Define an array segment that contains the entire array. - ArraySegment segment(words); - - // Display the contents of the ArraySegment. - Console::WriteLine("The first array segment" - " (with all the array's elements) contains:"); - PrintIndexAndValues(segment); - - // Define an array segment that contains the middle five - // values of the array. - ArraySegment middle(words, 2, 5); - - // Display the contents of the ArraySegment. - Console::WriteLine("The second array segment" - " (with the middle five elements) contains:"); - PrintIndexAndValues(middle); - - // Modify the fourth element of the first array - // segment - segment.Array[3] = "LION"; - - // Display the contents of the second array segment - // middle. Note that the value of its second element - // also changed. - Console::WriteLine("After the first array segment" - " is modified,the second array segment" - " now contains:"); - PrintIndexAndValues(middle); - Console::ReadLine(); - } - - static void PrintIndexAndValues(ArraySegment^ segment) - { - for (int i = segment->Offset; - i < (segment->Offset + segment->Count); i++) - { - Console::WriteLine(" [{0}] : {1}", i, - segment->Array[i]); - } - Console::WriteLine(); - } - - static void PrintIndexAndValues(array^ words) - { - for (int i = 0; i < words->Length; i++) - { - Console::WriteLine(" [{0}] : {1}", i, - words[i]); - } - Console::WriteLine(); - } - }; -} - -int main() -{ - Sample::SampleArray::Work(); - return 0; -} - - - /* - This code produces the following output. - - The original array initially contains: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - - The first array segment (with all the array's elements) contains: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - - The second array segment (with the middle five elements) contains: - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - - After the first array segment is modified, the second array segment now contains: - [2] : brown - [3] : LION - [4] : jumps - [5] : over - [6] : the - - */ - - // diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp deleted file mode 100644 index 2f0f4ea3c86..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -// -using namespace System; -int main() -{ - array^names = { "Dog", "Cat", "Fish"}; - array^objs = dynamic_cast^>(names); - try - { - objs[ 2 ] = (Object^)"Mouse"; - for ( Int32 i = 0; i < objs->Length; i++ ) - { - Console::WriteLine( objs[ i ] ); - - } - } - catch ( System::ArrayTypeMismatchException^ ) - { - - // Not reached, "Mouse" is of the correct type - Console::WriteLine( "Exception Thrown" ); - } - - try - { - Object^ obj = 13; - objs[ 2 ] = obj; - } - catch ( System::ArrayTypeMismatchException^ ) - { - - // Always reached, 13 is not a string. - Console::WriteLine( "New element is not of the correct type" ); - } - - - // Set obj to an array of objects instead of an array of strings - array^objs2 = gcnew array(3); - try - { - objs2[ 0 ] = (Object^)"Turtle"; - objs2[ 1 ] = 12; - objs2[ 2 ] = 2.341; - for ( Int32 i = 0; i < objs->Length; i++ ) - { - Console::WriteLine( objs2[ i ] ); - - } - } - catch ( System::ArrayTypeMismatchException^ ) - { - - // ArrayTypeMismatchException is not thrown this time. - Console::WriteLine( "Exception Thrown" ); - } - -} - -/*expected return values: -Dog -Cat -Mouse -New element is not of the correct type -Turtle -12 -2.341 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp deleted file mode 100644 index 63f0c9c330c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// The following example shows how to use GetEnumerator to list the elements of an array. -// -using namespace System; - -int main() -{ - // Creates and initializes a new Array. - array^myArr = gcnew array(10); - myArr[ 0 ] = "The"; - myArr[ 1 ] = "quick"; - myArr[ 2 ] = "brown"; - myArr[ 3 ] = "fox"; - myArr[ 4 ] = "jumps"; - myArr[ 5 ] = "over"; - myArr[ 6 ] = "the"; - myArr[ 7 ] = "lazy"; - myArr[ 8 ] = "dog"; - - // Displays the values of the Array. - int i = 0; - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - Console::WriteLine( "The Array contains the following values:" ); - while ( (myEnumerator->MoveNext()) && (myEnumerator->Current != nullptr) ) - Console::WriteLine( "[{0}] {1}", i++, myEnumerator->Current ); -} - -/* -This code produces the following output. - -The Array contains the following values: -[0] The -[1] quick -[2] brown -[3] fox -[4] jumps -[5] over -[6] the -[7] lazy -[8] dog - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp deleted file mode 100644 index bdfd647373c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// The following code example demonstrates how to set and get a specific value in a one-dimensional or multidimensional array. -// -using namespace System; -int main() -{ - - // Creates and initializes a one-dimensional array. - array^myArr1 = gcnew array(5); - - // Sets the element at index 3. - myArr1->SetValue( "three", 3 ); - Console::WriteLine( "[3]: {0}", myArr1->GetValue( 3 ) ); - - // Creates and initializes a two-dimensional array. - array^myArr2 = gcnew array(5,5); - - // Sets the element at index 1,3. - myArr2->SetValue( "one-three", 1, 3 ); - Console::WriteLine( "[1,3]: {0}", myArr2->GetValue( 1, 3 ) ); - - // Creates and initializes a three-dimensional array. - array^myArr3 = gcnew array(5,5,5); - - // Sets the element at index 1,2,3. - myArr3->SetValue( "one-two-three", 1, 2, 3 ); - Console::WriteLine( "[1,2,3]: {0}", myArr3->GetValue( 1, 2, 3 ) ); - - // Creates and initializes a seven-dimensional array. - array^myArr7 = gcnew array(5,5,5,5,5,5,5); - - // Sets the element at index 1,2,3,0,1,2,3. - array^myIndices = {1,2,3,0,1,2,3}; - myArr7->SetValue( "one-two-three-zero-one-two-three", myIndices ); - Console::WriteLine( "[1,2,3,0,1,2,3]: {0}", myArr7->GetValue( myIndices ) ); -} - -/* -This code produces the following output. - -[3]: three -[1,3]: one-three -[1,2,3]: one-two-three -[1,2,3,0,1,2,3]: one-two-three-zero-one-two-three - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp deleted file mode 100644 index e14da9f2add..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp +++ /dev/null @@ -1,124 +0,0 @@ - -using namespace System; -using namespace System::Reflection; - - // Define a custom parameter attribute that takes a single message argument. - -[AttributeUsage(AttributeTargets::Parameter)] -public ref class ArgumentUsageAttribute: public Attribute -{ - protected: - // usageMsg is storage for the attribute message. - String^ usageMsg; - - public: - // This is the attribute constructor. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - } - - - // Override ToString() to append the message to what the base generates. - virtual String^ ToString() override - { - return String::Concat( Attribute::ToString(), ":", usageMsg ); - } -} ; - - - // Define a custom parameter attribute that generates a GUID for each instance. -[AttributeUsage(AttributeTargets::Parameter)] -public ref class ArgumentIDAttribute : Attribute -{ - protected: - // instanceGUID is storage for the generated GUID. - Guid instanceGUID; - - public: - // This is the attribute constructor, which generates the GUID. - ArgumentIDAttribute() - { - this->instanceGUID = Guid::NewGuid(); - } - - // Override ToString() to append the GUID to what the base generates. - virtual String^ ToString() override - { - return String::Concat( Attribute::ToString(), ".", instanceGUID.ToString() ); - } -}; - -public ref class TestClass -{ - public: - // Assign an ArgumentID attribute to each parameter. - // Assign an ArgumentUsage attribute to each parameter. - void TestMethod( [ArgumentID][ArgumentUsage("Must pass an array here.")]array^strArray, - [ArgumentID][ArgumentUsage("Can pass param list or array here.")]array^strList ){} -}; - -int main() -{ - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = TestClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // There will be two elements in pInfoArray, one for each parameter. - array^pInfoArray = mInfo->GetParameters(); - if (pInfoArray != nullptr) - { - // Create an instance of the argument usage attribute on strArray. - ArgumentUsageAttribute^ arrayUsageAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create another instance of the argument usage attribute on strArray. - ArgumentUsageAttribute^ arrayUsageAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create an instance of the argument usage attribute on strList. - ArgumentUsageAttribute^ listUsageAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentUsageAttribute::typeid )); - - // Create an instance of the argument ID attribute on strArray. - ArgumentIDAttribute^ arrayIDAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentIDAttribute::typeid )); - - // Create another instance of the argument ID attribute on strArray. - ArgumentIDAttribute^ arrayIDAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentIDAttribute::typeid )); - - // Create an instance of the argument ID attribute on strList. - ArgumentIDAttribute^ listIDAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentIDAttribute::typeid )); - - // Compare various pairs of attributes for equality. - Console::WriteLine( "\nCompare a usage attribute instance to " - "another instance of the same attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayUsageAttr1->ToString(), arrayUsageAttr2->ToString(), arrayUsageAttr1->Equals( arrayUsageAttr2 ) ); - Console::WriteLine( "\nCompare a usage attribute to another usage attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayUsageAttr1->ToString(), listUsageAttr->ToString(), arrayUsageAttr1->Equals( listUsageAttr ) ); - Console::WriteLine( "\nCompare an ID attribute instance to " - "another instance of the same attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayIDAttr1->ToString(), arrayIDAttr2->ToString(), arrayIDAttr1->Equals( arrayIDAttr2 ) ); - Console::WriteLine( "\nCompare an ID attribute to another ID attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayIDAttr1->ToString(), listIDAttr->ToString(), arrayIDAttr1->Equals( listIDAttr ) ); - } - else - { - Console::WriteLine( "The parameters information could not be retrieved for method {0}.", mInfo->Name ); - } -} -/* -The example displays an output similar to the following: - Compare a usage attribute instance to another instance of the same attribute: - "ArgumentUsageAttribute:Must pass an array here." == - "ArgumentUsageAttribute:Must pass an array here." ? True - - Compare a usage attribute to another usage attribute: - "ArgumentUsageAttribute:Must pass an array here." == - "ArgumentUsageAttribute:Can pass param list or array here." ? False - - Compare an ID attribute instance to another instance of the same attribute: - "ArgumentIDAttribute.22d1a176-4aca-427b-8230-0c1563e13187" == - "ArgumentIDAttribute.7fa94bba-c290-48e1-a0de-e22f6c1e64f1" ? False - - Compare an ID attribute to another ID attribute: - "ArgumentIDAttribute.22d1a176-4aca-427b-8230-0c1563e13187" == - "ArgumentIDAttribute.b9eea70d-9c0f-459e-a984-19c46b6c8789" ? False -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp deleted file mode 100644 index b5764d952ba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp +++ /dev/null @@ -1,130 +0,0 @@ - -// -// Example for the Attribute::GetCustomAttribute( ParameterInfo*, Type* ) -// method. -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; - -namespace NDP_UE_CPP -{ - - // - // Define a custom parameter attribute that takes a single message argument. - - [AttributeUsage(AttributeTargets::Parameter)] - public ref class ArgumentUsageAttribute: public Attribute - { - protected: - - // usageMsg is storage for the attribute message. - String^ usageMsg; - - public: - - // This is the attribute constructor. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - } - - - property String^ Message - { - // This is the Message property for the attribute. - String^ get() - { - return usageMsg; - } - - void set( String^ value ) - { - this->usageMsg = value; - } - } - }; - // - - public ref class BaseClass - { - public: - - // Assign an ArgumentUsage attribute to the strArray parameter. - // Assign a ParamArray attribute to strList. - virtual void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, - ...array^strList ){} - }; - - public ref class DerivedClass: public BaseClass - { - public: - - // Assign an ArgumentUsage attributes to the strList parameter. - virtual void TestMethod( array^strArray, [ArgumentUsage( - "Can pass a parameter list or array here.")]array^strList ) override {} - }; -} - -int main() -{ - Console::WriteLine( "This example of Attribute::GetCustomAttribute( Param" - "eterInfo*, Type* )\ngenerates the following output." ); - - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = NDP_UE_CPP::DerivedClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // Iterate through the ParameterInfo array for the method parameters. - array^pInfoArray = mInfo->GetParameters(); - if ( pInfoArray != nullptr ) - { - // This implements foreach( ParameterInfo* paramInfo in pInfoArray ). - IEnumerator^ myEnum = pInfoArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ParameterInfo^ paramInfo = safe_cast(myEnum->Current); - - // See if the ParamArray attribute is defined. - bool isDef = Attribute::IsDefined( paramInfo, ParamArrayAttribute::typeid ); - if ( isDef ) - Console::WriteLine( "\nThe ParamArray attribute is defined for \n" - "parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - - // See if ParamUsageAttribute is defined. - // If so, display a message. - NDP_UE_CPP::ArgumentUsageAttribute^ usageAttr = static_cast(Attribute::GetCustomAttribute( paramInfo, NDP_UE_CPP::ArgumentUsageAttribute::typeid )); - if ( usageAttr != nullptr ) - { - Console::WriteLine( "\nThe ArgumentUsage attribute is defined for \n" - "parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - Console::WriteLine( "\n The usage " - "message for {0} is:\n \"{1}\".", paramInfo->Name, usageAttr->Message ); - } - } - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); -} - -/* -This example of Attribute::GetCustomAttribute( ParameterInfo*, Type* ) -generates the following output. - -The ArgumentUsage attribute is defined for -parameter strArray of method TestMethod. - - The usage message for strArray is: - "Must pass an array here.". - -The ParamArray attribute is defined for -parameter strList of method TestMethod. - -The ArgumentUsage attribute is defined for -parameter strList of method TestMethod. - - The usage message for strList is: - "Can pass a parameter list or array here.". -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp deleted file mode 100644 index 8197cb5c956..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp +++ /dev/null @@ -1,152 +0,0 @@ - -// -// Example for the Attribute::GetCustomAttribute( ParameterInfo*, Type*, bool ) -// method. -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; - -namespace NDP_UE_CPP -{ - // Define a custom parameter attribute that takes a single message argument. - - [AttributeUsage(AttributeTargets::Parameter)] - public ref class ArgumentUsageAttribute: public Attribute - { - protected: - - // usageMsg is storage for the attribute message. - String^ usageMsg; - - public: - - // This is the attribute constructor. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - } - - property String^ Message - { - // This is the Message property for the attribute. - String^ get() - { - return usageMsg; - } - - void set( String^ value ) - { - this->usageMsg = value; - } - } - }; - - public ref class BaseClass - { - public: - - // Assign an ArgumentUsage attribute to the strArray parameter. - // Assign a ParamArray attribute to strList. - virtual void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, - ...array^strList ){} - }; - - public ref class DerivedClass: public BaseClass - { - public: - - // Assign an ArgumentUsage attributes to the strList parameter. - virtual void TestMethod( array^strArray, [ArgumentUsage( - "Can pass a parameter list or array here.")]array^strList ) override {} - - }; - - void DisplayParameterAttributes( MethodInfo^ mInfo, array^pInfoArray, bool includeInherited ) - { - Console::WriteLine( "\nParameter attribute information for method \"{0}" - "\"\nincludes inheritance from base class: {1}.", mInfo->Name, includeInherited ? (String^)"Yes" : "No" ); - - // This implements foreach( ParameterInfo* paramInfo in pInfoArray ). - IEnumerator^ myEnum = pInfoArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ParameterInfo^ paramInfo = safe_cast(myEnum->Current); - - // See if the ParamArray attribute is defined. - bool isDef = Attribute::IsDefined( paramInfo, ParamArrayAttribute::typeid ); - if ( isDef ) - Console::WriteLine( "\n The ParamArray attribute is defined " - "for \n parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - - // See if ParamUsageAttribute is defined. - // If so, display a message. - ArgumentUsageAttribute^ usageAttr = static_cast(Attribute::GetCustomAttribute( paramInfo, ArgumentUsageAttribute::typeid, includeInherited )); - if ( usageAttr != nullptr ) - { - Console::WriteLine( "\n The ArgumentUsage attribute is defined " - "for \n parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - Console::WriteLine( "\n The usage " - "message for {0} is:\n \"{1}\".", paramInfo->Name, usageAttr->Message ); - } - } - } - -} - -int main() -{ - Console::WriteLine( "This example of Attribute::GetCustomAttribute( ParameterInfo*, " - "Type*, bool )\ngenerates the following output." ); - - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = NDP_UE_CPP::DerivedClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // Iterate through the ParameterInfo array for the method parameters. - array^pInfoArray = mInfo->GetParameters(); - if ( pInfoArray != nullptr ) - { - NDP_UE_CPP::DisplayParameterAttributes( mInfo, pInfoArray, false ); - NDP_UE_CPP::DisplayParameterAttributes( mInfo, pInfoArray, true ); - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); -} - -/* -This example of Attribute::GetCustomAttribute( ParameterInfo*, Type*, bool ) -generates the following output. - -Parameter attribute information for method "TestMethod" -includes inheritance from base class: No. - - The ParamArray attribute is defined for - parameter strList of method TestMethod. - - The ArgumentUsage attribute is defined for - parameter strList of method TestMethod. - - The usage message for strList is: - "Can pass a parameter list or array here.". - -Parameter attribute information for method "TestMethod" -includes inheritance from base class: Yes. - - The ArgumentUsage attribute is defined for - parameter strArray of method TestMethod. - - The usage message for strArray is: - "Must pass an array here.". - - The ParamArray attribute is defined for - parameter strList of method TestMethod. - - The ArgumentUsage attribute is defined for - parameter strList of method TestMethod. - - The usage message for strList is: - "Can pass a parameter list or array here.". -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp deleted file mode 100644 index 9cfaa32643e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp +++ /dev/null @@ -1,136 +0,0 @@ - -// -// Example for the Attribute::TypeId property. -using namespace System; -using namespace System::Reflection; - -namespace NDP_UE_CPP -{ - - // Define a custom parameter attribute that takes a single message argument. - - [AttributeUsage(AttributeTargets::Parameter)] - public ref class ArgumentUsageAttribute: public Attribute - { - protected: - - // This is storage for the attribute message and unique ID. - String^ usageMsg; - Guid instanceGUID; - - public: - - // The constructor saves the message and creates a unique identifier. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - this->instanceGUID = Guid::NewGuid(); - } - - property String^ Message - { - // This is the Message property for the attribute. - String^ get() - { - return usageMsg; - } - - void set( String^ value ) - { - this->usageMsg = value; - } - } - - property Object^ TypeId - { - // Override TypeId to provide a unique identifier for the instance. - virtual Object^ get() override - { - return instanceGUID; - } - } - - // Override ToString() to append the message to - // what the base generates. - virtual String^ ToString() override - { - return String::Concat( Attribute::ToString(), ":", usageMsg ); - } - }; - - public ref class TestClass - { - public: - - // Assign an ArgumentUsage attribute to each parameter. - // Assign a ParamArray attribute to strList. - void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, - [ArgumentUsage("Can pass a param list or array here.")]array^strList ){} - }; - - static void ShowAttributeTypeIds() - { - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = TestClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // There will be two elements in pInfoArray, one for each parameter. - array^pInfoArray = mInfo->GetParameters(); - if ( pInfoArray != nullptr ) - { - // Create an instance of the param array attribute on strList. - ParamArrayAttribute^ listArrayAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ParamArrayAttribute::typeid )); - - // Create an instance of the argument usage attribute on strArray. - ArgumentUsageAttribute^ arrayUsageAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create another instance of the argument usage attribute - // on strArray. - ArgumentUsageAttribute^ arrayUsageAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create an instance of the argument usage attribute on strList. - ArgumentUsageAttribute^ listUsageAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentUsageAttribute::typeid )); - - // Display the attributes and corresponding TypeId values. - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", listArrayAttr->ToString(), listArrayAttr->TypeId ); - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", arrayUsageAttr1->ToString(), arrayUsageAttr1->TypeId ); - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", arrayUsageAttr2->ToString(), arrayUsageAttr2->TypeId ); - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", listUsageAttr->ToString(), listUsageAttr->TypeId ); - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); - } -} - -int main() -{ - Console::WriteLine( "This example of the Attribute::TypeId property\n" - "generates the following output." ); - Console::WriteLine( "\nCreate instances from a derived Attribute " - "class that implements TypeId, \nand then " - "display the attributes and corresponding TypeId values:" ); - NDP_UE_CPP::ShowAttributeTypeIds(); -} - -/* -This example of the Attribute::TypeId property -generates output similar to the following: - -Create instances from a derived Attribute class that implements TypeId, -and then display the attributes and corresponding TypeId values: - -"System.ParamArrayAttribute" -TypeId: System.ParamArrayAttribute - -"NDP_UE_CPP.ArgumentUsageAttribute:Must pass an array here." -TypeId: 9316015d-1219-4ce1-b317-e71efb23d42e - -"NDP_UE_CPP.ArgumentUsageAttribute:Must pass an array here." -TypeId: ebc1ba23-2573-4c1f-aea6-90515e733796 - -"NDP_UE_CPP.ArgumentUsageAttribute:Can pass a param list or array here." -TypeId: 624af10b-9bba-4403-a97e-46927e7385fb -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp deleted file mode 100644 index b6498b4a22a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Example of BitConverter class methods. -using namespace System; -int main() -{ - String^ formatter = "{0,25}{1,30}"; - double aDoubl = 0.1111111111111111111; - float aSingl = 0.1111111111111111111F; - __int64 aLong = 1111111111111111111; - int anInt = 1111111111; - short aShort = 11111; - __wchar_t aChar = L'*'; - bool aBool = true; - Console::WriteLine( "This example of methods of the BitConverter class" - "\ngenerates the following output.\n" ); - Console::WriteLine( formatter, "argument", "byte array" ); - Console::WriteLine( formatter, "--------", "----------" ); - - // Convert values to Byte arrays and display them. - Console::WriteLine( formatter, aDoubl, BitConverter::ToString( BitConverter::GetBytes( aDoubl ) ) ); - Console::WriteLine( formatter, aSingl, BitConverter::ToString( BitConverter::GetBytes( aSingl ) ) ); - Console::WriteLine( formatter, aLong, BitConverter::ToString( BitConverter::GetBytes( aLong ) ) ); - Console::WriteLine( formatter, anInt, BitConverter::ToString( BitConverter::GetBytes( anInt ) ) ); - Console::WriteLine( formatter, aShort, BitConverter::ToString( BitConverter::GetBytes( aShort ) ) ); - Console::WriteLine( formatter, aChar, BitConverter::ToString( BitConverter::GetBytes( aChar ) ) ); - Console::WriteLine( formatter, aBool, BitConverter::ToString( BitConverter::GetBytes( aBool ) ) ); -} - -/* -This example of methods of the BitConverter class -generates the following output. - - argument byte array - -------- ---------- - 0.111111111111111 1C-C7-71-1C-C7-71-BC-3F - 0.1111111 39-8E-E3-3D - 1111111111111111111 C7-71-C4-2B-AB-75-6B-0F - 1111111111 C7-35-3A-42 - 11111 67-2B - * 2A-00 - True 01 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp deleted file mode 100644 index 57627564464..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -// Example of the BitConverter::IsLittleEndian field. -using namespace System; -int main() -{ - Console::WriteLine( "This example of the BitConverter::IsLittleEndian field " - "generates \nthe following output when run on " - "x86-class computers.\n" ); - Console::WriteLine( "IsLittleEndian: {0}", BitConverter::IsLittleEndian ); -} - -/* -This example of the BitConverter::IsLittleEndian field generates -the following output when run on x86-class computers. - -IsLittleEndian: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp deleted file mode 100644 index 011dda5201d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// -// Example of the BitConverter::Int64BitsToDouble method. -using namespace System; - -// Reinterpret the __int64 argument as a double. -void LongBitsToDouble( __int64 argument ) -{ - double doubleValue; - doubleValue = BitConverter::Int64BitsToDouble( argument ); - - // Display the argument in hexadecimal. - Console::WriteLine( "{0,20}{1,27:E16}", String::Format( "0x{0:X16}", argument ), doubleValue ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::Int64BitsToDouble( " - "__int64 ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,20}{1,27:E16}", "__int64 argument", "double value" ); - Console::WriteLine( "{0,20}{1,27:E16}", "----------------", "------------" ); - - // Convert __int64 values and display the results. - LongBitsToDouble( 0 ); - LongBitsToDouble( 0x3FF0000000000000 ); - LongBitsToDouble( 0x402E000000000000 ); - LongBitsToDouble( 0x406FE00000000000 ); - LongBitsToDouble( 0x41EFFFFFFFE00000 ); - LongBitsToDouble( 0x3F70000000000000 ); - LongBitsToDouble( 0x3DF0000000000000 ); - LongBitsToDouble( 0x0000000000000001 ); - LongBitsToDouble( 0x000000000000FFFF ); - LongBitsToDouble( 0x0000FFFFFFFFFFFF ); - LongBitsToDouble( 0xFFFFFFFFFFFFFFFF ); - LongBitsToDouble( 0xFFF0000000000000 ); - LongBitsToDouble( 0x7FF0000000000000 ); - LongBitsToDouble( 0xFFEFFFFFFFFFFFFF ); - LongBitsToDouble( 0x7FEFFFFFFFFFFFFF ); - LongBitsToDouble( Int64::MinValue ); - LongBitsToDouble( Int64::MaxValue ); -} - -/* -This example of the BitConverter::Int64BitsToDouble( __int64 ) -method generates the following output. - - __int64 argument double value - ---------------- ------------ - 0x0000000000000000 0.0000000000000000E+000 - 0x3FF0000000000000 1.0000000000000000E+000 - 0x402E000000000000 1.5000000000000000E+001 - 0x406FE00000000000 2.5500000000000000E+002 - 0x41EFFFFFFFE00000 4.2949672950000000E+009 - 0x3F70000000000000 3.9062500000000000E-003 - 0x3DF0000000000000 2.3283064365386963E-010 - 0x0000000000000001 4.9406564584124654E-324 - 0x000000000000FFFF 3.2378592100206092E-319 - 0x0000FFFFFFFFFFFF 1.3906711615669959E-309 - 0xFFFFFFFFFFFFFFFF NaN - 0xFFF0000000000000 -Infinity - 0x7FF0000000000000 Infinity - 0xFFEFFFFFFFFFFFFF -1.7976931348623157E+308 - 0x7FEFFFFFFFFFFFFF 1.7976931348623157E+308 - 0x8000000000000000 0.0000000000000000E+000 - 0x7FFFFFFFFFFFFFFF NaN -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp deleted file mode 100644 index 347acebc505..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -// Example of the BitConverter::DoubleToInt64Bits method. -using namespace System; - -// Reinterpret the double argument as an __int64. -void DoubleToLongBits( double argument ) -{ - __int64 longValue; - longValue = BitConverter::DoubleToInt64Bits( argument ); - - // Display the resulting __int64 in hexadecimal. - Console::WriteLine( "{0,25:E16}{1,23:X16}", argument, longValue ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::DoubleToInt64Bits( " - "double ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,25:E16}{1,23:X16}", "double argument", "hexadecimal value" ); - Console::WriteLine( "{0,25:E16}{1,23:X16}", "---------------", "-----------------" ); - - // Convert double values and display the results. - DoubleToLongBits( 1.0 ); - DoubleToLongBits( 15.0 ); - DoubleToLongBits( 255.0 ); - DoubleToLongBits( 4294967295.0 ); - DoubleToLongBits( 0.00390625 ); - DoubleToLongBits( 0.00000000023283064365386962890625 ); - DoubleToLongBits( 1.234567890123E-300 ); - DoubleToLongBits( 1.23456789012345E-150 ); - DoubleToLongBits( 1.2345678901234565 ); - DoubleToLongBits( 1.2345678901234567 ); - DoubleToLongBits( 1.2345678901234569 ); - DoubleToLongBits( 1.23456789012345678E+150 ); - DoubleToLongBits( 1.234567890123456789E+300 ); - DoubleToLongBits( Double::MinValue ); - DoubleToLongBits( Double::MaxValue ); - DoubleToLongBits( Double::Epsilon ); - DoubleToLongBits( Double::NaN ); - DoubleToLongBits( Double::NegativeInfinity ); - DoubleToLongBits( Double::PositiveInfinity ); -} - -/* -This example of the BitConverter::DoubleToInt64Bits( double ) -method generates the following output. - - double argument hexadecimal value - --------------- ----------------- - 1.0000000000000000E+000 3FF0000000000000 - 1.5000000000000000E+001 402E000000000000 - 2.5500000000000000E+002 406FE00000000000 - 4.2949672950000000E+009 41EFFFFFFFE00000 - 3.9062500000000000E-003 3F70000000000000 - 2.3283064365386963E-010 3DF0000000000000 - 1.2345678901230000E-300 01AA74FE1C1E7E45 - 1.2345678901234500E-150 20D02A36586DB4BB - 1.2345678901234565E+000 3FF3C0CA428C59FA - 1.2345678901234567E+000 3FF3C0CA428C59FB - 1.2345678901234569E+000 3FF3C0CA428C59FC - 1.2345678901234569E+150 5F182344CD3CDF9F - 1.2345678901234569E+300 7E3D7EE8BCBBD352 - -1.7976931348623157E+308 FFEFFFFFFFFFFFFF - 1.7976931348623157E+308 7FEFFFFFFFFFFFFF - 4.9406564584124654E-324 0000000000000001 - NaN FFF8000000000000 - -Infinity FFF0000000000000 - Infinity 7FF0000000000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp deleted file mode 100644 index d6d4ad9fb47..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; - -int main() -{ - // Define Boolean true and false values. - array^ values = { true, false }; - - // Display the value and its corresponding byte array. - Console::WriteLine("{0,10}{1,16}\n", "Boolean", "Bytes"); - for each (Byte value in values) { - array^ bytes = BitConverter::GetBytes(value); - Console::WriteLine("{0,10}{1,16}", value, - BitConverter::ToString(bytes)); - } -} -// This example displays the following output: -// Boolean Bytes -// -// True 01 -// False 00 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp deleted file mode 100644 index 47d776fe8a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( __wchar_t ) method. -using namespace System; - -// Convert a __wchar_t argument to a byte array and display it. -void GetBytesChar( __wchar_t argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,10}{1,16}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( __wchar_t ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,10}{1,16}", "__wchar_t", "byte array" ); - Console::WriteLine( "{0,10}{1,16}", "---------", "----------" ); - - // Convert __wchar_t values and display the results. - GetBytesChar( L'\0' ); - GetBytesChar( L' ' ); - GetBytesChar( L'*' ); - GetBytesChar( L'3' ); - GetBytesChar( L'A' ); - GetBytesChar( L'[' ); - GetBytesChar( L'a' ); - GetBytesChar( L'{' ); -} - -/* -This example of the BitConverter::GetBytes( __wchar_t ) -method generates the following output. - - __wchar_t byte array - --------- ---------- - 00-00 - 20-00 - * 2A-00 - 3 33-00 - A 41-00 - [ 5B-00 - a 61-00 - { 7B-00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp deleted file mode 100644 index 000a26b3a68..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( double ) method. -using namespace System; - -// Convert a double argument to a byte array and display it. -void GetBytesDouble( double argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,25:E16}{1,30}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( double ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,25:E16}{1,30}", "double", "byte array" ); - Console::WriteLine( "{0,25:E16}{1,30}", "------", "----------" ); - - // Convert double values and display the results. - GetBytesDouble( 0.0 ); - GetBytesDouble( 1.0 ); - GetBytesDouble( 255.0 ); - GetBytesDouble( 4294967295.0 ); - GetBytesDouble( 0.00390625 ); - GetBytesDouble( 0.00000000023283064365386962890625 ); - GetBytesDouble( 1.23456789012345E-300 ); - GetBytesDouble( 1.2345678901234565 ); - GetBytesDouble( 1.2345678901234567 ); - GetBytesDouble( 1.2345678901234569 ); - GetBytesDouble( 1.23456789012345678E+300 ); - GetBytesDouble( Double::MinValue ); - GetBytesDouble( Double::MaxValue ); - GetBytesDouble( Double::Epsilon ); - GetBytesDouble( Double::NaN ); - GetBytesDouble( Double::NegativeInfinity ); - GetBytesDouble( Double::PositiveInfinity ); -} - -/* -This example of the BitConverter::GetBytes( double ) -method generates the following output. - - double byte array - ------ ---------- - 0.0000000000000000E+000 00-00-00-00-00-00-00-00 - 1.0000000000000000E+000 00-00-00-00-00-00-F0-3F - 2.5500000000000000E+002 00-00-00-00-00-E0-6F-40 - 4.2949672950000000E+009 00-00-E0-FF-FF-FF-EF-41 - 3.9062500000000000E-003 00-00-00-00-00-00-70-3F - 2.3283064365386963E-010 00-00-00-00-00-00-F0-3D - 1.2345678901234500E-300 DF-88-1E-1C-FE-74-AA-01 - 1.2345678901234565E+000 FA-59-8C-42-CA-C0-F3-3F - 1.2345678901234567E+000 FB-59-8C-42-CA-C0-F3-3F - 1.2345678901234569E+000 FC-59-8C-42-CA-C0-F3-3F - 1.2345678901234569E+300 52-D3-BB-BC-E8-7E-3D-7E - -1.7976931348623157E+308 FF-FF-FF-FF-FF-FF-EF-FF - 1.7976931348623157E+308 FF-FF-FF-FF-FF-FF-EF-7F - 4.9406564584124654E-324 01-00-00-00-00-00-00-00 - NaN 00-00-00-00-00-00-F8-FF - -Infinity 00-00-00-00-00-00-F0-FF - Infinity 00-00-00-00-00-00-F0-7F -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp deleted file mode 100644 index c9dbcc43471..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( float ) method. -using namespace System; - -// Convert a float argument to a byte array and display it. -void GetBytesSingle( float argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,16:E7}{1,20}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( float ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,16:E7}{1,20}", "float", "byte array" ); - Console::WriteLine( "{0,16:E7}{1,20}", "-----", "----------" ); - - // Convert float values and display the results. - GetBytesSingle( 0.0F ); - GetBytesSingle( 1.0F ); - GetBytesSingle( 15.0F ); - GetBytesSingle( 65535.0F ); - GetBytesSingle( 0.00390625F ); - GetBytesSingle( 0.00000000023283064365386962890625F ); - GetBytesSingle( 1.2345E-35F ); - GetBytesSingle( 1.2345671F ); - GetBytesSingle( 1.2345673F ); - GetBytesSingle( 1.2345677F ); - GetBytesSingle( 1.23456789E+35F ); - GetBytesSingle( Single::MinValue ); - GetBytesSingle( Single::MaxValue ); - GetBytesSingle( Single::Epsilon ); - GetBytesSingle( Single::NaN ); - GetBytesSingle( Single::NegativeInfinity ); - GetBytesSingle( Single::PositiveInfinity ); -} - -/* -This example of the BitConverter::GetBytes( float ) -method generates the following output. - - float byte array - ----- ---------- - 0.0000000E+000 00-00-00-00 - 1.0000000E+000 00-00-80-3F - 1.5000000E+001 00-00-70-41 - 6.5535000E+004 00-FF-7F-47 - 3.9062500E-003 00-00-80-3B - 2.3283064E-010 00-00-80-2F - 1.2345000E-035 49-46-83-05 - 1.2345671E+000 4B-06-9E-3F - 1.2345673E+000 4D-06-9E-3F - 1.2345676E+000 50-06-9E-3F - 1.2345679E+035 1E-37-BE-79 - -3.4028235E+038 FF-FF-7F-FF - 3.4028235E+038 FF-FF-7F-7F - 1.4012985E-045 01-00-00-00 - NaN 00-00-C0-FF - -Infinity 00-00-80-FF - Infinity 00-00-80-7F -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp deleted file mode 100644 index 85dfd8f960e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of integers. - array^ values = { 0, 15, -15, 10000, -10000, - Int16::MinValue, Int16::MaxValue}; - - // Convert each integer to a byte array. - Console::WriteLine("{0,16}{1,10}{2,17}", "Integer", - "Endian", "Byte Array"); - Console::WriteLine("{0,16}{1,10}{2,17}", "---", "------", - "----------"); - for each (int value in values) { - array^ byteArray = BitConverter::GetBytes(value); - Console::WriteLine("{0,16}{1,10}{2,17}", value, - BitConverter::IsLittleEndian ? "Little" : " Big", - BitConverter::ToString(byteArray)); - } -} -// This example displays output like the following: -// Integer Endian Byte Array -// --- ------ ---------- -// 0 Little 00-00 -// 15 Little 0F-00 -// -15 Little F1-FF -// 10000 Little 10-27 -// -10000 Little F0-D8 -// -32768 Little 00-80 -// 32767 Little FF-7F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp deleted file mode 100644 index f1a781ff180..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of integers. - array^ values = { 0, 15, -15, 0x100000, -0x100000, 1000000000, - -1000000000, Int32::MinValue, Int32::MaxValue }; - - // Convert each integer to a byte array. - Console::WriteLine("{0,16}{1,10}{2,17}", "Integer", - "Endian", "Byte Array"); - Console::WriteLine("{0,16}{1,10}{2,17}", "---", "------", - "----------" ); - for each (int value in values) { - array^ byteArray = BitConverter::GetBytes(value); - Console::WriteLine("{0,16}{1,10}{2,17}", value, - BitConverter::IsLittleEndian ? "Little" : " Big", - BitConverter::ToString(byteArray)); - } -} -// This example displays output like the following: -// Integer Endian Byte Array -// --- ------ ---------- -// 0 Little 00-00-00-00 -// 15 Little 0F-00-00-00 -// -15 Little F1-FF-FF-FF -// 1048576 Little 00-00-10-00 -// -1048576 Little 00-00-F0-FF -// 1000000000 Little 00-CA-9A-3B -// -1000000000 Little 00-36-65-C4 -// -2147483648 Little 00-00-00-80 -// 2147483647 Little FF-FF-FF-7F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp deleted file mode 100644 index dace2c6c7a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; - -void main() -{ - // Define an array of Int64 values. - array^ values = { 0, 0xFFFFFF, -0xFFFFFF, 1000000000, -1000000000, - 0x100000000, -0x100000000, 0xAAAAAAAAAAAA, - -0xAAAAAAAAAAAA, 1000000000000000000, - -1000000000000000000, Int64::MinValue, - Int64::MaxValue}; - - Console::WriteLine( "{0,22}{1,10}{2,30}", "Int64", "Endian", "Byte Array"); - Console::WriteLine( "{0,22}{1,10}{2,30}", "----", "------", "----------"); - - for each (Int64 value in values) { - // Convert each Int64 value to a byte array. - array^ byteArray = BitConverter::GetBytes(value); - // Display the result. - Console::WriteLine("{0,22}{1,10}{2,30}", value, - BitConverter::IsLittleEndian ? "Little" : " Big", - BitConverter::ToString(byteArray)); - } -} -// The example displays output like the following: -// Int64 Endian Byte Array -// ---- ------ ---------- -// 0 Little 00-00-00-00-00-00-00-00 -// 16777215 Little FF-FF-FF-00-00-00-00-00 -// -16777215 Little 01-00-00-FF-FF-FF-FF-FF -// 1000000000 Little 00-CA-9A-3B-00-00-00-00 -// -1000000000 Little 00-36-65-C4-FF-FF-FF-FF -// 4294967296 Little 00-00-00-00-01-00-00-00 -// -4294967296 Little 00-00-00-00-FF-FF-FF-FF -// 187649984473770 Little AA-AA-AA-AA-AA-AA-00-00 -// -187649984473770 Little 56-55-55-55-55-55-FF-FF -// 1000000000000000000 Little 00-00-64-A7-B3-B6-E0-0D -// -1000000000000000000 Little 00-00-9C-58-4C-49-1F-F2 -// -9223372036854775808 Little 00-00-00-00-00-00-00-80 -// 9223372036854775807 Little FF-FF-FF-FF-FF-FF-FF-7F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp deleted file mode 100644 index 5ec8af9b911..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( unsigned short ) method. -using namespace System; - -// Convert an unsigned short argument to a byte array and display it. -void GetBytesUInt16( unsigned short argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,14}{1,13}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " - "short ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,14}{1,13}", "unsigned short", "byte array" ); - Console::WriteLine( "{0,14}{1,13}", "--------------", "----------" ); - - // Convert unsigned short values and display the results. - GetBytesUInt16( 15 ); - GetBytesUInt16( 1023 ); - GetBytesUInt16( 10000 ); - GetBytesUInt16( UInt16::MinValue ); - GetBytesUInt16( Int16::MaxValue ); - GetBytesUInt16( UInt16::MaxValue ); -} - -/* -This example of the BitConverter::GetBytes( unsigned short ) -method generates the following output. - -unsigned short byte array --------------- ---------- - 15 0F-00 - 1023 FF-03 - 10000 10-27 - 0 00-00 - 32767 FF-7F - 65535 FF-FF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp deleted file mode 100644 index e7017024141..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( unsigned int ) method. -using namespace System; - -// Convert an unsigned int argument to a byte array and display it. -void GetBytesUInt32( unsigned int argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,16}{1,20}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " - "int ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,16}{1,20}", "unsigned int", "byte array" ); - Console::WriteLine( "{0,16}{1,20}", "------------", "----------" ); - - // Convert unsigned int values and display the results. - GetBytesUInt32( 15 ); - GetBytesUInt32( 1023 ); - GetBytesUInt32( 0x100000 ); - GetBytesUInt32( 1000000000 ); - GetBytesUInt32( UInt32::MinValue ); - GetBytesUInt32( Int32::MaxValue ); - GetBytesUInt32( UInt32::MaxValue ); -} - -/* -This example of the BitConverter::GetBytes( unsigned int ) -method generates the following output. - - unsigned int byte array - ------------ ---------- - 15 0F-00-00-00 - 1023 FF-03-00-00 - 1048576 00-00-10-00 - 1000000000 00-CA-9A-3B - 0 00-00-00-00 - 2147483647 FF-FF-FF-7F - 4294967295 FF-FF-FF-FF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp deleted file mode 100644 index 7c94f1c6895..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( unsigned __int64 ) method. -using namespace System; - -// Convert an unsigned __int64 argument to a byte array and display it. -void GetBytesUInt64( unsigned __int64 argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,22}{1,30}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " - "__int64 ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,22}{1,30}", "unsigned __int64", "byte array" ); - Console::WriteLine( "{0,22}{1,30}", "----------------", "----------" ); - - // Convert unsigned __int64 values and display the results. - GetBytesUInt64( 0xFFFFFF ); - GetBytesUInt64( 1000000000 ); - GetBytesUInt64( 0x100000000 ); - GetBytesUInt64( 0xAAAAAAAAAAAA ); - GetBytesUInt64( 1000000000000000000 ); - GetBytesUInt64( 10000000000000000000 ); - GetBytesUInt64( UInt64::MinValue ); - GetBytesUInt64( Int64::MaxValue ); - GetBytesUInt64( UInt64::MaxValue ); -} - -/* -This example of the BitConverter::GetBytes( unsigned __int64 ) -method generates the following output. - - unsigned __int64 byte array - ---------------- ---------- - 16777215 FF-FF-FF-00-00-00-00-00 - 1000000000 00-CA-9A-3B-00-00-00-00 - 4294967296 00-00-00-00-01-00-00-00 - 187649984473770 AA-AA-AA-AA-AA-AA-00-00 - 1000000000000000000 00-00-64-A7-B3-B6-E0-0D - 10000000000000000000 00-00-E8-89-04-23-C7-8A - 0 00-00-00-00-00-00-00-00 - 9223372036854775807 FF-FF-FF-FF-FF-FF-FF-7F - 18446744073709551615 FF-FF-FF-FF-FF-FF-FF-FF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp deleted file mode 100644 index 6be5740936b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -// Example of the BitConverter::ToString( unsigned char[ ] ) method. -using namespace System; - -// Display a byte array with a name. -void WriteByteArray( array^bytes, String^ name ) -{ - String^ underLine = "--------------------------------"; - Console::WriteLine( name ); - Console::WriteLine( underLine->Substring( 0, Math::Min( name->Length, underLine->Length ) ) ); - Console::WriteLine( BitConverter::ToString( bytes ) ); - Console::WriteLine(); -} - -int main() -{ - array^arrayOne = {0,1,2,4,8,16,32,64,128,255}; - array^arrayTwo = {32,0,0,42,0,65,0,125,0,197,0,168,3,41,4,172,32}; - array^arrayThree = {15,0,0,128,16,39,240,216,241,255,127}; - array^arrayFour = {15,0,0,0,0,16,0,255,3,0,0,202,154,59,255,255,255,255,127}; - Console::WriteLine( "This example of the " - "BitConverter::ToString( unsigned char[ ] ) \n" - "method generates the following output.\n" ); - WriteByteArray( arrayOne, "arrayOne" ); - WriteByteArray( arrayTwo, "arrayTwo" ); - WriteByteArray( arrayThree, "arrayThree" ); - WriteByteArray( arrayFour, "arrayFour" ); -} - -/* -This example of the BitConverter::ToString( unsigned char[ ] ) -method generates the following output. - -arrayOne --------- -00-01-02-04-08-10-20-40-80-FF - -arrayTwo --------- -20-00-00-2A-00-41-00-7D-00-C5-00-A8-03-29-04-AC-20 - -arrayThree ----------- -0F-00-00-80-10-27-F0-D8-F1-FF-7F - -arrayFour ---------- -0F-00-00-00-00-10-00-FF-03-00-00-CA-9A-3B-FF-FF-FF-FF-7F -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp deleted file mode 100644 index a35ba6d8dc5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -// Example of some BitConverter::ToString( ) method overloads. -using namespace System; - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes, String^ name ) -{ - const int rowSize = 20; - String^ underLine = "--------------------------------"; - int iter; - Console::WriteLine( name ); - Console::WriteLine( underLine->Substring( 0, Math::Min( name->Length, underLine->Length ) ) ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^arrayOne = {0,0,0,0,128,63,0,0,112,65,0,255,127,71,0,0,128,59,0,0,128,47,73,70,131,5,75,6,158,63,77,6,158,63,80,6,158,63,30,55,190,121,255,255,127,255,255,127,127,1,0,0,0,192,255,0,0,128,255,0,0,128,127}; - array^arrayTwo = {255,255,255,0,0,20,0,33,0,0,0,1,0,0,0,100,167,179,182,224,13,0,202,154,59,0,143,91,0,170,170,170,170,170,170,0,0,232,137,4,35,199,138,255,232,244,255,252,205,255,255,129}; - array^arrayThree = {0,222,0,0,0,224,111,64,0,0,224,255,255,255,239,65,0,0,131,0,0,0,112,63,0,143,0,100,0,0,240,61,223,136,30,28,254,116,170,1,250,89,140,66,202,192,243,63,251,89,140,66,202,192,243,63,252,89,140,66,202,192,243,63,82,211,187,188,232,126,255,255,255,244,255,239,127,1,0,0,0,10,17,0,0,248,255,0,88,0,91,0,0,240,255,0,0,240,157}; - Console::WriteLine( "This example of the\n" - " BitConverter::ToString( unsigned char[ ], int ) and \n" - " BitConverter::ToString( unsigned char[ ], int, int ) \n" - "methods generates the following output.\n" ); - WriteMultiLineByteArray( arrayOne, "arrayOne" ); - WriteMultiLineByteArray( arrayTwo, "arrayTwo" ); - WriteMultiLineByteArray( arrayThree, "arrayThree" ); -} - -/* -This example of the - BitConverter::ToString( unsigned char[ ], int ) and - BitConverter::ToString( unsigned char[ ], int, int ) -methods generates the following output. - -arrayOne --------- -00-00-00-00-80-3F-00-00-70-41-00-FF-7F-47-00-00-80-3B-00-00- -80-2F-49-46-83-05-4B-06-9E-3F-4D-06-9E-3F-50-06-9E-3F-1E-37- -BE-79-FF-FF-7F-FF-FF-7F-7F-01-00-00-00-C0-FF-00-00-80-FF-00- -00-80-7F - -arrayTwo --------- -FF-FF-FF-00-00-14-00-21-00-00-00-01-00-00-00-64-A7-B3-B6-E0- -0D-00-CA-9A-3B-00-8F-5B-00-AA-AA-AA-AA-AA-AA-00-00-E8-89-04- -23-C7-8A-FF-E8-F4-FF-FC-CD-FF-FF-81 - -arrayThree ----------- -00-DE-00-00-00-E0-6F-40-00-00-E0-FF-FF-FF-EF-41-00-00-83-00- -00-00-70-3F-00-8F-00-64-00-00-F0-3D-DF-88-1E-1C-FE-74-AA-01- -FA-59-8C-42-CA-C0-F3-3F-FB-59-8C-42-CA-C0-F3-3F-FC-59-8C-42- -CA-C0-F3-3F-52-D3-BB-BC-E8-7E-FF-FF-FF-F4-FF-EF-7F-01-00-00- -00-0A-11-00-00-F8-FF-00-58-00-5B-00-00-F0-FF-00-00-F0-9D -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp deleted file mode 100644 index d867bc4145f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -// Example of the BitConverter::ToBoolean method. -using namespace System; - -int main() -{ - // Define an array of byte values. - array^ bytes = { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 }; - - Console::WriteLine("{0,5}{1,16}{2,10}\n", "index", "array element", "bool" ); - // Convert each array element to a Boolean value. - for (int index = 0; index < bytes->Length; index++) - Console::WriteLine("{0,5}{1,16:X2}{2,10}", index, bytes[index], - BitConverter::ToBoolean(bytes, index)); -} -// The example displays the following output: -// index array element bool -// -// 0 00 False -// 1 01 True -// 2 02 True -// 3 04 True -// 4 08 True -// 5 10 True -// 6 20 True -// 7 40 True -// 8 80 True -// 9 FF True -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp deleted file mode 100644 index cfade12139f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// Example of the BitConverter::ToChar method. -using namespace System; - -// Convert two byte array elements to a __wchar_t and display it. -void BAToChar( array^bytes, int index ) -{ - __wchar_t value = BitConverter::ToChar( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,11}", index, BitConverter::ToString( bytes, index, 2 ), value ); -} - -int main() -{ - array^byteArray = {32,0,0,42,0,65,0,125,0,197,0,168,3,41,4,172,32}; - Console::WriteLine( "This example of the BitConverter::ToChar( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to __wchar_t values.\n" ); - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,11}", "index", "array elements", "__wchar_t" ); - Console::WriteLine( "{0,5}{1,17}{2,11}", "-----", "--------------", "---------" ); - - // Convert byte array elements to __wchar_t values. - BAToChar( byteArray, 0 ); - BAToChar( byteArray, 1 ); - BAToChar( byteArray, 3 ); - BAToChar( byteArray, 5 ); - BAToChar( byteArray, 7 ); - BAToChar( byteArray, 9 ); - BAToChar( byteArray, 11 ); - BAToChar( byteArray, 13 ); - BAToChar( byteArray, 15 ); -} - -/* -This example of the BitConverter::ToChar(unsigned char[ ], int) -method generates the following output. It converts elements of a -byte array to __wchar_t values. - -initial unsigned char array ---------------------------- -20-00-00-2A-00-41-00-7D-00-C5-00-A8-03-29-04-AC-20 - -index array elements __wchar_t ------ -------------- --------- - 0 20-00 - 1 00-00 - 3 2A-00 * - 5 41-00 A - 7 7D-00 } - 9 C5-00 Å - 11 A8-03 Ψ - 13 29-04 Щ - 15 AC-20 € -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp deleted file mode 100644 index 9e797cb8ced..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -// -// Example of the BitConverter::ToDouble method. -using namespace System; - -// Convert eight byte array elements to a double and display it. -void BAToDouble( array^bytes, int index ) -{ - double value = BitConverter::ToDouble( bytes, index ); - Console::WriteLine( "{0,5}{1,27}{2,27:E16}", index, BitConverter::ToString( bytes, index, 8 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {0,0,0,0,0,0,0,0,240,63,0,0,0,0,0,224,111,64,0,0,224,255,255,255,239,65,0,0,0,0,0,0,112,63,0,0,0,0,0,0,240,61,223,136,30,28,254,116,170,1,250,89,140,66,202,192,243,63,251,89,140,66,202,192,243,63,252,89,140,66,202,192,243,63,82,211,187,188,232,126,61,126,255,255,255,255,255,255,239,255,255,255,255,255,255,239,127,1,0,0,0,0,0,0,0,248,255,0,0,0,0,0,0,240,255,0,0,0,0,0,0,240,127}; - Console::WriteLine( "This example of the BitConverter::ToDouble( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to double values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,27}{2,27:E16}", "index", "array elements", "double" ); - Console::WriteLine( "{0,5}{1,27}{2,27:E16}", "-----", "--------------", "------" ); - - // Convert byte array elements to double values. - BAToDouble( byteArray, 0 ); - BAToDouble( byteArray, 2 ); - BAToDouble( byteArray, 10 ); - BAToDouble( byteArray, 18 ); - BAToDouble( byteArray, 26 ); - BAToDouble( byteArray, 34 ); - BAToDouble( byteArray, 42 ); - BAToDouble( byteArray, 50 ); - BAToDouble( byteArray, 58 ); - BAToDouble( byteArray, 66 ); - BAToDouble( byteArray, 74 ); - BAToDouble( byteArray, 82 ); - BAToDouble( byteArray, 89 ); - BAToDouble( byteArray, 97 ); - BAToDouble( byteArray, 99 ); - BAToDouble( byteArray, 107 ); - BAToDouble( byteArray, 115 ); -} - -/* -This example of the BitConverter.ToDouble( byte( ), int ) -method generates the following output. It converts elements -of a byte array to double values. - -initial byte array ------------------- -00-00-00-00-00-00-00-00-F0-3F-00-00-00-00-00-E0-6F-40-00-00- -E0-FF-FF-FF-EF-41-00-00-00-00-00-00-70-3F-00-00-00-00-00-00- -F0-3D-DF-88-1E-1C-FE-74-AA-01-FA-59-8C-42-CA-C0-F3-3F-FB-59- -8C-42-CA-C0-F3-3F-FC-59-8C-42-CA-C0-F3-3F-52-D3-BB-BC-E8-7E- -3D-7E-FF-FF-FF-FF-FF-FF-EF-FF-FF-FF-FF-FF-FF-EF-7F-01-00-00- -00-00-00-00-00-F8-FF-00-00-00-00-00-00-F0-FF-00-00-00-00-00- -00-F0-7F - -index array elements double ------ -------------- ------ - 0 00-00-00-00-00-00-00-00 0.0000000000000000E+000 - 2 00-00-00-00-00-00-F0-3F 1.0000000000000000E+000 - 10 00-00-00-00-00-E0-6F-40 2.5500000000000000E+002 - 18 00-00-E0-FF-FF-FF-EF-41 4.2949672950000000E+009 - 26 00-00-00-00-00-00-70-3F 3.9062500000000000E-003 - 34 00-00-00-00-00-00-F0-3D 2.3283064365386963E-010 - 42 DF-88-1E-1C-FE-74-AA-01 1.2345678901234500E-300 - 50 FA-59-8C-42-CA-C0-F3-3F 1.2345678901234565E+000 - 58 FB-59-8C-42-CA-C0-F3-3F 1.2345678901234567E+000 - 66 FC-59-8C-42-CA-C0-F3-3F 1.2345678901234569E+000 - 74 52-D3-BB-BC-E8-7E-3D-7E 1.2345678901234569E+300 - 82 FF-FF-FF-FF-FF-FF-EF-FF -1.7976931348623157E+308 - 89 FF-FF-FF-FF-FF-FF-EF-7F 1.7976931348623157E+308 - 97 01-00-00-00-00-00-00-00 4.9406564584124654E-324 - 99 00-00-00-00-00-00-F8-FF NaN - 107 00-00-00-00-00-00-F0-FF -Infinity - 115 00-00-00-00-00-00-F0-7F Infinity -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp deleted file mode 100644 index bd457501a14..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -// -// Example of the BitConverter::ToSingle method. -using namespace System; - -// Convert four byte array elements to a float and display it. -void BAToSingle( array^bytes, int index ) -{ - float value = BitConverter::ToSingle( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,18:E7}", index, BitConverter::ToString( bytes, index, 4 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {0,0,0,0,128,63,0,0,112,65,0,255,127,71,0,0,128,59,0,0,128,47,73,70,131,5,75,6,158,63,77,6,158,63,80,6,158,63,30,55,190,121,255,255,127,255,255,127,127,1,0,0,0,192,255,0,0,128,255,0,0,128,127}; - Console::WriteLine( "This example of the BitConverter::ToSingle( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to float values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,17}{2,18:E7}", "index", "array elements", "float" ); - Console::WriteLine( "{0,5}{1,17}{2,18:E7}", "-----", "--------------", "-----" ); - - // Convert byte array elements to float values. - BAToSingle( byteArray, 0 ); - BAToSingle( byteArray, 2 ); - BAToSingle( byteArray, 6 ); - BAToSingle( byteArray, 10 ); - BAToSingle( byteArray, 14 ); - BAToSingle( byteArray, 18 ); - BAToSingle( byteArray, 22 ); - BAToSingle( byteArray, 26 ); - BAToSingle( byteArray, 30 ); - BAToSingle( byteArray, 34 ); - BAToSingle( byteArray, 38 ); - BAToSingle( byteArray, 42 ); - BAToSingle( byteArray, 45 ); - BAToSingle( byteArray, 49 ); - BAToSingle( byteArray, 51 ); - BAToSingle( byteArray, 55 ); - BAToSingle( byteArray, 59 ); -} - -/* -This example of the BitConverter::ToSingle( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to float values. - -initial unsigned char array ---------------------------- -00-00-00-00-80-3F-00-00-70-41-00-FF-7F-47-00-00-80-3B-00-00- -80-2F-49-46-83-05-4B-06-9E-3F-4D-06-9E-3F-50-06-9E-3F-1E-37- -BE-79-FF-FF-7F-FF-FF-7F-7F-01-00-00-00-C0-FF-00-00-80-FF-00- -00-80-7F - -index array elements float ------ -------------- ----- - 0 00-00-00-00 0.0000000E+000 - 2 00-00-80-3F 1.0000000E+000 - 6 00-00-70-41 1.5000000E+001 - 10 00-FF-7F-47 6.5535000E+004 - 14 00-00-80-3B 3.9062500E-003 - 18 00-00-80-2F 2.3283064E-010 - 22 49-46-83-05 1.2345000E-035 - 26 4B-06-9E-3F 1.2345671E+000 - 30 4D-06-9E-3F 1.2345673E+000 - 34 50-06-9E-3F 1.2345676E+000 - 38 1E-37-BE-79 1.2345679E+035 - 42 FF-FF-7F-FF -3.4028235E+038 - 45 FF-FF-7F-7F 3.4028235E+038 - 49 01-00-00-00 1.4012985E-045 - 51 00-00-C0-FF NaN - 55 00-00-80-FF -Infinity - 59 00-00-80-7F Infinity -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp deleted file mode 100644 index 92c948b4d19..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -// Example of the BitConverter::ToInt16 method. -using namespace System; - -// Convert two byte array elements to a short and display it. -void BAToInt16( array^bytes, int index ) -{ - short value = BitConverter::ToInt16( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,10}", index, BitConverter::ToString( bytes, index, 2 ), value ); -} - -int main() -{ - array^byteArray = {15,0,0,128,16,39,240,216,241,255,127}; - Console::WriteLine( "This example of the BitConverter::ToInt16( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to short values.\n" ); - Console::WriteLine( "initial byte array" ); - Console::WriteLine( "------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,10}", "index", "array elements", "short" ); - Console::WriteLine( "{0,5}{1,17}{2,10}", "-----", "--------------", "-----" ); - - // Convert byte array elements to short values. - BAToInt16( byteArray, 1 ); - BAToInt16( byteArray, 0 ); - BAToInt16( byteArray, 8 ); - BAToInt16( byteArray, 4 ); - BAToInt16( byteArray, 6 ); - BAToInt16( byteArray, 9 ); - BAToInt16( byteArray, 2 ); -} - -/* -This example of the BitConverter::ToInt16( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to short values. - -initial byte array ------------------- -0F-00-00-80-10-27-F0-D8-F1-FF-7F - -index array elements short ------ -------------- ----- - 1 00-00 0 - 0 0F-00 15 - 8 F1-FF -15 - 4 10-27 10000 - 6 F0-D8 -10000 - 9 FF-7F 32767 - 2 00-80 -32768 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp deleted file mode 100644 index d3e8f559b3c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// -// Example of the BitConverter::ToInt64 method. -using namespace System; - -// Convert eight byte array elements to an __int64 and display it. -void BAToInt64( array^bytes, int index ) -{ - __int64 value = BitConverter::ToInt64( bytes, index ); - Console::WriteLine( "{0,5}{1,27}{2,24}", index, BitConverter::ToString( bytes, index, 8 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {0,54,101,196,255,255,255,255,0,0,0,0,0,0,0,0,128,0,202,154,59,0,0,0,0,1,0,0,0,0,255,255,255,255,1,0,0,255,255,255,255,255,255,255,127,86,85,85,85,85,85,255,255,170,170,170,170,170,170,0,0,100,167,179,182,224,13,0,0,156,88,76,73,31,242}; - Console::WriteLine( "This example of the BitConverter::ToInt64( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to __int64 values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "index", "array elements", "__int64" ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "-----", "--------------", "-------" ); - - // Convert byte array elements to __int64 values. - BAToInt64( byteArray, 8 ); - BAToInt64( byteArray, 5 ); - BAToInt64( byteArray, 34 ); - BAToInt64( byteArray, 17 ); - BAToInt64( byteArray, 0 ); - BAToInt64( byteArray, 21 ); - BAToInt64( byteArray, 26 ); - BAToInt64( byteArray, 53 ); - BAToInt64( byteArray, 45 ); - BAToInt64( byteArray, 59 ); - BAToInt64( byteArray, 67 ); - BAToInt64( byteArray, 37 ); - BAToInt64( byteArray, 9 ); -} - -/* -This example of the BitConverter::ToInt64( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to __int64 values. - -initial unsigned char array ---------------------------- -00-36-65-C4-FF-FF-FF-FF-00-00-00-00-00-00-00-00-80-00-CA-9A- -3B-00-00-00-00-01-00-00-00-00-FF-FF-FF-FF-01-00-00-FF-FF-FF- -FF-FF-FF-FF-7F-56-55-55-55-55-55-FF-FF-AA-AA-AA-AA-AA-AA-00- -00-64-A7-B3-B6-E0-0D-00-00-9C-58-4C-49-1F-F2 - -index array elements __int64 ------ -------------- ------- - 8 00-00-00-00-00-00-00-00 0 - 5 FF-FF-FF-00-00-00-00-00 16777215 - 34 01-00-00-FF-FF-FF-FF-FF -16777215 - 17 00-CA-9A-3B-00-00-00-00 1000000000 - 0 00-36-65-C4-FF-FF-FF-FF -1000000000 - 21 00-00-00-00-01-00-00-00 4294967296 - 26 00-00-00-00-FF-FF-FF-FF -4294967296 - 53 AA-AA-AA-AA-AA-AA-00-00 187649984473770 - 45 56-55-55-55-55-55-FF-FF -187649984473770 - 59 00-00-64-A7-B3-B6-E0-0D 1000000000000000000 - 67 00-00-9C-58-4C-49-1F-F2 -1000000000000000000 - 37 FF-FF-FF-FF-FF-FF-FF-7F 9223372036854775807 - 9 00-00-00-00-00-00-00-80 -9223372036854775808 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp deleted file mode 100644 index c882255558e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -// Example of the BitConverter::ToUInt16 method. -using namespace System; - -// Convert two byte array elements to an unsigned short and display it. -void BAToUInt16( array^bytes, int index ) -{ - unsigned short value = BitConverter::ToUInt16( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,16}", index, BitConverter::ToString( bytes, index, 2 ), value ); -} - -int main() -{ - array^byteArray = {15,0,0,255,3,16,39,255,255,127}; - Console::WriteLine( "This example of the BitConverter::ToUInt16( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to unsigned short " - "values.\n" ); - Console::WriteLine( "initial byte array" ); - Console::WriteLine( "------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,16}", "index", "array elements", "unsigned short" ); - Console::WriteLine( "{0,5}{1,17}{2,16}", "-----", "--------------", "--------------" ); - - // Convert byte array elements to unsigned short values. - BAToUInt16( byteArray, 1 ); - BAToUInt16( byteArray, 0 ); - BAToUInt16( byteArray, 3 ); - BAToUInt16( byteArray, 5 ); - BAToUInt16( byteArray, 8 ); - BAToUInt16( byteArray, 7 ); -} - -/* -This example of the BitConverter::ToUInt16( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to unsigned short values. - -initial byte array ------------------- -0F-00-00-FF-03-10-27-FF-FF-7F - -index array elements unsigned short ------ -------------- -------------- - 1 00-00 0 - 0 0F-00 15 - 3 FF-03 1023 - 5 10-27 10000 - 8 FF-7F 32767 - 7 FF-FF 65535 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp deleted file mode 100644 index ea1eb361eda..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -// Example of the BitConverter::ToUInt32 method. -using namespace System; - -// Convert four byte array elements to an unsigned int and display it. -void BAToUInt32( array^bytes, int index ) -{ - unsigned int value = BitConverter::ToUInt32( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,15}", index, BitConverter::ToString( bytes, index, 4 ), value ); -} - -int main() -{ - array^byteArray = {15,0,0,0,0,16,0,255,3,0,0,202,154,59,255,255,255,255,127}; - Console::WriteLine( "This example of the BitConverter::ToUInt32( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to unsigned int " - "values.\n" ); - Console::WriteLine( "initial byte array" ); - Console::WriteLine( "------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,15}", "index", "array elements", "unsigned int" ); - Console::WriteLine( "{0,5}{1,17}{2,15}", "-----", "--------------", "------------" ); - - // Convert byte array elements to unsigned int values. - BAToUInt32( byteArray, 1 ); - BAToUInt32( byteArray, 0 ); - BAToUInt32( byteArray, 7 ); - BAToUInt32( byteArray, 3 ); - BAToUInt32( byteArray, 10 ); - BAToUInt32( byteArray, 15 ); - BAToUInt32( byteArray, 14 ); -} - -/* -This example of the BitConverter::ToUInt32( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to unsigned int values. - -initial byte array ------------------- -0F-00-00-00-00-10-00-FF-03-00-00-CA-9A-3B-FF-FF-FF-FF-7F - -index array elements unsigned int ------ -------------- ------------ - 1 00-00-00-00 0 - 0 0F-00-00-00 15 - 7 FF-03-00-00 1023 - 3 00-00-10-00 1048576 - 10 00-CA-9A-3B 1000000000 - 15 FF-FF-FF-7F 2147483647 - 14 FF-FF-FF-FF 4294967295 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp deleted file mode 100644 index 102a5ced116..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -// Example of the BitConverter::ToUInt64 method. -using namespace System; - -// Convert eight byte array elements to an unsigned __int64 value and -// display it. -void BAToUInt64( array^bytes, int index ) -{ - unsigned __int64 value = BitConverter::ToUInt64( bytes, index ); - Console::WriteLine( "{0,5}{1,27}{2,24}", index, BitConverter::ToString( bytes, index, 8 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {255,255,255,0,0,0,0,0,0,0,0,1,0,0,0,100,167,179,182,224,13,0,202,154,59,0,0,0,0,170,170,170,170,170,170,0,0,232,137,4,35,199,138,255,255,255,255,255,255,255,255,127}; - Console::WriteLine( "This example of the BitConverter::ToUInt64( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to unsigned __int64 " - "values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "index", "array elements", "unsigned __int64" ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "-----", "--------------", "----------------" ); - - // Convert byte array elements to unsigned __int64 values. - BAToUInt64( byteArray, 3 ); - BAToUInt64( byteArray, 0 ); - BAToUInt64( byteArray, 21 ); - BAToUInt64( byteArray, 7 ); - BAToUInt64( byteArray, 29 ); - BAToUInt64( byteArray, 13 ); - BAToUInt64( byteArray, 35 ); - BAToUInt64( byteArray, 44 ); - BAToUInt64( byteArray, 43 ); -} - -/* -This example of the BitConverter::ToUInt64( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to unsigned __int64 values. - -initial unsigned char array ---------------------------- -FF-FF-FF-00-00-00-00-00-00-00-00-01-00-00-00-64-A7-B3-B6-E0- -0D-00-CA-9A-3B-00-00-00-00-AA-AA-AA-AA-AA-AA-00-00-E8-89-04- -23-C7-8A-FF-FF-FF-FF-FF-FF-FF-FF-7F - -index array elements unsigned __int64 ------ -------------- ---------------- - 3 00-00-00-00-00-00-00-00 0 - 0 FF-FF-FF-00-00-00-00-00 16777215 - 21 00-CA-9A-3B-00-00-00-00 1000000000 - 7 00-00-00-00-01-00-00-00 4294967296 - 29 AA-AA-AA-AA-AA-AA-00-00 187649984473770 - 13 00-00-64-A7-B3-B6-E0-0D 1000000000000000000 - 35 00-00-E8-89-04-23-C7-8A 10000000000000000000 - 44 FF-FF-FF-FF-FF-FF-FF-7F 9223372036854775807 - 43 FF-FF-FF-FF-FF-FF-FF-FF 18446744073709551615 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp deleted file mode 100644 index 32b17db75b6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -using namespace System; -int main() -{ - - // - Boolean raining = false; - Boolean busLate = true; - Console::WriteLine( "raining->ToString() returns {0}", raining.ToString() ); - Console::WriteLine( "busLate->ToString() returns {0}", busLate.ToString() ); - // The example displays the following output: - // raining.ToString() returns False - // busLate.ToString() returns True - // - - // - Boolean val; - String^ input; - input = Boolean::TrueString; - val = Boolean::Parse( input ); - Console::WriteLine( "'{0}' parsed as {1}", input, val ); - // The example displays the following output: - // 'True' parsed as True - // -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp deleted file mode 100644 index 2ece40209b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// Buffer.BlockCopy2.cpp : main project file. - -// -using namespace System; - -// Display the individual bytes in the array in hexadecimal. -void DisplayArray(System::Array^ arr, String^ name) -{ - Console::WindowWidth = 120; - Console::Write("{0,11}:", name); - for (int ctr = 0; ctr < arr->Length; ctr++) - { - array^ bytes; - if (arr->GetType() == array::typeid) - bytes = BitConverter::GetBytes((Int64) arr->GetValue(ctr)); - else - bytes = BitConverter::GetBytes((Int16) arr->GetValue(ctr)); - - for each (Byte byteValue in bytes) - Console::Write(" {0:X2}", byteValue); - } - Console::WriteLine(); -} - -// Display the individual array element values in hexadecimal. -void DisplayArrayValues(Array^ arr, String^ name) -{ - // Get the length of one element in the array. - int elementLength = Buffer::ByteLength(arr) / arr->Length; - String^ formatString = String::Format(" {{0:X{0}}}", 2 * elementLength); - Console::Write( "{0,11}:", name); - for (int ctr = 0; ctr < arr->Length; ctr++) - Console::Write(formatString, arr->GetValue(ctr)); - - Console::WriteLine(); -} - -void main() -{ - // These are the source and destination arrays for BlockCopy. - array^ src = gcnew array { 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270 }; - array^ dest = gcnew array { 17, 18, 19, 20 }; - - // Display the initial value of the arrays in memory. - Console::WriteLine( "Initial values of arrays:"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src" ); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy bytes 5-10 from source to index 7 in destination and display the result. - Buffer::BlockCopy(src, 5, dest, 7, 6); - Console::WriteLine("Buffer::BlockCopy(src, 5, dest, 7, 6 )"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy bytes 16-20 from source to index 22 in destination and display the result. - Buffer::BlockCopy(src, 16, dest, 22, 5); - Console::WriteLine("Buffer.BlockCopy(src, 16, dest, 22, 5)"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy overlapping range of bytes 4-10 to index 5 in source. - Buffer::BlockCopy(src, 4, src, 5, 7 ); - Console::WriteLine("Buffer.BlockCopy( src, 4, src, 5, 7)"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy overlapping range of bytes 16-22 to index 15 in source. - Buffer::BlockCopy(src, 16, src, 15, 7); - Console::WriteLine("Buffer.BlockCopy( src, 16, src, 15, 7)"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); -} -// The example displays the following output: -// Initial values of arrays: -// Array values as Bytes: -// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 -// Array values: -// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E -// dest: 0000000000000011 0000000000000012 0000000000000013 0000000000000014 -// -// Buffer.BlockCopy(src, 5, dest, 7, 6 ) -// Array values as Bytes: -// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 -// Array values: -// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E -// dest: 0100000000000011 0000000701060105 0000000000000013 0000000000000014 -// -// Buffer.BlockCopy(src, 16, dest, 22, 5) -// Array values as Bytes: -// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 -// Array values: -// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E -// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B -// -// Buffer.BlockCopy( src, 4, src, 5, 7) -// Array values as Bytes: -// src: 02 01 03 01 04 04 01 05 01 06 01 07 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 -// Array values: -// src: 0102 0103 0404 0501 0601 0701 0108 0109 010A 010B 010C 010D 010E -// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B -// -// Buffer.BlockCopy( src, 16, src, 15, 7) -// Array values as Bytes: -// src: 02 01 03 01 04 04 01 05 01 06 01 07 08 01 09 0A 01 0B 01 0C 01 0D 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 -// Array values: -// src: 0102 0103 0404 0501 0601 0701 0108 0A09 0B01 0C01 0D01 010D 010E -// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp deleted file mode 100644 index 2ce360f905c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp +++ /dev/null @@ -1,62 +0,0 @@ - -// -// Example of the Buffer class methods. -using namespace System; - -// Display the array elements from right to left in hexadecimal. -void DisplayArray( array^arr ) -{ - Console::Write( " arr:" ); - for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) - Console::Write( " {0:X4}", arr[ loopX ] ); - Console::WriteLine(); -} - -int main() -{ - - // This array is to be modified and displayed. - array^arr = {258,259,260,261,262,263,264,265,266,267,268,269,270,271}; - Console::WriteLine( "This example of the Buffer class " - "methods generates the following output.\n" - "Note: The array is displayed from right to left.\n" ); - Console::WriteLine( "Initial values of array:\n" ); - - // Display the initial array values and ByteLength. - DisplayArray( arr ); - Console::WriteLine( "\nBuffer::ByteLength( arr ): {0}", Buffer::ByteLength( arr ) ); - - // Copy a region of the array; set a byte within the array. - Console::WriteLine( "\nCall these methods: \n" - " Buffer::BlockCopy( arr, 5, arr, 16, 9 ),\n" - " Buffer::SetByte( arr, 7, 170 ).\n" ); - Buffer::BlockCopy( arr, 5, arr, 16, 9 ); - Buffer::SetByte( arr, 7, 170 ); - - // Display the array and a byte within the array. - Console::WriteLine( "Final values of array:\n" ); - DisplayArray( arr ); - Console::WriteLine( "\nBuffer::GetByte( arr, 26 ): {0}", Buffer::GetByte( arr, 26 ) ); -} - -/* -This example of the Buffer class methods generates the following output. -Note: The array is displayed from right to left. - -Initial values of array: - - arr: 010F 010E 010D 010C 010B 010A 0109 0108 0107 0106 0105 0104 0103 0102 - -Buffer::ByteLength( arr ): 28 - -Call these methods: - Buffer::BlockCopy( arr, 5, arr, 16, 9 ), - Buffer::SetByte( arr, 7, 170 ). - -Final values of array: - - arr: 010F 0101 0801 0701 0601 0501 0109 0108 0107 0106 AA05 0104 0103 0102 - -Buffer::GetByte( arr, 26 ): 15 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp deleted file mode 100644 index 01bfe45c621..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Buffer.BlockCopy.cpp : main project file. - -using namespace System; - -void CopyExample1() -{ - // - const int INT_SIZE = 4; - array^ arr = gcnew array { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - Buffer::BlockCopy(arr, 0 * INT_SIZE, arr, 3 * INT_SIZE, 4 * INT_SIZE); - for each (int value in arr) - Console::Write("{0} ", value); - // The example displays the following output: - // 2 4 6 2 4 6 8 16 18 20 - // -} - -void CopyExample2() -{ - // - const int INT_SIZE = 4; - array^ arr = gcnew array { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - Buffer::BlockCopy(arr, 3 * INT_SIZE, arr, 0 * INT_SIZE, 4 * INT_SIZE); - for each (int value in arr) - Console::Write("{0} ", value); - // The example displays the following output: - // 8 10 12 14 10 12 14 16 18 20 - // -} - -void main() -{ - CopyExample1(); - Console::WriteLine(); - CopyExample2(); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp deleted file mode 100644 index 08596f73850..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// -// Example of the Buffer::ByteLength method. -using namespace System; - -void ArrayInfo( Array^ arr, String^ name ) -{ - int byteLength = Buffer::ByteLength( arr ); - - // Display the array name, type, Length, and ByteLength. - Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", name, arr->GetType(), arr->Length, byteLength ); -} - -int main() -{ - array^bytes = {1,2,3,4,5,6,7,8,9,0}; - array^bools = {true,false,true,false,true}; - array^chars = {' ','$','\"','A','{'}; - array^shorts = {258,259,260,261,262,263}; - array^singles = {1,678,2.37E33F,.00415F,8.9F}; - array^doubles = {2E-22,.003,4.4E44,555E55}; - array^longs = {1,10,100,1000,10000,100000}; - Console::WriteLine( "This example of the Buffer::ByteLength( Array* ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", "Array name", "Array type", "Length", "ByteLength" ); - Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", "----------", "----------", "------", "----------" ); - - // Display the Length and ByteLength for each array. - ArrayInfo( bytes, "bytes" ); - ArrayInfo( bools, "bools" ); - ArrayInfo( chars, "chars" ); - ArrayInfo( shorts, "shorts" ); - ArrayInfo( singles, "singles" ); - ArrayInfo( doubles, "doubles" ); - ArrayInfo( longs, "longs" ); -} - -/* -This example of the Buffer::ByteLength( Array* ) -method generates the following output. - -Array name Array type Length ByteLength ----------- ---------- ------ ---------- - bytes System.Byte[] 10 10 - bools System.Boolean[] 5 5 - chars System.Char[] 5 10 - shorts System.Int16[] 6 12 - singles System.Single[] 5 20 - doubles System.Double[] 4 32 - longs System.Int32[] 6 24 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp deleted file mode 100644 index 2b8f8c6e6ad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -// -// Example of the Buffer::GetByte method. -using namespace System; -#define formatter "{0,10}{1,10}{2,9} {3}" - -// Display the array contents in hexadecimal. -void DisplayArray( Array^ arr, String^ name ) -{ - - // Get the array element width; format the formatting string. - int elemWidth = Buffer::ByteLength( arr ) / arr->Length; - String^ format = String::Format( " {{0:X{0}}}", 2 * elemWidth ); - - // Display the array elements from right to left. - Console::Write( "{0,5}:", name ); - for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) - Console::Write( format, arr->GetValue( loopX ) ); - Console::WriteLine(); -} - -void ArrayInfo( Array^ arr, String^ name, int index ) -{ - unsigned char value = Buffer::GetByte( arr, index ); - - // Display the array name, index, and byte to be viewed. - Console::WriteLine( formatter, name, index, value, String::Format( "0x{0:X2}", value ) ); -} - -int main() -{ - - // These are the arrays to be viewed with GetByte. - array<__int64>^longs = {333333333333333333,666666666666666666,999999999999999999}; - array^ints = {111111111,222222222,333333333,444444444,555555555}; - Console::WriteLine( "This example of the " - "Buffer::GetByte( Array*, int ) \n" - "method generates the following output.\n" - "Note: The arrays are displayed from right to left.\n" ); - Console::WriteLine( " Values of arrays:\n" ); - - // Display the values of the arrays. - DisplayArray( longs, "longs" ); - DisplayArray( ints, "ints" ); - Console::WriteLine(); - Console::WriteLine( formatter, "Array", "index", "value", "" ); - Console::WriteLine( formatter, "-----", "-----", "-----", "----" ); - - // Display the Length and ByteLength for each array. - ArrayInfo( ints, "ints", 0 ); - ArrayInfo( ints, "ints", 7 ); - ArrayInfo( ints, "ints", 10 ); - ArrayInfo( ints, "ints", 17 ); - ArrayInfo( longs, "longs", 0 ); - ArrayInfo( longs, "longs", 6 ); - ArrayInfo( longs, "longs", 10 ); - ArrayInfo( longs, "longs", 17 ); - ArrayInfo( longs, "longs", 21 ); -} - -/* -This example of the Buffer::GetByte( Array*, int ) -method generates the following output. -Note: The arrays are displayed from right to left. - - Values of arrays: - -longs: 0DE0B6B3A763FFFF 094079CD1A42AAAA 04A03CE68D215555 - ints: 211D1AE3 1A7DAF1C 13DE4355 0D3ED78E 069F6BC7 - - Array index value - ----- ----- ----- ---- - ints 0 199 0xC7 - ints 7 13 0x0D - ints 10 222 0xDE - ints 17 26 0x1A - longs 0 85 0x55 - longs 6 160 0xA0 - longs 10 66 0x42 - longs 17 255 0xFF - longs 21 182 0xB6 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp deleted file mode 100644 index 564641225bf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -// Example of the Buffer::SetByte method. -using namespace System; - -// Display the array contents in hexadecimal. -void DisplayArray( Array^ arr, String^ name ) -{ - - // Get the array element width; format the formatting string. - int elemWidth = Buffer::ByteLength( arr ) / arr->Length; - String^ format = String::Format( " {{0:X{0}}}", 2 * elemWidth ); - - // Display the array elements from right to left. - Console::Write( "{0,7}:", name ); - for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) - Console::Write( format, arr->GetValue( loopX ) ); - Console::WriteLine(); -} - -int main() -{ - - // These are the arrays to be modified with SetByte. - array^shorts = gcnew array(10); - array^longs = gcnew array(3); - Console::WriteLine( "This example of the " - "Buffer::SetByte( Array*, int, unsigned char ) \n" - "method generates the following output.\n" - "Note: The arrays are displayed from right to left.\n" ); - Console::WriteLine( " Initial values of arrays:\n" ); - - // Display the initial values of the arrays. - DisplayArray( shorts, "shorts" ); - DisplayArray( longs, "longs" ); - - // Copy two regions of source array to destination array, - // and two overlapped copies from source to source. - Console::WriteLine( "\n Array values after setting byte 3 = 25, \n" - " byte 6 = 64, byte 12 = 121, and byte 17 = 196:\n" ); - Buffer::SetByte( shorts, 3, 25 ); - Buffer::SetByte( shorts, 6, 64 ); - Buffer::SetByte( shorts, 12, 121 ); - Buffer::SetByte( shorts, 17, 196 ); - Buffer::SetByte( longs, 3, 25 ); - Buffer::SetByte( longs, 6, 64 ); - Buffer::SetByte( longs, 12, 121 ); - Buffer::SetByte( longs, 17, 196 ); - - // Display the arrays again. - DisplayArray( shorts, "shorts" ); - DisplayArray( longs, "longs" ); -} - -/* -This example of the Buffer::SetByte( Array*, int, unsigned char ) -method generates the following output. -Note: The arrays are displayed from right to left. - - Initial values of arrays: - - shorts: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 - longs: 0000000000000000 0000000000000000 0000000000000000 - - Array values after setting byte 3 = 25, - byte 6 = 64, byte 12 = 121, and byte 17 = 196: - - shorts: 0000 C400 0000 0079 0000 0000 0040 0000 1900 0000 - longs: 000000000000C400 0000007900000000 0040000019000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp deleted file mode 100644 index 268d4585d1e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp +++ /dev/null @@ -1,106 +0,0 @@ -using namespace System; - -/// -/// Summary description for Class1. -/// -public ref class SystemByteExamples -{ -private: - Byte MemberByte; - -public: - // c'tor() - SystemByteExamples() - { - MemberByte = 0; - } - - // The following example demonstrates using the MinValue and MaxValue fields to - // determine whether an integer value falls within range of a byte. If it does, - // the value is set. If not, an error message is displayed. - - // MemberByte is assumed to exist as a class member - - // -public: - void MinMaxFields( Int32 numberToSet ) - { - if ( numberToSet <= (Int32)Byte::MaxValue && numberToSet >= (Int32)Byte::MinValue ) - { - - // You must explicitly convert an integer to a byte. - MemberByte = (Byte)numberToSet; - - // Displays MemberByte using the ToString() method. - Console::WriteLine( "The MemberByte value is {0}", MemberByte.ToString() ); - } - else - { - Console::WriteLine( "The value {0} is outside of the range of possible Byte values", numberToSet.ToString() ); - } - } - // - - // The following example converts the string representation of a byte - // into its actual numeric value. - - // MemberByte is assumed to exist as a class member - -public: - void ParseByte( String^ stringToConvert ) - { - try - { - MemberByte = Byte::Parse( stringToConvert ); - Console::WriteLine( "The MemberByte value is {0}", MemberByte.ToString() ); - } - catch ( System::OverflowException^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - } - - // The following example checks to see whether a byte passed in is - // greater than, less than, or equal to the member byte. - - // MemberByte is assumed to exist as a class member - - // -public: - void Compare( Byte myByte ) - { - Int32 myCompareResult; - - myCompareResult = MemberByte.CompareTo( myByte ); - - if ( myCompareResult > 0 ) - { - Console::WriteLine( "{0} is less than the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); - } - else - { - if ( myCompareResult < 0 ) - Console::WriteLine( "{0} is greater than the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); - else - Console::WriteLine( "{0} is equal to the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); - } - } - // -}; - -void main() -{ - SystemByteExamples^ sbe = gcnew SystemByteExamples; - Int32 numberToSet; - Byte compareByte; - String^ stringToConvert; - - numberToSet = 120; - stringToConvert = "200"; - compareByte = 201; - - sbe->MinMaxFields( numberToSet ); - sbe->ParseByte( stringToConvert ); - - sbe->Compare( compareByte ); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp deleted file mode 100644 index b8e6646267a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// Byte.Parse.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -// Byte.Parse(String) -void Parse1() -{ - // - String^ stringToConvert = " 162"; - Byte byteValue; - try - { - byteValue = Byte::Parse(stringToConvert); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException^) - { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); - } - // The example displays the following output to the console: - // Converted ' 162' to 162. - // -} - -// Byte.Parse(String, NumberStyles) -void Parse2a() -{ - // - String^ value; - NumberStyles style; - Byte number; - - // Parse value with no styles allowed. - style = NumberStyles::None; - value = " 241 "; - try - { - number = Byte::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", value); } - - // Parse value with trailing sign. - style = NumberStyles::Integer | NumberStyles::AllowTrailingSign; - value = " 163+"; - number = Byte::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - - // Parse value with leading sign. - value = " +253 "; - number = Byte::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - // This example displays the following output to the console: - // Unable to parse ' 241 '. - // Converted ' 163+' to 163. - // Converted ' +253 ' to 253. - // -} - -// Byte.Parse(String, IFormatProvider) -void Parse2b() -{ - // - String^ stringToConvert; - Byte byteValue; - - stringToConvert = " 214 "; - try { - byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } - catch (OverflowException^) { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); } - - stringToConvert = " + 214 "; - try { - byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } - catch (OverflowException^) { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); } - - stringToConvert = " +214 "; - try { - byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } - catch (OverflowException^) { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); } - // The example displays the following output to the console: - // Converted ' 214 ' to 214. - // Unable to parse ' + 214 '. - // Converted ' +214 ' to 214. - // -} - -void Parse3() -{ - // - NumberStyles style; - CultureInfo^ culture; - String^ value; - Byte number; - - // Parse number with decimals. - // NumberStyles.Float includes NumberStyles.AllowDecimalPoint. - style = NumberStyles::Float; - culture = CultureInfo::CreateSpecificCulture("fr-FR"); - value = "12,000"; - - number = Byte::Parse(value, style, culture); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - - culture = CultureInfo::CreateSpecificCulture("en-GB"); - try - { - number = Byte::Parse(value, style, culture); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", value); } - - value = "12.000"; - number = Byte::Parse(value, style, culture); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - // The example displays the following output to the console: - // Converted '12,000' to 12. - // Unable to parse '12,000'. - // Converted '12.000' to 12. - // -}; - -void main() -{ - Parse1(); // Parse(String) - Console::WriteLine(); - Parse2a(); // Parse(String, NumberStyles) - Console::WriteLine(); - Parse2b(); - Console::WriteLine(); - Parse3(); // Parse(String, NumberStyles, IFormatProvider) - Console::WriteLine(); - - Console::ReadLine(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp deleted file mode 100644 index fbad6b4f72e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// Byte.ToString.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -void main() -{ - // - array^ bytes = gcnew array {0, 1, 14, 168, 255}; - array^ providers = {gcnew CultureInfo("en-us"), - gcnew CultureInfo("fr-fr"), - gcnew CultureInfo("de-de"), - gcnew CultureInfo("es-es")}; - for each (Byte byteValue in bytes) - { - for each (CultureInfo^ provider in providers) - Console::Write("{0,3} ({1}) ", - byteValue.ToString(provider), provider->Name); - - Console::WriteLine(); - } - // The example displays the following output to the console: - // 0 (en-US) 0 (fr-FR) 0 (de-DE) 0 (es-ES) - // 1 (en-US) 1 (fr-FR) 1 (de-DE) 1 (es-ES) - // 14 (en-US) 14 (fr-FR) 14 (de-DE) 14 (es-ES) - // 168 (en-US) 168 (fr-FR) 168 (de-DE) 168 (es-ES) - // 255 (en-US) 255 (fr-FR) 255 (de-DE) 255 (es-ES) - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp deleted file mode 100644 index 76bc3225475..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Byte.ToString2.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -// Byte.ToString() -void Byte1() -{ - // - array^ bytes = gcnew array {0, 1, 14, 168, 255}; - for each (Byte byteValue in bytes) - Console::WriteLine(byteValue); - // The example displays the following output to the console if the current - // culture is en-US: - // 0 - // 1 - // 14 - // 168 - // 255 - // -} - -// Byte.ToString(String) -void Byte2() -{ - // - array^ formats = gcnew array {"C3", "D4", "e1", "E2", "F1", "G", "N1", - "P0", "X4", "0000.0000"}; - Byte number = 240; - for each (String^ format in formats) - Console::WriteLine("'{0}' format specifier: {1}", - format, number.ToString(format)); - - // The example displays the following output to the console if the - // current culture is en-us: - // 'C3' format specifier: $240.000 - // 'D4' format specifier: 0240 - // 'e1' format specifier: 2.4e+002 - // 'E2' format specifier: 2.40E+002 - // 'F1' format specifier: 240.0 - // 'G' format specifier: 240 - // 'N1' format specifier: 240.0 - // 'P0' format specifier: 24,000 % - // 'X4' format specifier: 00F0 - // '0000.0000' format specifier: 0240.0000 - // -} - -// ToString(String, IFormatProvider) -void Byte3() -{ - // - Byte byteValue = 250; - array^ providers = gcnew array { gcnew CultureInfo("en-us"), - gcnew CultureInfo("fr-fr"), - gcnew CultureInfo("es-es"), - gcnew CultureInfo("de-de")}; - - for each (CultureInfo^ provider in providers) - Console::WriteLine("{0} ({1})", - byteValue.ToString("N2", provider), provider->Name); - // The example displays the following output to the console: - // 250.00 (en-US) - // 250,00 (fr-FR) - // 250,00 (es-ES) - // 250,00 (de-DE) - // -} - -void main() -{ - Byte1(); - Console::WriteLine(); - Byte2(); - Console::WriteLine(); - Byte3(); - Console::WriteLine(); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp deleted file mode 100644 index ad5537892ae..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Byte.TryParse.cpp : main project file. -// Byte.TryParse(String, Byte) - -// -using namespace System; - -void main() -{ - array^ byteStrings = gcnew array { nullptr, String::Empty, - "1024", "100.1", "100", - "+100", "-100", "000000000000000100", - "00,100", " 20 ", "FF", "0x1F" }; - Byte byteValue; - for each (String^ byteString in byteStrings) { - bool result = Byte::TryParse(byteString, byteValue); - if (result) - Console::WriteLine("Converted '{0}' to {1}", - byteString, byteValue); - else - Console::WriteLine("Attempted conversion of '{0}' failed.", - byteString); - } -} -// The example displays the following output: -// Attempted conversion of '' failed. -// Attempted conversion of '' failed.` -// Attempted conversion of '1024' failed. -// Attempted conversion of '100.1' failed. -// Converted '100' to 100 -// Converted '+100' to 100 -// Attempted conversion of '-100' failed. -// Converted '000000000000000100' to 100 -// Attempted conversion of '00,100' failed. -// Converted ' 20 ' to 20 -// Attempted conversion of 'FF' failed. -// Attempted conversion of '0x1F' failed.} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp deleted file mode 100644 index e3e81cd2951..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Byte.TryParse2.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -void CallTryParse(String^ byteString, NumberStyles styles); - -void main() -{ - String^ byteString; - NumberStyles styles; - - byteString = "1024"; - styles = NumberStyles::Integer; - CallTryParse(byteString, styles); - - byteString = "100.1"; - styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; - CallTryParse(byteString, styles); - - byteString = "100.0"; - CallTryParse(byteString, styles); - - byteString = "+100"; - styles = NumberStyles::Integer | NumberStyles::AllowLeadingSign - | NumberStyles::AllowTrailingSign; - CallTryParse(byteString, styles); - - byteString = "-100"; - CallTryParse(byteString, styles); - - byteString = "000000000000000100"; - CallTryParse(byteString, styles); - - byteString = "00,100"; - styles = NumberStyles::Integer | NumberStyles::AllowThousands; - CallTryParse(byteString, styles); - - byteString = "2E+3 "; - styles = NumberStyles::Integer | NumberStyles::AllowExponent; - CallTryParse(byteString, styles); - - byteString = "FF"; - styles = NumberStyles::HexNumber; - CallTryParse(byteString, styles); - - byteString = "0x1F"; - CallTryParse(byteString, styles); -} - -void CallTryParse(String^ stringToConvert, NumberStyles styles) -{ - Byte byteValue; - bool result = Byte::TryParse(stringToConvert, styles, - (IFormatProvider^) nullptr , byteValue); - if (result) - Console::WriteLine("Converted '{0}' to {1}", - stringToConvert, byteValue); - else - Console::WriteLine("Attempted conversion of '{0}' failed.", - stringToConvert); -} -// The example displays the following output: -// Attempted conversion of '1024' failed. -// Attempted conversion of '100.1' failed. -// Converted '100.0' to 100 -// Converted '+100' to 100 -// Attempted conversion of '-100' failed. -// Converted '000000000000000100' to 100 -// Converted '00,100' to 100 -// Attempted conversion of '2E+3 ' failed. -// Converted 'FF' to 255 -// Attempted conversion of '0x1F' failed.} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp deleted file mode 100644 index b4230f4b6c0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -int main() -{ - char chA = 'A'; - char ch1 = '1'; - String^ str = "test string"; - Console::WriteLine( chA.CompareTo( 'B' ) ); // Output: "-1" (meaning 'A' is 1 less than 'B') - Console::WriteLine( chA.Equals( 'A' ) ); // Output: "True" - Console::WriteLine( Char::GetNumericValue( ch1 ) ); // Output: "1" - Console::WriteLine( Char::IsControl( '\t' ) ); // Output: "True" - Console::WriteLine( Char::IsDigit( ch1 ) ); // Output: "True" - Console::WriteLine( Char::IsLetter( ',' ) ); // Output: "False" - Console::WriteLine( Char::IsLower( 'u' ) ); // Output: "True" - Console::WriteLine( Char::IsNumber( ch1 ) ); // Output: "True" - Console::WriteLine( Char::IsPunctuation( '.' ) ); // Output: "True" - Console::WriteLine( Char::IsSeparator( str, 4 ) ); // Output: "True" - Console::WriteLine( Char::IsSymbol( '+' ) ); // Output: "True" - Console::WriteLine( Char::IsWhiteSpace( str, 4 ) ); // Output: "True" - Console::WriteLine( Char::Parse( "S" ) ); // Output: "S" - Console::WriteLine( Char::ToLower( 'M' ) ); // Output: "m" - Console::WriteLine( 'x' ); // Output: "x" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp deleted file mode 100644 index 317328712b3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -int main() -{ - char chA = 'A'; - char chB = 'B'; - Console::WriteLine( chA.CompareTo( 'A' ) ); // Output: "0" (meaning they're equal) - Console::WriteLine( 'b'.CompareTo( chB ) ); // Output: "32" (meaning 'b' is greater than 'B' by 32) - Console::WriteLine( chA.CompareTo( chB ) ); // Output: "-1" (meaning 'A' is less than 'B' by 1) -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp deleted file mode 100644 index 216b8181b48..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -int main() -{ - char chA = 'A'; - char chB = 'B'; - Console::WriteLine( chA.Equals( 'A' ) ); // Output: "True" - Console::WriteLine( 'b'.Equals( chB ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp deleted file mode 100644 index ea6ef6ca1a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "input: 1"; - Console::WriteLine( Char::GetNumericValue( '8' ) ); // Output: "8" - Console::WriteLine( Char::GetNumericValue( str, 7 ) ); // Output: "1" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp deleted file mode 100644 index 6056fad6c22..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch2 = '2'; - String^ str = "Upper Case"; - Console::WriteLine( Char::GetUnicodeCategory( 'a' ).ToString() ); // Output: S"LowercaseLetter" - Console::WriteLine( Char::GetUnicodeCategory( ch2 ).ToString() ); // Output: S"DecimalDigitNumber" - Console::WriteLine( Char::GetUnicodeCategory( str, 6 ).ToString() ); // Output: S"UppercaseLetter" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp deleted file mode 100644 index 9f742e155e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Char.IsControl1.cpp : main project file. -// Char.IsControl(Char) - -// -using namespace System; - -void main() -{ - int charsWritten = 0; - - for (int ctr = 0x00; ctr <= 0xFFFF; ctr++) - { - wchar_t ch = ctr; - if (Char::IsControl(ch)) - { - Console::Write(L"\U{0:X4} ", ctr); - charsWritten++; - if (charsWritten % 6 == 0) - Console::WriteLine(); - } - } -} -// The example displays the following output: -// U0000 U0001 U0002 U0003 U0004 U0005 -// U0006 U0007 U0008 U0009 U000A U000B -// U000C U000D U000E U000F U0010 U0011 -// U0012 U0013 U0014 U0015 U0016 U0017 -// U0018 U0019 U001A U001B U001C U001D -// U001E U001F U007F U0080 U0081 U0082 -// U0083 U0084 U0085 U0086 U0087 U0088 -// U0089 U008A U008B U008C U008D U008E -// U008F U0090 U0091 U0092 U0093 U0094 -// U0095 U0096 U0097 U0098 U0099 U009A -// U009B U009C U009D U009E U009F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp deleted file mode 100644 index 0fa25aafc01..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Char.IsControl2.cpp : main project file. - -// Char.IsControl(String, Int32) - -// -using namespace System; - -void main() -{ - String ^ sentence = "This is a " + Environment::NewLine + "two-line sentence."; - for (int ctr = 0; ctr < sentence->Length; ctr++) - { - if (Char::IsControl(sentence, ctr)) - Console::WriteLine("Control character \\U{0} found in position {1}.", - Convert::ToInt32(sentence[ctr]).ToString("X4"), ctr); - } -} -// The example displays the following output: -// Control character \U000D found in position 10. -// Control character \U000A found in position 11. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp deleted file mode 100644 index 9de55fe04c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = '8'; - Console::WriteLine( Char::IsDigit( ch ) ); // Output: "True" - Console::WriteLine( Char::IsDigit( "sample string", 7 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp deleted file mode 100644 index ca86988a709..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = '8'; - Console::WriteLine( Char::IsLetter( ch ) ); // False - Console::WriteLine( Char::IsLetter( "sample string", 7 ) ); // True -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp deleted file mode 100644 index 4ffec1eb61f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "newline:\n"; - Console::WriteLine( Char::IsLetterOrDigit( '8' ) ); // Output: "True" - Console::WriteLine( Char::IsLetterOrDigit( str, 8 ) ); // Output: "False", because it's a newline -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp deleted file mode 100644 index ea6466897e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = 'a'; - Console::WriteLine( Char::IsLower( ch ) ); // Output: "True" - Console::WriteLine( Char::IsLower( "upperCase", 5 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp deleted file mode 100644 index e462ab9c8b3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "non-numeric"; - Console::WriteLine( Char::IsNumber( '8' ) ); // Output: "True" - Console::WriteLine( Char::IsNumber( str, 3 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp deleted file mode 100644 index 21b3c010264..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = '.'; - Console::WriteLine( Char::IsPunctuation( ch ) ); // Output: "True" - Console::WriteLine( Char::IsPunctuation( "no punctuation", 3 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp deleted file mode 100644 index 51132b2f14c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "twain1 twain2"; - Console::WriteLine( Char::IsSeparator( 'a' ) ); // Output: "False" - Console::WriteLine( Char::IsSeparator( str, 6 ) ); // Output: "True" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp deleted file mode 100644 index ddec2d22729..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Char.IsSeparator.cpp : main project file. - -// -using namespace System; - -int main() -{ - for (int ctr = Convert::ToInt32(Char::MinValue); ctr <= Convert::ToInt32(Char::MaxValue); ctr++) - { - wchar_t ch = ctr; - if (Char::IsSeparator(ch)) - Console::WriteLine("\u{0:X4} ({1})", (int) ch, Char::GetUnicodeCategory(ch).ToString()); - } -} -// The example displays the following output: -// 0020 (SpaceSeparator) -// u00A0 (SpaceSeparator) -// u1680 (SpaceSeparator) -// u180E (SpaceSeparator) -// u2000 (SpaceSeparator) -// u2001 (SpaceSeparator) -// u2002 (SpaceSeparator) -// u2003 (SpaceSeparator) -// u2004 (SpaceSeparator) -// u2005 (SpaceSeparator) -// u2006 (SpaceSeparator) -// u2007 (SpaceSeparator) -// u2008 (SpaceSeparator) -// u2009 (SpaceSeparator) -// u200A (SpaceSeparator) -// u2028 (LineSeparator) -// u2029 (ParagraphSeparator) -// u202F (SpaceSeparator) -// u205F (SpaceSeparator) -// u3000 (SpaceSeparator) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp deleted file mode 100644 index d82d071c7a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - - // - escape params specifying Unicode not implemented in v7.0 - Console::WriteLine( Char::IsSurrogate( 'a' ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp deleted file mode 100644 index 27bcc3f6fc2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "non-symbolic characters"; - Console::WriteLine( Char::IsSymbol( '+' ) ); // Output: "True" - Console::WriteLine( Char::IsSymbol( str, 8 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp deleted file mode 100644 index f4062420996..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "black matter"; - Console::WriteLine( Char::IsWhiteSpace( 'A' ) ); // Output: "False" - Console::WriteLine( Char::IsWhiteSpace( str, 5 ) ); // Output: "True" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp deleted file mode 100644 index bb4eecacea5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -// -using namespace System; -int main() -{ - Console::WriteLine( Char::Parse( "A" ) ); // Output: 'A' -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp deleted file mode 100644 index 6d94d6be514..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; - -// for CultureInfo -void main() -{ - Console::WriteLine( Char::ToLower( 'A' ) ); // Output: "a" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp deleted file mode 100644 index 7c9937fa77e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = 'a'; - Console::WriteLine( ch ); // Output: "a" - Console::WriteLine( Char::ToString( 'b' ) ); // Output: "b" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp deleted file mode 100644 index 6dd27c48dfe..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// CharEnumerator.Current.cpp : main project file. - - -using namespace System; - -void Example1() -{ - // - String ^ title = "A Tale of Two Cities"; - CharEnumerator ^ chEnum = title->GetEnumerator(); - int ctr = 1; - String ^ outputLine1 = nullptr; - String ^ outputLine2 = nullptr; - String ^ outputLine3 = nullptr; - - while (chEnum->MoveNext()) - { - outputLine1 += ctr < 10 || ctr % 10 != 0 ? " " : (ctr / 10) + " "; - outputLine2 += (ctr % 10) + " "; - outputLine3 += chEnum->Current + " "; - ctr++; - } - - Console::WriteLine("The length of the string is {0} characters:", - title->Length); - Console::WriteLine(outputLine1); - Console::WriteLine(outputLine2); - Console::WriteLine(outputLine3); - // The example displays the following output to the console: - // The length of the string is 20 characters: - // 1 2 - // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 - // A T a l e o f T w o C i t i e s - // - Console::ReadLine(); -} - -void Example2() -{ - // - String ^ title = "A Tale of Two Cities"; - int ctr = 1; - String ^ outputLine1 = nullptr; - String ^ outputLine2 = nullptr; - String ^ outputLine3 = nullptr; - - for each (wchar_t ch in title) - { - outputLine1 += ctr < 10 || ctr % 10 != 0 ? " " : (ctr / 10) + " "; - outputLine2 += (ctr % 10) + " "; - outputLine3 += ch + " "; - ctr++; - } - - Console::WriteLine("The length of the string is {0} characters:", - title->Length); - Console::WriteLine(outputLine1); - Console::WriteLine(outputLine2); - Console::WriteLine(outputLine3); - // The example displays the following output to the console: - // The length of the string is 20 characters: - // 1 2 - // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 - // A T a l e o f T w o C i t i e s - // - Console::ReadLine(); -} - -void main() -{ - Example1(); - Console::WriteLine(); - Example2(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp deleted file mode 100644 index d9dc7f158c6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// This sample opens a file whose name is passed to it as a parameter. -// It reads each line in the file and replaces every occurrence of 4 -// space characters with a tab character. -// -// It takes two command-line arguments: the input file name, and -// the output file name. -// -// Usage: -// -// INSERTTABS inputfile.txt outputfile.txt -// -// -using namespace System; -using namespace System::IO; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - const int tabSize = 4; - String^ usageText = "Usage: INSERTTABS inputfile.txt outputfile.txt"; - StreamWriter^ writer = nullptr; - if ( args->Length < 3 ) - { - Console::WriteLine( usageText ); - return 1; - } - - try - { - // Attempt to open output file. - writer = gcnew StreamWriter( args[ 2 ] ); - // Redirect standard output from the console to the output file. - Console::SetOut( writer ); - // Redirect standard input from the console to the input file. - Console::SetIn( gcnew StreamReader( args[ 1 ] ) ); - } - catch ( IOException^ e ) - { - TextWriter^ errorWriter = Console::Error; - errorWriter->WriteLine( e->Message ); - errorWriter->WriteLine( usageText ); - return 1; - } - - String^ line; - while ( (line = Console::ReadLine()) != nullptr ) - { - String^ newLine = line->Replace( ((String^)"")->PadRight( tabSize, ' ' ), "\t" ); - Console::WriteLine( newLine ); - } - - writer->Close(); - - // Recover the standard output stream so that a - // completion message can be displayed. - StreamWriter^ standardOutput = gcnew StreamWriter( Console::OpenStandardOutput() ); - standardOutput->AutoFlush = true; - Console::SetOut( standardOutput ); - Console::WriteLine( "INSERTTABS has completed the processing of {0}.", args[ 1 ] ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp deleted file mode 100644 index 05916a9e0cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -using namespace System; - -// This sample converts tab-delmited input and converts it to -// comma-delimited output. Furthermore, it converts all boolean -// input to numeric representations. -// System.Console.Write -// System.Console.WriteLine -// System.Console.ReadLine -// -int main() -{ - array^lineInputArr = {"1 2.2 hello TRUE","2 5.22 bye FALSE","3 6.38 see ya' TRUE"}; - for ( Int32 i = 0; i < 3; i++ ) - { - String^ lineInput = lineInputArr->GetValue( i )->ToString(); - String^ aChar = "\t"; - array^fields = lineInput->Split( aChar->ToCharArray() ); - Boolean isFirstField = true; - for ( Int32 i = 0; i < fields->Length; i++ ) - { - if ( isFirstField ) - isFirstField = false; - else - Console::Write( "," ); - - // If the field represents a boolean, replace with a numeric representation. - try - { - Console::Write( Convert::ToByte( Convert::ToBoolean( fields[ i ] ) ) ); - } - catch ( FormatException^ ) - { - Console::Write( fields[ i ] ); - } - - - } - Console::WriteLine(); - - } -} - -// -/* -usage examples: -To convert tab-delimited input from the keyboard and display -the output (type CTRL+Z to mark the end of input): - REFORMAT - -To input tab-delimited data from a file and display the output: - REFORMAT commas.txt - -To convert tab-delimited data from a file and output the conversion -to a file: - REFORMAT commas.txt - -Example input: -1 2.2 hello TRUE -2 5.22 bye FALSE -3 6.38 see ya' TRUE - -Example output: -1,2.2,hello,1 -2,5.22,bye,0 -3,6.38,see ya',1 - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp deleted file mode 100644 index 28ce20635b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// System.Console.OpenStandartInput -// - -using namespace System; -using namespace System::Text; -using namespace System::IO; - -int main() -{ - Stream^ inputStream = Console::OpenStandardInput(); - array^bytes = gcnew array(100); - Console::WriteLine( "To decode, type or paste the UTF7 encoded string and press enter:" ); - Console::WriteLine( "(Example: \"M+APw-nchen ist wundervoll\")" ); - int outputLength = inputStream->Read( bytes, 0, 100 ); - array^chars = Encoding::UTF7->GetChars( bytes, 0, outputLength ); - Console::WriteLine( "Decoded string:" ); - Console::WriteLine( gcnew String( chars ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp deleted file mode 100644 index 46250e779de..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::Clear(); - - DateTime dat = DateTime::Now; - - Console::WriteLine("\nToday is {0:d} at {0:T}.", dat); - Console::Write("\nPress any key to continue... "); - Console::ReadLine(); -} -// The example displays output like the following: -// Today is 10/26/2015 at 12:22:22 PM. -// -// Press any key to continue... - -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp deleted file mode 100644 index 33019ead3ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Console.ReadLine.cpp : main project file. - -// -using namespace System; - -void main() -{ - String^ line; - Console::WriteLine("Enter one or more lines of text (press CTRL+Z to exit):"); - Console::WriteLine(); - do { - Console::Write(" "); - line = Console::ReadLine(); - if (line != nullptr) - Console::WriteLine(" " + line); - } while (line != nullptr); -} -// The following displays possible output from this example: -// Enter one or more lines of text (press CTRL+Z to exit): -// -// This is line #1. -// This is line #1. -// This is line #2 -// This is line #2 -// ^Z -// -// >} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp deleted file mode 100644 index 11038946fd4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Console.SetError.cpp : main project file. - -// -using namespace System; -using namespace System::IO; -using namespace System::Reflection; - -ref class RedirectStdErr; - -void main() -{ - // Define file to receive error stream. - DateTime appStart = DateTime::Now; - String^ fn = "c:\\temp\\errlog" + appStart.ToString("yyyyMMddHHmm") + ".log"; - TextWriter^ errStream = gcnew StreamWriter(fn); - String^ appName = Assembly::GetExecutingAssembly()->Location; - appName = appName->Substring(appName->LastIndexOf('\\') + 1); - // Redirect standard error stream to file. - Console::SetError(errStream); - // Write file header. - Console::Error->WriteLine("Error Log for Application {0}", appName); - Console::Error->WriteLine(); - Console::Error->WriteLine("Application started at {0}.", appStart); - Console::Error->WriteLine(); - // - // Application code along with error output - // - // Close redirected error stream. - Console::Error->Close(); -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp deleted file mode 100644 index a6753c8b965..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Console.WriteLine.cpp : main project file. - -// -using namespace System; - -void main() -{ - array^ lines = gcnew array { "This is the first line.", - "This is the second line." }; - // Output the lines using the default newline sequence. - Console::WriteLine("With the default new line characters:"); - Console::WriteLine(); - for each (String^ line in lines) - Console::WriteLine(line); - - Console::WriteLine(); - - // Redefine the newline characters to double space. - Console::Out->NewLine = "\r\n\r\n"; - // Output the lines using the new newline sequence. - Console::WriteLine("With redefined new line characters:"); - Console::WriteLine(); - for each (String^ line in lines) - Console::WriteLine(line); -} -// The example displays the following output: -// With the default new line characters: -// -// This is the first line. -// This is the second line. -// -// With redefined new line characters: -// -// -// -// This is the first line. -// -// This is the second line. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp deleted file mode 100644 index 0a1a1d1bd9d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Console.WriteLine1.cpp : main project file. - -// -using namespace System; - -void main() -{ - // Assign 10 random integers to an array. - Random^ rnd = gcnew Random(); - array^ numbers = gcnew array(10); - for (int ctr = 0; ctr <= numbers->GetUpperBound(0); ctr++) - numbers[ctr] = rnd->Next(); - - // Determine whether the numbers are even or odd. - for each (Int32 number in numbers) { - bool even = (number % 2 == 0); - Console::WriteLine("Is {0} even:", number); - Console::WriteLine(even); - Console::WriteLine(); - } -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp deleted file mode 100644 index 821a9d93340..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ values = { true, 12.632, 17908, "stringValue", - 'a', (Decimal) 16907.32 }; - for each (Object^ value in values) - Console::WriteLine(value); -} -// The example displays the following output: -// True -// 12.632 -// 17908 -// stringValue -// a -// 16907.32 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp deleted file mode 100644 index 0e3d6bf7e2a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// ConsoleKey.cpp : main project file. - - -// -using namespace System; -using namespace System::Text; - -void main() -{ - ConsoleKeyInfo input; - do { - Console::WriteLine("Press a key, together with Alt, Ctrl, or Shift."); - Console::WriteLine("Press Esc to exit."); - input = Console::ReadKey(true); - - StringBuilder^ output = gcnew StringBuilder( - String::Format("You pressed {0}", input.Key.ToString())); - bool modifiers = false; - - if ((input.Modifiers & ConsoleModifiers::Alt) == ConsoleModifiers::Alt) { - output->Append(", together with " + ConsoleModifiers::Alt.ToString()); - modifiers = true; - } - if ((input.Modifiers & ConsoleModifiers::Control) == ConsoleModifiers::Control) - { - if (modifiers) { - output->Append(" and "); - } - else { - output->Append(", together with "); - modifiers = true; - } - output->Append(ConsoleModifiers::Control.ToString()); - } - if ((input.Modifiers & ConsoleModifiers::Shift) == ConsoleModifiers::Shift) - { - if (modifiers) { - output->Append(" and "); - } - else { - output->Append(", together with "); - modifiers = true; - } - output->Append(ConsoleModifiers::Shift.ToString()); - } - output->Append("."); - Console::WriteLine(output->ToString()); - Console::WriteLine(); - } while (input.Key != ConsoleKey::Escape); -} -// The output from a sample console session might appear as follows: -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed D. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed X, along with Shift. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed L, along with Control and Shift. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed P, along with Alt and Control and Shift. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed Escape. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp deleted file mode 100644 index 1aea3c7af8b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// ConsoleKeyInfo.Equals.cpp : main project file. - -// ConsoleKeyInfo.Equals(Object) - -// -using namespace System; -using namespace System::Text; - -static String^ KeyCombination(ConsoleKeyInfo sourceCki); - -void main() -{ - String^ k1 = "\nEnter a key ......... "; - String^ k2 = "\nEnter another key ... "; - String^ key1 = ""; - String^ key2 = ""; - String^ areKeysEqual = "The {0} and {1} keys are {2}equal."; - String^ equalValue = ""; - String^ prompt = "Press the escape key (ESC) to quit, " + - "or any other key to continue."; - ConsoleKeyInfo cki1; - ConsoleKeyInfo cki2; - // - // The Console.TreatControlCAsInput property prevents this example from - // ending if you press CTL+C, however all other operating system keys and - // shortcuts, such as ALT+TAB or the Windows Logo key, are still in effect. - // - Console::TreatControlCAsInput = true; - - // Request that the user enter two key presses. A key press and any - // combination shift, CTRL, and ALT modifier keys is permitted. - do - { - Console::Write(k1); - cki1 = Console::ReadKey(false); - Console::Write(k2); - cki2 = Console::ReadKey(false); - Console::WriteLine(); - - key1 = KeyCombination(cki1); - key2 = KeyCombination(cki2); - if (cki1.Equals(cki2)) - equalValue = ""; - else - equalValue = "not "; - - Console::WriteLine(areKeysEqual, key1, key2, equalValue); - - Console::WriteLine(prompt); - cki1 = Console::ReadKey(true); - } while (cki1.Key != ConsoleKey::Escape); -// Note: This example requires the Escape (Esc) key. -} - -// The KeyCombination() method creates a string that specifies what -// key and what combination of shift, CTRL, and ALT modifier keys -// were pressed simultaneously. - -static String^ KeyCombination(ConsoleKeyInfo sourceCki) -{ - StringBuilder^ sb = gcnew StringBuilder(); - sb->Length = 0; - String^ keyCombo; - if (sourceCki.Modifiers != ConsoleModifiers()) - { - if ((sourceCki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) - sb->Append("ALT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) - sb->Append("SHIFT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) - sb->Append("CTL+"); - } - sb->Append(sourceCki.Key.ToString()); - keyCombo = sb->ToString(); - return keyCombo; -} -/* -This example produces results similar to the following output: - -Enter a key ......... a -Enter another key ... a -The A and A keys are equal. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... a -Enter another key ... A -The A and SHIFT+A keys are not equal. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... S -Enter another key ... -The ALT+SHIFT+S and ALT+CTL+F keys are not equal. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... -Enter another key ... -The UpArrow and UpArrow keys are equal. -Press the escape key (ESC) to quit, or any other key to continue. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp deleted file mode 100644 index 504f7fe19df..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// ConsoleKeyInfo.GetHashCode.cpp : main project file. - - -// -using namespace System; -using namespace System::Text; - -String^ KeyCombination(ConsoleKeyInfo sourceCki); - -void main() -{ - String^ k1 = "\nEnter a key ......... "; - String^ key1 = ""; - String^ hashCodeFmt = "The hash code for the {0} key is {1}."; - String^ prompt = "Press the escape key (ESC) to quit, " + - "or any other key to continue."; - ConsoleKeyInfo cki1; - int hashCode = 0; - - // The Console.TreatControlCAsInput property prevents this example from - // ending if you press CTL+C, however all other operating system keys and - // shortcuts, such as ALT+TAB or the Windows Logo key, are still in effect. - // - Console::TreatControlCAsInput = true; - - // Request that the user enter two key presses. A key press and any - // combination shift, CTRL, and ALT modifier keys is permitted. - do - { - Console::Write(k1); - cki1 = Console::ReadKey(false); - Console::WriteLine(); - - key1 = KeyCombination(cki1); - hashCode = cki1.GetHashCode(); - Console::WriteLine(hashCodeFmt, key1, hashCode); - - Console::WriteLine(prompt); - cki1 = Console::ReadKey(true); - } while (cki1.Key != ConsoleKey::Escape); - // Note: This example requires the Escape (Esc) key. -} - -// The KeyCombination() method creates a string that specifies what -// key and what combination of shift, CTRL, and ALT modifier keys -// were pressed simultaneously. - -static String^ KeyCombination(ConsoleKeyInfo sourceCki) -{ - StringBuilder^ sb = gcnew StringBuilder(); - sb->Length = 0; - String^ keyCombo; - if (sourceCki.Modifiers != (ConsoleModifiers) 0) - { - if ((sourceCki.Modifiers & ConsoleModifiers::Alt) != (ConsoleModifiers) 0) - sb->Append("ALT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Shift) != (ConsoleModifiers) 0) - sb->Append("SHIFT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Control) != (ConsoleModifiers) 0) - sb->Append("CTL+"); - } - sb->Append(sourceCki.Key.ToString()); - keyCombo = sb->ToString(); - return keyCombo; -} - - -/* -This example produces results similar to the following output: - -Enter a key ......... a -The hash code for the A key is 97. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... S -The hash code for the SHIFT+S key is 83. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... -The hash code for the ALT+SHIFT+CTL+J key is 7. -Press the escape key (ESC) to quit, or any other key to continue. - -*/ -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp deleted file mode 100644 index ec5dbbee4ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp +++ /dev/null @@ -1,593 +0,0 @@ -using namespace System; - -public ref class ConvertSnippet -{ -// -public: - void ConvertDoubleBool( double doubleVal ) - { - bool boolVal; - - // Double to bool conversion cannot overflow. - boolVal = System::Convert::ToBoolean( doubleVal ); - System::Console::WriteLine( " {0} as a Boolean is: {1}.", - doubleVal, boolVal ); - - // bool to double conversion cannot overflow. - doubleVal = System::Convert::ToDouble( boolVal ); - System::Console::WriteLine( " {0} as a double is: {1}.", - boolVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleByte( double doubleVal ) - { - Byte byteVal = 0; - - // Double to Byte conversion can overflow. - try - { - byteVal = System::Convert::ToByte( doubleVal ); - System::Console::WriteLine( " {0} as a Byte is: {1}.", - doubleVal, byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in double-to-Byte conversion." ); - } - - // Byte to double conversion cannot overflow. - doubleVal = System::Convert::ToDouble( byteVal ); - System::Console::WriteLine( " {0} as a double is: {1}.", - byteVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleInt( double doubleVal ) - { - int intVal = 0; - - // Double to int conversion can overflow. - try - { - intVal = System::Convert::ToInt32( doubleVal ); - System::Console::WriteLine( " {0} as an int is: {1}", - doubleVal, intVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in double-to-int conversion." ); - } - - // Int to double conversion cannot overflow. - doubleVal = System::Convert::ToDouble( intVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - intVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleDecimal( double doubleVal ) - { - Decimal decimalVal; - - // Conversion from double to decimal cannot overflow. - decimalVal = System::Convert::ToDecimal( doubleVal ); - System::Console::WriteLine( " {0} as a decimal is: {1}", - doubleVal, decimalVal ); - - // Decimal to double conversion can overflow. - try - { - doubleVal = System::Convert::ToDouble( decimalVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - decimalVal, doubleVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in decimal-to-double conversion." ); - } - } - // - - // -public: - void CovertDoubleFloat( double doubleVal ) - { - float floatVal = 0; - - // A conversion from Double to Single cannot overflow. - floatVal = System::Convert::ToSingle( doubleVal ); - System::Console::WriteLine( " {0} as a float is {1}", - doubleVal, floatVal ); - - // A conversion from Single to Double cannot overflow. - doubleVal = System::Convert::ToDouble( floatVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - floatVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleString( double doubleVal ) - { - String^ stringVal; - - // A conversion from Double to String cannot overflow. - stringVal = System::Convert::ToString( doubleVal ); - System::Console::WriteLine( " {0} as a String is: {1}", - doubleVal, stringVal ); - try - { - doubleVal = System::Convert::ToDouble( stringVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - stringVal, doubleVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Conversion from String-to-double overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( "The String was not formatted as a double." ); - } - catch ( System::ArgumentException^ ) - { - System::Console::WriteLine( "The String pointed to null." ); - } - } - // - - // -public: - void ConvertLongChar( Int64 longVal ) - { - Char charVal = 'a'; - - try - { - charVal = System::Convert::ToChar( longVal ); - System::Console::WriteLine( " {0} as a char is {1}", - longVal, charVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in long-to-char conversion." ); - } - - - // A conversion from Char to long cannot overflow. - longVal = System::Convert::ToInt64( charVal ); - System::Console::WriteLine( " {0} as an Int64 is {1}", - charVal, longVal ); - } - - - // - // - void ConvertLongByte( Int64 longVal ) - { - Byte byteVal = 0; - - // A conversion from Long to Byte can overflow. - try - { - byteVal = System::Convert::ToByte( longVal ); - System::Console::WriteLine( " {0} as a Byte is {1}", - longVal, byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in long-to-Byte conversion." ); - } - - // A conversion from Byte to long cannot overflow. - longVal = System::Convert::ToInt64( byteVal ); - System::Console::WriteLine( " {0} as an Int64 is {1}", - byteVal, longVal ); - } - // - - // -public: - void ConvertLongDecimal( Int64 longVal ) - { - Decimal decimalVal; - - // Long to decimal conversion cannot overflow. - decimalVal = System::Convert::ToDecimal( longVal ); - System::Console::WriteLine( " {0} as a decimal is {1}", - longVal, decimalVal ); - - // Decimal to long conversion can overflow. - try - { - longVal = System::Convert::ToInt64( decimalVal ); - System::Console::WriteLine( " {0} as a long is {1}", - decimalVal, longVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in decimal-to-long conversion." ); - } - } - // - - // -public: - void ConvertLongFloat( Int64 longVal ) - { - float floatVal; - - // A conversion from Long to float cannot overflow. - floatVal = System::Convert::ToSingle( longVal ); - System::Console::WriteLine( " {0} as a float is {1}", - longVal, floatVal ); - - // A conversion from float to long can overflow. - try - { - longVal = System::Convert::ToInt64( floatVal ); - System::Console::WriteLine( " {0} as a long is {1}", - floatVal, longVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in float-to-long conversion." ); - } - } - // - - // -public: - void ConvertStringBoolean( String^ stringVal ) - { - bool boolVal = false; - - try - { - boolVal = System::Convert::ToBoolean( stringVal ); - if ( boolVal ) - { - System::Console::WriteLine( - "String was equal to System::Boolean::TrueString." ); - } - else - { - System::Console::WriteLine( - "String was equal to System::Boolean::FalseString." ); - } - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( "The String must equal System::Boolean::TrueString " + - "or System::Boolean::FalseString." ); - } - - // A conversion from bool to String will always succeed. - stringVal = System::Convert::ToString( boolVal ); - System::Console::WriteLine( " {0} as a String is {1}", - boolVal, stringVal ); - } - // - - // -public: - void ConvertStringByte( String^ stringVal ) - { - Byte byteVal = 0; - - try - { - byteVal = System::Convert::ToByte( stringVal ); - System::Console::WriteLine( " {0} as a Byte is: {1}", - stringVal, byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "Conversion from String to Byte overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is not formatted as a Byte." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( "The String is 0." ); - } - - //The conversion from Byte to String is always valid. - stringVal = System::Convert::ToString( byteVal ); - System::Console::WriteLine( " {0} as a String is {1}", - byteVal, stringVal ); - } - // - - // -public: - void ConvertStringChar( String^ stringVal ) - { - Char charVal = 'a'; - - // A String must be one character long to convert to char. - try - { - charVal = System::Convert::ToChar( stringVal ); - System::Console::WriteLine( " {0} as a char is {1}", - stringVal, charVal ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is longer than one character." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( "The String is 0." ); - } - - // A char to String conversion will always succeed. - stringVal = System::Convert::ToString( charVal ); - System::Console::WriteLine( "The character as a String is {0}", - stringVal ); - } - // - - // -public: - void ConvertStringDecimal( String^ stringVal ) - { - Decimal decimalVal = 0; - - try - { - decimalVal = System::Convert::ToDecimal( stringVal ); - System::Console::WriteLine( "The String as a decimal is {0}.", - decimalVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The conversion from String to decimal overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is not formatted as a decimal." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( "The String is 0." ); - } - - // Decimal to String conversion will not overflow. - stringVal = System::Convert::ToString( decimalVal ); - System::Console::WriteLine( - "The decimal as a String is {0}.", stringVal ); - } - // - - // -public: - void ConvertStringFloat( String^ stringVal ) - { - float floatVal = 0; - - try - { - floatVal = System::Convert::ToSingle( stringVal ); - System::Console::WriteLine( - "The String as a float is {0}.", floatVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The conversion from String-to-float overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is not formatted as a float." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( - "The String is 0." ); - } - - // Float to String conversion will not overflow. - stringVal = System::Convert::ToString( floatVal ); - System::Console::WriteLine( - "The float as a String is {0}.", stringVal ); - } - // - - // -public: - void ConvertCharDecimal( Char charVal ) - { - Decimal decimalVal = 0; - - // Char to decimal conversion is not supported and will always - // throw an InvalidCastException. - try - { - decimalVal = System::Convert::ToDecimal( charVal ); - } - catch ( System::InvalidCastException^ ) - { - System::Console::WriteLine( - "Char-to-Decimal conversion is not supported by the .NET Framework." ); - } - - //Decimal to char conversion is also not supported. - try - { - charVal = System::Convert::ToChar( decimalVal ); - } - catch ( System::InvalidCastException^ ) - { - System::Console::WriteLine( - "Decimal-to-Char conversion is not supported by the .NET Framework." ); - } - } - // - - // -public: - void ConvertByteDecimal( Byte byteVal ) - { - Decimal decimalVal; - - // Byte to decimal conversion will not overflow. - decimalVal = System::Convert::ToDecimal( byteVal ); - System::Console::WriteLine( "The Byte as a decimal is {0}.", - decimalVal ); - - // Decimal to Byte conversion can overflow. - try - { - byteVal = System::Convert::ToByte( decimalVal ); - System::Console::WriteLine( "The Decimal as a Byte is {0}.", - byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The decimal value is too large for a Byte." ); - } - } - // - - // -public: - void ConvertByteSingle( Byte byteVal ) - { - float floatVal; - - // Byte to float conversion will not overflow. - floatVal = System::Convert::ToSingle( byteVal ); - System::Console::WriteLine( "The Byte as a float is {0}.", - floatVal ); - - // Float to Byte conversion can overflow. - try - { - byteVal = System::Convert::ToByte( floatVal ); - System::Console::WriteLine( "The float as a Byte is {0}.", - byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The float value is too large for a Byte." ); - } - } - // - - // -public: - void ConvertBoolean() - { - const int year = 1979; - const int month = 7; - const int day = 28; - const int hour = 13; - const int minute = 26; - const int second = 15; - const int millisecond = 53; - DateTime dateTime( year, month, day, hour, - minute, second, millisecond ); - bool boolVal; - - // System::InvalidCastException is always thrown. - try - { - boolVal = System::Convert::ToBoolean( dateTime ); - } - catch ( System::InvalidCastException^ ) - { - System::Console::WriteLine( "Conversion from DateTime to Boolean "+ - "is not supported by the .NET Framework." ); - } - } - // - - void ConvertDoubles( double doubleVal ) - { - ConvertDoubleBool( doubleVal ); - ConvertDoubleByte( doubleVal ); - ConvertDoubleInt( doubleVal ); - ConvertDoubleDecimal( doubleVal ); - CovertDoubleFloat( doubleVal ); - ConvertDoubleString( doubleVal ); - } - - void ConvertLongs( Int64 longVal ) - { - ConvertLongChar( longVal ); - ConvertLongByte( longVal ); - ConvertLongDecimal( longVal ); - ConvertLongFloat( longVal ); - } - - void ConvertStrings( String^ stringVal ) - { - ConvertStringBoolean( stringVal ); - ConvertStringByte( stringVal ); - ConvertStringChar( stringVal ); - ConvertStringDecimal( stringVal ); - ConvertStringFloat( stringVal ); - } - - void ConvertChars( Char charVal ) - { - ConvertCharDecimal( charVal ); - } - - void ConvertBytes( Byte byteVal ) - { - ConvertByteDecimal( byteVal ); - ConvertByteSingle( byteVal ); - } -}; - -int main() -{ - ConvertSnippet^ snippet = gcnew ConvertSnippet; - - double doubleVal; - System::Console::WriteLine( "Enter the double value: " ); - doubleVal = System::Convert::ToDouble( System::Console::ReadLine() ); - snippet->ConvertDoubles( doubleVal ); - - Int64 longVal; - System::Console::WriteLine( "Enter the Int64 value: " ); - longVal = System::Convert::ToInt64( System::Console::ReadLine() ); - snippet->ConvertLongs( longVal ); - - String^ stringVal; - System::Console::WriteLine( "Enter the String value: " ); - stringVal = System::Console::ReadLine(); - snippet->ConvertStrings( stringVal ); - - Char charVal; - System::Console::WriteLine( "Enter the char value: " ); - charVal = System::Convert::ToChar( System::Console::ReadLine() ); - snippet->ConvertChars( charVal ); - - Byte byteVal; - System::Console::WriteLine( "Enter the Byte value: " ); - byteVal = System::Convert::ToByte( System::Console::ReadLine() ); - snippet->ConvertBytes( byteVal ); - - snippet->ConvertBoolean(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp deleted file mode 100644 index 6ae7e65bdc1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// ToInt_Str_Int32.cpp : main project file. - -//#include "stdafx.h" - -using namespace System; - -int main(array ^args) -{ - // - // Create a hexadecimal value out of range of the integer type. - String^ value1 = Convert::ToString((static_cast<__int64>(int::MaxValue)) + 1, 16); - // Convert it back to a number. - try { - int number = Convert::ToInt32(value1, 16); - Console::WriteLine("0x{0} converts to {1}.", value1, number); - } - catch (OverflowException ^e) { - Console::WriteLine("Unable to convert '0x{0}' to an integer.", value1); - } - // The example displays the following output: - // 0x80000000 converts to -2147483648. - // - - // - __int64 sourceNumber2 = (static_cast<__int64>(int::MaxValue)) + 1; - bool isNegative = Math::Sign(sourceNumber2) == -1; - String^ value2 = Convert::ToString(sourceNumber2, 16); - int targetNumber; - try { - targetNumber = Convert::ToInt32(value2, 16); - if (!(isNegative) & (targetNumber & 0x80000000) != 0) - throw gcnew OverflowException(); - else - Console::WriteLine("0x{0} converts to {1}.", value2, targetNumber); - } - catch (OverflowException ^e) { - Console::WriteLine("Unable to convert '0x{0}' to an integer.", value2); - } - // The example displays the following output: - // Unable to convert '0x80000000' to an integer. - // - //Console::Write("Press any key..."); - //Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp deleted file mode 100644 index 7cff3673fb0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Convert.ToBoolean2.cpp : main project file. - -// -using namespace System; - -void main() -{ - array^ values = gcnew array { nullptr, String::Empty, - "true", "TrueString", - "False", " false ", - "-1", "0" }; - for each (String^ value in values) { - try - { - Console::WriteLine("Converted '{0}' to {1}.", value, - Convert::ToBoolean(value)); - } - catch (FormatException^ e) - { - Console::WriteLine("Unable to convert '{0}' to a Boolean.", value); - } - } -} -// The example displays the following output: -// Converted '' to False. -// Unable to convert '' to a Boolean. -// Converted 'true' to True. -// Unable to convert 'TrueString' to a Boolean. -// Converted 'False' to False. -// Converted ' false ' to False. -// Unable to convert '-1' to a Boolean. -// Unable to convert '0' to a Boolean. -// - - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp deleted file mode 100644 index ed404e69c09..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// Convert.ToBoolean.cpp : main project file. - -using namespace System; - -void ToByte() -{ - // - array^ bytes = gcnew array { Byte::MinValue, 100, 200, Byte::MaxValue }; - bool result; - - for each (Byte byteValue in bytes) - { - result = Convert::ToBoolean(byteValue); - Console::WriteLine("{0,-5} --> {1}", byteValue, result); - } - // The example displays the following output: - // 0 --> False - // 100 --> True - // 200 --> True - // 255 --> True - // -} - -void ToDecimal() -{ - // - array^ numbers = gcnew array { Decimal::MinValue, (Decimal) -12034.87, - (Decimal) -100, (Decimal) 0, (Decimal) 300, - (Decimal) 6790823.45, Decimal::MaxValue }; - bool result; - - for each (Decimal number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-30} --> {1}", number, result); - } - // The example displays the following output: - // -79228162514264337593543950335 --> True - // -12034.87 --> True - // -100 --> True - // 0 --> False - // 300 --> True - // 6790823.45 --> True - // 79228162514264337593543950335 --> True - // -} - -void ToInt16() -{ - // - array^ numbers = gcnew array { Int16::MinValue, -10000, -154, 0, 216, 21453, - Int16::MaxValue }; - bool result; - - for each (Int16 number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-7:N0} --> {1}", number, result); - } - // The example displays the following output: - // -32,768 --> True - // -10,000 --> True - // -154 --> True - // 0 --> False - // 216 --> True - // 21,453 --> True - // 32,767 --> True - // -} - -void ToInt32() -{ - // - array^ numbers = gcnew array { Int32::MinValue, -201649, -68, 0, 612, 4038907, - Int32::MaxValue }; - bool result; - - for each (int number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-15:N0} --> {1}", number, result); - } - // The example displays the following output: - // -2,147,483,648 --> True - // -201,649 --> True - // -68 --> True - // 0 --> False - // 612 --> True - // 4,038,907 --> True - // 2,147,483,647 --> True - // -} - -void ToInt64() -{ - // - array^ numbers = gcnew array { Int64::MinValue, -2016493, -689, 0, 6121, - 403890774, Int64::MaxValue }; - bool result; - - for each (Int64 number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-26:N0} --> {1}", number, result); - } - // The example displays the following output: - // -9,223,372,036,854,775,808 --> True - // -2,016,493 --> True - // -689 --> True - // 0 --> False - // 6,121 --> True - // 403,890,774 --> True - // 9,223,372,036,854,775,807 --> True - // -} - -void ToObject() -{ - // - array^ objects = gcnew array { 16.33, -24, 0, "12", "12.7", String::Empty, - "1String", "True", "false", nullptr, - gcnew System::Collections::ArrayList }; - - for each (Object^ obj in objects) - { - Console::Write("{0,-40} --> ", - obj == nullptr ? "null" : - String::Format("{0} ({1})", obj, obj->GetType()->Name)); - try { - Console::WriteLine("{0}", Convert::ToBoolean((Object^) obj)); - } - catch (FormatException^) { - Console::WriteLine("Bad Format"); - } - catch (InvalidCastException^) { - Console::WriteLine("No Conversion"); - } - } - // The example displays the following output: - // 16.33 (Double) --> True - // -24 (Int32) --> True - // 0 (Int32) --> False - // 12 (String) --> Bad Format - // 12.7 (String) --> Bad Format - // (String) --> Bad Format - // 1String (String) --> Bad Format - // True (String) --> True - // false (String) --> False - // null --> False - // System.Collections.ArrayList (ArrayList) --> No Conversion - // -} - -void ToSByte() -{ - // - array^ numbers = gcnew array { SByte::MinValue, -1, 0, 10, 100, SByte::MaxValue }; - bool result; - - for each (SByte number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-5} --> {1}", number, result); - } - // The example displays the following output: - // -128 --> True - // -1 --> True - // 0 --> False - // 10 --> True - // 100 --> True - // 127 --> True - // -} - -void ToSingle() -{ - // - array^ numbers = gcnew array { Single::MinValue, (float) -193.0012, (float) 20e-15f, 0, - (float) 10551e-10, (float) 100.3398, Single::MaxValue }; - bool result; - - for each (float number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-15} --> {1}", number, result); - } - // The example displays the following output: - // -3.402823E+38 --> True - // -193.0012 --> True - // 2E-14 --> True - // 0 --> False - // 1.0551E-06 --> True - // 100.3398 --> True - // 3.402823E+38 --> True - // -} - -void ToUInt16() -{ - // - array^ numbers = gcnew array { UInt16::MinValue, 216, 21453, UInt16::MaxValue }; - bool result; - - for each (unsigned short number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-7:N0} --> {1}", number, result); - } - // The example displays the following output: - // 0 --> False - // 216 --> True - // 21,453 --> True - // 65,535 --> True - // -} - -void ToUInt32() -{ - // - array^ numbers = gcnew array { UInt32::MinValue, 612, 4038907, Int32::MaxValue }; - bool result; - - for each (unsigned int number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-15:N0} --> {1}", number, result); - } - // The example displays the following output: - // 0 --> False - // 612 --> True - // 4,038,907 --> True - // 2,147,483,647 --> True - // -} - -void ToUInt64() -{ - // - array^ numbers = gcnew array { UInt64::MinValue, 6121, 403890774, UInt64::MaxValue }; - bool result; - - for each (UInt64 number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-26:N0} --> {1}", number, result); - } - // The example displays the following output: - // 0 --> False - // 6,121 --> True - // 403,890,774 --> True - // 18,446,744,073,709,551,615 --> True - // -} - -void main() -{ - Console::WriteLine("ToByte:"); - ToByte(); - Console::WriteLine(); - - Console::WriteLine("ToDecimal:"); - ToDecimal(); - Console::WriteLine(); - - Console::WriteLine("ToInt16:"); - ToInt16(); - Console::WriteLine(); - - Console::WriteLine("ToInt32:"); - ToInt32(); - Console::WriteLine(); - - Console::WriteLine("ToInt64:"); - ToInt64(); - Console::WriteLine(); - - Console::WriteLine("ToObject:"); - ToObject(); - Console::WriteLine(); - - Console::WriteLine("ToSByte:"); - ToSByte(); - Console::WriteLine(); - - Console::WriteLine("ToSingle:"); - ToSingle(); - Console::WriteLine(); - - Console::WriteLine("ToUInt16:"); - ToUInt16(); - Console::WriteLine(); - - Console::WriteLine("ToUInt32:"); - ToUInt32(); - Console::WriteLine(); - - Console::WriteLine("ToUInt64:"); - ToUInt64(); - Console::WriteLine(); - - Console::ReadLine(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp deleted file mode 100644 index 868a76dd151..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -ref class DummyProvider: public IFormatProvider -{ -public: - - // Normally, GetFormat returns an object of the requested type - // (usually itself) if it is able; otherwise, it returns Nothing. - virtual Object^ GetFormat( Type^ argType ) - { - // Here, GetFormat displays the name of argType, after removing - // the namespace information. GetFormat always returns null. - String^ argStr = argType->ToString(); - if ( argStr->Equals( "" ) ) - argStr = "Empty"; - - argStr = argStr->Substring( argStr->LastIndexOf( '.' ) + 1 ); - Console::Write( "{0,-20}", argStr ); - return (Object^)0; - } -}; - -int main() -{ - // Create an instance of IFormatProvider. - DummyProvider^ provider = gcnew DummyProvider; - String^ format = "{0,-17}{1,-17}{2}"; - - // Convert these values using DummyProvider. - String^ Int32A = "-252645135"; - String^ DoubleA = "61680.3855"; - String^ DayTimeA = "2001/9/11 13:45"; - String^ BoolA = "True"; - String^ StringA = "Qwerty"; - String^ CharA = "$"; - Console::WriteLine( "This example of selected " - "Convert::To( String*, IFormatProvider* ) \nmethods " - "generates the following output. The example displays the " - "\nprovider type if the IFormatProvider is called." ); - Console::WriteLine( "\nNote: For the " - "ToBoolean, ToString, and ToChar methods, the \n" - "IFormatProvider object is not referenced." ); - - // The format provider is called for the following conversions. - Console::WriteLine(); - Console::WriteLine( format, "ToInt32", Int32A, Convert::ToInt32( Int32A, provider ) ); - Console::WriteLine( format, "ToDouble", DoubleA, Convert::ToDouble( DoubleA, provider ) ); - Console::WriteLine( format, "ToDateTime", DayTimeA, Convert::ToDateTime( DayTimeA, provider ) ); - - // The format provider is not called for these conversions. - Console::WriteLine(); - Console::WriteLine( format, "ToBoolean", BoolA, Convert::ToBoolean( BoolA, provider ) ); - Console::WriteLine( format, "ToString", StringA, Convert::ToString( StringA, provider ) ); - Console::WriteLine( format, "ToChar", CharA, Convert::ToChar( CharA, provider ) ); -} - -/* -This example of selected Convert::To( String*, IFormatProvider* ) -methods generates the following output. The example displays the -provider type if the IFormatProvider is called. - -Note: For the ToBoolean, ToString, and ToChar methods, the -IFormatProvider object is not referenced. - -NumberFormatInfo ToInt32 -252645135 -252645135 -NumberFormatInfo ToDouble 61680.3855 61680.3855 -DateTimeFormatInfo ToDateTime 2001/9/11 13:45 9/11/2001 1:45:00 PM - -ToBoolean True True -ToString Qwerty Qwerty -ToChar $ $ -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp deleted file mode 100644 index feecf23e2a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp +++ /dev/null @@ -1,105 +0,0 @@ - -// -// Example of the Convert::ToInt16( String* ) and -// Convert::ToInt16( String*, IFormatProvider* ) methods. -using namespace System; -using namespace System::Globalization; -const __wchar_t * protoFmt = L"{0,-20}{1,-20}{2}"; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - -void ConvertToInt16( String^ numericStr, IFormatProvider^ provider ) -{ - Object^ defaultValue; - Object^ providerValue; - - // Convert numericStr to Int16 without a format provider. - try - { - defaultValue = Convert::ToInt16( numericStr ); - } - catch ( Exception^ ex ) - { - defaultValue = GetExceptionType( ex ); - } - - - // Convert numericStr to Int16 with a format provider. - try - { - providerValue = Convert::ToInt16( numericStr, provider ); - } - catch ( Exception^ ex ) - { - providerValue = GetExceptionType( ex ); - } - - Console::WriteLine( gcnew String( protoFmt ), numericStr, defaultValue, providerValue ); -} - -int main() -{ - - // Create a NumberFormatInfo object and set several of its - // properties that apply to numbers. - NumberFormatInfo^ provider = gcnew NumberFormatInfo; - - // These properties affect the conversion. - provider->NegativeSign = "neg "; - provider->PositiveSign = "pos "; - - // These properties do not affect the conversion. - // The input string cannot have decimal and group separators. - provider->NumberDecimalSeparator = "."; - provider->NumberGroupSeparator = ","; - array^sizes = {3}; - provider->NumberGroupSizes = sizes; - provider->NumberNegativePattern = 0; - Console::WriteLine( "This example of\n" - " Convert::ToInt16( String* ) and \n" - " Convert::ToInt16( String*, IFormatProvider* ) " - "\ngenerates the following output. It converts " - "several strings to \nshort values, using " - "default formatting or a NumberFormatInfo object.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "String to convert", "Default/exception", "Provider/exception" ); - Console::WriteLine( gcnew String( protoFmt ), "-----------------", "-----------------", "------------------" ); - - // Convert strings, with and without an IFormatProvider. - ConvertToInt16( "12345", provider ); - ConvertToInt16( "+12345", provider ); - ConvertToInt16( "pos 12345", provider ); - ConvertToInt16( "-12345", provider ); - ConvertToInt16( "neg 12345", provider ); - ConvertToInt16( "12345.", provider ); - ConvertToInt16( "12,345", provider ); - ConvertToInt16( "(12345)", provider ); - ConvertToInt16( "32768", provider ); - ConvertToInt16( "-32769", provider ); -} - -/* -This example of - Convert::ToInt16( String* ) and - Convert::ToInt16( String*, IFormatProvider* ) -generates the following output. It converts several strings to -short values, using default formatting or a NumberFormatInfo object. - -String to convert Default/exception Provider/exception ------------------ ----------------- ------------------ -12345 12345 12345 -+12345 12345 FormatException -pos 12345 FormatException 12345 --12345 -12345 FormatException -neg 12345 FormatException -12345 -12345. FormatException FormatException -12,345 FormatException FormatException -(12345) FormatException FormatException -32768 OverflowException OverflowException --32769 OverflowException FormatException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp deleted file mode 100644 index 3336b2aa23d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -// -// Example of the Convert::ToSByte( String* ) and -// Convert::ToSByte( String*, IFormatProvider* ) methods. -using namespace System; -using namespace System::Globalization; -const __wchar_t * protoFmt = L"{0,-20}{1,-20}{2}"; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - -void ConvertToSByte( String^ numericStr, IFormatProvider^ provider ) -{ - Object^ defaultValue; - Object^ providerValue; - - // Convert numericStr to SByte without a format provider. - try - { - defaultValue = Convert::ToSByte( numericStr ); - } - catch ( Exception^ ex ) - { - defaultValue = GetExceptionType( ex ); - } - - - // Convert numericStr to SByte with a format provider. - try - { - providerValue = Convert::ToSByte( numericStr, provider ); - } - catch ( Exception^ ex ) - { - providerValue = GetExceptionType( ex ); - } - - Console::WriteLine( gcnew String( protoFmt ), numericStr, defaultValue, providerValue ); -} - -int main() -{ - - // Create a NumberFormatInfo object and set several of its - // properties that apply to numbers. - NumberFormatInfo^ provider = gcnew NumberFormatInfo; - - // These properties affect the conversion. - provider->NegativeSign = "neg "; - provider->PositiveSign = "pos "; - - // These properties do not affect the conversion. - // The input string cannot have decimal and group separators. - provider->NumberDecimalSeparator = "."; - provider->NumberNegativePattern = 0; - Console::WriteLine( "This example of\n" - " Convert::ToSByte( String* ) and \n" - " Convert::ToSByte( String*, IFormatProvider* ) " - "\ngenerates the following output. It converts " - "several strings to \nSByte values, using " - "default formatting or a NumberFormatInfo object.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "String to convert", "Default/exception", "Provider/exception" ); - Console::WriteLine( gcnew String( protoFmt ), "-----------------", "-----------------", "------------------" ); - - // Convert strings, with and without an IFormatProvider. - ConvertToSByte( "123", provider ); - ConvertToSByte( "+123", provider ); - ConvertToSByte( "pos 123", provider ); - ConvertToSByte( "-123", provider ); - ConvertToSByte( "neg 123", provider ); - ConvertToSByte( "123.", provider ); - ConvertToSByte( "(123)", provider ); - ConvertToSByte( "128", provider ); - ConvertToSByte( "-129", provider ); -} - -/* -This example of - Convert::ToSByte( String* ) and - Convert::ToSByte( String*, IFormatProvider* ) -generates the following output. It converts several strings to -SByte values, using default formatting or a NumberFormatInfo object. - -String to convert Default/exception Provider/exception ------------------ ----------------- ------------------ -123 123 123 -+123 123 FormatException -pos 123 FormatException 123 --123 -123 FormatException -neg 123 FormatException -123 -123. FormatException FormatException -(123) FormatException FormatException -128 OverflowException OverflowException --129 OverflowException FormatException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp deleted file mode 100644 index 819130067f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -// -// Example of Convert::ToString( non-numeric types, IFormatProvider ). -using namespace System; -using namespace System::Globalization; - -#define null (Object^)0 - -// An instance of this class can be passed to methods that require -// an IFormatProvider. -ref class DummyProvider: public IFormatProvider -{ -public: - - // Normally, GetFormat returns an object of the requested type - // (usually itself) if it is able; otherwise, it returns Nothing. - virtual Object^ GetFormat( Type^ argType ) - { - // Here, the type of argType is displayed, and GetFormat - // always returns Nothing. - Console::Write( "{0,-40}", argType->ToString() ); - return null; - } -}; - -int main() -{ - // Create an instance of the IFormatProvider. - DummyProvider^ provider = gcnew DummyProvider; - String^ converted; - - // Convert these values using DummyProvider. - int Int32A = -252645135; - double DoubleA = 61680.3855; - Object^ ObjDouble = -98765.4321; - DateTime DayTimeA = DateTime(2001,9,11,13,45,0); - bool BoolA = true; - String^ StringA = "Qwerty"; - Char CharA = '$'; - TimeSpan TSpanA = TimeSpan(0,18,0); - Object^ ObjOther = static_cast(provider); - Console::WriteLine( "This example of " - "Convert::ToString( non-numeric, IFormatProvider* ) \n" - "generates the following output. The provider type, " - "argument type, \nand argument value are displayed." ); - Console::WriteLine( "\nNote: The IFormatProvider object is " - "not called for Boolean, String, \nChar, TimeSpan, " - "and non-numeric Object." ); - - // The format provider is called for these conversions. - Console::WriteLine(); - converted = Convert::ToString( Int32A, provider ); - Console::WriteLine( "int {0}", converted ); - converted = Convert::ToString( DoubleA, provider ); - Console::WriteLine( "double {0}", converted ); - converted = Convert::ToString( ObjDouble, provider ); - Console::WriteLine( "Object {0}", converted ); - converted = Convert::ToString( DayTimeA, provider ); - Console::WriteLine( "DateTime {0}", converted ); - - // The format provider is not called for these conversions. - Console::WriteLine(); - converted = Convert::ToString( BoolA, provider ); - Console::WriteLine( "bool {0}", converted ); - converted = Convert::ToString( StringA, provider ); - Console::WriteLine( "String {0}", converted ); - converted = Convert::ToString( CharA, provider ); - Console::WriteLine( "Char {0}", converted ); - converted = Convert::ToString( TSpanA, provider ); - Console::WriteLine( "TimeSpan {0}", converted ); - converted = Convert::ToString( ObjOther, provider ); - Console::WriteLine( "Object {0}", converted ); -} - -/* -This example of Convert::ToString( non-numeric, IFormatProvider* ) -generates the following output. The provider type, argument type, -and argument value are displayed. - -Note: The IFormatProvider object is not called for Boolean, String, -Char, TimeSpan, and non-numeric Object. - -System.Globalization.NumberFormatInfo int -252645135 -System.Globalization.NumberFormatInfo double 61680.3855 -System.Globalization.NumberFormatInfo Object -98765.4321 -System.Globalization.DateTimeFormatInfo DateTime 9/11/2001 1:45:00 PM - -bool True -String Qwerty -Char $ -TimeSpan 00:18:00 -Object DummyProvider -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp deleted file mode 100644 index 2e233191f16..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp +++ /dev/null @@ -1,458 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -// Define the types of averaging available in the class -// implementing IConvertible. -public enum class AverageType : short -{ - None = 0, - GeometricMean = 1, - ArithmeticMean = 2, - Median = 3 -}; - - -// Pass an instance of this class to methods that require an -// IFormatProvider. The class instance determines the type of -// average to calculate. -ref class AverageInfo: public IFormatProvider -{ -protected: - AverageType AvgType; - -public: - - // Specify the type of averaging in the constructor. - AverageInfo( AverageType avgType ) - { - this->AvgType = avgType; - } - - - // This method returns a reference to the containing object - // if an object of AverageInfo type is requested. - virtual Object^ GetFormat( Type^ argType ) - { - if ( argType == AverageInfo::typeid) - return this; - else - return (Object^)0; - } - - - property AverageType TypeOfAverage - { - - // Use this property to set or get the type of averaging. - AverageType get() - { - return this->AvgType; - } - - void set( AverageType value ) - { - this->AvgType = value; - } - - } - -}; - - -// This class encapsulates an array of double values and implements -// the IConvertible interface. Most of the IConvertible methods -// return an average of the array elements in one of three types: -// arithmetic mean, geometric mean, or median. -ref class DataSet: public IConvertible -{ -private: - static Object^ null = nullptr; - -protected: - ArrayList^ data; - AverageInfo^ defaultProvider; - - // This method unboxes a boxed double. - double UnBoxDouble( Object^ obj ) - { - return *static_cast(obj); - } - - -public: - - // Construct the object and add an initial list of values. - // Create a default format provider. - DataSet( ... array^values ) - { - data = gcnew ArrayList( (Array^)values ); - defaultProvider = gcnew AverageInfo( AverageType::ArithmeticMean ); - } - - - // Add additional values with this method. - int Add( double value ) - { - data->Add( value ); - return data->Count; - } - - - property double Item[ int ] - { - - // Get, set, and add values with this indexer property. - double get( int index ) - { - if ( index >= 0 && index < data->Count ) - return UnBoxDouble( data[ index ] ); - else - throw gcnew InvalidOperationException( "[DataSet.get] Index out of range." ); - } - - void set( int index, double value ) - { - if ( index >= 0 && index < data->Count ) - data[ index ] = value; - else - if ( index == data->Count ) - data->Add( value ); - else - throw gcnew InvalidOperationException( "[DataSet.set] Index out of range." ); - } - - } - - property int Count - { - - // This property returns the number of elements in the object. - int get() - { - return data->Count; - } - - } - -protected: - - // This method calculates the average of the object's elements. - double Average( AverageType avgType ) - { - double SumProd; - if ( data->Count == 0 ) - return 0.0; - - switch ( avgType ) - { - case AverageType::GeometricMean: - SumProd = 1.0; - for ( int Index = 0; Index < data->Count; Index++ ) - SumProd *= UnBoxDouble( data[ Index ] ); - - // This calculation will not fail with negative - // elements. - return Math::Sign( SumProd ) * Math::Pow( Math::Abs( SumProd ), 1.0 / data->Count ); - - case AverageType::ArithmeticMean: - SumProd = 0.0; - for ( int Index = 0; Index < data->Count; Index++ ) - SumProd += UnBoxDouble( data[ Index ] ); - return SumProd / data->Count; - - case AverageType::Median: - if ( data->Count % 2 == 0 ) - return (UnBoxDouble( data[ data->Count / 2 ] ) + UnBoxDouble( data[ data->Count / 2 - 1 ] )) / 2.0; - else - return UnBoxDouble( data[ data->Count / 2 ] ); - - default: - return 0.0; - } - } - - - // Get the AverageInfo object from the caller's format provider, - // or use the local default. - AverageInfo^ GetAverageInfo( IFormatProvider^ provider ) - { - AverageInfo^ avgInfo = nullptr; - if ( provider != nullptr ) - avgInfo = static_cast(provider->GetFormat( AverageInfo::typeid )); - - if ( avgInfo == nullptr ) - return defaultProvider; - else - return avgInfo; - } - - - // Calculate the average and limit the range. - double CalcNLimitAverage( double min, double max, IFormatProvider^ provider ) - { - - // Get the format provider and calculate the average. - AverageInfo^ avgInfo = GetAverageInfo( provider ); - double avg = Average( avgInfo->TypeOfAverage ); - - // Limit the range, based on the minimum and maximum values - // for the type. - return avg > max ? max : avg < min ? min : avg; - } - - -public: - - // The following elements are required by IConvertible. - // None of these conversion functions throw exceptions. When - // the data is out of range for the type, the appropriate - // MinValue or MaxValue is used. - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean( IFormatProvider^ provider ) - { - - // ToBoolean is false if the dataset is empty. - if ( data->Count <= 0 ) - return false; - // For median averaging, ToBoolean is true if any - // non-discarded elements are nonzero. - else - - // For median averaging, ToBoolean is true if any - // non-discarded elements are nonzero. - if ( AverageType::Median == GetAverageInfo( provider )->TypeOfAverage ) - { - if ( data->Count % 2 == 0 ) - return (UnBoxDouble( data[ data->Count / 2 ] ) != 0.0 || UnBoxDouble( data[ data->Count / 2 - 1 ] ) != 0.0); - else - return UnBoxDouble( data[ data->Count / 2 ] ) != 0.0; - } - // For arithmetic or geometric mean averaging, ToBoolean is - // true if any element of the dataset is nonzero. - else - { - for ( int Index = 0; Index < data->Count; Index++ ) - if ( UnBoxDouble( data[ Index ] ) != 0.0 ) - return true; - return false; - } - } - - virtual Byte ToByte( IFormatProvider^ provider ) - { - return Convert::ToByte( CalcNLimitAverage( Byte::MinValue, Byte::MaxValue, provider ) ); - } - - virtual Char ToChar( IFormatProvider^ provider ) - { - return Convert::ToChar( Convert::ToUInt16( CalcNLimitAverage( Char::MinValue, Char::MaxValue, provider ) ) ); - } - - - // Convert to DateTime by adding the calculated average as - // seconds to the current date and time. A valid DateTime is - // always returned. - virtual DateTime ToDateTime( IFormatProvider^ provider ) - { - double seconds = Average( GetAverageInfo( provider )->TypeOfAverage ); - try - { - return DateTime::Now.AddSeconds( seconds ); - } - catch ( ArgumentOutOfRangeException^ ) - { - return seconds < 0.0 ? DateTime::MinValue : DateTime::MaxValue; - } - - } - - virtual Decimal ToDecimal( IFormatProvider^ provider ) - { - - // The Double conversion rounds Decimal.MinValue and - // Decimal.MaxValue to invalid Decimal values, so the - // following limits must be used. - return Convert::ToDecimal( CalcNLimitAverage( -79228162514264330000000000000.0, 79228162514264330000000000000.0, provider ) ); - } - - virtual double ToDouble( IFormatProvider^ provider ) - { - return Average( GetAverageInfo( provider )->TypeOfAverage ); - } - - virtual short ToInt16( IFormatProvider^ provider ) - { - return Convert::ToInt16( CalcNLimitAverage( Int16::MinValue, Int16::MaxValue, provider ) ); - } - - virtual int ToInt32( IFormatProvider^ provider ) - { - return Convert::ToInt32( CalcNLimitAverage( Int32::MinValue, Int32::MaxValue, provider ) ); - } - - virtual __int64 ToInt64( IFormatProvider^ provider ) - { - - // The Double conversion rounds Int64.MinValue and - // Int64.MaxValue to invalid Int64 values, so the following - // limits must be used. - return Convert::ToInt64( CalcNLimitAverage( -9223372036854775000, 9223372036854775000, provider ) ); - } - - virtual signed char ToSByte( IFormatProvider^ provider ) - { - return Convert::ToSByte( CalcNLimitAverage( SByte::MinValue, SByte::MaxValue, provider ) ); - } - - virtual float ToSingle( IFormatProvider^ provider ) - { - return Convert::ToSingle( CalcNLimitAverage( Single::MinValue, Single::MaxValue, provider ) ); - } - - virtual UInt16 ToUInt16( IFormatProvider^ provider ) - { - return Convert::ToUInt16( CalcNLimitAverage( UInt16::MinValue, UInt16::MaxValue, provider ) ); - } - - virtual UInt32 ToUInt32( IFormatProvider^ provider ) - { - return Convert::ToUInt32( CalcNLimitAverage( UInt32::MinValue, UInt32::MaxValue, provider ) ); - } - - virtual UInt64 ToUInt64( IFormatProvider^ provider ) - { - - // The Double conversion rounds UInt64.MaxValue to an invalid - // UInt64 value, so the following limit must be used. - return Convert::ToUInt64( CalcNLimitAverage( 0, 18446744073709550000.0, provider ) ); - } - - virtual Object^ ToType( Type^ conversionType, IFormatProvider^ provider ) - { - return Convert::ChangeType( Average( GetAverageInfo( provider )->TypeOfAverage ), conversionType ); - } - - virtual String^ ToString( IFormatProvider^ provider ) - { - AverageType avgType = GetAverageInfo( provider )->TypeOfAverage; - return String::Format( "( {0}: {1:G10} )", avgType, Average( avgType ) ); - } - -}; - - -// Display a DataSet with three different format providers. -void DisplayDataSet( DataSet^ ds ) -{ - IFormatProvider^ null = nullptr; - String^ fmt = "{0,-12}{1,20}{2,20}{3,20}"; - AverageInfo^ median = gcnew AverageInfo( AverageType::Median ); - AverageInfo^ geMean = gcnew AverageInfo( AverageType::GeometricMean ); - - // Display the dataset elements. - if ( ds->Count > 0 ) - { - Console::Write( "\nDataSet: [{0}", ds->Item[ 0 ] ); - for ( int iX = 1; iX < ds->Count; iX++ ) - Console::Write( ", {0}", ds->Item[ iX ] ); - Console::WriteLine( "]\n" ); - } - - Console::WriteLine( fmt, "Convert::", "Default", "Geometric Mean", "Median" ); - Console::WriteLine( fmt, "---------", "-------", "--------------", "------" ); - Console::WriteLine( fmt, "ToBoolean", Convert::ToBoolean( ds, null ), Convert::ToBoolean( ds, geMean ), Convert::ToBoolean( ds, median ) ); - Console::WriteLine( fmt, "ToByte", Convert::ToByte( ds, null ), Convert::ToByte( ds, geMean ), Convert::ToByte( ds, median ) ); - Console::WriteLine( fmt, "ToChar", Convert::ToChar( ds, null ), Convert::ToChar( ds, geMean ), Convert::ToChar( ds, median ) ); - Console::WriteLine( "{0,-12}{1,20:yyyy-MM-dd HH:mm:ss}" - "{2,20:yyyy-MM-dd HH:mm:ss}{3,20:yyyy-MM-dd HH:mm:ss}", "ToDateTime", Convert::ToDateTime( ds, null ), Convert::ToDateTime( ds, geMean ), Convert::ToDateTime( ds, median ) ); - Console::WriteLine( fmt, "ToDecimal", Convert::ToDecimal( ds, null ), Convert::ToDecimal( ds, geMean ), Convert::ToDecimal( ds, median ) ); - Console::WriteLine( fmt, "ToDouble", Convert::ToDouble( ds, null ), Convert::ToDouble( ds, geMean ), Convert::ToDouble( ds, median ) ); - Console::WriteLine( fmt, "ToInt16", Convert::ToInt16( ds, null ), Convert::ToInt16( ds, geMean ), Convert::ToInt16( ds, median ) ); - Console::WriteLine( fmt, "ToInt32", Convert::ToInt32( ds, null ), Convert::ToInt32( ds, geMean ), Convert::ToInt32( ds, median ) ); - Console::WriteLine( fmt, "ToInt64", Convert::ToInt64( ds, null ), Convert::ToInt64( ds, geMean ), Convert::ToInt64( ds, median ) ); - Console::WriteLine( fmt, "ToSByte", Convert::ToSByte( ds, null ), Convert::ToSByte( ds, geMean ), Convert::ToSByte( ds, median ) ); - Console::WriteLine( fmt, "ToSingle", Convert::ToSingle( ds, null ), Convert::ToSingle( ds, geMean ), Convert::ToSingle( ds, median ) ); - Console::WriteLine( fmt, "ToUInt16", Convert::ToUInt16( ds, null ), Convert::ToUInt16( ds, geMean ), Convert::ToUInt16( ds, median ) ); - Console::WriteLine( fmt, "ToUInt32", Convert::ToUInt32( ds, null ), Convert::ToUInt32( ds, geMean ), Convert::ToUInt32( ds, median ) ); - Console::WriteLine( fmt, "ToUInt64", Convert::ToUInt64( ds, null ), Convert::ToUInt64( ds, geMean ), Convert::ToUInt64( ds, median ) ); -} - -int main() -{ - Console::WriteLine( "This example of the " - "Convert::To( Object*, IFormatProvider* ) methods " - "\ngenerates the following output. The example " - "displays the values \nreturned by the methods, " - "using several IFormatProvider objects.\n" ); - - // To call a [ParamArray] method in C++, you cannot just - // list the parameters, you need to build an array. - array^dataElem = gcnew array(6); - dataElem[ 0 ] = 10.5; - dataElem[ 1 ] = 22.2; - dataElem[ 2 ] = 45.9; - dataElem[ 3 ] = 88.7; - dataElem[ 4 ] = 156.05; - dataElem[ 5 ] = 297.6; - DataSet^ ds1 = gcnew DataSet( dataElem ); - DisplayDataSet( ds1 ); - dataElem = gcnew array(5); - dataElem[ 0 ] = 359999.95; - dataElem[ 1 ] = 425000; - dataElem[ 2 ] = 499999.5; - dataElem[ 3 ] = 775000; - dataElem[ 4 ] = 1695000; - DataSet^ ds2 = gcnew DataSet( dataElem ); - DisplayDataSet( ds2 ); -} - -/* -This example of the Convert::To( Object*, IFormatProvider* ) methods -generates the following output. The example displays the values -returned by the methods, using several IFormatProvider objects. - -DataSet: [10.5, 22.2, 45.9, 88.7, 156.05, 297.6] - -Convert:: Default Geometric Mean Median ---------- ------- -------------- ------ -ToBoolean True True True -ToByte 103 59 67 -ToChar g ; C -ToDateTime 2003-05-13 15:30:23 2003-05-13 15:29:39 2003-05-13 15:29:47 -ToDecimal 103.491666666667 59.4332135445164 67.3 -ToDouble 103.491666666667 59.4332135445164 67.3 -ToInt16 103 59 67 -ToInt32 103 59 67 -ToInt64 103 59 67 -ToSByte 103 59 67 -ToSingle 103.4917 59.43321 67.3 -ToUInt16 103 59 67 -ToUInt32 103 59 67 -ToUInt64 103 59 67 - -DataSet: [359999.95, 425000, 499999.5, 775000, 1695000] - -Convert:: Default Geometric Mean Median ---------- ------- -------------- ------ -ToBoolean True True True -ToByte 255 255 255 -ToChar ? ? ? -ToDateTime 2003-05-22 08:05:19 2003-05-20 22:54:57 2003-05-19 10:21:59 -ToDecimal 750999.89 631577.237188435 499999.5 -ToDouble 750999.89 631577.237188435 499999.5 -ToInt16 32767 32767 32767 -ToInt32 751000 631577 500000 -ToInt64 751000 631577 500000 -ToSByte 127 127 127 -ToSingle 750999.9 631577.3 499999.5 -ToUInt16 65535 65535 65535 -ToUInt32 751000 631577 500000 -ToUInt64 751000 631577 500000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp deleted file mode 100644 index caf5fe1bc43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; - -void main() -{ - DateTime^ date1 = gcnew DateTime(2008, 6, 1, 7, 47, 0); - Console::WriteLine(date1->ToString()); - - // Get date-only portion of date, without its time. - DateTime dateOnly = date1->Date; - // Display date using short date string. - Console::WriteLine(dateOnly.ToString("d")); - // Display date using 24-hour clock. - Console::WriteLine(dateOnly.ToString("g")); - Console::WriteLine(dateOnly.ToString(L"MM/dd/yyyy HH:mm")); -} -// The example displays the following output to the console: -// 6/1/2008 7:47:00 AM -// 6/1/2008 -// 6/1/2008 12:00 AM -// 06/01/2008 00:00 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp deleted file mode 100644 index 1c991227a37..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp +++ /dev/null @@ -1,31 +0,0 @@ -using namespace System; - -int main() -{ - // - System::DateTime moment = System::DateTime( - 1999, 1, 13, 3, 57, 32, 11 ); - - // Year gets 1999. - int year = moment.Year; - - // Month gets 1 (January). - int month = moment.Month; - - // Day gets 13. - int day = moment.Day; - - // Hour gets 3. - int hour = moment.Hour; - - // Minute gets 57. - int minute = moment.Minute; - - // Second gets 32. - int second = moment.Second; - - // Millisecond gets 11. - int millisecond = moment.Millisecond; - - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp deleted file mode 100644 index 26954f5c7f6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// DateTime.TryParse1.cpp : Defines the entry point for the console application. -// - -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - array^ dateStrings = { "05/01/2009 14:57:32.8", "2009-05-01 14:57:32.8", - "2009-05-01T14:57:32.8375298-04:00", - "5/01/2008 14:57:32.80 -07:00", - "1 May 2008 2:57:32.8 PM", "16-05-2009 1:00:32 PM", - "Fri, 15 May 2009 20:10:57 GMT" }; - DateTime dateValue; - - Console::WriteLine("Attempting to parse strings using {0} culture.", - CultureInfo::CurrentCulture->Name); - for each (String^ dateString in dateStrings) - { - if (DateTime::TryParse(dateString, dateValue)) - Console::WriteLine(" Converted '{0}' to {1} ({2}).", dateString, - dateValue, dateValue.Kind); - else - Console::WriteLine(" Unable to parse '{0}'.", dateString); - } -} -// The example displays the following output: -// Attempting to parse strings using en-US culture. -// Converted '05/01/2009 14:57:32.8' to 5/1/2009 2:57:32 PM (Unspecified). -// Converted '2009-05-01 14:57:32.8' to 5/1/2009 2:57:32 PM (Unspecified). -// Converted '2009-05-01T14:57:32.8375298-04:00' to 5/1/2009 11:57:32 AM (Local). -// Converted '5/01/2008 14:57:32.80 -07:00' to 5/1/2008 2:57:32 PM (Local). -// Converted '1 May 2008 2:57:32.8 PM' to 5/1/2008 2:57:32 PM (Unspecified). -// Unable to parse '16-05-2009 1:00:32 PM'. -// Converted 'Fri, 15 May 2009 20:10:57 GMT' to 5/15/2009 1:10:57 PM (Local). -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp deleted file mode 100644 index 224dd1602e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -// Example of the Decimal::Compare and static Decimal::Equals methods. -using namespace System; -const __wchar_t * protoFmt = L"{0,-45}{1}"; - -// Compare Decimal parameters, and display them with the results. -void CompareDecimals( Decimal Left, Decimal Right, String^ RightText ) -{ - String^ dataFmt = gcnew String( protoFmt ); - Console::WriteLine(); - Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); - Console::WriteLine( dataFmt, "Decimal::Equals( Left, Right )", Decimal::Equals( Left, Right ) ); - Console::WriteLine( dataFmt, "Decimal::Compare( Left, Right )", Decimal::Compare( Left, Right ) ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal::Equals( Decimal, Decimal " - ") and \nDecimal::Compare( Decimal, Decimal ) " - "methods generates the \nfollowing output. It creates " - "several different Decimal \nvalues and compares them " - "with the following reference value.\n" ); - - // Create a reference Decimal value. - Decimal Left = Decimal(123.456); - Console::WriteLine( gcnew String( protoFmt ), "Left: Decimal( 123.456 )", Left ); - - // Create Decimal values to compare with the reference. - CompareDecimals( Left, Decimal(1.2345600E+2), "Decimal( 1.2345600E+2 )" ); - CompareDecimals( Left, Decimal::Parse( "123.4561" ), "Decimal::Parse( \"123.4561\" )" ); - CompareDecimals( Left, Decimal::Parse( "123.4559" ), "Decimal::Parse( \"123.4559\" )" ); - CompareDecimals( Left, Decimal::Parse( "123.456000" ), "Decimal::Parse( \"123.456000\" )" ); - CompareDecimals( Left, Decimal(123456000,0,0,false,6), "Decimal( 123456000, 0, 0, false, 6 )" ); -} - -/* -This example of the Decimal::Equals( Decimal, Decimal ) and -Decimal::Compare( Decimal, Decimal ) methods generates the -following output. It creates several different Decimal -values and compares them with the following reference value. - -Left: Decimal( 123.456 ) 123.456 - -Right: Decimal( 1.2345600E+2 ) 123.456 -Decimal::Equals( Left, Right ) True -Decimal::Compare( Left, Right ) 0 - -Right: Decimal::Parse( "123.4561" ) 123.4561 -Decimal::Equals( Left, Right ) False -Decimal::Compare( Left, Right ) -1 - -Right: Decimal::Parse( "123.4559" ) 123.4559 -Decimal::Equals( Left, Right ) False -Decimal::Compare( Left, Right ) 1 - -Right: Decimal::Parse( "123.456000" ) 123.456000 -Decimal::Equals( Left, Right ) True -Decimal::Compare( Left, Right ) 0 - -Right: Decimal( 123456000, 0, 0, false, 6 ) 123.456000 -Decimal::Equals( Left, Right ) True -Decimal::Compare( Left, Right ) 0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp deleted file mode 100644 index e155f61c420..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the Decimal::CompareTo and Decimal::Equals instance -// methods. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Compare the Decimal to the Object parameters, -// and display the Object parameters with the results. -void CompDecimalToObject( Decimal Left, Object^ Right, String^ RightText ) -{ - Console::WriteLine( "{0,-46}{1}", String::Concat( "Object: ", RightText ), Right ); - Console::WriteLine( "{0,-46}{1}", "Left.Equals( Object )", Left.Equals( Right ) ); - Console::Write( "{0,-46}", "Left.CompareTo( Object )" ); - try - { - - // Catch the exception if CompareTo( ) throws one. - Console::WriteLine( "{0}\n", Left.CompareTo( Right ) ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "{0}\n", GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the Decimal::Equals( Object* ) and \n" - "Decimal::CompareTo( Object* ) methods generates the \n" - "following output. It creates several different " - "Decimal \nvalues and compares them with the following " - "reference value.\n" ); - - // Create a reference Decimal value. - Decimal Left = Decimal(987.654); - Console::WriteLine( "{0,-46}{1}\n", "Left: Decimal( 987.654 )", Left ); - - // Create objects to compare with the reference. - CompDecimalToObject( Left, Decimal(9.8765400E+2), "Decimal( 9.8765400E+2 )" ); - CompDecimalToObject( Left, Decimal::Parse( "987.6541" ), "Decimal::Parse( \"987.6541\" )" ); - CompDecimalToObject( Left, Decimal::Parse( "987.6539" ), "Decimal::Parse( \"987.6539\" )" ); - CompDecimalToObject( Left, Decimal(987654000,0,0,false,6), "Decimal( 987654000, 0, 0, false, 6 )" ); - CompDecimalToObject( Left, 9.8765400E+2, "Double 9.8765400E+2" ); - CompDecimalToObject( Left, "987.654", "String \"987.654\"" ); -} - -/* -This example of the Decimal::Equals( Object* ) and -Decimal::CompareTo( Object* ) methods generates the -following output. It creates several different Decimal -values and compares them with the following reference value. - -Left: Decimal( 987.654 ) 987.654 - -Object: Decimal( 9.8765400E+2 ) 987.654 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: Decimal::Parse( "987.6541" ) 987.6541 -Left.Equals( Object ) False -Left.CompareTo( Object ) -1 - -Object: Decimal::Parse( "987.6539" ) 987.6539 -Left.Equals( Object ) False -Left.CompareTo( Object ) 1 - -Object: Decimal( 987654000, 0, 0, false, 6 ) 987.654000 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: Double 9.8765400E+2 987.654 -Left.Equals( Object ) False -Left.CompareTo( Object ) ArgumentException - -Object: String "987.654" 987.654 -Left.Equals( Object ) False -Left.CompareTo( Object ) ArgumentException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp deleted file mode 100644 index 52935e71178..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp +++ /dev/null @@ -1,117 +0,0 @@ - -// -// Example of the Decimal( int __gc [ ] ) constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( array^bits ) -{ - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {{ 0x{0:X}", bits[ 0 ] ); - String^ valOrExc; - for ( int index = 1; index < bits->Length; index++ ) - ctor = String::Concat( ctor, String::Format( ", 0x{0:X}", bits[ index ] ) ); - ctor = String::Concat( ctor, " } )" ); - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(bits); - - // Format the Decimal value for display. - valOrExc = decimalNum.ToString(); - } - catch ( Exception^ ex ) - { - - // Save the exception type if an exception was thrown. - valOrExc = GetExceptionType( ex ); - } - - - // Display the constructor and Decimal value or exception. - int ctorLen = 76 - valOrExc->Length; - - // Display the data on one line if it will fit. - if ( ctorLen > ctor->Length ) - Console::WriteLine( "{0}{1}", ctor->PadRight( ctorLen ), valOrExc ); - // Otherwise, display the data on two lines. - else - { - Console::WriteLine( "{0}", ctor ); - Console::WriteLine( "{0,76}", valOrExc ); - } -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( int __gc [ ] ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-38}{1,38}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-38}{1,38}", "-----------", "------------------" ); - - // Construct Decimal objects from integer arrays. - array^zero = {0,0,0,0}; - CreateDecimal( zero ); - array^arrayShort = {0,0,0}; - CreateDecimal( arrayShort ); - array^arrayLong = {0,0,0,0,0}; - CreateDecimal( arrayLong ); - array^word0Data = {1000000000,0,0,0}; - CreateDecimal( word0Data ); - array^word1Data = {0,1000000000,0,0}; - CreateDecimal( word1Data ); - array^word2Data = {0,0,1000000000,0}; - CreateDecimal( word2Data ); - array^word3Data = {0,0,0,1000000000}; - CreateDecimal( word3Data ); - array^decMax = { -1,-1,-1,0}; - CreateDecimal( decMax ); - array^decMin = { -1,-1,-1,0x80000000}; - CreateDecimal( decMin ); - array^fracDig16 = { -1,0,0,0x100000}; - CreateDecimal( fracDig16 ); - array^fracDig28 = { -1,0,0,0x1C0000}; - CreateDecimal( fracDig28 ); - array^fracDig29 = { -1,0,0,0x1D0000}; - CreateDecimal( fracDig29 ); - array^reserved = { -1,0,0,0x1C0001}; - CreateDecimal( reserved ); - array^Same4Words = {0xF0000,0xF0000,0xF0000,0xF0000}; - CreateDecimal( Same4Words ); -} - -/* -This example of the Decimal( int __gc [ ] ) constructor -generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( { 0x0, 0x0, 0x0, 0x0 } ) 0 -Decimal( { 0x0, 0x0, 0x0 } ) ArgumentException -Decimal( { 0x0, 0x0, 0x0, 0x0, 0x0 } ) ArgumentException -Decimal( { 0x3B9ACA00, 0x0, 0x0, 0x0 } ) 1000000000 -Decimal( { 0x0, 0x3B9ACA00, 0x0, 0x0 } ) 4294967296000000000 -Decimal( { 0x0, 0x0, 0x3B9ACA00, 0x0 } ) 18446744073709551616000000000 -Decimal( { 0x0, 0x0, 0x0, 0x3B9ACA00 } ) ArgumentException -Decimal( { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0 } ) - 79228162514264337593543950335 -Decimal( { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x80000000 } ) - -79228162514264337593543950335 -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x100000 } ) 0.0000004294967295 -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1C0000 } ) 0.0000000000000000004294967295 -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1D0000 } ) ArgumentException -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1C0001 } ) ArgumentException -Decimal( { 0xF0000, 0xF0000, 0xF0000, 0xF0000 } ) - 18133887298.441562272235520 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp deleted file mode 100644 index c0aef542fb3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp +++ /dev/null @@ -1,108 +0,0 @@ - -// -// Example of the Decimal( int, int, int, bool, unsigned char ) -// constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( int low, int mid, int high, bool isNeg, unsigned char scale ) -{ - - // Format the constructor for display. - array^boxedParams = gcnew array(5); - boxedParams[ 0 ] = low; - boxedParams[ 1 ] = mid; - boxedParams[ 2 ] = high; - boxedParams[ 3 ] = isNeg; - boxedParams[ 4 ] = scale; - String^ ctor = String::Format( "Decimal( {0}, {1}, {2}, {3}, {4} )", boxedParams ); - String^ valOrExc; - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(low,mid,high,isNeg,scale); - - // Format and save the Decimal value. - valOrExc = decimalNum.ToString(); - } - catch ( Exception^ ex ) - { - - // Save the exception type if an exception was thrown. - valOrExc = GetExceptionType( ex ); - } - - - // Display the constructor and Decimal value or exception. - int ctorLen = 76 - valOrExc->Length; - - // Display the data on one line if it will fit. - if ( ctorLen > ctor->Length ) - Console::WriteLine( "{0}{1}", ctor->PadRight( ctorLen ), valOrExc ); - // Otherwise, display the data on two lines. - else - { - Console::WriteLine( "{0}", ctor ); - Console::WriteLine( "{0,76}", valOrExc ); - } -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( int, int, " - "int, bool, unsigned char ) \nconstructor " - "generates the following output.\n" ); - Console::WriteLine( "{0,-38}{1,38}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-38}{1,38}", "-----------", "------------------" ); - - // Construct Decimal objects from double values. - CreateDecimal( 0, 0, 0, false, 0 ); - CreateDecimal( 0, 0, 0, false, 27 ); - CreateDecimal( 0, 0, 0, true, 0 ); - CreateDecimal( 1000000000, 0, 0, false, 0 ); - CreateDecimal( 0, 1000000000, 0, false, 0 ); - CreateDecimal( 0, 0, 1000000000, false, 0 ); - CreateDecimal( 1000000000, 1000000000, 1000000000, false, 0 ); - CreateDecimal( -1, -1, -1, false, 0 ); - CreateDecimal( -1, -1, -1, true, 0 ); - CreateDecimal( -1, -1, -1, false, 15 ); - CreateDecimal( -1, -1, -1, false, 28 ); - CreateDecimal( -1, -1, -1, false, 29 ); - CreateDecimal( Int32::MaxValue, 0, 0, false, 18 ); - CreateDecimal( Int32::MaxValue, 0, 0, false, 28 ); - CreateDecimal( Int32::MaxValue, 0, 0, true, 28 ); -} - -/* -This example of the Decimal( int, int, int, bool, unsigned char ) -constructor generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( 0, 0, 0, False, 0 ) 0 -Decimal( 0, 0, 0, False, 27 ) 0 -Decimal( 0, 0, 0, True, 0 ) 0 -Decimal( 1000000000, 0, 0, False, 0 ) 1000000000 -Decimal( 0, 1000000000, 0, False, 0 ) 4294967296000000000 -Decimal( 0, 0, 1000000000, False, 0 ) 18446744073709551616000000000 -Decimal( 1000000000, 1000000000, 1000000000, False, 0 ) - 18446744078004518913000000000 -Decimal( -1, -1, -1, False, 0 ) 79228162514264337593543950335 -Decimal( -1, -1, -1, True, 0 ) -79228162514264337593543950335 -Decimal( -1, -1, -1, False, 15 ) 79228162514264.337593543950335 -Decimal( -1, -1, -1, False, 28 ) 7.9228162514264337593543950335 -Decimal( -1, -1, -1, False, 29 ) ArgumentOutOfRangeException -Decimal( 2147483647, 0, 0, False, 18 ) 0.000000002147483647 -Decimal( 2147483647, 0, 0, False, 28 ) 0.0000000000000000002147483647 -Decimal( 2147483647, 0, 0, True, 28 ) -0.0000000000000000002147483647 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp deleted file mode 100644 index ecdc7081878..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( int ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( int value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-30}{1,16}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( int ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-30}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-30}{1,16}", "-----------", "-----" ); - - // Construct Decimal objects from int values. - CreateDecimal( Int32::MinValue, "Int32::MinValue" ); - CreateDecimal( Int32::MaxValue, "Int32::MaxValue" ); - CreateDecimal( 0, "0" ); - CreateDecimal( 999999999, "999999999" ); - CreateDecimal( 0x40000000, "0x40000000" ); - CreateDecimal( (int)0xC0000000, "(int)0xC0000000" ); -} - -/* -This example of the Decimal( int ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( Int32::MinValue ) -2147483648 -Decimal( Int32::MaxValue ) 2147483647 -Decimal( 0 ) 0 -Decimal( 999999999 ) 999999999 -Decimal( 0x40000000 ) 1073741824 -Decimal( (int)0xC0000000 ) -1073741824 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp deleted file mode 100644 index 1e66c122bf6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( __int64 ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( __int64 value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-35}{1,22}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( __int64 ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-35}{1,22}", "Constructor", "Value" ); - Console::WriteLine( "{0,-35}{1,22}", "-----------", "-----" ); - - // Construct Decimal objects from __int64 values. - CreateDecimal( Int64::MinValue, "Int64::MinValue" ); - CreateDecimal( Int64::MaxValue, "Int64::MaxValue" ); - CreateDecimal( 0, "0" ); - CreateDecimal( 999999999999999999, "999999999999999999" ); - CreateDecimal( 0x2000000000000000, "0x2000000000000000" ); - CreateDecimal( 0xE000000000000000, "0xE000000000000000" ); -} - -/* -This example of the Decimal( __int64 ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( Int64::MinValue ) -9223372036854775808 -Decimal( Int64::MaxValue ) 9223372036854775807 -Decimal( 0 ) 0 -Decimal( 999999999999999999 ) 999999999999999999 -Decimal( 0x2000000000000000 ) 2305843009213693952 -Decimal( 0xE000000000000000 ) -2305843009213693952 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp deleted file mode 100644 index 4882d3004fb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( unsigned int ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( unsigned int value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-30}{1,16}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( unsigned " - "int ) constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-30}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-30}{1,16}", "-----------", "-----" ); - - // Construct Decimal objects from unsigned int values. - CreateDecimal( UInt32::MinValue, "UInt32::MinValue" ); - CreateDecimal( UInt32::MaxValue, "UInt32::MaxValue" ); - CreateDecimal( Int32::MaxValue, "Int32::MaxValue" ); - CreateDecimal( 999999999, "999999999" ); - CreateDecimal( 0x40000000, "0x40000000" ); - CreateDecimal( 0xC0000000, "0xC0000000" ); -} - -/* -This example of the Decimal( unsigned int ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( UInt32::MinValue ) 0 -Decimal( UInt32::MaxValue ) 4294967295 -Decimal( Int32::MaxValue ) 2147483647 -Decimal( 999999999 ) 999999999 -Decimal( 0x40000000 ) 1073741824 -Decimal( 0xC0000000 ) 3221225472 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp deleted file mode 100644 index d09060bdbb9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( unsigned __int64 ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( unsigned __int64 value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-33}{1,22}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( unsigned " - "__int64 ) constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-33}{1,22}", "Constructor", "Value" ); - Console::WriteLine( "{0,-33}{1,22}", "-----------", "-----" ); - - // Construct Decimal objects from unsigned __int64 values. - CreateDecimal( UInt64::MinValue, "UInt64::MinValue" ); - CreateDecimal( UInt64::MaxValue, "UInt64::MaxValue" ); - CreateDecimal( Int64::MaxValue, "Int64::MaxValue" ); - CreateDecimal( 999999999999999999, "999999999999999999" ); - CreateDecimal( 0x2000000000000000, "0x2000000000000000" ); - CreateDecimal( 0xE000000000000000, "0xE000000000000000" ); -} - -/* -This example of the Decimal( unsigned __int64 ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( UInt64::MinValue ) 0 -Decimal( UInt64::MaxValue ) 18446744073709551615 -Decimal( Int64::MaxValue ) 9223372036854775807 -Decimal( 999999999999999999 ) 999999999999999999 -Decimal( 0x2000000000000000 ) 2305843009213693952 -Decimal( 0xE000000000000000 ) 16140901064495857664 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp deleted file mode 100644 index 3ffa533351d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -// Example of the Decimal( double ) constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( double value, String^ valToStr ) -{ - - // Format and display the constructor. - Console::Write( "{0,-34}", String::Format( "Decimal( {0} )", valToStr ) ); - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(value); - - // Display the value if it was created successfully. - Console::WriteLine( "{0,31}", decimalNum ); - } - catch ( Exception^ ex ) - { - - // Display the exception type if an exception was thrown. - Console::WriteLine( "{0,31}", GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( double ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-34}{1,31}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-34}{1,31}", "-----------", "------------------" ); - - // Construct Decimal objects from double values. - CreateDecimal( 1.23456789E+5, "1.23456789E+5" ); - CreateDecimal( 1.234567890123E+15, "1.234567890123E+15" ); - CreateDecimal( 1.2345678901234567E+25, "1.2345678901234567E+25" ); - CreateDecimal( 1.2345678901234567E+35, "1.2345678901234567E+35" ); - CreateDecimal( 1.23456789E-5, "1.23456789E-5" ); - CreateDecimal( 1.234567890123E-15, "1.234567890123E-15" ); - CreateDecimal( 1.2345678901234567E-25, "1.2345678901234567E-25" ); - CreateDecimal( 1.2345678901234567E-35, "1.2345678901234567E-35" ); - CreateDecimal( 1.0 / 7.0, "1.0 / 7.0" ); -} - -/* -This example of the Decimal( double ) constructor -generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( 1.23456789E+5 ) 123456.789 -Decimal( 1.234567890123E+15 ) 1234567890123000 -Decimal( 1.2345678901234567E+25 ) 12345678901234600000000000 -Decimal( 1.2345678901234567E+35 ) OverflowException -Decimal( 1.23456789E-5 ) 0.0000123456789 -Decimal( 1.234567890123E-15 ) 0.000000000000001234567890123 -Decimal( 1.2345678901234567E-25 ) 0.0000000000000000000000001235 -Decimal( 1.2345678901234567E-35 ) 0 -Decimal( 1.0 / 7.0 ) 0.142857142857143 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp deleted file mode 100644 index f2052b72799..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -// Example of the Decimal( float ) constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( float value, String^ valToStr ) -{ - - // Format and display the constructor. - Console::Write( "{0,-27}", String::Format( "Decimal( {0} )", valToStr ) ); - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(value); - - // Display the value if it was created successfully. - Console::WriteLine( "{0,31}", decimalNum ); - } - catch ( Exception^ ex ) - { - - // Display the exception type if an exception was thrown. - Console::WriteLine( "{0,31}", GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( float ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-27}{1,31}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-27}{1,31}", "-----------", "------------------" ); - - // Construct Decimal objects from float values. - CreateDecimal( 1.2345E+5, "1.2345E+5" ); - CreateDecimal( 1.234567E+15, "1.234567E+15" ); - CreateDecimal( 1.23456789E+25, "1.23456789E+25" ); - CreateDecimal( 1.23456789E+35, "1.23456789E+35" ); - CreateDecimal( 1.2345E-5, "1.2345E-5" ); - CreateDecimal( 1.234567E-15, "1.234567E-15" ); - CreateDecimal( 1.23456789E-25, "1.23456789E-25" ); - CreateDecimal( 1.23456789E-35, "1.23456789E-35" ); - CreateDecimal( 1.0 / 7.0, "1.0 / 7.0" ); -} - -/* -This example of the Decimal( float ) constructor -generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( 1.2345E+5 ) 123450 -Decimal( 1.234567E+15 ) 1234567000000000 -Decimal( 1.23456789E+25 ) 12345680000000000000000000 -Decimal( 1.23456789E+35 ) OverflowException -Decimal( 1.2345E-5 ) 0.000012345 -Decimal( 1.234567E-15 ) 0.000000000000001234567 -Decimal( 1.23456789E-25 ) 0.0000000000000000000000001235 -Decimal( 1.23456789E-35 ) 0 -Decimal( 1.0 / 7.0 ) 0.1428571 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp deleted file mode 100644 index 7f0743a1a5e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -// Example of the Decimal fields. -using namespace System; -int main() -{ - String^ numberFmt = "{0,-25}{1,45:N0}"; - String^ exprFmt = "{0,-55}{1,15}"; - Console::WriteLine( "This example of the fields of the Decimal structure " - "\ngenerates the following output.\n" ); - Console::WriteLine( numberFmt, "Field or Expression", "Value" ); - Console::WriteLine( numberFmt, "-------------------", "-----" ); - - // Display the values of the Decimal fields. - Console::WriteLine( numberFmt, "Decimal::MaxValue", Decimal::MaxValue ); - Console::WriteLine( numberFmt, "Decimal::MinValue", Decimal::MinValue ); - Console::WriteLine( numberFmt, "Decimal::MinusOne", Decimal::MinusOne ); - Console::WriteLine( numberFmt, "Decimal::One", Decimal::One ); - Console::WriteLine( numberFmt, "Decimal::Zero", Decimal::Zero ); - Console::WriteLine(); - - // Display the values of expressions of the Decimal fields. - Console::WriteLine( exprFmt, "( Decimal::MinusOne + Decimal::One ) == Decimal::Zero", (Decimal::MinusOne + Decimal::One) == Decimal::Zero ); - Console::WriteLine( exprFmt, "Decimal::MaxValue + Decimal::MinValue", Decimal::MaxValue + Decimal::MinValue ); - Console::WriteLine( exprFmt, "Decimal::MinValue / Decimal::MaxValue", Decimal::MinValue / Decimal::MaxValue ); - Console::WriteLine( "{0,-40}{1,30}", "100000000000000M / Decimal::MaxValue", Convert::ToDecimal( 100000000000000 ) / Decimal::MaxValue ); -} - -/* -This example of the fields of the Decimal structure -generates the following output. - -Field or Expression Value -------------------- ----- -Decimal::MaxValue 79,228,162,514,264,337,593,543,950,335 -Decimal::MinValue -79,228,162,514,264,337,593,543,950,335 -Decimal::MinusOne -1 -Decimal::One 1 -Decimal::Zero 0 - -( Decimal::MinusOne + Decimal::One ) == Decimal::Zero True -Decimal::MaxValue + Decimal::MinValue 0 -Decimal::MinValue / Decimal::MaxValue -1 -100000000000000M / Decimal::MaxValue 0.0000000000000012621774483536 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp deleted file mode 100644 index 5ec1281cf67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example of the Decimal::Negate, Decimal::Floor, and -// Decimal::Truncate methods. -using namespace System; - -// Display Decimal parameters and the method results. -void ShowDecimalFloorNegTrunc( Decimal Argument ) -{ - String^ dataFmt = "{0,-30}{1,26}"; - Console::WriteLine(); - Console::WriteLine( dataFmt, "Decimal Argument", Argument ); - Console::WriteLine( dataFmt, "Decimal::Negate( Argument )", Decimal::Negate( Argument ) ); - Console::WriteLine( dataFmt, "Decimal::Floor( Argument )", Decimal::Floor( Argument ) ); - Console::WriteLine( dataFmt, "Decimal::Truncate( Argument )", Decimal::Truncate( Argument ) ); -} - -int main() -{ - Console::WriteLine( "This example of the \n" - " Decimal::Negate( Decimal ), \n" - " Decimal::Floor( Decimal ), and \n" - " Decimal::Truncate( Decimal ) \n" - "methods generates the following output." ); - - // Create pairs of Decimal objects. - ShowDecimalFloorNegTrunc( Decimal::Parse( "0" ) ); - ShowDecimalFloorNegTrunc( Decimal::Parse( "123.456" ) ); - ShowDecimalFloorNegTrunc( Decimal::Parse( "-123.456" ) ); - ShowDecimalFloorNegTrunc( Decimal(1230000000,0,0,true,7) ); - ShowDecimalFloorNegTrunc( Decimal::Parse( "-9999999999.9999999999" ) ); -} - -/* -This example of the - Decimal::Negate( Decimal ), - Decimal::Floor( Decimal ), and - Decimal::Truncate( Decimal ) -methods generates the following output. - -Decimal Argument 0 -Decimal::Negate( Argument ) 0 -Decimal::Floor( Argument ) 0 -Decimal::Truncate( Argument ) 0 - -Decimal Argument 123.456 -Decimal::Negate( Argument ) -123.456 -Decimal::Floor( Argument ) 123 -Decimal::Truncate( Argument ) 123 - -Decimal Argument -123.456 -Decimal::Negate( Argument ) 123.456 -Decimal::Floor( Argument ) -124 -Decimal::Truncate( Argument ) -123 - -Decimal Argument -123.0000000 -Decimal::Negate( Argument ) 123.0000000 -Decimal::Floor( Argument ) -123 -Decimal::Truncate( Argument ) -123 - -Decimal Argument -9999999999.9999999999 -Decimal::Negate( Argument ) 9999999999.9999999999 -Decimal::Floor( Argument ) -10000000000 -Decimal::Truncate( Argument ) -9999999999 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp deleted file mode 100644 index ac862b815f9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -using namespace System; - -int main() -{ - // Define an array of Decimal values. - array^ values = gcnew array { Decimal::One, - Decimal::Parse("100000000000000"), - Decimal::Parse("10000000000000000000000000000"), - Decimal::Parse("100000000000000.00000000000000"), - Decimal::Parse("1.0000000000000000000000000000"), - Decimal::Parse("123456789"), - Decimal::Parse("0.123456789"), - Decimal::Parse("0.000000000123456789"), - Decimal::Parse("0.000000000000000000123456789"), - Decimal::Parse("4294967295.0"), - Decimal::Parse("18446744073709551615.0"), - Decimal::MaxValue, Decimal::MinValue, - Decimal::Parse("-7.9228162514264337593543950335") }; - - Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", - "Argument", "Bits[3]", "Bits[2]", "Bits[1]", "Bits[0]" ); - Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", - "--------", "-------", "-------", "-------", "-------" ); - - for each (Decimal value in values) - { - array^ bits = Decimal::GetBits(value); - Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", - value, bits[3], bits[2], bits[1], bits[0] ); - } -} - -/* -This example of the Decimal::GetBits( Decimal ) method -generates the following output. It displays the argument -as a Decimal and the result array in hexadecimal. - - Argument Bits[3] Bits[2] Bits[1] Bits[0] - -------- ------- ------- ------- ------- - 1 00000000 00000000 00000000 00000001 - 100000000000000 00000000 00000000 00005AF3 107A4000 - 10000000000000000000000000000 00000000 204FCE5E 3E250261 10000000 - 100000000000000.00000000000000 000E0000 204FCE5E 3E250261 10000000 - 1.0000000000000000000000000000 001C0000 204FCE5E 3E250261 10000000 - 123456789 00000000 00000000 00000000 075BCD15 - 0.123456789 00090000 00000000 00000000 075BCD15 - 0.000000000123456789 00120000 00000000 00000000 075BCD15 - 0.000000000000000000123456789 001B0000 00000000 00000000 075BCD15 - 4294967295 00000000 00000000 00000000 FFFFFFFF - 18446744073709551615 00000000 00000000 FFFFFFFF FFFFFFFF - 79228162514264337593543950335 00000000 FFFFFFFF FFFFFFFF FFFFFFFF - -79228162514264337593543950335 80000000 FFFFFFFF FFFFFFFF FFFFFFFF --7.9228162514264337593543950335 801C0000 FFFFFFFF FFFFFFFF FFFFFFFF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp deleted file mode 100644 index f99684b6727..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -// Example of the Decimal::GetTypeCode method. -using namespace System; -int main() -{ - Console::WriteLine( "This example of the " - "Decimal::GetTypeCode( ) \nmethod " - "generates the following output.\n" ); - - // Create a Decimal object and get its type code. - Decimal aDecimal = Decimal(1.0); - TypeCode typCode = aDecimal.GetTypeCode(); - Console::WriteLine( "Type Code: \"{0}\"", typCode ); - Console::WriteLine( "Numeric value: {0}", (int)typCode ); -} - -/* -This example of the Decimal::GetTypeCode( ) -method generates the following output. - -Type Code: "Decimal" -Numeric value: 15 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp deleted file mode 100644 index ec780d29082..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -// Example of the Decimal::Multiply, Decimal::Divide, and -// Decimal::Remainder methods. -using namespace System; - -// Display Decimal parameters and their product, quotient, and -// remainder. -void ShowDecimalProQuoRem( Decimal Left, Decimal Right ) -{ - String^ dataFmt = "{0,-35}{1,31}"; - Console::WriteLine(); - Console::WriteLine( dataFmt, "Decimal Left", Left ); - Console::WriteLine( dataFmt, "Decimal Right", Right ); - Console::WriteLine( dataFmt, "Decimal::Multiply( Left, Right )", Decimal::Multiply( Left, Right ) ); - Console::WriteLine( dataFmt, "Decimal::Divide( Left, Right )", Decimal::Divide( Left, Right ) ); - Console::WriteLine( dataFmt, "Decimal::Remainder( Left, Right )", Decimal::Remainder( Left, Right ) ); -} - -int main() -{ - Console::WriteLine( "This example of the \n" - " Decimal::Multiply( Decimal, Decimal ), \n" - " Decimal::Divide( Decimal, Decimal ), and \n" - " Decimal::Remainder( Decimal, Decimal ) \n" - "methods generates the following output. It displays " - "the product, \nquotient, and remainder of several " - "pairs of Decimal objects." ); - - // Create pairs of Decimal objects. - ShowDecimalProQuoRem( Decimal::Parse( "1000" ), Decimal::Parse( "7" ) ); - ShowDecimalProQuoRem( Decimal::Parse( "-1000" ), Decimal::Parse( "7" ) ); - ShowDecimalProQuoRem( Decimal(1230000000,0,0,false,7), Decimal::Parse( "0.0012300" ) ); - ShowDecimalProQuoRem( Decimal::Parse( "12345678900000000" ), Decimal::Parse( "0.0000000012345678" ) ); - ShowDecimalProQuoRem( Decimal::Parse( "123456789.0123456789" ), Decimal::Parse( "123456789.1123456789" ) ); -} - -/* -This example of the - Decimal::Multiply( Decimal, Decimal ), - Decimal::Divide( Decimal, Decimal ), and - Decimal::Remainder( Decimal, Decimal ) -methods generates the following output. It displays the product, -quotient, and remainder of several pairs of Decimal objects. - -Decimal Left 1000 -Decimal Right 7 -Decimal::Multiply( Left, Right ) 7000 -Decimal::Divide( Left, Right ) 142.85714285714285714285714286 -Decimal::Remainder( Left, Right ) 6 - -Decimal Left -1000 -Decimal Right 7 -Decimal::Multiply( Left, Right ) -7000 -Decimal::Divide( Left, Right ) -142.85714285714285714285714286 -Decimal::Remainder( Left, Right ) -6 - -Decimal Left 123.0000000 -Decimal Right 0.0012300 -Decimal::Multiply( Left, Right ) 0.15129000000000 -Decimal::Divide( Left, Right ) 100000 -Decimal::Remainder( Left, Right ) 0 - -Decimal Left 12345678900000000 -Decimal Right 0.0000000012345678 -Decimal::Multiply( Left, Right ) 15241577.6390794200000000 -Decimal::Divide( Left, Right ) 10000000729000059778004901.796 -Decimal::Remainder( Left, Right ) 0.000000000983 - -Decimal Left 123456789.0123456789 -Decimal Right 123456789.1123456789 -Decimal::Multiply( Left, Right ) 15241578765584515.651425087878 -Decimal::Divide( Left, Right ) 0.9999999991899999933660999449 -Decimal::Remainder( Left, Right ) 123456789.0123456789 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp deleted file mode 100644 index 2447a44f013..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// Example of the Decimal::FromOACurrency method. -using namespace System; -#define dataFmt "{0,21}{1,25}" - -// Display the Decimal::FromOACurrency parameter and Decimal result. -void ShowDecimalFromOACurrency( __int64 Argument ) -{ - Decimal decCurrency = Decimal::FromOACurrency( Argument ); - Console::WriteLine( dataFmt, Argument, decCurrency ); -} - -int main() -{ - Console::WriteLine( "This example of the " - "Decimal::FromOACurrency( ) method generates \nthe " - "following output. It displays the OLE Automation " - "Currency \nvalue as an __int64 and the result as a " - "Decimal.\n" ); - Console::WriteLine( dataFmt, "OA Currency", "Decimal Value" ); - Console::WriteLine( dataFmt, "-----------", "-------------" ); - - // Convert OLE Automation Currency values to Decimal objects. - ShowDecimalFromOACurrency( 0L ); - ShowDecimalFromOACurrency( 1L ); - ShowDecimalFromOACurrency( 100000L ); - ShowDecimalFromOACurrency( 100000000000L ); - ShowDecimalFromOACurrency( 1000000000000000000L ); - ShowDecimalFromOACurrency( 1000000000000000001L ); - ShowDecimalFromOACurrency( Int64::MaxValue ); - ShowDecimalFromOACurrency( Int64::MinValue ); - ShowDecimalFromOACurrency( 123456789L ); - ShowDecimalFromOACurrency( 1234567890000L ); - ShowDecimalFromOACurrency( 1234567890987654321 ); - ShowDecimalFromOACurrency( 4294967295L ); -} - -/* -This example of the Decimal::FromOACurrency( ) method generates -the following output. It displays the OLE Automation Currency -value as an __int64 and the result as a Decimal. - - OA Currency Decimal Value - ----------- ------------- - 0 0 - 1 0.0001 - 100000 10 - 100000000000 10000000 - 1000000000000000000 100000000000000 - 1000000000000000001 100000000000000.0001 - 9223372036854775807 922337203685477.5807 - -9223372036854775808 -922337203685477.5808 - 123456789 12345.6789 - 1234567890000 123456789 - 1234567890987654321 123456789098765.4321 - 4294967295 429496.7295 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp deleted file mode 100644 index 047800b7566..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -// Example of the Decimal::ToOACurrency method. -using namespace System; -#define dataFmt "{0,31}{1,27}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Display the Decimal::ToOACurrency parameter and the result -// or exception. -void ShowDecimalToOACurrency( Decimal Argument ) -{ - - // Catch the exception if ToOACurrency( ) throws one. - try - { - __int64 oaCurrency = Decimal::ToOACurrency( Argument ); - Console::WriteLine( dataFmt, Argument, oaCurrency ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( dataFmt, Argument, GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the " - "Decimal::ToOACurrency( ) method generates \nthe " - "following output. It displays the argument as a " - "Decimal \nand the OLE Automation Currency value " - "as an __int64.\n" ); - Console::WriteLine( dataFmt, "Argument", "OA Currency or Exception" ); - Console::WriteLine( dataFmt, "--------", "------------------------" ); - - // Convert Decimal values to OLE Automation Currency values. - ShowDecimalToOACurrency( Decimal(0) ); - ShowDecimalToOACurrency( Decimal(1) ); - ShowDecimalToOACurrency( Decimal::Parse( "1.0000000000000000000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "100000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "100000000000000.00000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "10000000000000000000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "0.000000000123456789" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "0.123456789" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "123456789" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "123456789000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "4294967295" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "18446744073709551615" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "-79.228162514264337593543950335" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "-79228162514264.337593543950335" ) ); -} - -/* -This example of the Decimal::ToOACurrency( ) method generates -the following output. It displays the argument as a Decimal -and the OLE Automation Currency value as an __int64. - - Argument OA Currency or Exception - -------- ------------------------ - 0 0 - 1 10000 - 1.0000000000000000000000000000 10000 - 100000000000000 1000000000000000000 - 100000000000000.00000000000000 1000000000000000000 - 10000000000000000000000000000 OverflowException - 0.000000000123456789 0 - 0.123456789 1235 - 123456789 1234567890000 - 123456789000000000 OverflowException - 4294967295 42949672950000 - 18446744073709551615 OverflowException --79.228162514264337593543950335 -792282 --79228162514264.337593543950335 -792281625142643376 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp deleted file mode 100644 index 9aec6164459..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -// -// Example of the Decimal::ToSingle and Decimal::ToDouble methods. -using namespace System; -#define formatter "{0,30}{1,17}{2,23}" - -// Convert the Decimal argument; no exceptions are thrown. -void DecimalToSgl_Dbl( Decimal argument ) -{ - Object^ SingleValue; - Object^ DoubleValue; - - // Convert the argument to a float value. - SingleValue = Decimal::ToSingle( argument ); - - // Convert the argument to a double value. - DoubleValue = Decimal::ToDouble( argument ); - Console::WriteLine( formatter, argument, SingleValue, DoubleValue ); -} - -int main() -{ - Console::WriteLine( "This example of the \n" - " Decimal::ToSingle( Decimal ) and \n" - " Decimal::ToDouble( Decimal ) \nmethods " - "generates the following output. It \ndisplays " - "several converted Decimal values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "float", "double" ); - Console::WriteLine( formatter, "----------------", "-----", "------" ); - - // Convert Decimal values and display the results. - DecimalToSgl_Dbl( Decimal::Parse( "0.0000000000000000000000000001" ) ); - DecimalToSgl_Dbl( Decimal::Parse( "0.0000000000123456789123456789" ) ); - DecimalToSgl_Dbl( Decimal::Parse( "123" ) ); - DecimalToSgl_Dbl( Decimal(123000000,0,0,false,6) ); - DecimalToSgl_Dbl( Decimal::Parse( "123456789.123456789" ) ); - DecimalToSgl_Dbl( Decimal::Parse( "123456789123456789123456789" ) ); - DecimalToSgl_Dbl( Decimal::MinValue ); - DecimalToSgl_Dbl( Decimal::MaxValue ); -} - -/* -This example of the - Decimal::ToSingle( Decimal ) and - Decimal::ToDouble( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument float double - ---------------- ----- ------ -0.0000000000000000000000000001 1E-28 1E-28 -0.0000000000123456789123456789 1.234568E-11 1.23456789123457E-11 - 123 123 123 - 123.000000 123 123 - 123456789.123456789 1.234568E+08 123456789.123457 - 123456789123456789123456789 1.234568E+26 1.23456789123457E+26 --79228162514264337593543950335 -7.922816E+28 -7.92281625142643E+28 - 79228162514264337593543950335 7.922816E+28 7.92281625142643E+28 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp deleted file mode 100644 index b208ee69e6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// ToStringCPP.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -int main(array ^args) -{ - double value = 16325.62901; - String^ specifier; - CultureInfo^ culture; - - // Use standard numeric format specifiers. - specifier = "G"; - culture = CultureInfo::CreateSpecificCulture("eu-ES"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16325,62901 - Console::WriteLine(value.ToString(specifier, CultureInfo::InvariantCulture)); - // Displays: 16325.62901 - - specifier = "C"; - culture = CultureInfo::CreateSpecificCulture("en-US"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: $16,325.63 - culture = CultureInfo::CreateSpecificCulture("en-GB"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: £16,325.63 - - specifier = "E04"; - culture = CultureInfo::CreateSpecificCulture("sv-SE"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 1,6326E+004 - culture = CultureInfo::CreateSpecificCulture("en-NZ"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 1.6326E+004 - - specifier = "F"; - culture = CultureInfo::CreateSpecificCulture("fr-FR"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16325,63 - culture = CultureInfo::CreateSpecificCulture("en-CA"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16325.63 - - specifier = "N"; - culture = CultureInfo::CreateSpecificCulture("es-ES"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16.325,63 - culture = CultureInfo::CreateSpecificCulture("fr-CA"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16 325,63 - - specifier = "P"; - culture = CultureInfo::InvariantCulture; - Console::WriteLine((value/10000).ToString(specifier, culture)); - // Displays: 163.26 % - culture = CultureInfo::CreateSpecificCulture("ar-EG"); - Console::WriteLine((value/10000).ToString(specifier, culture)); - // Displays: 163.256 % - - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp deleted file mode 100644 index 69e9a30d33e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp +++ /dev/null @@ -1,223 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ numbers= {1054.32179, -195489100.8377, 1.0437E21, - -1.0573e-05}; - array^ specifiers = { "C", "E", "e", "F", "G", "N", "P", - "R", "#,000.000", "0.###E-000", - "000,000,000,000.00###" }; - for each (Double number in numbers) - { - Console::WriteLine("Formatting of {0}:", number); - for each (String^ specifier in specifiers) { - Console::WriteLine(" {0,-22} {1}", - specifier + ":", number.ToString(specifier)); - // Add precision specifiers from 0 to 3. - if (specifier->Length == 1 & ! specifier->Equals("R")) { - for (int precision = 0; precision <= 3; precision++) { - String^ pSpecifier = String::Format("{0}{1}", specifier, precision); - Console::WriteLine(" {0,-22} {1}", - pSpecifier + ":", number.ToString(pSpecifier)); - } - Console::WriteLine(); - } - } - Console::WriteLine(); - } -} -// The example displays the following output: -// Formatting of 1054.32179: -// C: $1,054.32 -// C0: $1,054 -// C1: $1,054.3 -// C2: $1,054.32 -// C3: $1,054.322 -// -// E: 1.054322E+003 -// E0: 1E+003 -// E1: 1.1E+003 -// E2: 1.05E+003 -// E3: 1.054E+003 -// -// e: 1.054322e+003 -// e0: 1e+003 -// e1: 1.1e+003 -// e2: 1.05e+003 -// e3: 1.054e+003 -// -// F: 1054.32 -// F0: 1054 -// F1: 1054.3 -// F2: 1054.32 -// F3: 1054.322 -// -// G: 1054.32179 -// G0: 1054.32179 -// G1: 1E+03 -// G2: 1.1E+03 -// G3: 1.05E+03 -// -// N: 1,054.32 -// N0: 1,054 -// N1: 1,054.3 -// N2: 1,054.32 -// N3: 1,054.322 -// -// P: 105,432.18 % -// P0: 105,432 % -// P1: 105,432.2 % -// P2: 105,432.18 % -// P3: 105,432.179 % -// -// R: 1054.32179 -// #,000.000: 1,054.322 -// 0.###E-000: 1.054E003 -// 000,000,000,000.00###: 000,000,001,054.32179 -// -// Formatting of -195489100.8377: -// C: ($195,489,100.84) -// C0: ($195,489,101) -// C1: ($195,489,100.8) -// C2: ($195,489,100.84) -// C3: ($195,489,100.838) -// -// E: -1.954891E+008 -// E0: -2E+008 -// E1: -2.0E+008 -// E2: -1.95E+008 -// E3: -1.955E+008 -// -// e: -1.954891e+008 -// e0: -2e+008 -// e1: -2.0e+008 -// e2: -1.95e+008 -// e3: -1.955e+008 -// -// F: -195489100.84 -// F0: -195489101 -// F1: -195489100.8 -// F2: -195489100.84 -// F3: -195489100.838 -// -// G: -195489100.8377 -// G0: -195489100.8377 -// G1: -2E+08 -// G2: -2E+08 -// G3: -1.95E+08 -// -// N: -195,489,100.84 -// N0: -195,489,101 -// N1: -195,489,100.8 -// N2: -195,489,100.84 -// N3: -195,489,100.838 -// -// P: -19,548,910,083.77 % -// P0: -19,548,910,084 % -// P1: -19,548,910,083.8 % -// P2: -19,548,910,083.77 % -// P3: -19,548,910,083.770 % -// -// R: -195489100.8377 -// #,000.000: -195,489,100.838 -// 0.###E-000: -1.955E008 -// 000,000,000,000.00###: -000,195,489,100.8377 -// -// Formatting of 1.0437E+21: -// C: $1,043,700,000,000,000,000,000.00 -// C0: $1,043,700,000,000,000,000,000 -// C1: $1,043,700,000,000,000,000,000.0 -// C2: $1,043,700,000,000,000,000,000.00 -// C3: $1,043,700,000,000,000,000,000.000 -// -// E: 1.043700E+021 -// E0: 1E+021 -// E1: 1.0E+021 -// E2: 1.04E+021 -// E3: 1.044E+021 -// -// e: 1.043700e+021 -// e0: 1e+021 -// e1: 1.0e+021 -// e2: 1.04e+021 -// e3: 1.044e+021 -// -// F: 1043700000000000000000.00 -// F0: 1043700000000000000000 -// F1: 1043700000000000000000.0 -// F2: 1043700000000000000000.00 -// F3: 1043700000000000000000.000 -// -// G: 1.0437E+21 -// G0: 1.0437E+21 -// G1: 1E+21 -// G2: 1E+21 -// G3: 1.04E+21 -// -// N: 1,043,700,000,000,000,000,000.00 -// N0: 1,043,700,000,000,000,000,000 -// N1: 1,043,700,000,000,000,000,000.0 -// N2: 1,043,700,000,000,000,000,000.00 -// N3: 1,043,700,000,000,000,000,000.000 -// -// P: 104,370,000,000,000,000,000,000.00 % -// P0: 104,370,000,000,000,000,000,000 % -// P1: 104,370,000,000,000,000,000,000.0 % -// P2: 104,370,000,000,000,000,000,000.00 % -// P3: 104,370,000,000,000,000,000,000.000 % -// -// R: 1.0437E+21 -// #,000.000: 1,043,700,000,000,000,000,000.000 -// 0.###E-000: 1.044E021 -// 000,000,000,000.00###: 1,043,700,000,000,000,000,000.00 -// -// Formatting of -1.0573E-05: -// C: $0.00 -// C0: $0 -// C1: $0.0 -// C2: $0.00 -// C3: $0.000 -// -// E: -1.057300E-005 -// E0: -1E-005 -// E1: -1.1E-005 -// E2: -1.06E-005 -// E3: -1.057E-005 -// -// e: -1.057300e-005 -// e0: -1e-005 -// e1: -1.1e-005 -// e2: -1.06e-005 -// e3: -1.057e-005 -// -// F: 0.00 -// F0: 0 -// F1: 0.0 -// F2: 0.00 -// F3: 0.000 -// -// G: -1.0573E-05 -// G0: -1.0573E-05 -// G1: -1E-05 -// G2: -1.1E-05 -// G3: -1.06E-05 -// -// N: 0.00 -// N0: 0 -// N1: 0.0 -// N2: 0.00 -// N3: 0.000 -// -// P: 0.00 % -// P0: 0 % -// P1: 0.0 % -// P2: 0.00 % -// P3: -0.001 % -// -// R: -1.0573E-05 -// #,000.000: 000.000 -// 0.###E-000: -1.057E-005 -// 000,000,000,000.00###: -000,000,000,000.00001 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp deleted file mode 100644 index 7d153608b4c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp +++ /dev/null @@ -1,150 +0,0 @@ -using namespace System; - -int main() -{ - // - Double d = 4.55; - // - - // - Console::WriteLine( "A double is of type {0}.", d.GetType() ); - // - - // - bool done = false; - String^ inp; - do - { - Console::Write( "Enter a real number: " ); - inp = Console::ReadLine(); - try - { - d = Double::Parse( inp ); - Console::WriteLine( "You entered {0}.", d ); - done = true; - } - catch ( FormatException^ ) - { - Console::WriteLine( "You did not enter a number." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred while parsing your response: {0}", e ); - } - - } - while ( !done ); - // - - // - if ( d > Double::MaxValue ) - { - Console::WriteLine( "Your number is bigger than a double." ); - } - // - - // - if ( d < Double::MinValue ) - { - Console::WriteLine( "Your number is smaller than a double." ); - } - // - - // - Console::WriteLine( "Epsilon, or the permittivity of a vacuum, has value {0}", Double::Epsilon ); - // - - // - Double zero = 0; - - // This condition will return false. - if ( (0 / zero) == Double::NaN ) - { - Console::WriteLine( "0 / 0 can be tested with Double::NaN." ); - } - else - { - Console::WriteLine( "0 / 0 cannot be tested with Double::NaN; use Double::IsNan() instead." ); - } - // - - // - // This will return true. - if ( Double::IsNaN( 0 / zero ) ) - { - Console::WriteLine( "Double::IsNan() can determine whether a value is not-a-number." ); - } - // - - // - // This will equal Infinity. - Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Double::NegativeInfinity) ); - // - - // - // This will equal Infinity. - Console::WriteLine( "PositiveInfinity plus 10.0 equals {0}.", (Double::PositiveInfinity + 10.0) ); - // - - // - // This will return S"true". - Console::WriteLine( "IsInfinity(3.0 / 0) == {0}.", Double::IsInfinity( 3.0 / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return S"true". - Console::WriteLine( "IsPositiveInfinity(4.0 / 0) == {0}.", Double::IsPositiveInfinity( 4.0 / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return S"true". - Console::WriteLine( "IsNegativeInfinity(-5.0 / 0) == {0}.", Double::IsNegativeInfinity( -5.0 / zero ) ? (String^)"true" : "false" ); - // - - // - Double a; - a = 500; - Object^ obj1; - // - - // - // The variables point to the same objects. - Object^ obj2; - obj1 = a; - obj2 = obj1; - if ( Double::ReferenceEquals( obj1, obj2 ) ) - { - Console::WriteLine( "The variables point to the same double object." ); - } - else - { - Console::WriteLine( "The variables point to different double objects." ); - } - // - - // - obj1 = (Double)450; - if ( a.CompareTo( obj1 ) < 0 ) - { - Console::WriteLine( "{0} is less than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) > 0 ) - { - Console::WriteLine( "{0} is greater than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) == 0 ) - { - Console::WriteLine( "{0} equals {1}.", a, obj1 ); - } - // - - // - obj1 = (Double)500; - if ( a.Equals( obj1 ) ) - { - Console::WriteLine( "The value type and reference type values are equal." ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp deleted file mode 100644 index 9a426f16689..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -void main() -{ - if (Environment::OSVersion->Platform == PlatformID::Win32NT) - { - // Change the directory to %WINDIR% - Environment::CurrentDirectory = Environment::GetEnvironmentVariable( "windir" ); - DirectoryInfo^ info = gcnew DirectoryInfo( "." ); - - Console::WriteLine("Directory Info: {0}", info->FullName); - } - else - { - Console::WriteLine("This example runs on Windows only."); - } -} -// The example displays output like the following on a .NET implementation running on Windows: -// Directory Info: C:\windows -// The example displays the following output on a .NET implementation on Unix-based systems: -// This example runs on Windows only. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp deleted file mode 100644 index dcea5c7890b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp +++ /dev/null @@ -1,108 +0,0 @@ - -// -// Example for the Exception( ) constructor. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception with a predefined message. - public ref class NotEvenException: public Exception - { - public: - NotEvenException() - : Exception( "The argument to a function requiring " - "even input is not divisible by 2." ) - {} - - }; - - - // Half throws a base exception if the input is not even. - int Half( int input ) - { - if ( input % 2 != 0 ) - throw gcnew Exception; - else - return input / 2; - } - - - // Half2 throws a derived exception if the input is not even. - int Half2( int input ) - { - if ( input % 2 != 0 ) - throw gcnew NotEvenException; - else - return input / 2; - } - - - // CalcHalf calls Half and catches any thrown exceptions. - void CalcHalf( int input ) - { - try - { - int halfInput = Half( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - - - // CalcHalf2 calls Half2 and catches any thrown exceptions. - void CalcHalf2( int input ) - { - try - { - int halfInput = Half2( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of the Exception( ) constructor " - "generates the following output." ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "parameterless constructor of the base class.\n" ); - NDP_UE_CPP::CalcHalf( 12 ); - NDP_UE_CPP::CalcHalf( 15 ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "parameterless constructor of a derived class.\n" ); - NDP_UE_CPP::CalcHalf2( 24 ); - NDP_UE_CPP::CalcHalf2( 27 ); -} - -/* -This example of the Exception( ) constructor generates the following output. - -Here, an exception is thrown using the -parameterless constructor of the base class. - -Half of 12 is 6. -System.Exception: Exception of type System.Exception was thrown. - at NDP_UE_CPP.Half(Int32 input) - at NDP_UE_CPP.CalcHalf(Int32 input) - -Here, an exception is thrown using the -parameterless constructor of a derived class. - -Half of 24 is 12. -NDP_UE_CPP.NotEvenException: The argument to a function requiring even input is - not divisible by 2. - at NDP_UE_CPP.Half2(Int32 input) - at NDP_UE_CPP.CalcHalf2(Int32 input) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp deleted file mode 100644 index 680a5c851ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp +++ /dev/null @@ -1,116 +0,0 @@ - -// -// Example for the Exception( String* ) constructor. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception with a specifiable message. - public ref class NotEvenException: public Exception - { - private: - static String^ notEvenMessage = "The argument to a function requiring " - "even input is not divisible by 2."; - - public: - NotEvenException() - : Exception( notEvenMessage ) - {} - - NotEvenException( String^ auxMessage ) - : Exception( String::Format( "{0} - {1}", auxMessage, notEvenMessage ) ) - {} - - }; - - - // Half throws a base exception if the input is not even. - int Half( int input ) - { - if ( input % 2 != 0 ) - throw gcnew Exception( String::Format( "The argument {0} is not divisible by 2.", input ) ); - else - return input / 2; - } - - - // Half2 throws a derived exception if the input is not even. - int Half2( int input ) - { - if ( input % 2 != 0 ) - throw gcnew NotEvenException( String::Format( "Invalid argument: {0}", input ) ); - else - return input / 2; - } - - - // CalcHalf calls Half and catches any thrown exceptions. - void CalcHalf( int input ) - { - try - { - int halfInput = Half( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - - - // CalcHalf2 calls Half2 and catches any thrown exceptions. - void CalcHalf2( int input ) - { - try - { - int halfInput = Half2( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of the Exception( String* )\n" - "constructor generates the following output." ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "constructor of the base class.\n" ); - NDP_UE_CPP::CalcHalf( 18 ); - NDP_UE_CPP::CalcHalf( 21 ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "constructor of a derived class.\n" ); - NDP_UE_CPP::CalcHalf2( 30 ); - NDP_UE_CPP::CalcHalf2( 33 ); -} - -/* -This example of the Exception( String* ) -constructor generates the following output. - -Here, an exception is thrown using the -constructor of the base class. - -Half of 18 is 9. -System.Exception: The argument 21 is not divisible by 2. - at NDP_UE_CPP.Half(Int32 input) - at NDP_UE_CPP.CalcHalf(Int32 input) - -Here, an exception is thrown using the -constructor of a derived class. - -Half of 30 is 15. -NDP_UE_CPP.NotEvenException: Invalid argument: 33 - The argument to a function -requiring even input is not divisible by 2. - at NDP_UE_CPP.Half2(Int32 input) - at NDP_UE_CPP.CalcHalf2(Int32 input) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp deleted file mode 100644 index c1923e2fbc7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp +++ /dev/null @@ -1,109 +0,0 @@ - -// -// Example for the Exception( String*, Exception* ) constructor. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception with a specifiable message and inner exception. - public ref class LogTableOverflowException: public Exception - { - private: - static String^ overflowMessage = "The log table has overflowed."; - - public: - LogTableOverflowException() - : Exception( overflowMessage ) - {} - - LogTableOverflowException( String^ auxMessage ) - : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ) ) - {} - - LogTableOverflowException( String^ auxMessage, Exception^ inner ) - : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ), inner ) - {} - - }; - - public ref class LogTable - { - public: - LogTable( int numElements ) - { - logArea = gcnew array(numElements); - elemInUse = 0; - } - - - protected: - array^logArea; - int elemInUse; - - public: - - // The AddRecord method throws a derived exception - // if the array bounds exception is caught. - int AddRecord( String^ newRecord ) - { - try - { - logArea[ elemInUse ] = newRecord; - return elemInUse++; - } - catch ( Exception^ ex ) - { - throw gcnew LogTableOverflowException( String::Format( "Record \"{0}\" was not logged.", newRecord ),ex ); - } - - } - - }; - - - // Create a log table and force an overflow. - void ForceOverflow() - { - LogTable^ log = gcnew LogTable( 4 ); - try - { - for ( int count = 1; ; count++ ) - { - log->AddRecord( String::Format( "Log record number {0}", count ) ); - - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of the Exception( String*, Exception* )\n" - "constructor generates the following output." ); - Console::WriteLine( "\nExample of a derived exception " - "that references an inner exception:\n" ); - NDP_UE_CPP::ForceOverflow(); -} - -/* -This example of the Exception( String*, Exception* ) -constructor generates the following output. - -Example of a derived exception that references an inner exception: - -NDP_UE_CPP.LogTableOverflowException: The log table has overflowed. - Record "L -og record number 5" was not logged. ---> System.IndexOutOfRangeException: Index - was outside the bounds of the array. - at NDP_UE_CPP.LogTable.AddRecord(String newRecord) - --- End of inner exception stack trace --- - at NDP_UE_CPP.LogTable.AddRecord(String newRecord) - at NDP_UE_CPP.ForceOverflow() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp deleted file mode 100644 index 38d74dc3b35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp +++ /dev/null @@ -1,137 +0,0 @@ - -// -// Example for the Exception::GetBaseException method. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Define two derived exceptions to demonstrate nested exceptions. - ref class SecondLevelException: public Exception - { - public: - SecondLevelException( String^ message, Exception^ inner ) - : Exception( message, inner ) - {} - - }; - - ref class ThirdLevelException: public Exception - { - public: - ThirdLevelException( String^ message, Exception^ inner ) - : Exception( message, inner ) - {} - - }; - - - // DivideBy0 forces a division by 0 and throws a second exception. - void DivideBy0() - { - try - { - int zero = 0; - int ecks = 1 / zero; - } - catch ( Exception^ ex ) - { - throw gcnew SecondLevelException( "Forced a division by 0 and threw " - "a second exception.",ex ); - } - - } - - - // This function catches the exception from the called function - // DivideBy0( ) and throws another in response. - void Rethrow() - { - try - { - DivideBy0(); - } - catch ( Exception^ ex ) - { - throw gcnew ThirdLevelException( "Caught the second exception and " - "threw a third in response.",ex ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of Exception.GetBaseException " - "generates the following output." ); - Console::WriteLine( "\nThe program forces a division by 0, " - "then throws the exception \ntwice more, " - "using a different derived exception each time.\n" ); - try - { - - // This function calls another that forces a division by 0. - NDP_UE_CPP::Rethrow(); - } - catch ( Exception^ e ) - { - Exception^ current; - Console::WriteLine( "Unwind the nested exceptions using " - "the InnerException property:\n" ); - - // This code unwinds the nested exceptions using the - // InnerException property. - current = e; - while ( current != (Object^)0 ) - { - Console::WriteLine( current->ToString() ); - Console::WriteLine(); - current = current->InnerException; - } - - // Display the innermost exception. - Console::WriteLine( "Display the base exception using the \n" - "GetBaseException method:\n" ); - Console::WriteLine( e->GetBaseException()->ToString() ); - } - -} - -/* -This example of Exception.GetBaseException generates the following output. - -The program forces a division by 0, then throws the exception -twice more, using a different derived exception each time. - -Unwind the nested exceptions using the InnerException property: - -NDP_UE_CPP.ThirdLevelException: Caught the second exception and threw a third i -n response. ---> NDP_UE_CPP.SecondLevelException: Forced a division by 0 and th -rew a second exception. ---> System.DivideByZeroException: Attempted to divide -by zero. - at NDP_UE_CPP.DivideBy0() - --- End of inner exception stack trace --- - at NDP_UE_CPP.DivideBy0() - at NDP_UE_CPP.Rethrow() - --- End of inner exception stack trace --- - at NDP_UE_CPP.Rethrow() - at main() - -NDP_UE_CPP.SecondLevelException: Forced a division by 0 and threw a second exce -ption. ---> System.DivideByZeroException: Attempted to divide by zero. - at NDP_UE_CPP.DivideBy0() - --- End of inner exception stack trace --- - at NDP_UE_CPP.DivideBy0() - at NDP_UE_CPP.Rethrow() - -System.DivideByZeroException: Attempted to divide by zero. - at NDP_UE_CPP.DivideBy0() - -Display the base exception using the -GetBaseException method: - -System.DivideByZeroException: Attempted to divide by zero. - at NDP_UE_CPP.DivideBy0() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp deleted file mode 100644 index b3714fff6d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -// Example for the Exception::HResult property. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Create the derived exception class. - ref class SecondLevelException: public Exception - { - private: - static int SecondLevelHResult = (int)0x81234567; - - public: - - // Set HResult for this exception, and include it in - // the exception message. - SecondLevelException( String^ message, Exception^ inner ) - : Exception( String::Format( "(HRESULT:0x{1:X8}) {0}", message, SecondLevelHResult ), inner ) - { - HResult = SecondLevelHResult; - } - - }; - - - // This function forces a division by 0 and throws - // a second exception. - void DivideBy0() - { - try - { - try - { - int zero = 0; - int ecks = 1 / zero; - } - catch ( Exception^ ex ) - { - throw gcnew SecondLevelException( "Forced a division by 0 and threw " - "a second exception.",ex ); - } - - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - NDP_UE_CPP::DivideBy0(); -} - -/* -This example of Exception::HResult generates the following output. - -NDP_UE_CPP.SecondLevelException: (HRESULT:0x81234567) Forced a division by 0 an -d threw a second exception. ---> System.DivideByZeroException: Attempted to div -ide by zero. - at NDP_UE_CPP.DivideBy0() - --- End of inner exception stack trace --- - at NDP_UE_CPP.DivideBy0() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj deleted file mode 100644 index 62a1c06daf2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - NDP_UE_CPP - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp deleted file mode 100644 index 5597ab64333..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp +++ /dev/null @@ -1,121 +0,0 @@ - -// -// Example for the Exception::HelpLink, Exception::Source, -// Exception::StackTrace, and Exception::TargetSite properties. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception; the constructor sets the HelpLink and - // Source properties. - public ref class LogTableOverflowException: public Exception - { - private: - static String^ overflowMessage = "The log table has overflowed."; - - public: - LogTableOverflowException( String^ auxMessage, Exception^ inner ) - : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ), inner ) - { - this->HelpLink = "https://learn.microsoft.com"; - this->Source = "Exception_Class_Samples"; - } - - }; - - public ref class LogTable - { - public: - LogTable( int numElements ) - { - logArea = gcnew array(numElements); - elemInUse = 0; - } - - - protected: - array^logArea; - int elemInUse; - - public: - - // The AddRecord method throws a derived exception if - // the array bounds exception is caught. - int AddRecord( String^ newRecord ) - { - try - { - logArea[ elemInUse ] = newRecord; - return elemInUse++; - } - catch ( Exception^ ex ) - { - throw gcnew LogTableOverflowException( String::Format( "Record \"{0}\" was not logged.", newRecord ),ex ); - } - - } - - }; - - - // Create a log table and force an overflow. - void ForceOverflow() - { - LogTable^ log = gcnew LogTable( 4 ); - try - { - for ( int count = 1; ; count++ ) - { - log->AddRecord( String::Format( "Log record number {0}", count ) ); - - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( "\nMessage ---\n{0}", ex->Message ); - Console::WriteLine( "\nHelpLink ---\n{0}", ex->HelpLink ); - Console::WriteLine( "\nSource ---\n{0}", ex->Source ); - Console::WriteLine( "\nStackTrace ---\n{0}", ex->StackTrace ); - Console::WriteLine( "\nTargetSite ---\n{0}", ex->TargetSite->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of \n Exception::Message, \n" - " Exception::HelpLink, \n Exception::Source, \n" - " Exception::StackTrace, and \n Exception::" - "TargetSite \ngenerates the following output." ); - NDP_UE_CPP::ForceOverflow(); -} - -/* -This example of - Exception::Message, - Exception::HelpLink, - Exception::Source, - Exception::StackTrace, and - Exception::TargetSite -generates the following output. - -Message --- -The log table has overflowed. - Record "Log record number 5" was not logged. - -HelpLink --- -https://learn.microsoft.com - -Source --- -Exception_Class_Samples - -StackTrace --- - at NDP_UE_CPP.LogTable.AddRecord(String newRecord) - at NDP_UE_CPP.ForceOverflow() - -TargetSite --- -Int32 AddRecord(System.String) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp deleted file mode 100644 index f572f53062b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp +++ /dev/null @@ -1,79 +0,0 @@ - -// -using namespace System; - -// Define an Enum without FlagsAttribute. -public enum class SingleHue : short -{ - None = 0, - Black = 1, - Red = 2, - Green = 4, - Blue = 8 -}; - -// Define an Enum with FlagsAttribute. -[Flags] -enum class MultiHue : short -{ - None = 0, - Black = 1, - Red = 2, - Green = 4, - Blue = 8 -}; - -int main() -{ - // Display all possible combinations of values. - Console::WriteLine( - "All possible combinations of values without FlagsAttribute:"); - for (int val = 0; val <= 16; val++) - Console::WriteLine("{0,3} - {1:G}", val, (SingleHue)val); - - Console::WriteLine( - "\nAll possible combinations of values with FlagsAttribute:"); - - // Display all combinations of values, and invalid values. - for (int val = 0; val <= 16; val++ ) - Console::WriteLine("{0,3} - {1:G}", val, (MultiHue)val); -} -// The example displays the following output: -// All possible combinations of values without FlagsAttribute: -// 0 - None -// 1 - Black -// 2 - Red -// 3 - 3 -// 4 - Green -// 5 - 5 -// 6 - 6 -// 7 - 7 -// 8 - Blue -// 9 - 9 -// 10 - 10 -// 11 - 11 -// 12 - 12 -// 13 - 13 -// 14 - 14 -// 15 - 15 -// 16 - 16 -// -// All possible combinations of values with FlagsAttribute: -// 0 - None -// 1 - Black -// 2 - Red -// 3 - Black, Red -// 4 - Green -// 5 - Black, Green -// 6 - Red, Green -// 7 - Black, Red, Green -// 8 - Blue -// 9 - Black, Blue -// 10 - Red, Blue -// 11 - Black, Red, Blue -// 12 - Green, Blue -// 13 - Black, Green, Blue -// 14 - Red, Green, Blue -// 15 - Black, Red, Green, Blue -// 16 - 16 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp deleted file mode 100644 index 71b62c4c010..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -using namespace System; - -[Flags] -enum class PhoneService -{ - None = 0, - LandLine = 1, - Cell = 2, - Fax = 4, - Internet = 8, - Other = 16 -}; - -void main() -{ - // Define three variables representing the types of phone service - // in three households. - PhoneService household1 = PhoneService::LandLine | PhoneService::Cell | - PhoneService::Internet; - PhoneService household2 = PhoneService::None; - PhoneService household3 = PhoneService::Cell | PhoneService::Internet; - - // Store the variables in an array for ease of access. - array^ households = { household1, household2, household3 }; - - // Which households have no service? - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has phone service: {1}", - ctr + 1, - households[ctr] == PhoneService::None ? - "No" : "Yes"); - Console::WriteLine(); - - // Which households have cell phone service? - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has cell phone service: {1}", - ctr + 1, - (households[ctr] & PhoneService::Cell) == PhoneService::Cell ? - "Yes" : "No"); - Console::WriteLine(); - - // Which households have cell phones and land lines? - PhoneService cellAndLand = PhoneService::Cell | PhoneService::LandLine; - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has cell and land line service: {1}", - ctr + 1, - (households[ctr] & cellAndLand) == cellAndLand ? - "Yes" : "No"); - Console::WriteLine(); - - // List all types of service of each household?// - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has: {1:G}", - ctr + 1, households[ctr]); - Console::WriteLine(); -} -// The example displays the following output: -// Household 1 has phone service: Yes -// Household 2 has phone service: No -// Household 3 has phone service: Yes -// -// Household 1 has cell phone service: Yes -// Household 2 has cell phone service: No -// Household 3 has cell phone service: Yes -// -// Household 1 has cell and land line service: Yes -// Household 2 has cell and land line service: No -// Household 3 has cell and land line service: No -// -// Household 1 has: LandLine, Cell, Internet -// Household 2 has: None -// Household 3 has: Cell, Internet -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp deleted file mode 100644 index 55b8b589334..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp +++ /dev/null @@ -1,44 +0,0 @@ -using namespace System; -using namespace System::Linq; -using namespace System::Collections; -using namespace System::Collections::Generic; - -// -// Declare a delegate -delegate String ^ MyDel(String ^); - -// Create wrapper class and function that takes in a string and converts it to uppercase -ref class DelegateWrapper { -public: - String ^ ToUpper(String ^ s) { - return s->ToUpper(); - } -}; - -int main() { - // Declare delegate - DelegateWrapper ^ delegateWrapper = gcnew DelegateWrapper; - MyDel ^ DelInst = gcnew MyDel(delegateWrapper, &DelegateWrapper::ToUpper); - - // Cast into Func - Func ^ selector = reinterpret_cast ^>(DelInst); - - // Create an array of strings - array ^ words = { "orange", "apple", "Article", "elephant" }; - - // Query the array and select strings according to the selector method - Generic::IEnumerable ^ aWords = Enumerable::Select((Generic::IEnumerable^)words, selector); - - // Output the results to the console - for each(String ^ word in aWords) - Console::WriteLine(word); - /* - This code example produces the following output: - - ORANGE - APPLE - ARTICLE - ELEPHANT - */ -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp deleted file mode 100644 index 8583565fa53..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; - -const int maxGarbage = 1000; - -void MakeSomeGarbage() -{ - Version^ vt; - for ( int i = 0; i < maxGarbage; i++ ) { - // Create objects and release them to fill up memory with unused objects. - vt = gcnew Version; - } -} - -void main() -{ - // Put some objects in memory. - MakeSomeGarbage(); - Console::WriteLine("Memory used before collection: {0:N0}", - GC::GetTotalMemory( false ) ); - - // Collect all generations of memory. - GC::Collect(); - Console::WriteLine("Memory used after full collection: {0:N0}", - GC::GetTotalMemory( true ) ); -} -// The output from the example resembles the following: -// Memory used before collection: 79,392 -// Memory used after full collection: 52,640 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp deleted file mode 100644 index e3587de2c56..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -// -using namespace System; -ref class MyGCCollectClass -{ -private: - static const long maxGarbage = 1000; - -public: - void MakeSomeGarbage() - { - Version^ vt; - for ( int i = 0; i < maxGarbage; i++ ) - { - - // Create objects and release them to fill up memory - // with unused objects. - vt = gcnew Version; - - } - } - -}; - -int main() -{ - - // Create a strong reference to an Object. - MyGCCollectClass^ myGCCol = gcnew MyGCCollectClass; - - // Put some objects in memory. - myGCCol->MakeSomeGarbage(); - - // Get the generation of managed memory where myGCCol is stored. - Console::WriteLine( "The object is in generation: {0}", GC::GetGeneration( myGCCol ) ); - - // Perform a full garbage collection. - // Because there is a strong reference to myGCCol, it will - // not be garbage collected. - GC::Collect(); - - // Get the generation of managed memory where myGCCol is stored. - Console::WriteLine( "The object is in generation: {0}", GC::GetGeneration( myGCCol ) ); - - // Create a WeakReference to myGCCol. - WeakReference^ wkref = gcnew WeakReference( myGCCol ); - - // Remove the strong reference to myGCCol. - myGCCol = nullptr; - - // Get the generation of managed memory where wkref is stored. - Console::WriteLine( "The WeakReference to the object is in generation: {0}", GC::GetGeneration( wkref ) ); - - // Perform another full garbage collection. - // A WeakReference will not survive a garbage collection. - GC::Collect(); - - // Try to get the generation of managed memory where wkref is stored. - // Because it has been collected, an exception will be thrown. - try - { - Console::WriteLine( "The WeakReference to the object is in generation: {0}", GC::GetGeneration( wkref ) ); - Console::Read(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The WeakReference to the object has been garbage collected: ' {0}'", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp deleted file mode 100644 index b457b3d8f57..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp +++ /dev/null @@ -1,108 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Runtime::InteropServices; - -// A simple class that exposes two static Win32 functions. -// One is a delegate type and the other is an enumerated type. -public ref class MyWin32 -{ -public: - - // An enumerated type for the control messages sent to the handler routine. - enum class CtrlTypes - { - CTRL_C_EVENT = 0, - CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT = 5, - CTRL_SHUTDOWN_EVENT - }; - - delegate Boolean HandlerRoutine( // A delegate type to be used as the Handler Routine for SetConsoleCtrlHandler. - CtrlTypes CtrlType ); - - // Declare the SetConsoleCtrlHandler function as external and receiving a delegate. - - [DllImport("Kernel32")] - static Boolean SetConsoleCtrlHandler( HandlerRoutine^ Handler, Boolean Add ); -}; - -public ref class MyApp -{ -private: - - // A private static handler function in the MyApp class. - static Boolean Handler( MyWin32::CtrlTypes CtrlType ) - { - String^ message = "This message should never be seen!"; - - // A switch to handle the event type. - switch ( CtrlType ) - { - case MyWin32::CtrlTypes::CTRL_C_EVENT: - message = "A CTRL_C_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_BREAK_EVENT: - message = "A CTRL_BREAK_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_CLOSE_EVENT: - message = "A CTRL_CLOSE_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_LOGOFF_EVENT: - message = "A CTRL_LOGOFF_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_SHUTDOWN_EVENT: - message = "A CTRL_SHUTDOWN_EVENT was raised by the user."; - break; - } - - // Use interop to display a message for the type of event. - Console::WriteLine( message ); - return true; - } - - -public: - static void Test() - { - - // Use interop to set a console control handler. - MyWin32::HandlerRoutine^ hr = gcnew MyWin32::HandlerRoutine( Handler ); - MyWin32::SetConsoleCtrlHandler( hr, true ); - - // Give the user some time to raise a few events. - Console::WriteLine( "Waiting 30 seconds for console ctrl events..." ); - - // The Object hr is not referred to again. - // The garbage collector can detect that the object has no - // more managed references and might clean it up here while - // the unmanaged SetConsoleCtrlHandler method is still using it. - // Force a garbage collection to demonstrate how the hr - // object will be handled. - GC::Collect(); - GC::WaitForPendingFinalizers(); - GC::Collect(); - Thread::Sleep( 30000 ); - - // Display a message to the console when the unmanaged method - // has finished its work. - Console::WriteLine( "Finished!" ); - - // Call GC::KeepAlive(hr) at this point to maintain a reference to hr. - // This will prevent the garbage collector from collecting the - // object during the execution of the SetConsoleCtrlHandler method. - GC::KeepAlive( hr ); - } - -}; - -int main() -{ - MyApp::Test(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp deleted file mode 100644 index 9a8cc79ec77..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -using namespace System; -ref class MyFinalizeObject -{ -public: - static MyFinalizeObject^ currentInstance = nullptr; - -private: - bool hasFinalized; - -public: - MyFinalizeObject() - { - hasFinalized = false; - } - - ~MyFinalizeObject() - { - if ( !hasFinalized ) - { - Console::WriteLine( "First finalization" ); - - // Put this object back into a root by creating - // a reference to it. - MyFinalizeObject::currentInstance = this; - - // Indicate that this instance has finalized once. - hasFinalized = true; - - // Place a reference to this object back in the - // finalization queue. - GC::ReRegisterForFinalize( this ); - } - else - { - Console::WriteLine( "Second finalization" ); - } - } - -}; - -int main() -{ - - // Create a MyFinalizeObject. - MyFinalizeObject^ mfo = gcnew MyFinalizeObject; - - // Release the reference to mfo. - mfo = nullptr; - - // Force a garbage collection. - GC::Collect(); - - // At this point mfo will have gone through the first Finalize. - // There should now be a reference to mfo in the static - // MyFinalizeObject::currentInstance field. Setting this value - // to 0 and forcing another garbage collection will now - // cause the object to Finalize permanently. - MyFinalizeObject::currentInstance = nullptr; - GC::Collect(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp deleted file mode 100644 index c542afe35eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -ref class MyFinalizeObject -{ -private: - - // Make this number very large to cause the finalizer to - // do more work. - literal int maxIterations = 10000; - ~MyFinalizeObject() - { - Console::WriteLine( "Finalizing a MyFinalizeObject" ); - - // Do some work. - for ( int i = 0; i < maxIterations; i++ ) - { - - // This method performs no operation on i, but prevents - // the JIT compiler from optimizing away the code inside - // the loop. - GC::KeepAlive( i ); - - } - } - -}; - - -// You can increase this number to fill up more memory. -const int numMfos = 1000; - -// You can increase this number to cause more -// post-finalization work to be done. -const int maxIterations = 100; -int main() -{ - MyFinalizeObject^ mfo = nullptr; - - // Create and release a large number of objects - // that require finalization. - for ( int j = 0; j < numMfos; j++ ) - { - mfo = gcnew MyFinalizeObject; - - } - - //Release the last object created in the loop. - mfo = nullptr; - - //Force garbage collection. - GC::Collect(); - - // Wait for all finalizers to complete before continuing. - // Without this call to GC::WaitForPendingFinalizers, - // the worker loop below might execute at the same time - // as the finalizers. - // With this call, the worker loop executes only after - // all finalizers have been called. - GC::WaitForPendingFinalizers(); - - // Worker loop to perform post-finalization code. - for ( int i = 0; i < maxIterations; i++ ) - { - Console::WriteLine( "Doing some post-finalize work" ); - - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp deleted file mode 100644 index 8b5d97c0b94..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp +++ /dev/null @@ -1,144 +0,0 @@ - - -// -#using - -using namespace System; - -/// Class that implements IConvertible -ref class Complex: public IConvertible -{ -private: - double x; - double y; - -public: - Complex( double x, double y ) - { - this->x = x; - this->y = y; - } - - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean( IFormatProvider^ /*provider*/ ) = IConvertible::ToBoolean - { - if ( (x != 0.0) || (y != 0.0) ) - return true; - else - return false; - } - - double GetDoubleValue() - { - return Math::Sqrt( x * x + y * y ); - } - - virtual Byte ToByte( IFormatProvider^ /*provider*/ ) = IConvertible::ToByte - { - return Convert::ToByte( GetDoubleValue() ); - } - - virtual Char ToChar( IFormatProvider^ /*provider*/ ) = IConvertible::ToChar - { - return Convert::ToChar( GetDoubleValue() ); - } - - virtual DateTime ToDateTime( IFormatProvider^ /*provider*/ ) = IConvertible::ToDateTime - { - return Convert::ToDateTime( GetDoubleValue() ); - } - - virtual Decimal ToDecimal( IFormatProvider^ /*provider*/ ) = IConvertible::ToDecimal - { - return Convert::ToDecimal( GetDoubleValue() ); - } - - virtual double ToDouble( IFormatProvider^ /*provider*/ ) = IConvertible::ToDouble - { - return GetDoubleValue(); - } - - virtual short ToInt16( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt16 - { - return Convert::ToInt16( GetDoubleValue() ); - } - - virtual int ToInt32( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt32 - { - return Convert::ToInt32( GetDoubleValue() ); - } - - virtual Int64 ToInt64( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt64 - { - return Convert::ToInt64( GetDoubleValue() ); - } - - virtual signed char ToSByte( IFormatProvider^ /*provider*/ ) = IConvertible::ToSByte - { - return Convert::ToSByte( GetDoubleValue() ); - } - - virtual float ToSingle( IFormatProvider^ /*provider*/ ) = IConvertible::ToSingle - { - return Convert::ToSingle( GetDoubleValue() ); - } - - virtual String^ ToString( IFormatProvider^ /*provider*/ ) = IConvertible::ToString - { - return String::Format( "( {0} , {1} )", x, y ); - } - - virtual Object^ ToType( Type^ conversionType, IFormatProvider^ /*provider*/ ) = IConvertible::ToType - { - return Convert::ChangeType( GetDoubleValue(), conversionType ); - } - - virtual UInt16 ToUInt16( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt16 - { - return Convert::ToUInt16( GetDoubleValue() ); - } - - virtual UInt32 ToUInt32( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt32 - { - return Convert::ToUInt32( GetDoubleValue() ); - } - - virtual UInt64 ToUInt64( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt64 - { - return Convert::ToUInt64( GetDoubleValue() ); - } - -}; - -void WriteObjectInfo( Object^ testObject ) -{ - TypeCode typeCode = Type::GetTypeCode( testObject->GetType() ); - switch ( typeCode ) - { - case TypeCode::Boolean: - Console::WriteLine( "Boolean: {0}", testObject ); - break; - - case TypeCode::Double: - Console::WriteLine( "Double: {0}", testObject ); - break; - - default: - Console::WriteLine( "{0}: {1}", typeCode, testObject ); - break; - } -} - -int main() -{ - Complex^ testComplex = gcnew Complex( 4,7 ); - WriteObjectInfo( testComplex ); - WriteObjectInfo( Convert::ToBoolean( testComplex ) ); - WriteObjectInfo( Convert::ToDecimal( testComplex ) ); - WriteObjectInfo( Convert::ToString( testComplex ) ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp deleted file mode 100644 index 7ec610d0749..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// The following example demonstrates how to create a class that -// implements the IDisposable interface and the IDisposable.Dispose -// method with finalization to clean up unmanaged resources. -// -public ref class MyResource: public IDisposable -{ -private: - - // Pointer to an external unmanaged resource. - IntPtr handle; - - // A managed resource this class uses. - Component^ component; - - // Track whether Dispose has been called. - bool disposed; - -public: - // The class constructor. - MyResource( IntPtr handle, Component^ component ) - { - this->handle = handle; - this->component = component; - disposed = false; - } - - // This method is called if the user explicitly disposes of the - // object (by calling the Dispose method in other managed languages, - // or the destructor in C++). The compiler emits as a call to - // GC::SuppressFinalize( this ) for you, so there is no need to - // call it here. - ~MyResource() - { - // Dispose of managed resources. - component->~Component(); - - // Call C++ finalizer to clean up unmanaged resources. - this->!MyResource(); - - // Mark the class as disposed. This flag allows you to throw an - // exception if a disposed object is accessed. - disposed = true; - } - - // Use interop to call the method necessary to clean up the - // unmanaged resource. - // - [System::Runtime::InteropServices::DllImport("Kernel32")] - static Boolean CloseHandle( IntPtr handle ); - - // The C++ finalizer destructor ensures that unmanaged resources get - // released if the user releases the object without explicitly - // disposing of it. - // - !MyResource() - { - // Call the appropriate methods to clean up unmanaged - // resources here. If disposing is false when Dispose(bool, - // disposing) is called, only the following code is executed. - CloseHandle( handle ); - handle = IntPtr::Zero; - } - -}; - -void main() -{ - // Insert code here to create and use the MyResource object. - MyResource^ mr = gcnew MyResource((IntPtr) 42, (Component^) gcnew Button()); - mr->~MyResource(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp deleted file mode 100644 index ced314ab27c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// MinValue.cpp : main project file. - -using namespace System; - -int main(array ^args) -{ - // - array^ numbersToConvert = {162345, 32183, -54000}; - Int16 newNumber; - for each (Int64 number in numbersToConvert) - { - if (number >= Int16::MinValue && number <= Int16::MaxValue) - { - newNumber = Convert::ToInt16(number); - Console::WriteLine("Successfully converted {0} to an Int16.", - newNumber); - } - else - { - Console::WriteLine("Unable to convert {0} to an Int16.", number); - } - } - // The example displays the following output: - // Unable to convert 162345 to an Int16. - // Successfully converted 32183 to an Int16. - // Unable to convert -54000 to an Int16. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp deleted file mode 100644 index aeaef4e7bea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Parse1.cpp : main project file. -// Code example for Int16.Parse(String) - -using namespace System; - -int main(array ^args) -{ - // - String^ value; - Int16 number; - - value = " 12603 "; - try - { - number = Int16::Parse(value); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", - value); - } - - value = " 16,054"; - try - { - number = Int16::Parse(value); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", - value); - } - - value = " -17264"; - try - { - number = Int16::Parse(value); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", - value); - } - // The example displays the following output to the console: - // Converted ' 12603 ' to 12603. - // Unable to convert ' 16,054' to a 16-bit signed integer. - // Converted ' -17264' to -17264. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp deleted file mode 100644 index 0b5222a1f6f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// Parse2.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -ref class ParseSample -{ -public: - static void Main() - { - String^ value; - NumberStyles style; - - // Parse a number with a thousands separator (throws an exception). - value = "14,644"; - style = NumberStyles::None; - ParseSample::ParseToInt16(value, style); - - style = NumberStyles::AllowThousands; - ParseToInt16(value, style); - - // Parse a number with a thousands separator and decimal point. - value = "14,644.00"; - style = NumberStyles::AllowThousands | NumberStyles::Integer | - NumberStyles::AllowDecimalPoint; - ParseToInt16(value, style); - - // Parse a number with a fractional component (throws an exception). - value = "14,644.001"; - ParseToInt16(value, style); - - // Parse a number in exponential notation. - value = "145E02"; - style = style | NumberStyles::AllowExponent; - ParseToInt16(value, style); - - // Parse a number in exponential notation with a positive sign. - value = "145E+02"; - ParseToInt16(value, style); - - // Parse a number in exponential notation with a negative sign - // (throws an exception). - value = "145E-02"; - ParseToInt16(value, style); - } - -private: - static void ParseToInt16(String^ value, NumberStyles style) - { - try - { - Int16 number = Int16::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}' with style {1}.", value, - style); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0}' is out of range of the Int16 type.", value); - } - } -}; - -int main() -{ - ParseSample::Main(); - Console::ReadLine(); - return 0; -} -// The example displays the following output: -// Unable to parse '14,644' with style None. -// Converted '14,644' to 14644. -// Converted '14,644.00' to 14644. -// '14,644.001' is out of range of the Int16 type. -// Converted '145E02' to 14500. -// Converted '145E+02' to 14500. -// '145E-02' is out of range of the Int16 type. -// - - - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp deleted file mode 100644 index e17d9457ac6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Parse3.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -int main(array ^args) -{ - // - String^ value; - Int16 number; - NumberStyles style; - - // Parse string using "." as the thousands separator - // and " " as the decimal separator. - value = "19 694,00"; - style = NumberStyles::AllowDecimalPoint | NumberStyles::AllowThousands; - CultureInfo^ provider = gcnew CultureInfo("fr-FR"); - - number = Int16::Parse(value, style, provider); - Console::WriteLine("'{0}' converted to {1}.", value, number); - // Displays: - // '19 694,00' converted to 19694. - - try - { - number = Int16::Parse(value, style, CultureInfo::InvariantCulture); - Console::WriteLine("'{0}' converted to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", value); - } - // Displays: - // Unable to parse '19 694,00'. - - // Parse string using "$" as the currency symbol for en_GB and - // en-US cultures. - value = "$6,032.00"; - style = NumberStyles::Number | NumberStyles::AllowCurrencySymbol; - provider = gcnew CultureInfo("en-GB"); - - try - { - number = Int16::Parse(value, style, CultureInfo::InvariantCulture); - Console::WriteLine("'{0}' converted to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", value); - } - // Displays: - // Unable to parse '$6,032.00'. - - provider = gcnew CultureInfo("en-US"); - number = Int16::Parse(value, style, provider); - Console::WriteLine("'{0}' converted to {1}.", value, number); - // Displays: - // '$6,032.00' converted to 6032. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp deleted file mode 100644 index 111fb90e90d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Parse4.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -int main(array ^args) -{ - // - String^ stringToConvert; - Int16 number; - - stringToConvert = " 214 "; - try - { - number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0'} is out of range of the Int16 data type.", - stringToConvert); - } - - stringToConvert = " + 214"; - try - { - number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0'} is out of range of the Int16 data type.", - stringToConvert); - } - - stringToConvert = " +214 "; - try - { - number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0'} is out of range of the Int16 data type.", - stringToConvert); - } - // The example displays the following output to the console: - // Converted ' 214 ' to 214. - // Unable to parse ' + 214'. - // Converted ' +214 ' to 214. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp deleted file mode 100644 index 3eb4dcbf5d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ values = { "+13230", "-0", "1,390,146", "$190,235,421,127", - "0xFA1B", "163042", "-10", "007", "2147483647", - "2147483648", "16e07", "134985.0", "-12034", - "-2147483648", "-2147483649" }; - for each (String^ value in values) - { - try { - Int32 number = Int32::Parse(value); - Console::WriteLine("{0} --> {1}", value, number); - } - catch (FormatException^ e) { - Console::WriteLine("{0}: Bad Format", value); - } - catch (OverflowException^ e) { - Console::WriteLine("{0}: Overflow", value); - } - } -} -// The example displays the following output: -// +13230 --> 13230 -// -0 --> 0 -// 1,390,146: Bad Format -// $190,235,421,127: Bad Format -// 0xFA1B: Bad Format -// 163042 --> 163042 -// -10 --> -10 -// 007 --> 7 -// 2147483647 --> 2147483647 -// 2147483648: Overflow -// 16e07: Bad Format -// 134985.0: Bad Format -// -12034 --> -12034 -// -2147483648 --> -2147483648 -// -2147483649: Overflow -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp deleted file mode 100644 index 763b56c34a5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -public ref class ParseInt32 -{ -public: - static void Main() - { - Convert("104.0", NumberStyles::AllowDecimalPoint); - Convert("104.9", NumberStyles::AllowDecimalPoint); - Convert(" $17,198,064.42", NumberStyles::AllowCurrencySymbol | - NumberStyles::Number); - Convert("103E06", NumberStyles::AllowExponent); - Convert("-1,345,791", NumberStyles::AllowThousands); - Convert("(1,345,791)", NumberStyles::AllowThousands | - NumberStyles::AllowParentheses); - } - -private: - static void Convert(String^ value, NumberStyles style) - { - try - { - int number = Int32::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) - { - Console::WriteLine("Unable to convert '{0}'.", value); - } - catch (OverflowException^) - { - Console::WriteLine("'{0}' is out of range of the Int32 type.", value); - } - } -}; - -int main() -{ - ParseInt32::Main(); -} -// The example displays the following output to the console: -// Converted '104.0' to 104. -// '104.9' is out of range of the Int32 type. -// ' $17,198,064.42' is out of range of the Int32 type. -// Converted '103E06' to 103000000. -// Unable to convert '-1,345,791'. -// Converted '(1,345,791)' to -1345791. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp deleted file mode 100644 index 6d7ea5b521f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -public ref class ParseInt32 -{ -public: - static void Main() - { - Convert("12,000", NumberStyles::Float | NumberStyles::AllowThousands, - gcnew CultureInfo("en-GB")); - Convert("12,000", NumberStyles::Float | NumberStyles::AllowThousands, - gcnew CultureInfo("fr-FR")); - Convert("12,000", NumberStyles::Float, gcnew CultureInfo("en-US")); - - Convert("12 425,00", NumberStyles::Float | NumberStyles::AllowThousands, - gcnew CultureInfo("sv-SE")); - Convert("12,425.00", NumberStyles::Float | NumberStyles::AllowThousands, - NumberFormatInfo::InvariantInfo); - Convert("631,900", NumberStyles::Integer | NumberStyles::AllowDecimalPoint, - gcnew CultureInfo("fr-FR")); - Convert("631,900", NumberStyles::Integer | NumberStyles::AllowDecimalPoint, - gcnew CultureInfo("en-US")); - Convert("631,900", NumberStyles::Integer | NumberStyles::AllowThousands, - gcnew CultureInfo("en-US")); - } - -private: - static void Convert(String^ value, NumberStyles style, - IFormatProvider^ provider) - { - try - { - int number = Int32::Parse(value, style, provider); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) - { - Console::WriteLine("Unable to convert '{0}'.", value); - } - catch (OverflowException^) - { - Console::WriteLine("'{0}' is out of range of the Int32 type.", value); - } - } -}; - -int main() -{ - ParseInt32::Main(); -} -// This example displays the following output to the console: -// Converted '12,000' to 12000. -// Converted '12,000' to 12. -// Unable to convert '12,000'. -// Converted '12 425,00' to 12425. -// Converted '12,425.00' to 12425. -// '631,900' is out of range of the Int32 type. -// Unable to convert '631,900'. -// Converted '631,900' to 631900. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp deleted file mode 100644 index 490a4147b45..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -using namespace System; - -void main() -{ - int value = -16325; - // Display value using default ToString method. - Console::WriteLine(value.ToString()); - // Display value using some standard format specifiers. - Console::WriteLine(value.ToString("G")); - Console::WriteLine(value.ToString("C")); - Console::WriteLine(value.ToString("D")); - Console::WriteLine(value.ToString("F")); - Console::WriteLine(value.ToString("N")); - Console::WriteLine(value.ToString("X")); -} -// The example displays the following output: -// -16325 -// -16325 -// ($16,325.00) -// -16325 -// -16325.00 -// -16,325.00 -// FFFFC03B -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp deleted file mode 100644 index 9db3bc117d2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - int value = -16325; - // Display value using the invariant culture. - Console::WriteLine(value.ToString(CultureInfo::InvariantCulture)); - // Display value using the en-GB culture. - Console::WriteLine(value.ToString(CultureInfo::CreateSpecificCulture("en-GB"))); - // Display value using the de-DE culture. - Console::WriteLine(value.ToString(CultureInfo::CreateSpecificCulture("de-DE"))); -} -// The example displays the following output: -// -16325 -// -16325 -// -16325 -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp deleted file mode 100644 index 890b1ae948c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -using namespace System; - -void main() -{ - int value = -16325; - String^ specifier; - - // Use standard numeric format specifiers. - specifier = "G"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "C"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "D8"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "E4"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "e3"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "F"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "N"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "P"; - Console::WriteLine("{0}: {1}", specifier, (value/100000).ToString(specifier)); - - specifier = "X"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - // Use custom numeric format specifiers. - specifier = "0,0.000"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "#,#.00#;(#,#.00#)"; - Console::WriteLine("{0}: {1}", specifier, (value*-1).ToString(specifier)); -} -// The example displays the following output: -// G: -16325 -// C: ($16,325.00) -// D8: -00016325 -// E4: -1.6325E+004 -// e3: -1.633e+004 -// F: -16325.00 -// N: -16,325.00 -// P: 0.00 % -// X: FFFFC03B -// 0,0.000: -16,325.000 -// #,#.00#;(#,#.00#): 16,325.00 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp deleted file mode 100644 index 60f27268433..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - // Define cultures whose formatting conventions are to be used. - array^ cultures = { CultureInfo::CreateSpecificCulture("en-US"), - CultureInfo::CreateSpecificCulture("fr-FR"), - CultureInfo::CreateSpecificCulture("es-ES") }; - int positiveNumber = 1679; - int negativeNumber = -3045; - array^ specifiers = {"G", "C", "D8", "E2", "F", "N", "P", "X8"}; - - for each (String^ specifier in specifiers) - { - for each (CultureInfo^ culture in cultures) - { - // Display values with "G" format specifier. - Console::WriteLine("{0} format using {1} culture: {2, 16} {3, 16}", - specifier, culture->Name, - positiveNumber.ToString(specifier, culture), - negativeNumber.ToString(specifier, culture)); - } - Console::WriteLine(); - } -} -// The example displays the following output: -// G format using en-US culture: 1679 -3045 -// G format using fr-FR culture: 1679 -3045 -// G format using es-ES culture: 1679 -3045 -// -// C format using en-US culture: $1,679.00 ($3,045.00) -// C format using fr-FR culture: 1 679,00 € -3 045,00 € -// C format using es-ES culture: 1.679,00 € -3.045,00 € -// -// D8 format using en-US culture: 00001679 -00003045 -// D8 format using fr-FR culture: 00001679 -00003045 -// D8 format using es-ES culture: 00001679 -00003045 -// -// E2 format using en-US culture: 1.68E+003 -3.05E+003 -// E2 format using fr-FR culture: 1,68E+003 -3,05E+003 -// E2 format using es-ES culture: 1,68E+003 -3,05E+003 -// -// F format using en-US culture: 1679.00 -3045.00 -// F format using fr-FR culture: 1679,00 -3045,00 -// F format using es-ES culture: 1679,00 -3045,00 -// -// N format using en-US culture: 1,679.00 -3,045.00 -// N format using fr-FR culture: 1 679,00 -3 045,00 -// N format using es-ES culture: 1.679,00 -3.045,00 -// -// P format using en-US culture: 167,900.00 % -304,500.00 % -// P format using fr-FR culture: 167 900,00 % -304 500,00 % -// P format using es-ES culture: 167.900,00 % -304.500,00 % -// -// X8 format using en-US culture: 0000068F FFFFF41B -// X8 format using fr-FR culture: 0000068F FFFFF41B -// X8 format using es-ES culture: 0000068F FFFFF41B -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp deleted file mode 100644 index 8772bdc80e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// ConsoleApplication1.cpp : Defines the entry point for the console application. -// - - -// -using namespace System; - - - void TryToParse(String^ value) - { - Int32 number; - bool result = Int32::TryParse(value, number); - if (result) { - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - else { - if (value == nullptr) value = ""; - Console::WriteLine("Attempted conversion of '{0}' failed.", value); - } - } - - -void main() -{ - TryToParse(nullptr); - TryToParse("160519"); - TryToParse("9432.0"); - TryToParse("16,667"); - TryToParse(" -322 "); - TryToParse("+4302"); - TryToParse("(100);"); - TryToParse("01FA"); -} -// The example displays the following output: -// Attempted conversion of '' failed. -// Converted '160519' to 160519. -// Attempted conversion of '9432.0' failed. -// Attempted conversion of '16,667' failed. -// Converted ' -322 ' to -322. -// Converted '+4302' to 4302. -// Attempted conversion of '(100);' failed. -// Attempted conversion of '01FA' failed. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp deleted file mode 100644 index 0639d8b9dc6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Int32.TryParse2.cpp : Defines the entry point for the console application. -// - - -// -using namespace System; -using namespace System::Globalization; - -void CallTryParse(String^ stringToConvert, NumberStyles styles) -{ - Int32 number; - CultureInfo^ provider; - - // If currency symbol is allowed, use en-US culture. - if (((Int32) (styles & NumberStyles::AllowCurrencySymbol)) > 0) - provider = gcnew CultureInfo("en-US"); - else - provider = CultureInfo::InvariantCulture; - - bool result = Int32::TryParse(stringToConvert, styles, - provider, number); - if (result) - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - else - Console::WriteLine("Attempted conversion of '{0}' failed.", - Convert::ToString(stringToConvert)); -} - -void main() -{ - String^ numericString; - NumberStyles styles; - - numericString = "106779"; - styles = NumberStyles::Integer; - CallTryParse(numericString, styles); - - numericString = "-30677"; - styles = NumberStyles::None; - CallTryParse(numericString, styles); - - styles = NumberStyles::AllowLeadingSign; - CallTryParse(numericString, styles); - - numericString = "301677-"; - CallTryParse(numericString, styles); - - styles = styles | NumberStyles::AllowTrailingSign; - CallTryParse(numericString, styles); - - numericString = "$10634"; - styles = NumberStyles::Integer; - CallTryParse(numericString, styles); - - styles = NumberStyles::Integer | NumberStyles::AllowCurrencySymbol; - CallTryParse(numericString, styles); - - numericString = "10345.00"; - styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; - CallTryParse(numericString, styles); - - numericString = "10345.72"; - styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; - CallTryParse(numericString, styles); - - numericString = "22,593"; - styles = NumberStyles::Integer | NumberStyles::AllowThousands; - CallTryParse(numericString, styles); - - numericString = "12E-01"; - styles = NumberStyles::Integer | NumberStyles::AllowExponent; - CallTryParse(numericString, styles); - - numericString = "12E03"; - CallTryParse(numericString, styles); - - numericString = "80c1"; - CallTryParse(numericString, NumberStyles::HexNumber); - - numericString = "0x80C1"; - CallTryParse(numericString, NumberStyles::HexNumber); - Console::ReadLine(); -} -// The example displays the following output: -// Converted '106779' to 106779. -// Attempted conversion of '-30677' failed. -// Converted '-30677' to -30677. -// Attempted conversion of '301677-' failed. -// Converted '301677-' to -301677. -// Attempted conversion of '$10634' failed. -// Converted '$10634' to 10634. -// Converted '10345.00' to 10345. -// Attempted conversion of '10345.72' failed. -// Converted '22,593' to 22593. -// Attempted conversion of '12E-01' failed. -// Converted '12E03' to 12000. -// Converted '80c1' to 32961. -// Attempted conversion of '0x80C1' failed. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp deleted file mode 100644 index 8a1d8bb47db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example for the Math::E field. -using namespace System; - -// Approximate E with a power series. -void CalcPowerSeries() -{ - double factorial = 1.0; - double PS = 0.0; - - // Stop iterating when the series converges, - // and prevent a runaway process. - for ( int n = 0; n < 999 && Math::Abs( Math::E - PS ) > 1.0E-15; n++ ) - { - - // Calculate a running factorial. - if ( n > 0 ) - factorial *= (double)n; - - // Calculate and display the power series. - PS += 1.0 / factorial; - Console::WriteLine( "PS({0:D2}) == {1:E16}, Math::E - PS({0:D2}) == {2:E16}", n, PS, Math::E - PS ); - - } -} - -int main() -{ - Console::WriteLine( "This example of Math::E == {0:E16}\n" - "generates the following output.\n", Math::E ); - Console::WriteLine( "Define the power series PS(n) = Sum(k->0,n)[1/k!]" ); - Console::WriteLine( " (limit n->infinity)PS(n) == e" ); - Console::WriteLine( "Display PS(n) and Math::E - PS(n), " - "and stop when delta < 1.0E-15\n" ); - CalcPowerSeries(); -} - -/* -This example of Math::E == 2.7182818284590451E+000 -generates the following output. - -Define the power series PS(n) = Sum(k->0,n)[1/k!] - (limit n->infinity)PS(n) == e -Display PS(n) and Math::E - PS(n), and stop when delta < 1.0E-15 - -PS(00) == 1.0000000000000000E+000, Math::E - PS(00) == 1.7182818284590451E+000 -PS(01) == 2.0000000000000000E+000, Math::E - PS(01) == 7.1828182845904509E-001 -PS(02) == 2.5000000000000000E+000, Math::E - PS(02) == 2.1828182845904509E-001 -PS(03) == 2.6666666666666665E+000, Math::E - PS(03) == 5.1615161792378572E-002 -PS(04) == 2.7083333333333330E+000, Math::E - PS(04) == 9.9484951257120535E-003 -PS(05) == 2.7166666666666663E+000, Math::E - PS(05) == 1.6151617923787498E-003 -PS(06) == 2.7180555555555554E+000, Math::E - PS(06) == 2.2627290348964380E-004 -PS(07) == 2.7182539682539684E+000, Math::E - PS(07) == 2.7860205076724043E-005 -PS(08) == 2.7182787698412700E+000, Math::E - PS(08) == 3.0586177750535626E-006 -PS(09) == 2.7182815255731922E+000, Math::E - PS(09) == 3.0288585284310443E-007 -PS(10) == 2.7182818011463845E+000, Math::E - PS(10) == 2.7312660577649694E-008 -PS(11) == 2.7182818261984929E+000, Math::E - PS(11) == 2.2605521898810821E-009 -PS(12) == 2.7182818282861687E+000, Math::E - PS(12) == 1.7287637987806193E-010 -PS(13) == 2.7182818284467594E+000, Math::E - PS(13) == 1.2285727990501982E-011 -PS(14) == 2.7182818284582302E+000, Math::E - PS(14) == 8.1490370007486490E-013 -PS(15) == 2.7182818284589949E+000, Math::E - PS(15) == 5.0182080713057076E-014 -PS(16) == 2.7182818284590429E+000, Math::E - PS(16) == 2.2204460492503131E-015 -PS(17) == 2.7182818284590455E+000, Math::E - PS(17) == -4.4408920985006262E-016 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp deleted file mode 100644 index a74b9251364..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -// -// Example for the Math::Exp( double ) method. -using namespace System; - -// Evaluate logarithmic/exponential identity with a given argument. -void UseLnExp( double arg ) -{ - - // Evaluate e ^ ln(X) == ln(e ^ X) == X. - Console::WriteLine( "\n Math::Exp(Math::Log({0})) == {1:E16}\n" - " Math::Log(Math::Exp({0})) == {2:E16}", arg, Math::Exp( Math::Log( arg ) ), Math::Log( Math::Exp( arg ) ) ); -} - - -// Evaluate exponential identities that are functions of two arguments. -void UseTwoArgs( double argX, double argY ) -{ - - // Evaluate (e ^ X) * (e ^ Y) == e ^ (X + Y). - Console::WriteLine( "\nMath::Exp({0}) * Math::Exp({1}) == {2:E16}" - "\n Math::Exp({0} + {1}) == {3:E16}", argX, argY, Math::Exp( argX ) * Math::Exp( argY ), Math::Exp( argX + argY ) ); - - // Evaluate (e ^ X) ^ Y == e ^ (X * Y). - Console::WriteLine( " Math::Pow(Math::Exp({0}), {1}) == {2:E16}" - "\n Math::Exp({0} * {1}) == {3:E16}", argX, argY, Math::Pow( Math::Exp( argX ), argY ), Math::Exp( argX * argY ) ); - - // Evaluate X ^ Y == e ^ (Y * ln(X)). - Console::WriteLine( " Math::Pow({0}, {1}) == {2:E16}" - "\nMath::Exp({1} * Math::Log({0})) == {3:E16}", argX, argY, Math::Pow( argX, argY ), Math::Exp( argY * Math::Log( argX ) ) ); -} - -int main() -{ - Console::WriteLine( "This example of Math::Exp( double ) " - "generates the following output.\n" ); - Console::WriteLine( "Evaluate [e ^ ln(X) == ln(e ^ X) == X] " - "with selected values for X:" ); - UseLnExp( 0.1 ); - UseLnExp( 1.2 ); - UseLnExp( 4.9 ); - UseLnExp( 9.9 ); - Console::WriteLine( "\nEvaluate these identities with " - "selected values for X and Y:" ); - Console::WriteLine( " (e ^ X) * (e ^ Y) == e ^ (X + Y)" ); - Console::WriteLine( " (e ^ X) ^ Y == e ^ (X * Y)" ); - Console::WriteLine( " X ^ Y == e ^ (Y * ln(X))" ); - UseTwoArgs( 0.1, 1.2 ); - UseTwoArgs( 1.2, 4.9 ); - UseTwoArgs( 4.9, 9.9 ); -} - -/* -This example of Math::Exp( double ) generates the following output. - -Evaluate [e ^ ln(X) == ln(e ^ X) == X] with selected values for X: - - Math::Exp(Math::Log(0.1)) == 1.0000000000000001E-001 - Math::Log(Math::Exp(0.1)) == 1.0000000000000008E-001 - - Math::Exp(Math::Log(1.2)) == 1.2000000000000000E+000 - Math::Log(Math::Exp(1.2)) == 1.2000000000000000E+000 - - Math::Exp(Math::Log(4.9)) == 4.9000000000000012E+000 - Math::Log(Math::Exp(4.9)) == 4.9000000000000004E+000 - - Math::Exp(Math::Log(9.9)) == 9.9000000000000004E+000 - Math::Log(Math::Exp(9.9)) == 9.9000000000000004E+000 - -Evaluate these identities with selected values for X and Y: - (e ^ X) * (e ^ Y) == e ^ (X + Y) - (e ^ X) ^ Y == e ^ (X * Y) - X ^ Y == e ^ (Y * ln(X)) - -Math::Exp(0.1) * Math::Exp(1.2) == 3.6692966676192444E+000 - Math::Exp(0.1 + 1.2) == 3.6692966676192444E+000 - Math::Pow(Math::Exp(0.1), 1.2) == 1.1274968515793757E+000 - Math::Exp(0.1 * 1.2) == 1.1274968515793757E+000 - Math::Pow(0.1, 1.2) == 6.3095734448019331E-002 -Math::Exp(1.2 * Math::Log(0.1)) == 6.3095734448019344E-002 - -Math::Exp(1.2) * Math::Exp(4.9) == 4.4585777008251705E+002 - Math::Exp(1.2 + 4.9) == 4.4585777008251716E+002 - Math::Pow(Math::Exp(1.2), 4.9) == 3.5780924170885260E+002 - Math::Exp(1.2 * 4.9) == 3.5780924170885277E+002 - Math::Pow(1.2, 4.9) == 2.4433636334442981E+000 -Math::Exp(4.9 * Math::Log(1.2)) == 2.4433636334442981E+000 - -Math::Exp(4.9) * Math::Exp(9.9) == 2.6764450551890982E+006 - Math::Exp(4.9 + 9.9) == 2.6764450551891015E+006 - Math::Pow(Math::Exp(4.9), 9.9) == 1.1684908531676833E+021 - Math::Exp(4.9 * 9.9) == 1.1684908531676829E+021 - Math::Pow(4.9, 9.9) == 6.8067718210957060E+006 -Math::Exp(9.9 * Math::Log(4.9)) == 6.8067718210956985E+006 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp deleted file mode 100644 index aa7f305520b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example for the Math::Log( double ) and Math::Log( double, double ) methods. -using namespace System; - -// Evaluate logarithmic identities that are functions of two arguments. -void UseBaseAndArg( double argB, double argX ) -{ - - // Evaluate log(B)[X] == 1 / log(X)[B]. - Console::WriteLine( "\n Math::Log({1}, {0}) == {2:E16}" - "\n 1.0 / Math::Log({0}, {1}) == {3:E16}", argB, argX, Math::Log( argX, argB ), 1.0 / Math::Log( argB, argX ) ); - - // Evaluate log(B)[X] == ln[X] / ln[B]. - Console::WriteLine( " Math::Log({1}) / Math::Log({0}) == {2:E16}", argB, argX, Math::Log( argX ) / Math::Log( argB ) ); - - // Evaluate log(B)[X] == log(B)[e] * ln[X]. - Console::WriteLine( "Math::Log(Math::E, {0}) * Math::Log({1}) == {2:E16}", argB, argX, Math::Log( Math::E, argB ) * Math::Log( argX ) ); -} - -void main() -{ - Console::WriteLine( "This example of Math::Log( double ) and " - "Math::Log( double, double )\n" - "generates the following output.\n" ); - Console::WriteLine( "Evaluate these identities with " - "selected values for X and B (base):" ); - Console::WriteLine( " log(B)[X] == 1 / log(X)[B]" ); - Console::WriteLine( " log(B)[X] == ln[X] / ln[B]" ); - Console::WriteLine( " log(B)[X] == log(B)[e] * ln[X]" ); - UseBaseAndArg( 0.1, 1.2 ); - UseBaseAndArg( 1.2, 4.9 ); - UseBaseAndArg( 4.9, 9.9 ); - UseBaseAndArg( 9.9, 0.1 ); -} - -/* -This example of Math::Log( double ) and Math::Log( double, double ) -generates the following output. - -Evaluate these identities with selected values for X and B (base): - log(B)[X] == 1 / log(X)[B] - log(B)[X] == ln[X] / ln[B] - log(B)[X] == log(B)[e] * ln[X] - - Math::Log(1.2, 0.1) == -7.9181246047624818E-002 - 1.0 / Math::Log(0.1, 1.2) == -7.9181246047624818E-002 - Math::Log(1.2) / Math::Log(0.1) == -7.9181246047624818E-002 -Math::Log(Math::E, 0.1) * Math::Log(1.2) == -7.9181246047624804E-002 - - Math::Log(4.9, 1.2) == 8.7166610085093179E+000 - 1.0 / Math::Log(1.2, 4.9) == 8.7166610085093161E+000 - Math::Log(4.9) / Math::Log(1.2) == 8.7166610085093179E+000 -Math::Log(Math::E, 1.2) * Math::Log(4.9) == 8.7166610085093179E+000 - - Math::Log(9.9, 4.9) == 1.4425396251981288E+000 - 1.0 / Math::Log(4.9, 9.9) == 1.4425396251981288E+000 - Math::Log(9.9) / Math::Log(4.9) == 1.4425396251981288E+000 -Math::Log(Math::E, 4.9) * Math::Log(9.9) == 1.4425396251981288E+000 - - Math::Log(0.1, 9.9) == -1.0043839404494075E+000 - 1.0 / Math::Log(9.9, 0.1) == -1.0043839404494075E+000 - Math::Log(0.1) / Math::Log(9.9) == -1.0043839404494075E+000 -Math::Log(Math::E, 9.9) * Math::Log(0.1) == -1.0043839404494077E+000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp deleted file mode 100644 index e16651faef4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp +++ /dev/null @@ -1,120 +0,0 @@ - -// -// Example for the trigonometric Math.Sin( double ) -// and Math.Cos( double ) methods. -using namespace System; - -// Evaluate trigonometric identities with a given angle. -void UseSineCosine( double degrees ) -{ - double angle = Math::PI * degrees / 180.0; - double sinAngle = Math::Sin( angle ); - double cosAngle = Math::Cos( angle ); - - // Evaluate sin^2(X) + cos^2(X) == 1. - Console::WriteLine( "\n Math::Sin({0} deg) == {1:E16}\n" - " Math::Cos({0} deg) == {2:E16}", degrees, Math::Sin( angle ), Math::Cos( angle ) ); - Console::WriteLine( "(Math::Sin({0} deg))^2 + (Math::Cos({0} deg))^2 == {1:E16}", degrees, sinAngle * sinAngle + cosAngle * cosAngle ); - - // Evaluate sin(2 * X) == 2 * sin(X) * cos(X). - Console::WriteLine( " Math::Sin({0} deg) == {1:E16}", 2.0 * degrees, Math::Sin( 2.0 * angle ) ); - Console::WriteLine( " 2 * Math::Sin({0} deg) * Math::Cos({0} deg) == {1:E16}", degrees, 2.0 * sinAngle * cosAngle ); - - // Evaluate cos(2 * X) == cos^2(X) - sin^2(X). - Console::WriteLine( " Math::Cos({0} deg) == {1:E16}", 2.0 * degrees, Math::Cos( 2.0 * angle ) ); - Console::WriteLine( "(Math::Cos({0} deg))^2 - (Math::Sin({0} deg))^2 == {1:E16}", degrees, cosAngle * cosAngle - sinAngle * sinAngle ); -} - - -// Evaluate trigonometric identities that are functions of two angles. -void UseTwoAngles( double degreesX, double degreesY ) -{ - double angleX = Math::PI * degreesX / 180.0; - double angleY = Math::PI * degreesY / 180.0; - - // Evaluate sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y). - Console::WriteLine( "\n Math::Sin({0} deg) * Math::Cos({1} deg) +\n" - " Math::Cos({0} deg) * Math::Sin({1} deg) == {2:E16}", degreesX, degreesY, Math::Sin( angleX ) * Math::Cos( angleY ) + Math::Cos( angleX ) * Math::Sin( angleY ) ); - Console::WriteLine( " Math::Sin({0} deg) == {1:E16}", degreesX + degreesY, Math::Sin( angleX + angleY ) ); - - // Evaluate cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y). - Console::WriteLine( " Math::Cos({0} deg) * Math::Cos({1} deg) -\n" - " Math::Sin({0} deg) * Math::Sin({1} deg) == {2:E16}", degreesX, degreesY, Math::Cos( angleX ) * Math::Cos( angleY ) - Math::Sin( angleX ) * Math::Sin( angleY ) ); - Console::WriteLine( " Math::Cos({0} deg) == {1:E16}", degreesX + degreesY, Math::Cos( angleX + angleY ) ); -} - -int main() -{ - Console::WriteLine( "This example of trigonometric " - "Math::Sin( double ) and Math::Cos( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "Convert selected values for X to radians \n" - "and evaluate these trigonometric identities:" ); - Console::WriteLine( " sin^2(X) + cos^2(X) == 1\n" - " sin(2 * X) == 2 * sin(X) * cos(X)" ); - Console::WriteLine( " cos(2 * X) == cos^2(X) - sin^2(X)" ); - UseSineCosine( 15.0 ); - UseSineCosine( 30.0 ); - UseSineCosine( 45.0 ); - Console::WriteLine( "\nConvert selected values for X and Y to radians \n" - "and evaluate these trigonometric identities:" ); - Console::WriteLine( " sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y)" ); - Console::WriteLine( " cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y)" ); - UseTwoAngles( 15.0, 30.0 ); - UseTwoAngles( 30.0, 45.0 ); -} - -/* -This example of trigonometric Math::Sin( double ) and Math::Cos( double ) -generates the following output. - -Convert selected values for X to radians -and evaluate these trigonometric identities: - sin^2(X) + cos^2(X) == 1 - sin(2 * X) == 2 * sin(X) * cos(X) - cos(2 * X) == cos^2(X) - sin^2(X) - - Math::Sin(15 deg) == 2.5881904510252074E-001 - Math::Cos(15 deg) == 9.6592582628906831E-001 -(Math::Sin(15 deg))^2 + (Math::Cos(15 deg))^2 == 1.0000000000000000E+000 - Math::Sin(30 deg) == 4.9999999999999994E-001 - 2 * Math::Sin(15 deg) * Math::Cos(15 deg) == 4.9999999999999994E-001 - Math::Cos(30 deg) == 8.6602540378443871E-001 -(Math::Cos(15 deg))^2 - (Math::Sin(15 deg))^2 == 8.6602540378443871E-001 - - Math::Sin(30 deg) == 4.9999999999999994E-001 - Math::Cos(30 deg) == 8.6602540378443871E-001 -(Math::Sin(30 deg))^2 + (Math::Cos(30 deg))^2 == 1.0000000000000000E+000 - Math::Sin(60 deg) == 8.6602540378443860E-001 - 2 * Math::Sin(30 deg) * Math::Cos(30 deg) == 8.6602540378443860E-001 - Math::Cos(60 deg) == 5.0000000000000011E-001 -(Math::Cos(30 deg))^2 - (Math::Sin(30 deg))^2 == 5.0000000000000022E-001 - - Math::Sin(45 deg) == 7.0710678118654746E-001 - Math::Cos(45 deg) == 7.0710678118654757E-001 -(Math::Sin(45 deg))^2 + (Math::Cos(45 deg))^2 == 1.0000000000000000E+000 - Math::Sin(90 deg) == 1.0000000000000000E+000 - 2 * Math::Sin(45 deg) * Math::Cos(45 deg) == 1.0000000000000000E+000 - Math::Cos(90 deg) == 6.1230317691118863E-017 -(Math::Cos(45 deg))^2 - (Math::Sin(45 deg))^2 == 2.2204460492503131E-016 - -Convert selected values for X and Y to radians -and evaluate these trigonometric identities: - sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y) - cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y) - - Math::Sin(15 deg) * Math::Cos(30 deg) + - Math::Cos(15 deg) * Math::Sin(30 deg) == 7.0710678118654746E-001 - Math::Sin(45 deg) == 7.0710678118654746E-001 - Math::Cos(15 deg) * Math::Cos(30 deg) - - Math::Sin(15 deg) * Math::Sin(30 deg) == 7.0710678118654757E-001 - Math::Cos(45 deg) == 7.0710678118654757E-001 - - Math::Sin(30 deg) * Math::Cos(45 deg) + - Math::Cos(30 deg) * Math::Sin(45 deg) == 9.6592582628906831E-001 - Math::Sin(75 deg) == 9.6592582628906820E-001 - Math::Cos(30 deg) * Math::Cos(45 deg) - - Math::Sin(30 deg) * Math::Sin(45 deg) == 2.5881904510252085E-001 - Math::Cos(75 deg) == 2.5881904510252096E-001 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp deleted file mode 100644 index c3fdb8d9939..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp +++ /dev/null @@ -1,115 +0,0 @@ - -// -// Example for the hyperbolic Math.Sinh( double ) -// and Math.Cosh( double ) methods. -using namespace System; - -// Evaluate hyperbolic identities with a given argument. -void UseSinhCosh( double arg ) -{ - double sinhArg = Math::Sinh( arg ); - double coshArg = Math::Cosh( arg ); - - // Evaluate cosh^2(X) - sinh^2(X) == 1. - Console::WriteLine( "\n Math::Sinh({0}) == {1:E16}\n" - " Math::Cosh({0}) == {2:E16}", arg, Math::Sinh( arg ), Math::Cosh( arg ) ); - Console::WriteLine( "(Math::Cosh({0}))^2 - (Math::Sinh({0}))^2 == {1:E16}", arg, coshArg * coshArg - sinhArg * sinhArg ); - - // Evaluate sinh(2 * X) == 2 * sinh(X) * cosh(X). - Console::WriteLine( " Math::Sinh({0}) == {1:E16}", 2.0 * arg, Math::Sinh( 2.0 * arg ) ); - Console::WriteLine( " 2 * Math::Sinh({0}) * Math::Cosh({0}) == {1:E16}", arg, 2.0 * sinhArg * coshArg ); - - // Evaluate cosh(2 * X) == cosh^2(X) + sinh^2(X). - Console::WriteLine( " Math::Cosh({0}) == {1:E16}", 2.0 * arg, Math::Cosh( 2.0 * arg ) ); - Console::WriteLine( "(Math::Cosh({0}))^2 + (Math::Sinh({0}))^2 == {1:E16}", arg, coshArg * coshArg + sinhArg * sinhArg ); -} - - -// Evaluate hyperbolic identities that are functions of two arguments. -void UseTwoArgs( double argX, double argY ) -{ - - // Evaluate sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y). - Console::WriteLine( "\n Math::Sinh({0}) * Math::Cosh({1}) +\n" - " Math::Cosh({0}) * Math::Sinh({1}) == {2:E16}", argX, argY, Math::Sinh( argX ) * Math::Cosh( argY ) + Math::Cosh( argX ) * Math::Sinh( argY ) ); - Console::WriteLine( " Math::Sinh({0}) == {1:E16}", argX + argY, Math::Sinh( argX + argY ) ); - - // Evaluate cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y). - Console::WriteLine( " Math::Cosh({0}) * Math::Cosh({1}) +\n" - " Math::Sinh({0}) * Math::Sinh({1}) == {2:E16}", argX, argY, Math::Cosh( argX ) * Math::Cosh( argY ) + Math::Sinh( argX ) * Math::Sinh( argY ) ); - Console::WriteLine( " Math::Cosh({0}) == {1:E16}", argX + argY, Math::Cosh( argX + argY ) ); -} - -int main() -{ - Console::WriteLine( "This example of hyperbolic " - "Math::Sinh( double ) and Math::Cosh( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "Evaluate these hyperbolic identities " - "with selected values for X:" ); - Console::WriteLine( " cosh^2(X) - sinh^2(X) == 1\n" - " sinh(2 * X) == 2 * sinh(X) * cosh(X)" ); - Console::WriteLine( " cosh(2 * X) == cosh^2(X) + sinh^2(X)" ); - UseSinhCosh( 0.1 ); - UseSinhCosh( 1.2 ); - UseSinhCosh( 4.9 ); - Console::WriteLine( "\nEvaluate these hyperbolic identities " - "with selected values for X and Y:" ); - Console::WriteLine( " sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y)" ); - Console::WriteLine( " cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y)" ); - UseTwoArgs( 0.1, 1.2 ); - UseTwoArgs( 1.2, 4.9 ); -} - -/* -This example of hyperbolic Math::Sinh( double ) and Math::Cosh( double ) -generates the following output. - -Evaluate these hyperbolic identities with selected values for X: - cosh^2(X) - sinh^2(X) == 1 - sinh(2 * X) == 2 * sinh(X) * cosh(X) - cosh(2 * X) == cosh^2(X) + sinh^2(X) - - Math::Sinh(0.1) == 1.0016675001984403E-001 - Math::Cosh(0.1) == 1.0050041680558035E+000 -(Math::Cosh(0.1))^2 - (Math::Sinh(0.1))^2 == 9.9999999999999989E-001 - Math::Sinh(0.2) == 2.0133600254109399E-001 - 2 * Math::Sinh(0.1) * Math::Cosh(0.1) == 2.0133600254109396E-001 - Math::Cosh(0.2) == 1.0200667556190759E+000 -(Math::Cosh(0.1))^2 + (Math::Sinh(0.1))^2 == 1.0200667556190757E+000 - - Math::Sinh(1.2) == 1.5094613554121725E+000 - Math::Cosh(1.2) == 1.8106555673243747E+000 -(Math::Cosh(1.2))^2 - (Math::Sinh(1.2))^2 == 1.0000000000000000E+000 - Math::Sinh(2.4) == 5.4662292136760939E+000 - 2 * Math::Sinh(1.2) * Math::Cosh(1.2) == 5.4662292136760939E+000 - Math::Cosh(2.4) == 5.5569471669655064E+000 -(Math::Cosh(1.2))^2 + (Math::Sinh(1.2))^2 == 5.5569471669655064E+000 - - Math::Sinh(4.9) == 6.7141166550932297E+001 - Math::Cosh(4.9) == 6.7148613134003227E+001 -(Math::Cosh(4.9))^2 - (Math::Sinh(4.9))^2 == 1.0000000000000000E+000 - Math::Sinh(9.8) == 9.0168724361884615E+003 - 2 * Math::Sinh(4.9) * Math::Cosh(4.9) == 9.0168724361884615E+003 - Math::Cosh(9.8) == 9.0168724916400624E+003 -(Math::Cosh(4.9))^2 + (Math::Sinh(4.9))^2 == 9.0168724916400606E+003 - -Evaluate these hyperbolic identities with selected values for X and Y: - sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y) - cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y) - - Math::Sinh(0.1) * Math::Cosh(1.2) + - Math::Cosh(0.1) * Math::Sinh(1.2) == 1.6983824372926155E+000 - Math::Sinh(1.3) == 1.6983824372926160E+000 - Math::Cosh(0.1) * Math::Cosh(1.2) + - Math::Sinh(0.1) * Math::Sinh(1.2) == 1.9709142303266281E+000 - Math::Cosh(1.3) == 1.9709142303266285E+000 - - Math::Sinh(1.2) * Math::Cosh(4.9) + - Math::Cosh(1.2) * Math::Sinh(4.9) == 2.2292776360739879E+002 - Math::Sinh(6.1) == 2.2292776360739885E+002 - Math::Cosh(1.2) * Math::Cosh(4.9) + - Math::Sinh(1.2) * Math::Sinh(4.9) == 2.2293000647511826E+002 - Math::Cosh(6.1) == 2.2293000647511832E+002 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp deleted file mode 100644 index 00a5cb83a3d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// -// Example for the hyperbolic Math::Tanh( double ) method. -using namespace System; - -// Evaluate hyperbolic identities with a given argument. -void UseTanh( double arg ) -{ - double tanhArg = Math::Tanh( arg ); - - // Evaluate tanh(X) == sinh(X) / cosh(X). - Console::WriteLine( "\n Math::Tanh({0}) == {1:E16}\n" - " Math::Sinh({0}) / Math::Cosh({0}) == {2:E16}", arg, tanhArg, (Math::Sinh( arg ) / Math::Cosh( arg )) ); - - // Evaluate tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)). - Console::WriteLine( " 2 * Math::Tanh({0}) /", arg, 2.0 * tanhArg ); - Console::WriteLine( " (1 + (Math::Tanh({0}))^2) == {1:E16}", arg, 2.0 * tanhArg / (1.0 + tanhArg * tanhArg) ); - Console::WriteLine( " Math::Tanh({0}) == {1:E16}", 2.0 * arg, Math::Tanh( 2.0 * arg ) ); -} - - -// Evaluate a hyperbolic identity that is a function of two arguments. -void UseTwoArgs( double argX, double argY ) -{ - - // Evaluate tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y)). - Console::WriteLine( "\n (Math::Tanh({0}) + Math::Tanh({1})) /\n" - "(1 + Math::Tanh({0}) * Math::Tanh({1})) == {2:E16}", argX, argY, (Math::Tanh( argX ) + Math::Tanh( argY )) / (1.0 + Math::Tanh( argX ) * Math::Tanh( argY )) ); - Console::WriteLine( " Math::Tanh({0}) == {1:E16}", argX + argY, Math::Tanh( argX + argY ) ); -} - -int main() -{ - Console::WriteLine( "This example of hyperbolic Math::Tanh( double )\n" - "generates the following output." ); - Console::WriteLine( "\nEvaluate these hyperbolic identities " - "with selected values for X:" ); - Console::WriteLine( " tanh(X) == sinh(X) / cosh(X)" ); - Console::WriteLine( " tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X))" ); - UseTanh( 0.1 ); - UseTanh( 1.2 ); - UseTanh( 4.9 ); - Console::WriteLine( "\nEvaluate [tanh(X + Y) == " - "(tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]" - "\nwith selected values for X and Y:" ); - UseTwoArgs( 0.1, 1.2 ); - UseTwoArgs( 1.2, 4.9 ); -} - -/* -This example of hyperbolic Math::Tanh( double ) -generates the following output. - -Evaluate these hyperbolic identities with selected values for X: - tanh(X) == sinh(X) / cosh(X) - tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)) - - Math::Tanh(0.1) == 9.9667994624955819E-002 - Math::Sinh(0.1) / Math::Cosh(0.1) == 9.9667994624955819E-002 - 2 * Math::Tanh(0.1) / - (1 + (Math::Tanh(0.1))^2) == 1.9737532022490401E-001 - Math::Tanh(0.2) == 1.9737532022490401E-001 - - Math::Tanh(1.2) == 8.3365460701215521E-001 - Math::Sinh(1.2) / Math::Cosh(1.2) == 8.3365460701215521E-001 - 2 * Math::Tanh(1.2) / - (1 + (Math::Tanh(1.2))^2) == 9.8367485769368024E-001 - Math::Tanh(2.4) == 9.8367485769368024E-001 - - Math::Tanh(4.9) == 9.9988910295055444E-001 - Math::Sinh(4.9) / Math::Cosh(4.9) == 9.9988910295055433E-001 - 2 * Math::Tanh(4.9) / - (1 + (Math::Tanh(4.9))^2) == 9.9999999385024030E-001 - Math::Tanh(9.8) == 9.9999999385024030E-001 - -Evaluate [tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))] -with selected values for X and Y: - - (Math::Tanh(0.1) + Math::Tanh(1.2)) / -(1 + Math::Tanh(0.1) * Math::Tanh(1.2)) == 8.6172315931330645E-001 - Math::Tanh(1.3) == 8.6172315931330634E-001 - - (Math::Tanh(1.2) + Math::Tanh(4.9)) / -(1 + Math::Tanh(1.2) * Math::Tanh(4.9)) == 9.9998993913939649E-001 - Math::Tanh(6.1) == 9.9998993913939649E-001 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp deleted file mode 100644 index f6ba5145e9c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -// Example for the OperatingSystem::Clone method. -using namespace System; - -// Copy, clone, and duplicate an OperatingSystem object. -void CopyOperatingSystemObjects() -{ - - // The Version object does not need to correspond to an - // actual OS version. - Version^ verMMBVer = gcnew Version( 5,6,7,8 ); - OperatingSystem^ opCreate1 = gcnew OperatingSystem( PlatformID::Win32NT,verMMBVer ); - - // Create another OperatingSystem object with the same - // parameters as opCreate1. - OperatingSystem^ opCreate2 = gcnew OperatingSystem( PlatformID::Win32NT,verMMBVer ); - - // Clone opCreate1 and copy the opCreate1 reference. - OperatingSystem^ opClone = safe_cast(opCreate1->Clone()); - OperatingSystem^ opCopy = opCreate1; - - // Compare the various objects for equality. - Console::WriteLine( "{0,-50}{1}", "Is the second object the same as the original?", opCreate1->Equals( opCreate2 ) ); - Console::WriteLine( "{0,-50}{1}", "Is the object clone the same as the original?", opCreate1->Equals( opClone ) ); - Console::WriteLine( "{0,-50}{1}", "Is the copied object the same as the original?", opCreate1->Equals( opCopy ) ); -} - -int main() -{ - Console::WriteLine( "This example of OperatingSystem::Clone( ) " - "generates the following output.\n" ); - Console::WriteLine( "Create an OperatingSystem object, and then " - "create another object with the \n" - "same parameters. Clone and copy the original " - "object, and then compare \n" - "each object with the original " - "using the Equals( ) method. Equals( ) \n" - "returns true only when both " - "references refer to the same object.\n" ); - CopyOperatingSystemObjects(); -} - -/* -This example of OperatingSystem::Clone( ) generates the following output. - -Create an OperatingSystem object, and then create another object with the -same parameters. Clone and copy the original object, and then compare -each object with the original using the Equals( ) method. Equals( ) -returns true only when both references refer to the same object. - -Is the second object the same as the original? False -Is the object clone the same as the original? False -Is the copied object the same as the original? True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp deleted file mode 100644 index 51ca7637c6e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -// -// Example for the OperatingSystem constructor and the -// OperatingSystem::ToString( ) method. -using namespace System; - -// Create and display an OperatingSystem object. -void BuildOSObj( PlatformID pID, Version^ ver ) -{ - OperatingSystem^ os = gcnew OperatingSystem( pID,ver ); - Console::WriteLine( " {0}", os->ToString() ); -} - -void BuildOperatingSystemObjects() -{ - - // The Version object does not need to correspond to an - // actual OS version. - Version^ verNull = gcnew Version; - Version^ verMajMin = gcnew Version( 3,11 ); - Version^ verMMBld = gcnew Version( 5,25,625 ); - Version^ verMMBVer = gcnew Version( 5,6,7,8 ); - Version^ verString = gcnew Version( "3.5.8.13" ); - - // All PlatformID members are shown here. - BuildOSObj( PlatformID::Win32NT, verNull ); - BuildOSObj( PlatformID::Win32S, verMajMin ); - BuildOSObj( PlatformID::Win32Windows, verMMBld ); - BuildOSObj( PlatformID::WinCE, verMMBVer ); - BuildOSObj( PlatformID::Win32NT, verString ); -} - -int main() -{ - Console::WriteLine( "This example of the OperatingSystem constructor and \n" - "OperatingSystem::ToString( ) generates the following " - "output.\n" ); - Console::WriteLine( "Create and display several different " - "OperatingSystem objects:\n" ); - BuildOperatingSystemObjects(); - Console::WriteLine( "\nThe OS version of the host computer is:\n\n {0}", Environment::OSVersion->ToString() ); -} - -/* -This example of the OperatingSystem constructor and -OperatingSystem::ToString( ) generates the following output. - -Create and display several different OperatingSystem objects: - - Microsoft Windows NT 0.0 - Microsoft Win32S 3.11 - Microsoft Windows 98 5.25.625 - Microsoft Windows CE 5.6.7.8 - Microsoft Windows NT 3.5.8.13 - -The OS version of the host computer is: - - Microsoft Windows NT 5.1.2600.0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp deleted file mode 100644 index 955079bbbca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example for the OperatingSystem.Platform and -// OperatingSystem.Version properties. -using namespace System; - -// Create an OperatingSystem object and display the Platform -// and Version properties. -void BuildOSObj( PlatformID pID, Version^ ver ) -{ - OperatingSystem^ opSys = gcnew OperatingSystem( pID,ver ); - PlatformID platform = opSys->Platform; - Version^ version = opSys->Version; - Console::WriteLine( " Platform: {0,-15} Version: {1}", platform, version ); -} - -void BuildOperatingSystemObjects() -{ - - // The Version object does not need to correspond to an - // actual OS version. - Version^ verNull = gcnew Version; - Version^ verString = gcnew Version( "3.5.8.13" ); - Version^ verMajMin = gcnew Version( 6,10 ); - Version^ verMMBld = gcnew Version( 5,25,5025 ); - Version^ verMMBVer = gcnew Version( 5,6,7,8 ); - - // All PlatformID members are shown here. - BuildOSObj( PlatformID::Win32NT, verNull ); - BuildOSObj( PlatformID::Win32S, verString ); - BuildOSObj( PlatformID::Win32Windows, verMajMin ); - BuildOSObj( PlatformID::WinCE, verMMBld ); - BuildOSObj( PlatformID::Win32NT, verMMBVer ); -} - -int main() -{ - Console::WriteLine( "This example of OperatingSystem::Platform " - "and OperatingSystem::Version \n" - "generates the following output.\n" ); - Console::WriteLine( "Create several OperatingSystem objects " - "and display their properties:\n" ); - BuildOperatingSystemObjects(); - Console::WriteLine( "\nThe operating system of the host computer is:\n" ); - BuildOSObj( Environment::OSVersion->Platform, Environment::OSVersion->Version ); -} - -/* -This example of OperatingSystem::Platform and OperatingSystem::Version -generates the following output. - -Create several OperatingSystem objects and display their properties: - - Platform: Win32NT Version: 0.0 - Platform: Win32S Version: 3.5.8.13 - Platform: Win32Windows Version: 6.10 - Platform: WinCE Version: 5.25.5025 - Platform: Win32NT Version: 5.6.7.8 - -The operating system of the host computer is: - - Platform: Win32NT Version: 5.1.2600.0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp deleted file mode 100644 index cb05859164c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp +++ /dev/null @@ -1,95 +0,0 @@ - -// -// Example of the Random class constructors and Random::NextDouble() -// method. -using namespace System; -using namespace System::Threading; - -// Generate random numbers from the specified Random object. -void RunIntNDoubleRandoms(Random^ randObj) -{ - - // Generate the first six random integers. - for (int j = 0; j < 6; j++) - Console::Write(" {0,10} ", randObj->Next()); - Console::WriteLine(); - - // Generate the first six random doubles. - for (int j = 0; j < 6; j++) - Console::Write(" {0:F8} ", randObj->NextDouble()); - Console::WriteLine(); -} - - -// Create a Random object with the specified seed. -void FixedSeedRandoms(int seed) -{ - Console::WriteLine("\nRandom numbers from a Random object with seed = {0}:", seed); - Random^ fixRand = gcnew Random(seed); - RunIntNDoubleRandoms(fixRand); -} - - -// Create a random object with a timer-generated seed. -void AutoSeedRandoms() -{ - - // Wait to allow the timer to advance. - Thread::Sleep(1); - Console::WriteLine("\nRandom numbers from a Random object " - "with an auto-generated seed:"); - Random^ autoRand = gcnew Random; - RunIntNDoubleRandoms(autoRand); -} - -int main() -{ - Console::WriteLine("This example of the Random class constructors and Random" - "::NextDouble() \ngenerates the following output.\n"); - Console::WriteLine("Create Random objects, and then generate and " - "display six integers and \nsix doubles from each."); - FixedSeedRandoms(123); - FixedSeedRandoms(123); - FixedSeedRandoms(456); - FixedSeedRandoms(456); - AutoSeedRandoms(); - AutoSeedRandoms(); - AutoSeedRandoms(); -} - -/* -This example of the Random class constructors and Random::NextDouble() -generates an output similar to the following: - -Create Random objects, and then generate and display six integers and -six doubles from each. - -Random numbers from a Random object with seed = 123: - 2114319875 1949518561 1596751841 1742987178 1586516133 103755708 - 0.01700087 0.14935942 0.19470390 0.63008947 0.90976122 0.49519146 - -Random numbers from a Random object with seed = 123: - 2114319875 1949518561 1596751841 1742987178 1586516133 103755708 - 0.01700087 0.14935942 0.19470390 0.63008947 0.90976122 0.49519146 - -Random numbers from a Random object with seed = 456: - 2044805024 1323311594 1087799997 1907260840 179380355 120870348 - 0.21988117 0.21026556 0.39236514 0.42420498 0.24102703 0.47310170 - -Random numbers from a Random object with seed = 456: - 2044805024 1323311594 1087799997 1907260840 179380355 120870348 - 0.21988117 0.21026556 0.39236514 0.42420498 0.24102703 0.47310170 - -Random numbers from a Random object with an auto-generated seed: - 1624372556 1894939458 302472229 588108304 23919954 1085111949 - 0.14595512 0.30162298 0.92267372 0.55707657 0.25430079 0.74143239 - -Random numbers from a Random object with an auto-generated seed: - 2105952511 1753605347 280739490 876793040 1129567796 524571616 - 0.62652210 0.31846701 0.15984073 0.24458755 0.62160607 0.54857684 - -Random numbers from a Random object with an auto-generated seed: - 440048819 1612271236 259006751 1165477776 87731991 2111514930 - 0.10708907 0.33531104 0.39700773 0.93209853 0.98891135 0.35572129 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp deleted file mode 100644 index 167584f6cc6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp +++ /dev/null @@ -1,99 +0,0 @@ - -// -// Example of the Random::Next() methods. -using namespace System; - -// Generate random numbers with no bounds specified. -void NoBoundsRandoms(int seed) -{ - Console::WriteLine("\nRandom object, seed = {0}, no bounds:", seed); - Random^ randObj = gcnew Random(seed); - - // Generate six random integers from 0 to int.MaxValue. - for (int j = 0; j < 6; j++) - Console::Write("{0,11} ", randObj->Next()); - Console::WriteLine(); -} - - -// Generate random numbers with an upper bound specified. -void UpperBoundRandoms(int seed, int upper) -{ - Console::WriteLine("\nRandom object, seed = {0}, upper bound = {1}:", seed, upper); - Random^ randObj = gcnew Random(seed); - - // Generate six random integers from 0 to the upper bound. - for (int j = 0; j < 6; j++) - Console::Write("{0,11} ", randObj->Next(upper)); - Console::WriteLine(); -} - - -// Generate random numbers with both bounds specified. -void BothBoundsRandoms(int seed, int lower, int upper) -{ - Console::WriteLine("\nRandom object, seed = {0}, lower = {1}, upper = {2}:", seed, lower, upper); - Random^ randObj = gcnew Random(seed); - - // Generate six random integers from the lower to - // upper bounds. - for (int j = 0; j < 6; j++) - Console::Write("{0,11} ", randObj->Next(lower, upper)); - Console::WriteLine(); -} - -int main() -{ - Console::WriteLine("This example of the Random::Next() methods\n" - "generates the following output.\n"); - Console::WriteLine("Create Random objects all with the same seed and " - "generate\nsequences of numbers with different " - "bounds. Note the effect\nthat the various " - "combinations of bounds have on the sequences."); - NoBoundsRandoms(234); - UpperBoundRandoms(234, Int32::MaxValue); - UpperBoundRandoms(234, 2000000000); - UpperBoundRandoms(234, 200000000); - BothBoundsRandoms(234, 0, Int32::MaxValue); - BothBoundsRandoms(234, Int32::MinValue, Int32::MaxValue); - BothBoundsRandoms(234, -2000000000, 2000000000); - BothBoundsRandoms(234, -200000000, 200000000); - BothBoundsRandoms(234, -2000, 2000); -} - -/* -This example of the Random::Next() methods -generates the following output. - -Create Random objects all with the same seed and generate -sequences of numbers with different bounds. Note the effect -that the various combinations of bounds have on the sequences. - -Random object, seed = 234, no bounds: - 2091148258 1024955023 711273344 1081917183 1833298756 109460588 - -Random object, seed = 234, upper bound = 2147483647: - 2091148258 1024955023 711273344 1081917183 1833298756 109460588 - -Random object, seed = 234, upper bound = 2000000000: - 1947533580 954563751 662424922 1007613896 1707392518 101943116 - -Random object, seed = 234, upper bound = 200000000: - 194753358 95456375 66242492 100761389 170739251 10194311 - -Random object, seed = 234, lower = 0, upper = 2147483647: - 2091148258 1024955023 711273344 1081917183 1833298756 109460588 - -Random object, seed = 234, lower = -2147483648, upper = 2147483647: - 2034812868 -97573602 -724936960 16350718 1519113864 -1928562472 - -Random object, seed = 234, lower = -2000000000, upper = 2000000000: - 1895067160 -90872498 -675150156 15227793 1414785036 -1796113767 - -Random object, seed = 234, lower = -200000000, upper = 200000000: - 189506716 -9087250 -67515016 1522779 141478503 -179611377 - -Random object, seed = 234, lower = -2000, upper = 2000: - 1895 -91 -676 15 1414 -1797 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp deleted file mode 100644 index fad6b704dab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; - -void main() -{ - Random^ rnd = gcnew Random(); - array^ malePetNames = { "Rufus", "Bear", "Dakota", "Fido", - "Vanya", "Samuel", "Koani", "Volodya", - "Prince", "Yiska" }; - array^ femalePetNames = { "Maggie", "Penny", "Saya", "Princess", - "Abby", "Laila", "Sadie", "Olivia", - "Starlight", "Talla" }; - - // Generate random indexes for pet names. - int mIndex = rnd->Next(malePetNames->Length); - int fIndex = rnd->Next(femalePetNames->Length); - - // Display the result. - Console::WriteLine("Suggested pet name of the day: "); - Console::WriteLine(" For a male: {0}", malePetNames[mIndex]); - Console::WriteLine(" For a female: {0}", femalePetNames[fIndex]); -} -// The example displays output similar to the following: -// Suggested pet name of the day: -// For a male: Koani -// For a female: Maggie -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp deleted file mode 100644 index 6f5970848da..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -using namespace System; - -void main() -{ - Random^ rnd = gcnew Random(); - - Console::WriteLine("\n20 random integers from -100 to 100:"); - for (int ctr = 1; ctr <= 20; ctr++) - { - Console::Write("{0,6}", rnd->Next(-100, 101)); - if (ctr % 5 == 0) Console::WriteLine(); - } - - Console::WriteLine("\n20 random integers from 1000 to 10000:"); - for (int ctr = 1; ctr <= 20; ctr++) - { - Console::Write("{0,8}", rnd->Next(1000, 10001)); - if (ctr % 5 == 0) Console::WriteLine(); - } - - Console::WriteLine("\n20 random integers from 1 to 10:"); - for (int ctr = 1; ctr <= 20; ctr++) - { - Console::Write("{0,6}", rnd->Next(1, 11)); - if (ctr % 5 == 0) Console::WriteLine(); - } -} -// The example displays output similar to the following: -// 20 random integers from -100 to 100: -// 65 -95 -10 90 -35 -// -83 -16 -15 -19 41 -// -67 -93 40 12 62 -// -80 -95 67 -81 -21 -// -// 20 random integers from 1000 to 10000: -// 4857 9897 4405 6606 1277 -// 9238 9113 5151 8710 1187 -// 2728 9746 1719 3837 3736 -// 8191 6819 4923 2416 3028 -// -// 20 random integers from 1 to 10: -// 9 8 5 9 9 -// 9 1 2 3 8 -// 1 4 8 10 5 -// 9 7 9 10 5 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp deleted file mode 100644 index 6f999eb0477..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::Write("Number of random numbers to generate: "); - String^ line = Console::ReadLine(); - unsigned int numbers = 0; - Random^ rnd = gcnew Random(); - - if (!UInt32::TryParse(line, numbers)) - numbers = 10; - - for (unsigned int ctr = 1; ctr <= numbers; ctr++) - Console::WriteLine("{0,15:N0}", rnd->Next()); -} -// The example displays output like the following when asked to generate -// 15 random numbers: -// Number of random numbers to generate: 15 -// 1,733,189,596 -// 566,518,090 -// 1,166,108,546 -// 1,931,426,514 -// 1,341,108,291 -// 1,012,698,049 -// 890,578,409 -// 1,377,589,722 -// 2,108,384,181 -// 1,532,939,448 -// 762,207,767 -// 815,074,920 -// 1,521,208,785 -// 1,950,436,671 -// 1,266,596,666 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp deleted file mode 100644 index 9b547303cfa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; - -void main() -{ - Random^ rnd = gcnew Random(); - array^ malePetNames = { "Rufus", "Bear", "Dakota", "Fido", - "Vanya", "Samuel", "Koani", "Volodya", - "Prince", "Yiska" }; - array^ femalePetNames = { "Maggie", "Penny", "Saya", "Princess", - "Abby", "Laila", "Sadie", "Olivia", - "Starlight", "Talla" }; - - // Generate random indexes for pet names. - int mIndex = rnd->Next(0, malePetNames->Length); - int fIndex = rnd->Next(0, femalePetNames->Length); - - // Display the result. - Console::WriteLine("Suggested pet name of the day: "); - Console::WriteLine(" For a male: {0}", malePetNames[mIndex]); - Console::WriteLine(" For a female: {0}", femalePetNames[fIndex]); -} -// The example displays the following output: -// Suggested pet name of the day: -// For a male: Koani -// For a female: Maggie -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp deleted file mode 100644 index 9e0bb8434a9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// SampleEx.cpp : main project file. - -// -using namespace System; - -// This derived class converts the uniformly distributed random -// numbers generated by base.Sample() to another distribution. -public ref class RandomProportional : Random -{ - // The Sample method generates a distribution proportional to the value - // of the random numbers, in the range [0.0, 1.0]. -protected: - virtual double Sample() override - { - return Math::Sqrt(Random::Sample()); - } - -public: - RandomProportional() - {} - - virtual int Next() override - { - return (int) (Sample() * Int32::MaxValue); - } -}; - -int main(array ^args) -{ - const int rows = 4, cols = 6; - const int runCount = 1000000; - const int distGroupCount = 10; - const double intGroupSize = - ((double) Int32::MaxValue + 1.0) / (double)distGroupCount; - - RandomProportional ^randObj = gcnew RandomProportional(); - - array^ intCounts = gcnew array(distGroupCount); - array^ realCounts = gcnew array(distGroupCount); - - Console::WriteLine( - "\nThe derived RandomProportional class overrides " + - "the Sample method to \ngenerate random numbers " + - "in the range [0.0, 1.0]. The distribution \nof " + - "the numbers is proportional to their numeric values. " + - "For example, \nnumbers are generated in the " + - "vicinity of 0.75 with three times the \n" + - "probability of those generated near 0.25."); - Console::WriteLine( - "\nRandom doubles generated with the NextDouble() " + - "method:\n"); - - // Generate and display [rows * cols] random doubles. - for (int i = 0; i < rows; i++) - { - for (int j = 0; j < cols; j++) - Console::Write("{0,12:F8}", randObj->NextDouble()); - Console::WriteLine(); - } - - Console::WriteLine( - "\nRandom integers generated with the Next() " + - "method:\n"); - - // Generate and display [rows * cols] random integers. - for (int i = 0; i < rows; i++) - { - for (int j = 0; j < cols; j++) - Console::Write("{0,12}", randObj->Next()); - Console::WriteLine(); - } - - Console::WriteLine( - "\nTo demonstrate the proportional distribution, " + - "{0:N0} random \nintegers and doubles are grouped " + - "into {1} equal value ranges. This \n" + - "is the count of values in each range:\n", - runCount, distGroupCount); - Console::WriteLine( - "{0,21}{1,10}{2,20}{3,10}", "Integer Range", - "Count", "Double Range", "Count"); - Console::WriteLine( - "{0,21}{1,10}{2,20}{3,10}", "-------------", - "-----", "------------", "-----"); - - // Generate random integers and doubles, and then count - // them by group. - for (int i = 0; i < runCount; i++) - { - intCounts[ (int)((double)randObj->Next() / - intGroupSize) ]++; - realCounts[ (int)(randObj->NextDouble() * - (double)distGroupCount) ]++; - } - - // Display the count of each group. - for (int i = 0; i < distGroupCount; i++) - Console::WriteLine( - "{0,10}-{1,10}{2,10:N0}{3,12:N5}-{4,7:N5}{5,10:N0}", - (int)((double)i * intGroupSize), - (int)((double)(i + 1) * intGroupSize - 1.0), - intCounts[ i ], - ((double)i) / (double)distGroupCount, - ((double)(i + 1)) / (double)distGroupCount, - realCounts[ i ]); - return 0; -} - -/* -This example of Random.Sample() displays output similar to the following: - - The derived RandomProportional class overrides the Sample method to - generate random numbers in the range [0.0, 1.0). The distribution - of the numbers is proportional to the number values. For example, - numbers are generated in the vicinity of 0.75 with three times the - probability of those generated near 0.25. - - Random doubles generated with the NextDouble() method: - - 0.59455719 0.17589882 0.83134398 0.35795862 0.91467727 0.54022658 - 0.93716947 0.54817519 0.94685080 0.93705478 0.18582318 0.71272428 - 0.77708682 0.95386216 0.70412393 0.86099417 0.08275804 0.79108316 - 0.71019941 0.84205103 0.41685082 0.58186880 0.89492302 0.73067715 - - Random integers generated with the Next() method: - - 1570755704 1279192549 1747627711 1705700211 1372759203 1849655615 - 2046235980 1210843924 1554274149 1307936697 1480207570 1057595022 - 337854215 844109928 2028310798 1386669369 2073517658 1291729809 - 1537248240 1454198019 1934863511 1640004334 2032620207 534654791 - - To demonstrate the proportional distribution, 1,000,000 random - integers and doubles are grouped into 10 equal value ranges. This - is the count of values in each range: - - Integer Range Count Double Range Count - ------------- ----- ------------ ----- - 0- 214748363 10,079 0.00000-0.10000 10,148 - 214748364- 429496728 29,835 0.10000-0.20000 29,849 - 429496729- 644245093 49,753 0.20000-0.30000 49,948 - 644245094- 858993458 70,325 0.30000-0.40000 69,656 - 858993459-1073741823 89,906 0.40000-0.50000 90,337 - 1073741824-1288490187 109,868 0.50000-0.60000 110,225 - 1288490188-1503238552 130,388 0.60000-0.70000 129,986 - 1503238553-1717986917 149,231 0.70000-0.80000 150,428 - 1717986918-1932735282 170,234 0.80000-0.90000 169,610 - 1932735283-2147483647 190,381 0.90000-1.00000 189,813 -*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp deleted file mode 100644 index 8fba2211c96..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -using namespace System; - -void main() -{ - // Instantiate random number generator using system-supplied value as seed. - Random^ rand = gcnew Random(); - // Generate and display 5 random byte (integer) values. - array^ bytes = gcnew array(4); - rand->NextBytes(bytes); - Console::WriteLine("Five random byte values:"); - for each (Byte byteValue in bytes) - Console::Write("{0, 5}", byteValue); - Console::WriteLine(); - // Generate and display 5 random integers. - Console::WriteLine("Five random integer values:"); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,15:N0}", rand->Next()); - Console::WriteLine(); - // Generate and display 5 random integers between 0 and 100.// - Console::WriteLine("Five random integers between 0 and 100:"); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N0}", rand->Next(101)); - Console::WriteLine(); - // Generate and display 5 random integers from 50 to 100. - Console::WriteLine("Five random integers between 50 and 100:"); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N0}", rand->Next(50, 101)); - Console::WriteLine(); - // Generate and display 5 random floating point values from 0 to 1. - Console::WriteLine("Five Doubles."); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N3}", rand->NextDouble()); - Console::WriteLine(); - // Generate and display 5 random floating point values from 0 to 5. - Console::WriteLine("Five Doubles between 0 and 5."); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N3}", rand->NextDouble() * 5); -} -// The example displays output like the following: -// Five random byte values: -// 194 185 239 54 116 -// Five random integer values: -// 507,353,531 1,509,532,693 2,125,074,958 1,409,512,757 652,767,128 -// Five random integers between 0 and 100: -// 16 78 94 79 52 -// Five random integers between 50 and 100: -// 56 66 96 60 65 -// Five Doubles. -// 0.943 0.108 0.744 0.563 0.415 -// Five Doubles between 0 and 5. -// 2.934 3.130 0.292 1.432 4.369 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp deleted file mode 100644 index b32ab193862..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp +++ /dev/null @@ -1,163 +0,0 @@ -using namespace System; - -class SingleSample -{ -public: - SingleSample() - { - - // - Single s = 4.55F; - // - - // - Console::WriteLine( "A Single is of type {0}.", s.GetType() ); - // - - // - bool done = false; - String^ inp; - do - { - Console::Write( "Enter a real number: " ); - inp = Console::ReadLine(); - try - { - s = Single::Parse( inp ); - Console::WriteLine( "You entered {0}.", s ); - done = true; - } - catch ( FormatException^ ) - { - Console::WriteLine( "You did not enter a number." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred while parsing your response: {0}", e ); - } - } - while ( !done ); - // - - // - if ( s > Single::MaxValue ) - { - Console::WriteLine( "Your number is larger than a Single." ); - } - // - - // - if ( s < Single::MinValue ) - { - Console::WriteLine( "Your number is smaller than a Single." ); - } - // - - // - Console::WriteLine( "Epsilon, or the permittivity of a vacuum, has value {0}", Single::Epsilon ); - // - - // - Single zero = 0; - - // This condition will return false. - if ( (0 / zero) == Single::NaN ) - { - Console::WriteLine( "0 / 0 can be tested with Single::NaN." ); - } - else - { - Console::WriteLine( "0 / 0 cannot be tested with Single::NaN; use Single::IsNan() instead." ); - } - // - - // - // This will return true. - if ( Single::IsNaN( 0 / zero ) ) - { - Console::WriteLine( "Single::IsNan() can determine whether a value is not-a-number." ); - } - // - - // - // This will equal Infinity. - Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Single::NegativeInfinity) ); - // - - // - // This will equal Infinity. - Console::WriteLine( "PositiveInfinity plus 10.0 equals {0}.", (Single::PositiveInfinity + 10.0) ); - // - - // - // This will return S"true". - Console::WriteLine( "IsInfinity(3.0F / 0) == {0}.", Single::IsInfinity( 3.0F / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return true. - Console::WriteLine( "IsPositiveInfinity(4.0F / 0) == {0}.", Single::IsPositiveInfinity( 4.0F / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return true. - Console::WriteLine( "IsNegativeInfinity(-5.0F / 0) == {0}.", Single::IsNegativeInfinity( -5.0F / zero ) ? (String^)"true" : "false" ); - // - - // - Single a; - a = 500; - - Object^ obj1; - // - - // - // The variables point to the same objects. - Object^ obj2; - obj1 = a; - obj2 = obj1; - - if ( Single::ReferenceEquals( obj1, obj2 ) ) - { - Console::WriteLine( "The variables point to the same Single object." ); - } - else - { - Console::WriteLine( "The variables point to different Single objects." ); - } - // - - // - obj1 = (Single)450; - - if ( a.CompareTo( obj1 ) < 0 ) - { - Console::WriteLine( " {0} is less than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) > 0 ) - { - Console::WriteLine( " {0} is greater than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) == 0 ) - { - Console::WriteLine( " {0} equals {1}.", a, obj1 ); - } - // - - // - obj1 = (Single)500; - - if ( a.Equals( obj1 ) ) - { - Console::WriteLine( "The value type and reference type values are equal." ); - } - // - } -}; - -int main() -{ - new SingleSample; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp deleted file mode 100644 index 851ef4dcfad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -using namespace System; -using namespace System::Text; - -void main() -{ - String^ characters = "abc" + L'0' + "def"; - Console::WriteLine(characters->Length); // Displays 7 -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp deleted file mode 100644 index 9da4bfb57cf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; - -void main() -{ - // Create upper-case characters from their Unicode code units. - String^ stringUpper = "\x0041\x0042\x0043"; - - // Create lower-case characters from their Unicode code units. - String^ stringLower = "\x0061\x0062\x0063"; - - // Display the strings. - Console::WriteLine("Comparing '{0}' and '{1}':", - stringUpper, stringLower); - - // Compare the uppercased strings; the result is true. - Console::WriteLine("The Strings are equal when capitalized? {0}", - String::Compare(stringUpper->ToUpper(), stringLower->ToUpper()) == 0 - ? "true" : "false"); - - // The previous method call is equivalent to this Compare method, which ignores case. - Console::WriteLine("The Strings are equal when case is ignored? {0}", - String::Compare(stringUpper, stringLower, true) == 0 - ? "true" : "false"); -} -// The example displays the following output: -// Comparing 'ABC' and 'abc': -// The Strings are equal when capitalized? true -// The Strings are equal when case is ignored? true -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp deleted file mode 100644 index ceae78e341d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -public ref class Example -{ -public: - static void Main() - { - String^ string1 = "brother"; - String^ string2 = "Brother"; - String^ relation; - int result; - - // Cultural (linguistic) comparison. - result = String::Compare(string1, string2, gcnew CultureInfo("en-US"), - CompareOptions::None); - if (result > 0) - relation = "comes after"; - else if (result == 0) - relation = "is the same as"; - else - relation = "comes before"; - - Console::WriteLine("'{0}' {1} '{2}'.", - string1, relation, string2); - - // Cultural (linguistic) case-insensitive comparison. - result = String::Compare(string1, string2, gcnew CultureInfo("en-US"), - CompareOptions::IgnoreCase); - if (result > 0) - relation = "comes after"; - else if (result == 0) - relation = "is the same as"; - else - relation = "comes before"; - - Console::WriteLine("'{0}' {1} '{2}'.", - string1, relation, string2); - - // Culture-insensitive ordinal comparison. - result = String::CompareOrdinal(string1, string2); - if (result > 0) - relation = "comes after"; - else if (result == 0) - relation = "is the same as"; - else - relation = "comes before"; - - Console::WriteLine("'{0}' {1} '{2}'.", - string1, relation, string2); - } -}; - -int main() -{ - Example::Main(); -} - - -// The example produces the following output: -// 'brother' comes before 'Brother'. -// 'brother' is the same as 'Brother'. -// 'brother' comes after 'Brother'. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp deleted file mode 100644 index 403d3a1c663..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp +++ /dev/null @@ -1,197 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -public ref class Example -{ -public: - static void Main() - { - Console::WriteLine("Hi!"); - } -}; - -int main() -{ - Example::Main(); -} - -// System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32) -public ref class CompareSample1_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -// System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32) -public ref class CompareSample1_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32,System.Boolean) -public class CompareSample2_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32,System.Boolean) -public class CompareSample2_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32, -// System.Boolean,System.Globalization.CultureInfo) -public class CompareSample3_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32, -// System.Boolean,System.Globalization.CultureInfo) -public class CompareSample3_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32, -// System.Int32,System.StringComparison) -public class CompareSample4_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32, -// System.Int32,System.StringComparison) -public class CompareSample4_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String) -public class CompareSample5_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String) -public class CompareSample5_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean) -public class CompareSample6_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean) -public class CompareSample6_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean,System.Globalization.CultureInfo) -public class CompareSample7_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean,System.Globalization.CultureInfo) -public class CompareSample7_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.StringComparison) -public class CompareSample8_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.StringComparison) -public class CompareSample8_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp deleted file mode 100644 index 3c33eb9d8a7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// -// This example demonstrates the -// System.String.Compare(String, String, StringComparison) method. - -using namespace System; -using namespace System::Threading; - -void Test(int testStringIndex, int searchStringIndex, - StringComparison comparison, array^ testI, - array^ testNames) -{ - String^ resultFormat = "{0} is {1} {2}"; - String^ resultString = "equal to"; - int comparisonValue = 0; - - comparisonValue = String::Compare(testI[testStringIndex], - testI[searchStringIndex], comparison); - if (comparisonValue < 0) - { - resultString = "less than"; - } - else if (comparisonValue > 0) - { - resultString = "greater than"; - } - Console::WriteLine(resultFormat, testNames[testStringIndex], resultString, - testNames[searchStringIndex]); -} - -int main() -{ - String^ introMessage = - "Compare three versions of the letter I using different " + - "values of StringComparison."; - - // Define an array of strings where each element contains a version of - // the letter I. (An array of strings is used so you can easily modify - // this code example to test additional or different combinations of - // strings.) - - array^ letterVariation = gcnew array(3); - // LATIN SMALL LETTER I (U+0069) - letterVariation[0] = "i"; - // LATIN SMALL LETTER DOTLESS I (U+0131) - letterVariation[1] = L"\u0131"; - // LATIN CAPITAL LETTER I (U+0049) - letterVariation[2] = "I"; - - array^ unicodeNames = { - "LATIN SMALL LETTER I (U+0069)", - "LATIN SMALL LETTER DOTLESS I (U+0131)", - "LATIN CAPITAL LETTER I (U+0049)"}; - - array^ comparisonValues = { - StringComparison::CurrentCulture, - StringComparison::CurrentCultureIgnoreCase, - StringComparison::InvariantCulture, - StringComparison::InvariantCultureIgnoreCase, - StringComparison::Ordinal, - StringComparison::OrdinalIgnoreCase}; - - Console::Clear(); - Console::WriteLine(introMessage); - - // Display the current culture because the culture-specific comparisons - // can produce different results with different cultures. - Console::WriteLine("The current culture is {0}.{1}", - Thread::CurrentThread->CurrentCulture->Name, Environment::NewLine); - - // Determine the relative sort order of three versions of the letter I. - for each (StringComparison stringCmp in comparisonValues) - { - Console::WriteLine("StringComparison.{0}:", stringCmp); - - // LATIN SMALL LETTER I (U+0069) : LATIN SMALL LETTER DOTLESS I - // (U+0131) - Test(0, 1, stringCmp, letterVariation, unicodeNames); - - // LATIN SMALL LETTER I (U+0069) : LATIN CAPITAL LETTER I (U+0049) - Test(0, 2, stringCmp, letterVariation, unicodeNames); - - // LATIN SMALL LETTER DOTLESS I (U+0131) : LATIN CAPITAL LETTER I - // (U+0049) - Test(1, 2, stringCmp, letterVariation, unicodeNames); - - Console::WriteLine(); - } -} - -/* -This code example produces the following results: - -Compare three versions of the letter I using different values of -StringComparison. -The current culture is en-US. - -StringComparison.CurrentCulture: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is less than LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.CurrentCultureIgnoreCase: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.InvariantCulture: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is less than LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.InvariantCultureIgnoreCase: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.Ordinal: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is greater than LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.OrdinalIgnoreCase: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp deleted file mode 100644 index 85a57be8c79..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// -// This example demonstrates the -// System.String.EndsWith(String, StringComparison) method. - -using namespace System; -using namespace System::Threading; - -void Test(String^ testString, String^ searchString, - StringComparison comparison) -{ - String^ resultFormat = "\"{0}\" {1} with \"{2}\"."; - String^ resultString = "does not end"; - - if (testString->EndsWith(searchString, comparison)) - { - resultString = "ends"; - } - Console::WriteLine(resultFormat, testString, resultString, searchString); -} - -int main() -{ - String^ introMessage = - "Determine whether a string ends with another string, " + - "using\ndifferent values of StringComparison."; - - array^ comparisonValues = { - StringComparison::CurrentCulture, - StringComparison::CurrentCultureIgnoreCase, - StringComparison::InvariantCulture, - StringComparison::InvariantCultureIgnoreCase, - StringComparison::Ordinal, - StringComparison::OrdinalIgnoreCase}; - - Console::WriteLine(introMessage); - - // Display the current culture because the culture-specific comparisons - // can produce different results with different cultures. - Console::WriteLine("The current culture is {0}.\n", - Thread::CurrentThread->CurrentCulture->Name); - // Perform two tests for each StringComparison - for each (StringComparison stringCmp in comparisonValues) - { - Console::WriteLine("StringComparison.{0}:", stringCmp); - Test("abcXYZ", "XYZ", stringCmp); - Test("abcXYZ", "xyz", stringCmp); - Console::WriteLine(); - } -} - -/* -This code example produces the following results: - -Determine whether a string ends with another string, using -different values of StringComparison. -The current culture is en-US. - -StringComparison.CurrentCulture: -"abcXYZ" ends with "XYZ". -"abcXYZ" does not end with "xyz". - -StringComparison.CurrentCultureIgnoreCase: -"abcXYZ" ends with "XYZ". -"abcXYZ" ends with "xyz". - -StringComparison.InvariantCulture: -"abcXYZ" ends with "XYZ". -"abcXYZ" does not end with "xyz". - -StringComparison.InvariantCultureIgnoreCase: -"abcXYZ" ends with "XYZ". -"abcXYZ" ends with "xyz". - -StringComparison.Ordinal: -"abcXYZ" ends with "XYZ". -"abcXYZ" does not end with "xyz". - -StringComparison.OrdinalIgnoreCase: -"abcXYZ" ends with "XYZ". -"abcXYZ" ends with "xyz". - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp deleted file mode 100644 index ecbc4947741..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Example for the String Equality operator. -using namespace System; -void CompareAndDisplay( String^ Comparand ) -{ - String^ Lower = "abcd"; - Console::WriteLine( "\"{0}\" == \"{1}\" ? {2}", Lower, Comparand, Lower == Comparand ); -} - -int main() -{ - Console::WriteLine( "This example of the String Equality operator\n" - "generates the following output.\n" ); - CompareAndDisplay( "ijkl" ); - CompareAndDisplay( "ABCD" ); - CompareAndDisplay( "abcd" ); -} - -/* -This example of the String Equality operator -generates the following output. - -"abcd" == "ijkl" ? False -"abcd" == "ABCD" ? False -"abcd" == "abcd" ? True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp deleted file mode 100644 index 546e49f2c89..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Format4.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - String^ formatString = " {0,10} ({0,8:X8})\n" + - "And {1,10} ({1,8:X8})\n" + - " = {2,10} ({2,8:X8})"; - int value1 = 16932; - int value2 = 15421; - String^ result = String::Format(formatString, - value1, value2, value1 & value2); - Console::WriteLine(result); -} -// The example displays the following output: -// 16932 (00004224) -// And 15421 (00003C3D) -// = 36 (00000024) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp deleted file mode 100644 index 8415cc4c1df..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Format5.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - DateTime date1 = DateTime(2009, 7, 1); - TimeSpan hiTime = TimeSpan(14, 17, 32); - Decimal hiTemp = (Decimal) 62.1; - TimeSpan loTime = TimeSpan(3, 16, 10); - Decimal loTemp = (Decimal)54.8; - - String^ result1 = String::Format("Temperature on {0:d}:\n{1,11}: {2} degrees (hi)\n{3,11}: {4} degrees (lo)", - date1, hiTime, hiTemp, loTime, loTemp); - Console::WriteLine(result1); - Console::WriteLine(); - - String^ result2 = String::Format("Temperature on {0:d}:\n{1,11}: {2} degrees (hi)\n{3,11}: {4} degrees (lo)", - gcnew array { date1, hiTime, hiTemp, loTime, loTemp }); - Console::WriteLine(result2); -} -// The example displays the following output: -// Temperature on 7/1/2009: -// 14:17:32: 62.1 degrees (hi) -// 03:16:10: 54.8 degrees (lo) -// Temperature on 7/1/2009: -// 14:17:32: 62.1 degrees (hi) -// 03:16:10: 54.8 degrees (lo) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp deleted file mode 100644 index 166e0c1c832..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Format7.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - DateTime birthdate = DateTime(1993, 7, 28); - array^ dates = gcnew array { DateTime(1993, 8, 16), - DateTime(1994, 7, 28), - DateTime(2000, 10, 16), - DateTime(2003, 7, 27), - DateTime(2007, 5, 27) }; - - for each (DateTime dateValue in dates) - { - TimeSpan interval = dateValue - birthdate; - // Get the approximate number of years, without accounting for leap years. - int years = ((int)interval.TotalDays) / 365; - // See if adding the number of years exceeds dateValue. - String^ output; - if (birthdate.AddYears(years) <= dateValue) { - output = String::Format("You are now {0} years old.", years); - Console::WriteLine(output); - } - else { - output = String::Format("You are now {0} years old.", years - 1); - Console::WriteLine(output); - } - } -} -// The example displays the following output: -// You are now 0 years old. -// You are now 1 years old. -// You are now 7 years old. -// You are now 9 years old. -// You are now 13 years old. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp deleted file mode 100644 index 30af678140b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Format_ParamArray1.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -ref class CityInfo -{ -public: - CityInfo(String^ name, int population, Decimal area, int year) - { - this->Name = name; - this->Population = population; - this->Area = area; - this->Year = year; - } - - String^ Name; - int Population; - Decimal Area; - int Year; -}; - -ref class Example -{ -public: - static void ShowPopulationData(CityInfo^ city) - { - array^ args = gcnew array { city->Name, city->Year, city->Population, city->Area }; - String^ result = String::Format("{0} in {1}: Population {2:N0}, Area {3:N1} sq. feet", - args); - Console::WriteLine(result); - } -}; - -void main() -{ - CityInfo^ nyc2010 = gcnew CityInfo("New York", 8175133, (Decimal) 302.64, 2010); - Example::ShowPopulationData(nyc2010); - CityInfo^ sea2010 = gcnew CityInfo("Seattle", 608660, (Decimal) 83.94, 2010); - Example::ShowPopulationData(sea2010); -} -// The example displays the following output: -// New York in 2010: Population 8,175,133, Area 302.6 sq. feet -// Seattle in 2010: Population 608,660, Area 83.9 sq. feet -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp deleted file mode 100644 index 1acc61d5d34..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// FormatExample2.cpp : Defines the entry point for the console application. -// - -// #include "stdafx.h" - -// -using namespace System; - -ref class CustomerFormatter : IFormatProvider, ICustomFormatter -{ -public: - virtual Object^ GetFormat(Type^ formatType) - { - if (formatType == ICustomFormatter::typeid) - return this; - else - return nullptr; - } - - virtual String^ Format(String^ format, - Object^ arg, - IFormatProvider^ formatProvider) - { - if (!this->Equals(formatProvider)) - { - return nullptr; - } - else - { - if (String::IsNullOrEmpty(format)) - format = "G"; - - String^ customerString = arg->ToString(); - if (customerString->Length < 8) - customerString = customerString->PadLeft(8, '0'); - - format = format->ToUpper(); - if (format == L"G") - return customerString->Substring(0, 1) + "-" + - customerString->Substring(1, 5) + "-" + - customerString->Substring(6); - else if (format == L"S") - return customerString->Substring(0, 1) + "/" + - customerString->Substring(1, 5) + "/" + - customerString->Substring(6); - else if (format == L"P") - return customerString->Substring(0, 1) + "." + - customerString->Substring(1, 5) + "." + - customerString->Substring(6); - else - throw gcnew FormatException( - String::Format("The '{0}' format specifier is not supported.", format)); - } - } -}; - -void main() -{ - int acctNumber = 79203159; - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0}", acctNumber)); - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:G}", acctNumber)); - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:S}", acctNumber)); - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:P}", acctNumber)); - try { - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:X}", acctNumber)); - } - catch (FormatException^ e) { - Console::WriteLine(e->Message); - } -} -// The example displays the following output: -// 7-92031-59 -// 7-92031-59 -// 7/92031/59 -// 7.92031.59 -// The 'X' format specifier is not supported. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp deleted file mode 100644 index a0a958f9dc8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// FormatExample4.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - - -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - Dictionary^ temperatureInfo = gcnew Dictionary(); - temperatureInfo->Add(DateTime(2010, 6, 1, 14, 0, 0), 87.46); - temperatureInfo->Add(DateTime(2010, 12, 1, 10, 0, 0), 36.81); - - Console::WriteLine("Temperature Information:\n"); - String^ output; - for each (KeyValuePair^ item in temperatureInfo) - { - output = String::Format("Temperature at {0,8:t} on {0,9:d}: {1,5:N1}F", - item->Key, item->Value); - Console::WriteLine(output); - } -} -// The example displays the following output: -// Temperature Information: -// -// Temperature at 2:00 PM on 6/1/2010: 87.5F -// Temperature at 10:00 AM on 12/1/2010: 36.8F -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp deleted file mode 100644 index 34c12932dfc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// FormatOverload1.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - DateTime^ dat = gcnew DateTime(2012, 1, 17, 9, 30, 0); - String^ city = "Chicago"; - int temp = -16; - String^ output = String::Format("At {0} in {1}, the temperature was {2} degrees.", - dat, city, temp); - Console::WriteLine(output); -} -// The example displays the following output: -// At 1/17/2012 9:30:00 AM in Chicago, the temperature was -16 degrees. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp deleted file mode 100644 index 6ac7fe64f84..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// FormatOverload2.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - // Create array of 5-tuples with population data for three U.S. cities, 1940-1950. - array^>^ cities = gcnew array^> - { gcnew Tuple("Los Angeles", DateTime(1940, 1, 1), 1504277, - DateTime(1950, 1, 1), 1970358), - gcnew Tuple("New York", DateTime(1940, 1, 1), 7454995, - DateTime(1950, 1, 1), 7891957), - gcnew Tuple("Chicago", DateTime(1940, 1, 1), 3396808, - DateTime(1950, 1, 1), 3620962), - gcnew Tuple("Detroit", DateTime(1940, 1, 1), 1623452, - DateTime(1950, 1, 1), 1849568) }; - - // Display header - String^ header = String::Format("{0,-12}{1,8}{2,12}{1,8}{2,12}{3,14}\n", - "City", "Year", "Population", "Change (%)"); - Console::WriteLine(header); - String^ output; - for each (Tuple^ city in cities) { - output = String::Format("{0,-12}{1,8:yyyy}{2,12:N0}{3,8:yyyy}{4,12:N0}{5,14:P1}", - city->Item1, city->Item2, city->Item3, city->Item4, city->Item5, - (city->Item5 - city->Item3)/ (double)city->Item3); - Console::WriteLine(output); - } -} -// The example displays the following output: -// City Year Population Year Population Change (%) -// -// Los Angeles 1940 1,504,277 1950 1,970,358 31.0 % -// New York 1940 7,454,995 1950 7,891,957 5.9 % -// Chicago 1940 3,396,808 1950 3,620,962 6.6 % -// Detroit 1940 1,623,452 1950 1,849,568 13.9 % -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp deleted file mode 100644 index c0e1e10820b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// FormatSyntax1.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -using namespace System; - -void main() -{ - String^ value = -// -String::Format("{0,-10:C}", (Decimal) 126347.89); -// -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp deleted file mode 100644 index a5be70b67be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Interceptor2.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; -using namespace System::Globalization; - -ref class InterceptProvider : IFormatProvider, ICustomFormatter -{ -public: - virtual Object^ GetFormat(Type^ formatType) - { - if (formatType == ICustomFormatter::typeid) - return this; - else - return nullptr; - } - - virtual String^ Format(String^ format, Object^ obj, IFormatProvider^ provider) - { - // Display information about method call. - String^ formatString = format != nullptr ? format : ""; - Console::WriteLine("Provider: {0}, Object: {1}, Format String: {2}", - provider, obj != nullptr ? obj : "", formatString); - - if (obj == nullptr) return String::Empty; - - // If this is a byte and the "R" format string, format it with Roman numerals. - if (obj->GetType() == Byte::typeid && formatString->ToUpper()->Equals("R")) { - Byte value = (Byte) obj; - int remainder; - int result; - String^ returnString = String::Empty; - - // Get the hundreds digit(s) - result = Math::DivRem(value, 100, remainder); - if (result > 0) - returnString = gcnew String('C', result); - value = (Byte) remainder; - // Get the 50s digit - result = Math::DivRem(value, 50, remainder); - if (result == 1) - returnString += "L"; - value = (Byte) remainder; - // Get the tens digit. - result = Math::DivRem(value, 10, remainder); - if (result > 0) - returnString += gcnew String('X', result); - value = (Byte) remainder; - // Get the fives digit. - result = Math::DivRem(value, 5, remainder); - if (result > 0) - returnString += "V"; - value = (Byte) remainder; - // Add the ones digit. - if (remainder > 0) - returnString += gcnew String('I', remainder); - - // Check whether we have too many X characters. - int pos = returnString->IndexOf("XXXX"); - if (pos >= 0) { - int xPos = returnString->IndexOf("L"); - if ((xPos >= 0) & (xPos == pos - 1)) - returnString = returnString->Replace("LXXXX", "XC"); - else - returnString = returnString->Replace("XXXX", "XL"); - } - // Check whether we have too many I characters - pos = returnString->IndexOf("IIII"); - if (pos >= 0) - if (returnString->IndexOf("V") >= 0) - returnString = returnString->Replace("VIIII", "IX"); - else - returnString = returnString->Replace("IIII", "IV"); - - return returnString; - } - - // Use default for all other formatting. - if (obj->GetType() == IFormattable::typeid) - return ((IFormattable^) obj)->ToString(format, CultureInfo::CurrentCulture); - else - return obj->ToString(); - } -}; - -void main() -{ - int n = 10; - double value = 16.935; - DateTime day = DateTime::Now; - InterceptProvider^ provider = gcnew InterceptProvider(); - Console::WriteLine(String::Format(provider, "{0:N0}: {1:C2} on {2:d}\n", n, value, day)); - Console::WriteLine(String::Format(provider, "{0}: {1:F}\n", "Today: ", - (DayOfWeek) DateTime::Now.DayOfWeek)); - Console::WriteLine(String::Format(provider, "{0:X}, {1}, {2}\n", - (Byte) 2, (Byte) 12, (Byte) 199)); - Console::WriteLine(String::Format(provider, "{0:R}, {1:R}, {2:R}\n", - (Byte) 2, (Byte) 12, (Byte) 199)); -} -// The example displays the following output: -// Provider: InterceptProvider, Object: 10, Format String: N0 -// Provider: InterceptProvider, Object: 16.935, Format String: C2 -// Provider: InterceptProvider, Object: 1/31/2013 6:10:28 PM, Format String: d -// 10: $16.94 on 1/31/2013 -// -// Provider: InterceptProvider, Object: Today: , Format String: -// Provider: InterceptProvider, Object: Thursday, Format String: F -// Today: : Thursday -// -// Provider: InterceptProvider, Object: 2, Format String: X -// Provider: InterceptProvider, Object: 12, Format String: -// Provider: InterceptProvider, Object: 199, Format String: -// 2, 12, 199 -// -// Provider: InterceptProvider, Object: 2, Format String: R -// Provider: InterceptProvider, Object: 12, Format String: R -// Provider: InterceptProvider, Object: 199, Format String: R -// II, XII, CXCIX -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp deleted file mode 100644 index d74de7f473c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp +++ /dev/null @@ -1,80 +0,0 @@ -using namespace System; -using namespace System::Text; - -ref class Example -{ - public: - static void Snippet31() - { - // - String^ s = String::Format("At {0}, the temperature is {1}°C.", - DateTime::Now, 20.4); - // Output similar to: 'At 4/10/2015 9:29:41 AM, the temperature is 20.4°C.' - // - Console::WriteLine(s); - } - - static void Snippet32() - { - // - String^ s = String::Format("It is now {0:d} at {0:t}", - DateTime::Now); - // Output similar to: 'It is now 4/10/2015 at 10:04 AM' - // - Console::WriteLine(s); - } - - static void Snippet33() - { - // - array^ years = { 2013, 2014, 2015 }; - array^ population = { 1025632, 1105967, 1148203 }; - StringBuiler^ sb = gcnew StringBuilder(); - sb->Append(String::Format("{0,6} {1,15}\n\n", "Year", "Population")); - for(int index = 0; index < years->Length; index++) - sb->AppendFormat("{0,6} {1,15:N0}\n", - years[index], population[index]); - // Result: - // Year Population - // - // 2013 1,025,632 - // 2014 1,105,967 - // 2015 1,148,203 - // - Console::WriteLine(sb); - } - - static void Snippet34() - { - // - array^ years = { 2013, 2014, 2015 }; - array^ population = { 1025632, 1105967, 1148203 }; - String^ s = String::Format("{0,-10} {1,-10}\n\n", "Year", "Population"); - for(int index = 0; index < years->Length; index++) - s += String::Format("{0,-10} {1,-10:N0}\n", - years[index], population[index]); - // Result: - // Year Population - // - // 2013 1,025,632 - // 2014 1,105,967 - // 2015 1,148,203 - // - Console::WriteLine("\n{0}", s); - } -}; - -void main() -{ - // - Decimal temp = (Decimal)20.4; - String^ s = String::Format("The temperature is {0}°C.", temp); - Console::WriteLine(s); - // Displays 'The temperature is 20.4°C.' - // - - Example::Snippet31(); - Example::Snippet32(); - Example::Snippet33(); - Example::Snippet34(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp deleted file mode 100644 index 068c5e9cd1c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -using namespace System; - -ref class Example -{ - public: - - void Main() - { - // - Decimal pricePerOunce = (Decimal)17.36; - String^ s = String::Format("The current price is {0} per ounce.", - pricePerOunce); - // Result: The current price is 17.36 per ounce. - // - Console::WriteLine(s); - ShowFormatted(); - } - - void ShowFormatted() - { - // - Decimal pricePerOunce = (Decimal)17.36; - String^ s = String::Format("The current price is {0:C2} per ounce.", - pricePerOunce); - // Result if current culture is en-US: - // The current price is $17.36 per ounce. - // - Console::WriteLine(s); - } -}; - - -void main() -{ - Example^ ex = gcnew Example(); - ex->Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp deleted file mode 100644 index cf52d962e88..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -using namespace System; - -void EnumerateAndDisplay(String^ phrase) -{ - Console::WriteLine("The characters in the string \"{0}\" are:", - phrase); - - int CharCount = 0; - int controlChars = 0; - int alphanumeric = 0; - int punctuation = 0; - - for each (Char ch in phrase) { - Console::Write("'{0}' ", (! Char::IsControl(ch)) ? ch.ToString() : - "0x" + Convert::ToUInt16(ch).ToString("X4")); - if (Char::IsLetterOrDigit(ch)) - alphanumeric++; - else if (Char::IsControl(ch)) - controlChars++; - else if (Char::IsPunctuation(ch)) - punctuation++; - CharCount++; - } - - Console::WriteLine("\n Total characters: {0,3}", CharCount); - Console::WriteLine(" Alphanumeric characters: {0,3}", alphanumeric); - Console::WriteLine(" Punctuation characters: {0,3}", punctuation); - Console::WriteLine(" Control Characters: {0,3}\n", controlChars); -} - -int main() -{ - EnumerateAndDisplay("Test Case"); - EnumerateAndDisplay("This is a sentence."); - EnumerateAndDisplay("Has\ttwo\ttabs"); - EnumerateAndDisplay("Two\nnew\nlines"); -} -// The example displays the following output: -// The characters in the string "Test Case" are: -// 'T' 'e' 's' 't' ' ' 'C' 'a' 's' 'e' -// Total characters: 9 -// Alphanumeric characters: 8 -// Punctuation characters: 0 -// Control Characters: 0 -// -// The characters in the string "This is a sentence." are: -// 'T' 'h' 'i' 's' ' ' 'i' 's' ' ' 'a' ' ' 's' 'e' 'n' 't' 'e' 'n' 'c' 'e' '.' -// Total characters: 19 -// Alphanumeric characters: 15 -// Punctuation characters: 1 -// Control Characters: 0 -// -// The characters in the string "Has two tabs" are: -// 'H' 'a' 's' '0x0009' 't' 'w' 'o' '0x0009' 't' 'a' 'b' 's' -// Total characters: 12 -// Alphanumeric characters: 10 -// Punctuation characters: 0 -// Control Characters: 2 -// -// The characters in the string "Two -// new -// lines" are: -// 'T' 'w' 'o' '0x000A' 'n' 'e' 'w' '0x000A' 'l' 'i' 'n' 'e' 's' -// Total characters: 13 -// Alphanumeric characters: 11 -// Punctuation characters: 0 -// Control Characters: 2 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp deleted file mode 100644 index d0860d3d34b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; - -void DisplayHashCode( String^ Operand ) -{ - int HashCode = Operand->GetHashCode(); - Console::WriteLine( "The hash code for \"{0}\" is: 0x{1:X8}, {1}", Operand, HashCode ); -} - -int main() -{ - DisplayHashCode( "" ); - DisplayHashCode( "a" ); - DisplayHashCode( "ab" ); - DisplayHashCode( "abc" ); - DisplayHashCode( "abd" ); - DisplayHashCode( "abe" ); - DisplayHashCode( "abcdef" ); - DisplayHashCode( "abcdeg" ); - DisplayHashCode( "abcdeh" ); - DisplayHashCode( "abcdei" ); - DisplayHashCode( "Abcdeg" ); - DisplayHashCode( "Abcdeh" ); - DisplayHashCode( "Abcdei" ); -} - -/* -This example displays output like the following: - The hash code for "" is: 0x2D2816FE, 757602046 - The hash code for "a" is: 0xCDCAB7BF, -842352705 - The hash code for "ab" is: 0xCDE8B7BF, -840386625 - The hash code for "abc" is: 0x2001D81A, 536991770 - The hash code for "abd" is: 0xC2A94CB5, -1029092171 - The hash code for "abe" is: 0x6550C150, 1699791184 - The hash code for "abcdef" is: 0x1762906D, 392335469 - The hash code for "abcdeg" is: 0x1763906D, 392401005 - The hash code for "abcdeh" is: 0x175C906D, 391942253 - The hash code for "abcdei" is: 0x175D906D, 392007789 - The hash code for "Abcdeg" is: 0x1763954D, 392402253 - The hash code for "Abcdeh" is: 0x175C954D, 391943501 - The hash code for "Abcdei" is: 0x175D954D, 392009037 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp deleted file mode 100644 index 129189e1c03..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -using namespace System; - -void main() -{ - // Create a Unicode String with 5 Greek Alpha characters. - String^ szGreekAlpha = gcnew String(L'\x0391',5); - - // Create a Unicode String with a 3 Greek Omega characters. - String^ szGreekOmega = L"\x03A9\x03A9\x03A9"; - - String^ szGreekLetters = String::Concat(szGreekOmega, szGreekAlpha, - szGreekOmega->Clone()); - - // Display the entire string. - Console::WriteLine(szGreekLetters); - - // The first index of Alpha. - int ialpha = szGreekLetters->IndexOf( L'\x0391'); - // The first index of Omega. - int iomega = szGreekLetters->IndexOf(L'\x03A9'); - - Console::WriteLine("First occurrence of the Greek letter Alpha: Index {0}", - ialpha); - Console::WriteLine("First occurrence of the Greek letter Omega: Index {0}", - iomega); -} -// The example displays the following output: -// The string: OOO?????OOO -// First occurrence of the Greek letter Alpha: Index 3 -// First occurrence of the Greek letter Omega: Index 0 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp deleted file mode 100644 index 536ce88ab56..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// -// Example for the String::IndexOf( Char, int, int ) method. -using namespace System; -void FindAllChar( Char target, String^ searched ) -{ - Console::Write( "The character '{0}' occurs at position(s): ", target ); - int startIndex = -1; - int hitCount = 0; - - // Search for all occurrences of the target. - while ( true ) - { - startIndex = searched->IndexOf( target, startIndex + 1, searched->Length - startIndex - 1 ); - - // Exit the loop if the target is not found. - if ( startIndex < 0 ) - break; - - Console::Write( "{0}, ", startIndex ); - hitCount++; - } - - Console::WriteLine( "occurrences: {0}", hitCount ); -} - -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----" - "4----+----5----+----6----+----7"; - String^ br2 = "0123456789012345678901234567890123456789" - "0123456789012345678901234567890"; - String^ str = "ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi " - "ABCDEFGHI abcdefghi ABCDEFGHI"; - Console::WriteLine( "This example of String::IndexOf( Char, int, int )\n" - "generates the following output." ); - Console::WriteLine( "{0}{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - FindAllChar( 'A', str ); - FindAllChar( 'a', str ); - FindAllChar( 'I', str ); - FindAllChar( 'i', str ); - FindAllChar( '@', str ); - FindAllChar( ' ', str ); -} - -/* -This example of String::IndexOf( Char, int, int ) -generates the following output. - -0----+----1----+----2----+----3----+----4----+----5----+----6----+----7 -01234567890123456789012345678901234567890123456789012345678901234567890 -ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi ABCDEFGHI - -The character 'A' occurs at position(s): 0, 20, 40, 60, occurrences: 4 -The character 'a' occurs at position(s): 10, 30, 50, occurrences: 3 -The character 'I' occurs at position(s): 8, 28, 48, 68, occurrences: 4 -The character 'i' occurs at position(s): 18, 38, 58, occurrences: 3 -The character '@' occurs at position(s): occurrences: 0 -The character ' ' occurs at position(s): 9, 19, 29, 39, 49, 59, occurrences: 6 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp deleted file mode 100644 index 777e7856dd8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ str = "animal"; - String^ toFind = "n"; - int index = str->IndexOf("n"); - Console::WriteLine("Found '{0}' in '{1}' at position {2}", - toFind, str, index); - -} -// The example displays the following output: -// Found 'n' in 'animal' at position 1 -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp deleted file mode 100644 index fb115d56be2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Example for the String Inequality operator. -using namespace System; -void CompareAndDisplay( String^ Comparand ) -{ - String^ Lower = "abcd"; - Console::WriteLine( "\"{0}\" != \"{1}\" ? {2}", Lower, Comparand, Lower != Comparand ); -} - -int main() -{ - Console::WriteLine( "This example of the String Inequality operator\n" - "generates the following output.\n" ); - CompareAndDisplay( "ijkl" ); - CompareAndDisplay( "ABCD" ); - CompareAndDisplay( "abcd" ); -} - -/* -This example of the String Inequality operator -generates the following output. - -"abcd" != "ijkl" ? True -"abcd" != "ABCD" ? True -"abcd" != "abcd" ? False -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp deleted file mode 100644 index 9a0970cfcc3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// -using namespace System; - -void main() -{ - int n = 0; - for (int ctr = 0x20; ctr <= 0x017F; ctr++) { - String^ string1 = Convert::ToChar(ctr).ToString(); - String^ upperString = string1->ToUpper(); - if (string1 != upperString) { - Console::Write(L"{0} (\u+{1}) --> {2} (\u+{3}) ", - string1, - Convert::ToUInt16(string1[0]).ToString("X4"), - upperString, - Convert::ToUInt16(upperString[0]).ToString("X4")); - n++; - if (n % 2 == 0) Console::WriteLine(); - } - } -} -// The example displays the following output: -// a (\u+0061) --> A (\u+0041) b (\u+0062) --> B (\u+0042) -// c (\u+0063) --> C (\u+0043) d (\u+0064) --> D (\u+0044) -// e (\u+0065) --> E (\u+0045) f (\u+0066) --> F (\u+0046) -// g (\u+0067) --> G (\u+0047) h (\u+0068) --> H (\u+0048) -// i (\u+0069) --> I (\u+0049) j (\u+006A) --> J (\u+004A) -// k (\u+006B) --> K (\u+004B) l (\u+006C) --> L (\u+004C) -// m (\u+006D) --> M (\u+004D) n (\u+006E) --> N (\u+004E) -// o (\u+006F) --> O (\u+004F) p (\u+0070) --> P (\u+0050) -// q (\u+0071) --> Q (\u+0051) r (\u+0072) --> R (\u+0052) -// s (\u+0073) --> S (\u+0053) t (\u+0074) --> T (\u+0054) -// u (\u+0075) --> U (\u+0055) v (\u+0076) --> V (\u+0056) -// w (\u+0077) --> W (\u+0057) x (\u+0078) --> X (\u+0058) -// y (\u+0079) --> Y (\u+0059) z (\u+007A) --> Z (\u+005A) -// à (\u+00E0) --> À (\u+00C0) á (\u+00E1) --> Á (\u+00C1) -// â (\u+00E2) -->  (\u+00C2) ã (\u+00E3) --> à (\u+00C3) -// ä (\u+00E4) --> Ä (\u+00C4) å (\u+00E5) --> Å (\u+00C5) -// æ (\u+00E6) --> Æ (\u+00C6) ç (\u+00E7) --> Ç (\u+00C7) -// è (\u+00E8) --> È (\u+00C8) é (\u+00E9) --> É (\u+00C9) -// ê (\u+00EA) --> Ê (\u+00CA) ë (\u+00EB) --> Ë (\u+00CB) -// ì (\u+00EC) --> Ì (\u+00CC) í (\u+00ED) --> Í (\u+00CD) -// î (\u+00EE) --> Î (\u+00CE) ï (\u+00EF) --> Ï (\u+00CF) -// ð (\u+00F0) --> Ð (\u+00D0) ñ (\u+00F1) --> Ñ (\u+00D1) -// ò (\u+00F2) --> Ò (\u+00D2) ó (\u+00F3) --> Ó (\u+00D3) -// ô (\u+00F4) --> Ô (\u+00D4) õ (\u+00F5) --> Õ (\u+00D5) -// ö (\u+00F6) --> Ö (\u+00D6) ø (\u+00F8) --> Ø (\u+00D8) -// ù (\u+00F9) --> Ù (\u+00D9) ú (\u+00FA) --> Ú (\u+00DA) -// û (\u+00FB) --> Û (\u+00DB) ü (\u+00FC) --> Ü (\u+00DC) -// ý (\u+00FD) --> Ý (\u+00DD) þ (\u+00FE) --> Þ (\u+00DE) -// ÿ (\u+00FF) --> Ÿ (\u+0178) ā (\u+0101) --> Ā (\u+0100) -// ă (\u+0103) --> Ă (\u+0102) ą (\u+0105) --> Ą (\u+0104) -// ć (\u+0107) --> Ć (\u+0106) ĉ (\u+0109) --> Ĉ (\u+0108) -// ċ (\u+010B) --> Ċ (\u+010A) č (\u+010D) --> Č (\u+010C) -// ď (\u+010F) --> Ď (\u+010E) đ (\u+0111) --> Đ (\u+0110) -// ē (\u+0113) --> Ē (\u+0112) ĕ (\u+0115) --> Ĕ (\u+0114) -// ė (\u+0117) --> Ė (\u+0116) ę (\u+0119) --> Ę (\u+0118) -// ě (\u+011B) --> Ě (\u+011A) ĝ (\u+011D) --> Ĝ (\u+011C) -// ğ (\u+011F) --> Ğ (\u+011E) ġ (\u+0121) --> Ġ (\u+0120) -// ģ (\u+0123) --> Ģ (\u+0122) ĥ (\u+0125) --> Ĥ (\u+0124) -// ħ (\u+0127) --> Ħ (\u+0126) ĩ (\u+0129) --> Ĩ (\u+0128) -// ī (\u+012B) --> Ī (\u+012A) ĭ (\u+012D) --> Ĭ (\u+012C) -// į (\u+012F) --> Į (\u+012E) ı (\u+0131) --> I (\u+0049) -// ij (\u+0133) --> IJ (\u+0132) ĵ (\u+0135) --> Ĵ (\u+0134) -// ķ (\u+0137) --> Ķ (\u+0136) ĺ (\u+013A) --> Ĺ (\u+0139) -// ļ (\u+013C) --> Ļ (\u+013B) ľ (\u+013E) --> Ľ (\u+013D) -// ŀ (\u+0140) --> Ŀ (\u+013F) ł (\u+0142) --> Ł (\u+0141) -// ń (\u+0144) --> Ń (\u+0143) ņ (\u+0146) --> Ņ (\u+0145) -// ň (\u+0148) --> Ň (\u+0147) ŋ (\u+014B) --> Ŋ (\u+014A) -// ō (\u+014D) --> Ō (\u+014C) ŏ (\u+014F) --> Ŏ (\u+014E) -// ő (\u+0151) --> Ő (\u+0150) œ (\u+0153) --> Œ (\u+0152) -// ŕ (\u+0155) --> Ŕ (\u+0154) ŗ (\u+0157) --> Ŗ (\u+0156) -// ř (\u+0159) --> Ř (\u+0158) ś (\u+015B) --> Ś (\u+015A) -// ŝ (\u+015D) --> Ŝ (\u+015C) ş (\u+015F) --> Ş (\u+015E) -// š (\u+0161) --> Š (\u+0160) ţ (\u+0163) --> Ţ (\u+0162) -// ť (\u+0165) --> Ť (\u+0164) ŧ (\u+0167) --> Ŧ (\u+0166) -// ũ (\u+0169) --> Ũ (\u+0168) ū (\u+016B) --> Ū (\u+016A) -// ŭ (\u+016D) --> Ŭ (\u+016C) ů (\u+016F) --> Ů (\u+016E) -// ű (\u+0171) --> Ű (\u+0170) ų (\u+0173) --> Ų (\u+0172) -// ŵ (\u+0175) --> Ŵ (\u+0174) ŷ (\u+0177) --> Ŷ (\u+0176) -// ź (\u+017A) --> Ź (\u+0179) ż (\u+017C) --> Ż (\u+017B) -// ž (\u+017E) --> Ž (\u+017D) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp deleted file mode 100644 index befd0ecbf85..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ charsToTrim = { L'*', L' ', L'\\' }; - String^ banner = "*** Much Ado About Nothing ***"; - String^ result = banner->Trim(charsToTrim); - Console::WriteLine("Trimmmed\n {0}\nto\n '{1}'", banner, result); -} -// The example displays the following output: -// Trimmmed -// *** Much Ado About Nothing *** -// to -// 'Much Ado About Nothing' -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp deleted file mode 100644 index bd9807b395d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::Write("Enter your first name: "); - String^ firstName = Console::ReadLine(); - - Console::Write("Enter your middle name or initial: "); - String^ middleName = Console::ReadLine(); - - Console::Write("Enter your last name: "); - String^ lastName = Console::ReadLine(); - - Console::WriteLine(); - Console::WriteLine("You entered '{0}', '{1}', and '{2}'.", - firstName, middleName, lastName); - - String^ name = ((firstName->Trim() + " " + middleName->Trim())->Trim() + " " + - lastName->Trim())->Trim(); - Console::WriteLine("The result is " + name + "."); -} -// The following is possible output from this example: -// Enter your first name: John -// Enter your middle name or initial: -// Enter your last name: Doe -// -// You entered ' John ', '', and ' Doe'. -// The result is John Doe. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp deleted file mode 100644 index 19daa2e0cd4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// -// This example demonstrates members of the -// System::StringComparer class. - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Generic; -using namespace System::Globalization; -using namespace System::Threading; - -void Display(List^ stringList, String^ title) -{ - Char firstChar; - int codePoint; - Console::WriteLine(title); - for each (String^ s in stringList) - { - firstChar = s[0]; - codePoint = Convert::ToInt32(firstChar); - Console::WriteLine("0x{0:x}", codePoint); - } - Console::WriteLine(); -} - -int main() -{ - // Create a list of string. - List^ stringList = gcnew List(); - - // Get the tr-TR (Turkish-Turkey) culture. - CultureInfo^ turkishCulture = gcnew CultureInfo("tr-TR"); - - // Get the culture that is associated with the current thread. - CultureInfo^ currentCulture = Thread::CurrentThread->CurrentCulture; - - // Get the standard StringComparers. - StringComparer^ invariant = StringComparer::InvariantCulture; - StringComparer^ invariantIgnoreCase = - StringComparer::InvariantCultureIgnoreCase; - StringComparer^ current = StringComparer::CurrentCulture; - StringComparer^ currentIgnoreCase = - StringComparer::CurrentCultureIgnoreCase; - StringComparer^ ordinal = StringComparer::Ordinal; - StringComparer^ ordinalIgnoreCase = StringComparer::OrdinalIgnoreCase; - - // Create a StringComparer that uses the Turkish culture and ignores - // case. - StringComparer^ turkishIgnoreCase = - StringComparer::Create(turkishCulture, true); - - // Define three strings consisting of different versions of the - // letter I. LATIN CAPITAL LETTER I (U+0049) - String^ capitalLetterI = "I"; - - // LATIN SMALL LETTER I (U+0069) - String^ smallLetterI = "i"; - - // LATIN SMALL LETTER DOTLESS I (U+0131) - String^ smallLetterDotlessI = L"\u0131"; - - // Add the three strings to the list. - stringList->Add(capitalLetterI); - stringList->Add(smallLetterI); - stringList->Add(smallLetterDotlessI); - - // Display the original list order. - Display(stringList, "The original order of the list entries..."); - - // Sort the list using the invariant culture. - stringList->Sort(invariant); - Display(stringList, "Invariant culture..."); - stringList->Sort(invariantIgnoreCase); - Display(stringList, "Invariant culture, ignore case..."); - - // Sort the list using the current culture. - Console::WriteLine("The current culture is \"{0}\".", - currentCulture->Name); - stringList->Sort(current); - Display(stringList, "Current culture..."); - stringList->Sort(currentIgnoreCase); - Display(stringList, "Current culture, ignore case..."); - - // Sort the list using the ordinal value of the character code points. - stringList->Sort(ordinal); - Display(stringList, "Ordinal..."); - stringList->Sort(ordinalIgnoreCase); - Display(stringList, "Ordinal, ignore case..."); - - // Sort the list using the Turkish culture, which treats LATIN SMALL - // LETTER DOTLESS I differently than LATIN SMALL LETTER I. - stringList->Sort(turkishIgnoreCase); - Display(stringList, "Turkish culture, ignore case..."); -} -/* -This code example produces the following results: - -The original order of the list entries... -0x49 -0x69 -0x131 - -Invariant culture... -0x69 -0x49 -0x131 - -Invariant culture, ignore case... -0x49 -0x69 -0x131 - -The current culture is "en-US". -Current culture... -0x69 -0x49 -0x131 - -Current culture, ignore case... -0x49 -0x69 -0x131 - -Ordinal... -0x49 -0x69 -0x131 - -Ordinal, ignore case... -0x69 -0x49 -0x131 - -Turkish culture, ignore case... -0x131 -0x49 -0x69 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp deleted file mode 100644 index fba1b99c662..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example of the TimeSpan::Compare( TimeSpan, TimeSpan ) and -// TimeSpan::Equals( TimeSpan, TimeSpan ) methods. -using namespace System; -const __wchar_t * protoFmt = L"{0,-38}{1}"; - -// Compare TimeSpan parameters, and display them with the results. -void CompareTimeSpans( TimeSpan Left, TimeSpan Right, String^ RightText ) -{ - String^ dataFmt = gcnew String( protoFmt ); - Console::WriteLine(); - Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); - Console::WriteLine( dataFmt, "TimeSpan::Equals( Left, Right )", TimeSpan::Equals( Left, Right ) ); - Console::WriteLine( dataFmt, "TimeSpan::Compare( Left, Right )", TimeSpan::Compare( Left, Right ) ); -} - -int main() -{ - TimeSpan Left = TimeSpan(2,0,0); - Console::WriteLine( "This example of the TimeSpan::Equals( TimeSpan, TimeSpan " - ") and \nTimeSpan::Compare( TimeSpan, TimeSpan ) " - "methods generates the \nfollowing output by creating " - "several different TimeSpan \nobjects and comparing " - "them with a 2-hour TimeSpan.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "Left: TimeSpan( 2, 0, 0 )", Left ); - - // Create objects to compare with a 2-hour TimeSpan. - CompareTimeSpans( Left, TimeSpan(0,120,0), "TimeSpan( 0, 120, 0 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,1), "TimeSpan( 2, 0, 1 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,-1), "TimeSpan( 2, 0, -1 )" ); - CompareTimeSpans( Left, TimeSpan(72000000000), "TimeSpan( 72000000000 )" ); - CompareTimeSpans( Left, TimeSpan::FromDays( 1.0 / 12. ), "TimeSpan::FromDays( 1 / 12 )" ); -} - -/* -This example of the TimeSpan::Equals( TimeSpan, TimeSpan ) and -TimeSpan::Compare( TimeSpan, TimeSpan ) methods generates the -following output by creating several different TimeSpan -objects and comparing them with a 2-hour TimeSpan. - -Left: TimeSpan( 2, 0, 0 ) 02:00:00 - -Right: TimeSpan( 0, 120, 0 ) 02:00:00 -TimeSpan::Equals( Left, Right ) True -TimeSpan::Compare( Left, Right ) 0 - -Right: TimeSpan( 2, 0, 1 ) 02:00:01 -TimeSpan::Equals( Left, Right ) False -TimeSpan::Compare( Left, Right ) -1 - -Right: TimeSpan( 2, 0, -1 ) 01:59:59 -TimeSpan::Equals( Left, Right ) False -TimeSpan::Compare( Left, Right ) 1 - -Right: TimeSpan( 72000000000 ) 02:00:00 -TimeSpan::Equals( Left, Right ) True -TimeSpan::Compare( Left, Right ) 0 - -Right: TimeSpan::FromDays( 1 / 12 ) 02:00:00 -TimeSpan::Equals( Left, Right ) True -TimeSpan::Compare( Left, Right ) 0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp deleted file mode 100644 index 3c27f181be1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -// Example of the TimeSpan::CompareTo( Object* ) and -// TimeSpan::Equals( Object* ) methods. -using namespace System; - -// Compare the TimeSpan to the Object parameters, -// and display the Object parameters with the results. -void CompTimeSpanToObject( TimeSpan Left, Object^ Right, String^ RightText ) -{ - Console::WriteLine( "{0,-33}{1}", String::Concat( "Object: ", RightText ), Right ); - Console::WriteLine( "{0,-33}{1}", "Left.Equals( Object )", Left.Equals( Right ) ); - Console::Write( "{0,-33}", "Left.CompareTo( Object )" ); - - // Catch the exception if CompareTo( ) throws one. - try - { - Console::WriteLine( "{0}\n", Left.CompareTo( Right ) ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Error: {0}\n", ex->Message ); - } - -} - -int main() -{ - TimeSpan Left = TimeSpan(0,5,0); - Console::WriteLine( "This example of the TimeSpan::Equals( Object* ) " - "and \nTimeSpan::CompareTo( Object* ) methods generates " - "the \nfollowing output by creating several different " - "TimeSpan \nobjects and comparing them with a " - "5-minute TimeSpan.\n" ); - Console::WriteLine( "{0,-33}{1}\n", "Left: TimeSpan( 0, 5, 0 )", Left ); - - // Create objects to compare with a 5-minute TimeSpan. - CompTimeSpanToObject( Left, TimeSpan(0,0,300), "TimeSpan( 0, 0, 300 )" ); - CompTimeSpanToObject( Left, TimeSpan(0,5,1), "TimeSpan( 0, 5, 1 )" ); - CompTimeSpanToObject( Left, TimeSpan(0,5,-1), "TimeSpan( 0, 5, -1 )" ); - CompTimeSpanToObject( Left, TimeSpan(3000000000), "TimeSpan( 3000000000 )" ); - CompTimeSpanToObject( Left, 3000000000L, "__int64 3000000000L" ); - CompTimeSpanToObject( Left, "00:05:00", "String \"00:05:00\"" ); -} - -/* -This example of the TimeSpan::Equals( Object* ) and -TimeSpan::CompareTo( Object* ) methods generates the -following output by creating several different TimeSpan -objects and comparing them with a 5-minute TimeSpan. - -Left: TimeSpan( 0, 5, 0 ) 00:05:00 - -Object: TimeSpan( 0, 0, 300 ) 00:05:00 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: TimeSpan( 0, 5, 1 ) 00:05:01 -Left.Equals( Object ) False -Left.CompareTo( Object ) -1 - -Object: TimeSpan( 0, 5, -1 ) 00:04:59 -Left.Equals( Object ) False -Left.CompareTo( Object ) 1 - -Object: TimeSpan( 3000000000 ) 00:05:00 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: __int64 3000000000L 3000000000 -Left.Equals( Object ) False -Left.CompareTo( Object ) Error: Object must be of type TimeSpan. - -Object: String "00:05:00" 00:05:00 -Left.Equals( Object ) False -Left.CompareTo( Object ) Error: Object must be of type TimeSpan. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp deleted file mode 100644 index f60d07081bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -// Example of the TimeSpan( int, int, int ) constructor. -using namespace System; - -// Create a TimeSpan object and display its value. -static void CreateTimeSpan( int hours, int minutes, int seconds ) -{ - TimeSpan elapsedTime = TimeSpan(hours,minutes,seconds); - - // Format the constructor for display. - String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2} )", hours, minutes, seconds ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-37}{1,16}", ctor, elapsedTime.ToString() ); -} - -int main() -{ - Console::WriteLine( "This example of the TimeSpan( int, int, int ) " - "\nconstructor generates the following output.\n" ); - Console::WriteLine( "{0,-37}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-37}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 10, 20, 30 ); - CreateTimeSpan( -10, 20, 30 ); - CreateTimeSpan( 0, 0, 37230 ); - CreateTimeSpan( 1000, 2000, 3000 ); - CreateTimeSpan( 1000, -2000, -3000 ); - CreateTimeSpan( 999999, 999999, 999999 ); -} - -/* -This example of the TimeSpan( int, int, int ) -constructor generates the following output. - -Constructor Value ------------ ----- -TimeSpan( 10, 20, 30 ) 10:20:30 -TimeSpan( -10, 20, 30 ) -09:39:30 -TimeSpan( 0, 0, 37230 ) 10:20:30 -TimeSpan( 1000, 2000, 3000 ) 43.02:10:00 -TimeSpan( 1000, -2000, -3000 ) 40.05:50:00 -TimeSpan( 999999, 999999, 999999 ) 42372.15:25:39 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp deleted file mode 100644 index 4a1c4233cf3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; - -// Create a TimeSpan object and display its value. -void CreateTimeSpan( int days, int hours, int minutes, int seconds ) -{ - TimeSpan elapsedTime = TimeSpan(days,hours,minutes,seconds); - - // Format the constructor for display. - array^boxedParams = gcnew array(4); - boxedParams[ 0 ] = days; - boxedParams[ 1 ] = hours; - boxedParams[ 2 ] = minutes; - boxedParams[ 3 ] = seconds; - String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2}, {3} )", boxedParams ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-44}{1,16}", ctor, elapsedTime.ToString() ); -} - -int main() -{ - Console::WriteLine( "{0,-44}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-44}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 10, 20, 30, 40 ); - CreateTimeSpan( -10, 20, 30, 40 ); - CreateTimeSpan( 0, 0, 0, 937840 ); - CreateTimeSpan( 1000, 2000, 3000, 4000 ); - CreateTimeSpan( 1000, -2000, -3000, -4000 ); - CreateTimeSpan( 999999, 999999, 999999, 999999 ); -} -// The example displays the following output: -// Constructor Value -// ----------- ----- -// TimeSpan( 10, 20, 30, 40 ) 10.20:30:40 -// TimeSpan( -10, 20, 30, 40 ) -9.03:29:20 -// TimeSpan( 0, 0, 0, 937840 ) 10.20:30:40 -// TimeSpan( 1000, 2000, 3000, 4000 ) 1085.11:06:40 -// TimeSpan( 1000, -2000, -3000, -4000 ) 914.12:53:20 -// TimeSpan( 999999, 999999, 999999, 999999 ) 1042371.15:25:39 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp deleted file mode 100644 index 2806b7c4188..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -// Example of the TimeSpan( int, int, int, int, int ) constructor. -using namespace System; - -// Create a TimeSpan object and display its value. -void CreateTimeSpan( int days, int hours, int minutes, int seconds, int millisec ) -{ - TimeSpan elapsedTime = TimeSpan(days,hours,minutes,seconds,millisec); - - // Format the constructor for display. - array^boxedParams = gcnew array(5); - boxedParams[ 0 ] = days; - boxedParams[ 1 ] = hours; - boxedParams[ 2 ] = minutes; - boxedParams[ 3 ] = seconds; - boxedParams[ 4 ] = millisec; - String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2}, {3}, {4} )", boxedParams ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-48}{1,24}", ctor, elapsedTime.ToString() ); -} - -int main() -{ - Console::WriteLine( "This example of the TimeSpan( int, int, int, int, int ) " - "\nconstructor generates the following output.\n" ); - Console::WriteLine( "{0,-48}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-48}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 10, 20, 30, 40, 50 ); - CreateTimeSpan( -10, 20, 30, 40, 50 ); - CreateTimeSpan( 0, 0, 0, 0, 937840050 ); - CreateTimeSpan( 1111, 2222, 3333, 4444, 5555 ); - CreateTimeSpan( 1111, -2222, -3333, -4444, -5555 ); - CreateTimeSpan( 99999, 99999, 99999, 99999, 99999 ); -} - -/* -This example of the TimeSpan( int, int, int, int, int ) -constructor generates the following output. - -Constructor Value ------------ ----- -TimeSpan( 10, 20, 30, 40, 50 ) 10.20:30:40.0500000 -TimeSpan( -10, 20, 30, 40, 50 ) -9.03:29:19.9500000 -TimeSpan( 0, 0, 0, 0, 937840050 ) 10.20:30:40.0500000 -TimeSpan( 1111, 2222, 3333, 4444, 5555 ) 1205.22:47:09.5550000 -TimeSpan( 1111, -2222, -3333, -4444, -5555 ) 1016.01:12:50.4450000 -TimeSpan( 99999, 99999, 99999, 99999, 99999 ) 104236.05:27:18.9990000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp deleted file mode 100644 index d5dd9f79124..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -// Example of the TimeSpan( __int64 ) constructor. -using namespace System; - -// Create a TimeSpan object and display its value. -void CreateTimeSpan( __int64 ticks ) -{ - TimeSpan elapsedTime = TimeSpan(ticks); - - // Format the constructor for display. - String^ ctor = String::Format( "TimeSpan( {0} )", ticks ); - - // Pad the end of a TimeSpan string with spaces if - // it does not contain milliseconds. - String^ elapsedStr = elapsedTime.ToString(); - int pointIndex = elapsedStr->IndexOf( ':' ); - pointIndex = elapsedStr->IndexOf( '.', pointIndex ); - if ( pointIndex < 0 ) - elapsedStr = String::Concat( elapsedStr, " " ); - - - // Display the constructor and its value. - Console::WriteLine( "{0,-33}{1,24}", ctor, elapsedStr ); -} - -int main() -{ - Console::WriteLine( "This example of the TimeSpan( __int64 ) constructor " - "\ngenerates the following output.\n" ); - Console::WriteLine( "{0,-33}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-33}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 1 ); - CreateTimeSpan( 999999 ); - CreateTimeSpan( -1000000000000 ); - CreateTimeSpan( 18012202000000 ); - CreateTimeSpan( 999999999999999999 ); - CreateTimeSpan( 1000000000000000000 ); -} - -/* -This example of the TimeSpan( __int64 ) constructor -generates the following output. - -Constructor Value ------------ ----- -TimeSpan( 1 ) 00:00:00.0000001 -TimeSpan( 999999 ) 00:00:00.0999999 -TimeSpan( -1000000000000 ) -1.03:46:40 -TimeSpan( 18012202000000 ) 20.20:20:20.2000000 -TimeSpan( 999999999999999999 ) 1157407.09:46:39.9999999 -TimeSpan( 1000000000000000000 ) 1157407.09:46:40 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp deleted file mode 100644 index 82a2aebbbc8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -// Example of the TimeSpan::Duration( ) and TimeSpan::Negate( ) methods, -// and the TimeSpan Unary Negation and Unary Plus operators. -using namespace System; -const __wchar_t * protoFmt = L"{0,22}{1,22}{2,22}"; -void ShowDurationNegate( TimeSpan interval ) -{ - - // Display the TimeSpan value and the results of the - // Duration and Negate methods. - Console::WriteLine( gcnew String( protoFmt ), interval, interval.Duration(), interval.Negate() ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::Duration( ), " - "TimeSpan::Negate( ), \nand the TimeSpan Unary " - "Negation and Unary Plus operators \n" - "generates the following output.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "TimeSpan", "Duration( )", "Negate( )" ); - Console::WriteLine( gcnew String( protoFmt ), "--------", "-----------", "---------" ); - - // Create TimeSpan objects and apply the Unary Negation - // and Unary Plus operators to them. - ShowDurationNegate( TimeSpan(1) ); - ShowDurationNegate( TimeSpan( -1234567) ); - ShowDurationNegate( +TimeSpan(0,0,10,-20,-30) ); - ShowDurationNegate( +TimeSpan(0,-10,20,-30,40) ); - ShowDurationNegate( -TimeSpan(1,10,20,40,160) ); - ShowDurationNegate( -TimeSpan( -10,-20,-30,-40,-50) ); -} - -/* -This example of TimeSpan::Duration( ), TimeSpan::Negate( ), -and the TimeSpan Unary Negation and Unary Plus operators -generates the following output. - - TimeSpan Duration( ) Negate( ) - -------- ----------- --------- - 00:00:00.0000001 00:00:00.0000001 -00:00:00.0000001 - -00:00:00.1234567 00:00:00.1234567 00:00:00.1234567 - 00:09:39.9700000 00:09:39.9700000 -00:09:39.9700000 - -09:40:29.9600000 09:40:29.9600000 09:40:29.9600000 - -1.10:20:40.1600000 1.10:20:40.1600000 1.10:20:40.1600000 - 10.20:30:40.0500000 10.20:30:40.0500000 -10.20:30:40.0500000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp deleted file mode 100644 index c72d87bcf54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan fields. -using namespace System; - -// Pad the end of a TimeSpan string with spaces if it does not -// contain milliseconds. -String^ Align( TimeSpan interval ) -{ - String^ intervalStr = interval.ToString(); - int pointIndex = intervalStr->IndexOf( ':' ); - pointIndex = intervalStr->IndexOf( '.', pointIndex ); - if ( pointIndex < 0 ) - intervalStr = String::Concat( intervalStr, " " ); - - return intervalStr; -} - -int main() -{ - String^ numberFmt = "{0,-22}{1,18:N0}"; - String^ timeFmt = "{0,-22}{1,26}"; - Console::WriteLine( "This example of the fields of the TimeSpan class" - "\ngenerates the following output.\n" ); - Console::WriteLine( numberFmt, "Field", "Value" ); - Console::WriteLine( numberFmt, "-----", "-----" ); - - // Display the maximum, minimum, and zero TimeSpan values. - Console::WriteLine( timeFmt, "Maximum TimeSpan", Align( TimeSpan::MaxValue ) ); - Console::WriteLine( timeFmt, "Minimum TimeSpan", Align( TimeSpan::MinValue ) ); - Console::WriteLine( timeFmt, "Zero TimeSpan", Align( TimeSpan::Zero ) ); - Console::WriteLine(); - - // Display the ticks-per-time-unit fields. - Console::WriteLine( numberFmt, "Ticks per day", TimeSpan::TicksPerDay ); - Console::WriteLine( numberFmt, "Ticks per hour", TimeSpan::TicksPerHour ); - Console::WriteLine( numberFmt, "Ticks per minute", TimeSpan::TicksPerMinute ); - Console::WriteLine( numberFmt, "Ticks per second", TimeSpan::TicksPerSecond ); - Console::WriteLine( numberFmt, "Ticks per millisecond", TimeSpan::TicksPerMillisecond ); -} - -/* -This example of the fields of the TimeSpan class -generates the following output. - -Field Value ------ ----- -Maximum TimeSpan 10675199.02:48:05.4775807 -Minimum TimeSpan -10675199.02:48:05.4775808 -Zero TimeSpan 00:00:00 - -Ticks per day 864,000,000,000 -Ticks per hour 36,000,000,000 -Ticks per minute 600,000,000 -Ticks per second 10,000,000 -Ticks per millisecond 10,000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp deleted file mode 100644 index 1ad4da8b17d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromDays( double ) method. -using namespace System; -void GenTimeSpanFromDays( double days ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of days. - TimeSpan interval = TimeSpan::FromDays( days ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", days, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromDays( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromDays", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "--------", "--------" ); - GenTimeSpanFromDays( 0.000000006 ); - GenTimeSpanFromDays( 0.000000017 ); - GenTimeSpanFromDays( 0.000123456 ); - GenTimeSpanFromDays( 1.234567898 ); - GenTimeSpanFromDays( 12345.678987654 ); - GenTimeSpanFromDays( 0.000011574 ); - GenTimeSpanFromDays( 0.000694444 ); - GenTimeSpanFromDays( 0.041666666 ); - GenTimeSpanFromDays( 1 ); - GenTimeSpanFromDays( 20.84745602 ); -} - -/* -This example of TimeSpan::FromDays( double ) -generates the following output. - - FromDays TimeSpan - -------- -------- - 6E-09 00:00:00.0010000 - 1.7E-08 00:00:00.0010000 - 0.000123456 00:00:10.6670000 - 1.234567898 1.05:37:46.6660000 - 12345.678987654 12345.16:17:44.5330000 - 1.1574E-05 00:00:01 - 0.000694444 00:01:00 - 0.041666666 01:00:00 - 1 1.00:00:00 - 20.84745602 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp deleted file mode 100644 index 291263f4c76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromHours( double ) method. -using namespace System; -void GenTimeSpanFromHours( double hours ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of hours. - TimeSpan interval = TimeSpan::FromHours( hours ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", hours, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromHours( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromHours", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "---------", "--------" ); - GenTimeSpanFromHours( 0.0000002 ); - GenTimeSpanFromHours( 0.0000003 ); - GenTimeSpanFromHours( 0.0012345 ); - GenTimeSpanFromHours( 12.3456789 ); - GenTimeSpanFromHours( 123456.7898765 ); - GenTimeSpanFromHours( 0.0002777 ); - GenTimeSpanFromHours( 0.0166666 ); - GenTimeSpanFromHours( 1 ); - GenTimeSpanFromHours( 24 ); - GenTimeSpanFromHours( 500.3389445 ); -} - -/* -This example of TimeSpan::FromHours( double ) -generates the following output. - - FromHours TimeSpan - --------- -------- - 2E-07 00:00:00.0010000 - 3E-07 00:00:00.0010000 - 0.0012345 00:00:04.4440000 - 12.3456789 12:20:44.4440000 - 123456.7898765 5144.00:47:23.5550000 - 0.0002777 00:00:01 - 0.0166666 00:01:00 - 1 01:00:00 - 24 1.00:00:00 - 500.3389445 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp deleted file mode 100644 index abaa9a05413..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromMilliseconds( double ) method. -using namespace System; -void GenTimeSpanFromMillisec( Double millisec ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of milliseconds. - TimeSpan interval = TimeSpan::FromMilliseconds( millisec ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", millisec, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromMilliseconds( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromMilliseconds", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "----------------", "--------" ); - GenTimeSpanFromMillisec( 1 ); - GenTimeSpanFromMillisec( 1.5 ); - GenTimeSpanFromMillisec( 12345.6 ); - GenTimeSpanFromMillisec( 123456789.8 ); - GenTimeSpanFromMillisec( 1234567898765.4 ); - GenTimeSpanFromMillisec( 1000 ); - GenTimeSpanFromMillisec( 60000 ); - GenTimeSpanFromMillisec( 3600000 ); - GenTimeSpanFromMillisec( 86400000 ); - GenTimeSpanFromMillisec( 1801220200 ); -} - -/* -This example of TimeSpan::FromMilliseconds( double ) -generates the following output. - - FromMilliseconds TimeSpan - ---------------- -------- - 1 00:00:00.0010000 - 1.5 00:00:00.0020000 - 12345.6 00:00:12.3460000 - 123456789.8 1.10:17:36.7900000 - 1234567898765.4 14288.23:31:38.7650000 - 1000 00:00:01 - 60000 00:01:00 - 3600000 01:00:00 - 86400000 1.00:00:00 - 1801220200 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp deleted file mode 100644 index 79a767372f3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromMinutes( double ) method. -using namespace System; -void GenTimeSpanFromMinutes( double minutes ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of minutes. - TimeSpan interval = TimeSpan::FromMinutes( minutes ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", minutes, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromMinutes( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromMinutes", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "-----------", "--------" ); - GenTimeSpanFromMinutes( 0.00001 ); - GenTimeSpanFromMinutes( 0.00002 ); - GenTimeSpanFromMinutes( 0.12345 ); - GenTimeSpanFromMinutes( 1234.56789 ); - GenTimeSpanFromMinutes( 12345678.98765 ); - GenTimeSpanFromMinutes( 0.01666 ); - GenTimeSpanFromMinutes( 1 ); - GenTimeSpanFromMinutes( 60 ); - GenTimeSpanFromMinutes( 1440 ); - GenTimeSpanFromMinutes( 30020.33667 ); -} - -/* -This example of TimeSpan::FromMinutes( double ) -generates the following output. - - FromMinutes TimeSpan - ----------- -------- - 1E-05 00:00:00.0010000 - 2E-05 00:00:00.0010000 - 0.12345 00:00:07.4070000 - 1234.56789 20:34:34.0730000 - 12345678.98765 8573.09:18:59.2590000 - 0.01666 00:00:01 - 1 00:01:00 - 60 01:00:00 - 1440 1.00:00:00 - 30020.33667 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp deleted file mode 100644 index 7ff5d2de047..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromSeconds( double ) method. -using namespace System; -void GenTimeSpanFromSeconds( double seconds ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of seconds. - TimeSpan interval = TimeSpan::FromSeconds( seconds ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", seconds, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromSeconds( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromSeconds", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "-----------", "--------" ); - GenTimeSpanFromSeconds( 0.001 ); - GenTimeSpanFromSeconds( 0.0015 ); - GenTimeSpanFromSeconds( 12.3456 ); - GenTimeSpanFromSeconds( 123456.7898 ); - GenTimeSpanFromSeconds( 1234567898.7654 ); - GenTimeSpanFromSeconds( 1 ); - GenTimeSpanFromSeconds( 60 ); - GenTimeSpanFromSeconds( 3600 ); - GenTimeSpanFromSeconds( 86400 ); - GenTimeSpanFromSeconds( 1801220.2 ); -} - -/* -This example of TimeSpan::FromSeconds( double ) -generates the following output. - - FromSeconds TimeSpan - ----------- -------- - 0.001 00:00:00.0010000 - 0.0015 00:00:00.0020000 - 12.3456 00:00:12.3460000 - 123456.7898 1.10:17:36.7900000 - 1234567898.7654 14288.23:31:38.7650000 - 1 00:00:01 - 60 00:01:00 - 3600 01:00:00 - 86400 1.00:00:00 - 1801220.2 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp deleted file mode 100644 index 489db154b67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromTicks( __int64 ) method. -using namespace System; -void GenTimeSpanFromTicks( __int64 ticks ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of ticks. - TimeSpan interval = TimeSpan::FromTicks( ticks ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", ticks, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromTicks( __int64 )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromTicks", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "---------", "--------" ); - GenTimeSpanFromTicks( 1 ); - GenTimeSpanFromTicks( 12345 ); - GenTimeSpanFromTicks( 123456789 ); - GenTimeSpanFromTicks( 1234567898765 ); - GenTimeSpanFromTicks( 12345678987654321 ); - GenTimeSpanFromTicks( 10000000 ); - GenTimeSpanFromTicks( 600000000 ); - GenTimeSpanFromTicks( 36000000000 ); - GenTimeSpanFromTicks( 864000000000 ); - GenTimeSpanFromTicks( 18012202000000 ); -} - -/* -This example of TimeSpan::FromTicks( __int64 ) -generates the following output. - - FromTicks TimeSpan - --------- -------- - 1 00:00:00.0000001 - 12345 00:00:00.0012345 - 123456789 00:00:12.3456789 - 1234567898765 1.10:17:36.7898765 - 12345678987654321 14288.23:31:38.7654321 - 10000000 00:00:01 - 600000000 00:01:00 - 36000000000 01:00:00 - 864000000000 1.00:00:00 - 18012202000000 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp deleted file mode 100644 index 9c57a8242fa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -// Example for the TimeSpan::GetHashCode( ) method. -using namespace System; -void DisplayHashCode( TimeSpan interval ) -{ - - // Create a hash code and a string representation of - // the TimeSpan parameter. - String^ timeInterval = interval.ToString(); - int hashCode = interval.GetHashCode(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,22} 0x{1:X8}, {1}", timeInterval, hashCode ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::GetHashCode( ) generates " - "the following \noutput, which displays " - "the hash codes of representative TimeSpan \n" - "objects in hexadecimal and decimal formats.\n" ); - Console::WriteLine( "{0,22} {1,10}", "TimeSpan ", "Hash Code" ); - Console::WriteLine( "{0,22} {1,10}", "-------- ", "---------" ); - DisplayHashCode( TimeSpan(0) ); - DisplayHashCode( TimeSpan(1) ); - DisplayHashCode( TimeSpan(0,0,0,0,1) ); - DisplayHashCode( TimeSpan(0,0,1) ); - DisplayHashCode( TimeSpan(0,1,0) ); - DisplayHashCode( TimeSpan(1,0,0) ); - DisplayHashCode( TimeSpan(36000000001) ); - DisplayHashCode( TimeSpan(0,1,0,0,1) ); - DisplayHashCode( TimeSpan(1,0,1) ); - DisplayHashCode( TimeSpan(1,0,0,0) ); - DisplayHashCode( TimeSpan(864000000001) ); - DisplayHashCode( TimeSpan(1,0,0,0,1) ); - DisplayHashCode( TimeSpan(1,0,0,1) ); - DisplayHashCode( TimeSpan(100,0,0,0) ); - DisplayHashCode( TimeSpan(100,0,0,0,1) ); - DisplayHashCode( TimeSpan(100,0,0,1) ); -} - -/* -This example of TimeSpan::GetHashCode( ) generates the following -output, which displays the hash codes of representative TimeSpan -objects in hexadecimal and decimal formats. - - TimeSpan Hash Code - -------- --------- - 00:00:00 0x00000000, 0 - 00:00:00.0000001 0x00000001, 1 - 00:00:00.0010000 0x00002710, 10000 - 00:00:01 0x00989680, 10000000 - 00:01:00 0x23C34600, 600000000 - 01:00:00 0x61C46808, 1640261640 - 01:00:00.0000001 0x61C46809, 1640261641 - 01:00:00.0010000 0x61C48F18, 1640271640 - 01:00:01 0x625CFE88, 1650261640 - 1.00:00:00 0x2A69C0C9, 711573705 - 1.00:00:00.0000001 0x2A69C0C8, 711573704 - 1.00:00:00.0010000 0x2A69E7D9, 711583705 - 1.00:00:01 0x2B025649, 721573449 - 100.00:00:00 0x914F4E94, -1857073516 - 100.00:00:00.0010000 0x914F6984, -1857066620 - 100.00:00:01 0x91E7D814, -1847076844 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp deleted file mode 100644 index 6e3817f134c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// -using namespace System; - -static void ShowTimeSpanProperties(TimeSpan interval) -{ - Console::WriteLine("{0,21}", interval ); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Days", interval.Days, "TotalDays", - interval.TotalDays); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Hours", interval.Hours, "TotalHours", - interval.TotalHours); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Minutes", interval.Minutes, "TotalMinutes", - interval.TotalMinutes); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Seconds", interval.Seconds, "TotalSeconds", - interval.TotalSeconds); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Milliseconds", interval.Milliseconds, - "TotalMilliseconds", interval.TotalMilliseconds); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N0}", - nullptr, nullptr, "Ticks", interval.Ticks); -} - -void main() -{ - // Create and display a TimeSpan value of 1 tick. - Console::Write("\n{0,-45}", "TimeSpan( 1 )"); - ShowTimeSpanProperties(TimeSpan(1)); - - // Create a TimeSpan value with a large number of ticks. - Console::Write("\n{0,-45}", "TimeSpan( 111222333444555 )"); - ShowTimeSpanProperties( TimeSpan(111222333444555)); - - // This TimeSpan has all fields specified. - Console::Write("\n{0,-45}", "TimeSpan( 10, 20, 30, 40, 50 )"); - ShowTimeSpanProperties( TimeSpan(10,20,30,40,50)); - - // This TimeSpan has all fields overflowing. - Console::Write("\n{0,-45}", "TimeSpan( 1111, 2222, 3333, 4444, 5555 )"); - ShowTimeSpanProperties( TimeSpan(1111,2222,3333,4444,5555)); - - // This TimeSpan is based on a number of days. - Console::Write("\n{0,-45}", "FromDays( 20.84745602 )"); - ShowTimeSpanProperties( TimeSpan::FromDays( 20.84745602 )); -} -// The example displays the following output if the current culture is en-US: -// TimeSpan( 1 ) 00:00:00.0000001 -// Days 0 TotalDays 0.000 -// Hours 0 TotalHours 0.000 -// Minutes 0 TotalMinutes 0.000 -// Seconds 0 TotalSeconds 0.000 -// Milliseconds 0 TotalMilliseconds 0.000 -// Ticks 1 -// -// TimeSpan( 111222333444555 ) 128.17:30:33.3444555 -// Days 128 TotalDays 128.730 -// Hours 17 TotalHours 3,089.509 -// Minutes 30 TotalMinutes 185,370.556 -// Seconds 33 TotalSeconds 11,122,233.344 -// Milliseconds 344 TotalMilliseconds 11,122,233,344.456 -// Ticks 111,222,333,444,555 -// -// TimeSpan( 10, 20, 30, 40, 50 ) 10.20:30:40.0500000 -// Days 10 TotalDays 10.855 -// Hours 20 TotalHours 260.511 -// Minutes 30 TotalMinutes 15,630.668 -// Seconds 40 TotalSeconds 937,840.050 -// Milliseconds 50 TotalMilliseconds 937,840,050.000 -// Ticks 9,378,400,500,000 -// -// TimeSpan( 1111, 2222, 3333, 4444, 5555 ) 1205.22:47:09.5550000 -// Days 1205 TotalDays 1,205.949 -// Hours 22 TotalHours 28,942.786 -// Minutes 47 TotalMinutes 1,736,567.159 -// Seconds 9 TotalSeconds 104,194,029.555 -// Milliseconds 555 TotalMilliseconds 104,194,029,555.000 -// Ticks 1,041,940,295,550,000 -// -// FromDays( 20.84745602 ) 20.20:20:20.2000000 -// Days 20 TotalDays 20.847 -// Hours 20 TotalHours 500.339 -// Minutes 20 TotalMinutes 30,020.337 -// Seconds 20 TotalSeconds 1,801,220.200 -// Milliseconds 200 TotalMilliseconds 1,801,220,200.000 -// Ticks 18,012,202,000,000 -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp deleted file mode 100644 index 526f4e39d00..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -// Example of the TimeSpan relational operators. -using namespace System; -const __wchar_t * protoFmt = L"{0,35} {1}"; - -// Compare TimeSpan parameters, and display them with the results. -void CompareTimeSpans( TimeSpan Left, TimeSpan Right, String^ RightText ) -{ - String^ dataFmt = gcnew String( protoFmt ); - Console::WriteLine(); - Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); - Console::WriteLine( dataFmt, "Left == Right", Left == Right ); - Console::WriteLine( dataFmt, "Left > Right", Left > Right ); - Console::WriteLine( dataFmt, "Left >= Right", Left >= Right ); - Console::WriteLine( dataFmt, "Left != Right", Left != Right ); - Console::WriteLine( dataFmt, "Left < Right", Left < Right ); - Console::WriteLine( dataFmt, "Left <= Right", Left <= Right ); -} - -int main() -{ - TimeSpan Left = TimeSpan(2,0,0); - Console::WriteLine( "This example of the TimeSpan relational operators " - "generates \nthe following output. It creates several " - "different TimeSpan \nobjects and compares them with " - "a 2-hour TimeSpan.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "Left: TimeSpan( 2, 0, 0 )", Left ); - - // Create objects to compare with a 2-hour TimeSpan. - CompareTimeSpans( Left, TimeSpan(0,120,0), "TimeSpan( 0, 120, 0 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,1), "TimeSpan( 2, 0, 1 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,-1), "TimeSpan( 2, 0, -1 )" ); - CompareTimeSpans( Left, TimeSpan::FromDays( 1.0 / 12. ), "TimeSpan::FromDays( 1 / 12 )" ); -} - -/* -This example of the TimeSpan relational operators generates -the following output. It creates several different TimeSpan -objects and compares them with a 2-hour TimeSpan. - - Left: TimeSpan( 2, 0, 0 ) 02:00:00 - - Right: TimeSpan( 0, 120, 0 ) 02:00:00 - Left == Right True - Left > Right False - Left >= Right True - Left != Right False - Left < Right False - Left <= Right True - - Right: TimeSpan( 2, 0, 1 ) 02:00:01 - Left == Right False - Left > Right False - Left >= Right False - Left != Right True - Left < Right True - Left <= Right True - - Right: TimeSpan( 2, 0, -1 ) 01:59:59 - Left == Right False - Left > Right True - Left >= Right True - Left != Right True - Left < Right False - Left <= Right False - -Right: TimeSpan::FromDays( 1 / 12 ) 02:00:00 - Left == Right True - Left > Right False - Left >= Right True - Left != Right False - Left < Right False - Left <= Right True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp deleted file mode 100644 index e1a104a5583..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// -// Example of selected TimeZone class elements. -using namespace System; -using namespace System::Globalization; -int main() -{ - String^ dataFmt = "{0,-30}{1}"; - String^ timeFmt = "{0,-30}{1:yyyy-MM-dd HH:mm}"; - Console::WriteLine( "This example of selected TimeZone class " - "elements generates the following \n" - "output, which varies depending on the " - "time zone in which it is run.\n" ); - - // Get the local time zone and the current local time and year. - TimeZone^ localZone = TimeZone::CurrentTimeZone; - DateTime currentDate = DateTime::Now; - int currentYear = currentDate.Year; - - // Display the names for standard time and daylight saving - // time for the local time zone. - Console::WriteLine( dataFmt, "Standard time name:", localZone->StandardName ); - Console::WriteLine( dataFmt, "Daylight saving time name:", localZone->DaylightName ); - - // Display the current date and time and show if they occur - // in daylight saving time. - Console::WriteLine( String::Concat( "\n", timeFmt ), "Current date and time:", currentDate ); - Console::WriteLine( dataFmt, "Daylight saving time?", localZone->IsDaylightSavingTime( currentDate ) ); - - // Get the current Coordinated Universal Time (UTC) and UTC - // offset. - DateTime currentUTC = localZone->ToUniversalTime( currentDate ); - TimeSpan currentOffset = localZone->GetUtcOffset( currentDate ); - Console::WriteLine( timeFmt, "Coordinated Universal Time:", currentUTC ); - Console::WriteLine( dataFmt, "UTC offset:", currentOffset ); - - // Get the DaylightTime object for the current year. - DaylightTime^ daylight = localZone->GetDaylightChanges( currentYear ); - - // Display the daylight saving time range for the current year. - Console::WriteLine( "\nDaylight saving time for year {0}:", currentYear ); - Console::WriteLine( "{0:yyyy-MM-dd HH:mm} to " - "{1:yyyy-MM-dd HH:mm}, delta: {2}", daylight->Start, daylight->End, daylight->Delta ); -} - -/* -This example of selected TimeZone class elements generates the following -output, which varies depending on the time zone in which it is run. - -Standard time name: Pacific Standard Time -Daylight saving time name: Pacific Daylight Time - -Current date and time: 2006-01-06 16:47 -Daylight saving time? False -Coordinated Universal Time: 2006-01-07 00:47 -UTC offset: -08:00:00 - -Daylight saving time for year 2006: -2006-04-02 02:00 to 2006-10-29 02:00, delta: 01:00:00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp deleted file mode 100644 index 3ac30b92e74..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -namespace Example -{ - public ref class Test - { - public: - static void CreateConstructedType(void) - { - Console::WriteLine("\r\n--- Create a constructed type" - " from the generic Dictionary`2 type."); - - // Create a type object representing - // the generic Dictionary`2 type. - Type^ genericType = Type::GetType( - "System.Collections.Generic.Dictionary`2"); - if (genericType != nullptr) - { - DisplayTypeInfo(genericType); - } - else - { - Console::WriteLine("The type is not found"); - return; - } - - // Create an array of types to substitute for the type - // parameters of Dictionary`2. - // The key is of type string, and the type to be - // contained in the Dictionary`2 is Test. - array^ typeArgs = {String::typeid, Test::typeid}; - Type^ constructedType = - genericType->MakeGenericType(typeArgs); - DisplayTypeInfo(constructedType); - - // Compare the type objects obtained above to type objects - // obtained using typeof() and GetGenericTypeDefinition(). - Console::WriteLine("\r\n--- Compare types obtained by" - " different methods:"); - - Type^ definedType = Dictionary::typeid; - Console::WriteLine("\tAre the constructed types " - "equal? {0}", definedType == constructedType); - Console::WriteLine("\tAre the generic types equal? {0}", - definedType->GetGenericTypeDefinition() == genericType); - } - - private: - static void DisplayTypeInfo(Type^ typeToDisplay) - { - Console::WriteLine("\r\n{0}", typeToDisplay); - Console::WriteLine("\tIs this a generic type definition? " - "{0}", typeToDisplay->IsGenericTypeDefinition); - Console::WriteLine("\tIs it a generic type? " - "{0}", typeToDisplay->IsGenericType); - - array^ typeArguments = - typeToDisplay->GetGenericArguments(); - Console::WriteLine("\tList type arguments ({0}):", - typeArguments->Length); - - for each (Type^ typeArgument in typeArguments) - { - Console::WriteLine("\t\t{0}", typeArgument); - } - } - }; -} - -int main(void) -{ - Example::Test::CreateConstructedType(); -} - -/* This example produces the following output: - ---- Create a constructed type from the generic Dictionary`2 type. - -System.Collections.Generic.Dictionary`2[KeyType,ValueType] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - K - V - -System.Collections.Generic.Dictionary`2[System.String, Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - ---- Compare types obtained by different methods: - Are the constructed types equal? True - Are the generic types equal? True - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp deleted file mode 100644 index 42acac613e9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -public ref class Test -{ -public: - static void Main() - { - Console::Write( L"\r\n--- Get the generic type that " ); - Console::WriteLine( L"defines a constructed type." ); - - // Create a Dictionary of Test objects, using strings for the - // keys. - Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; - - // Get a Type object representing the constructed type. - // - Type^ constructed = d->GetType(); - DisplayTypeInfo( constructed ); - Type^ myGeneric = constructed->GetGenericTypeDefinition(); - DisplayTypeInfo( myGeneric ); - } - -private: - static void DisplayTypeInfo( Type^ t ) - { - Console::WriteLine( L"\r\n{0}", t ); - Console::WriteLine( L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition ); - Console::WriteLine( L"\tIs it a generic type? {0}", - t->IsGenericType ); - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine( L"\tList type arguments ({0}):", - typeArguments->Length ); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ tParam = safe_cast(myEnum->Current); - Console::WriteLine( L"\t\t{0}", tParam ); - } - } -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Get the generic type that defines a constructed type. - -System.Collections.Generic.Dictionary`2[System.String,Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - -System.Collections.Generic.Dictionary`2[TKey,TValue] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - TKey - TValue - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp deleted file mode 100644 index bd05647c2bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -// Define a base class with two type parameters. -generic< class T,class U > -public ref class Base {}; - -// Define a derived class. The derived class inherits from a constructed -// class that meets the following criteria: -// (1) Its generic type definition is Base. -// (2) It specifies int for the first type parameter. -// (3) For the second type parameter, it uses the same type that is used -// for the type parameter of the derived class. -// Thus, the derived class is a generic type with one type parameter, but -// its base class is an open constructed type with one type argument and -// one type parameter. -generic -public ref class Derived : Base {}; - -public ref class Test -{ -public: - static void Main() - { - Console::WriteLine( - L"\r\n--- Display a generic type and the open constructed"); - Console::WriteLine(L" type from which it is derived."); - - // Create a Type object representing the generic type definition - // for the Derived type. Note the absence of type arguments. - // - Type^ derivedType = Derived::typeid; - DisplayGenericTypeInfo(derivedType); - - // Display its open constructed base type. - DisplayGenericTypeInfo(derivedType->BaseType); - } - - -private: - static void DisplayGenericTypeInfo(Type^ t) - { - Console::WriteLine(L"\r\n{0}", t); - Console::WriteLine(L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition); - Console::WriteLine(L"\tIs it a generic type? {0}", t->IsGenericType); - Console::WriteLine(L"\tDoes it have unassigned generic parameters? {0}", - t->ContainsGenericParameters); - if (t->IsGenericType) - { - - // If this is a generic type, display the type arguments. - // - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine(L"\tList type arguments ({0}):", - typeArguments->Length); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while (myEnum->MoveNext()) - { - Type^ tParam = safe_cast(myEnum->Current); - - // IsGenericParameter is true only for generic type - // parameters. - // - if (tParam->IsGenericParameter) - { - Console::WriteLine( - L"\t\t{0} (unassigned - parameter position {1})", - tParam, tParam->GenericParameterPosition); - } - else - { - Console::WriteLine(L"\t\t{0}", tParam); - } - } - } - } -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Display a generic type and the open constructed - type from which it is derived. - -Derived`1[V] - Is this a generic type definition? True - Is it a generic type? True - Does it have unassigned generic parameters? True - List type arguments (1): - V (unassigned - parameter position 0) - -Base`2[System.Int32,V] - Is this a generic type definition? False - Is it a generic type? True - Does it have unassigned generic parameters? True - List type arguments (2): - System.Int32 - V (unassigned - parameter position 0) - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp deleted file mode 100644 index 7382ca1e398..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -public ref class Test -{ -private: - static void DisplayGenericTypeInfo( Type^ t ) - { - Console::WriteLine( L"\r\n{0}", t ); - Console::WriteLine( L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition ); - Console::WriteLine( L"\tIs it a generic type? {0}", - t->IsGenericType ); - - // - if ( t->IsGenericType ) - { - - // If this is a generic type, display the type arguments. - // - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine( L"\tList type arguments ({0}):", - typeArguments->Length ); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ tParam = safe_cast(myEnum->Current); - - // If this is a type parameter, display its - // position. - // - if ( tParam->IsGenericParameter ) - { - Console::WriteLine( - L"\t\t{0}\t(unassigned - parameter position {1})", - tParam, tParam->GenericParameterPosition ); - } - else - { - Console::WriteLine( L"\t\t{0}", tParam ); - } - } - } - // - } - - -public: - static void Main() - { - Console::Write( L"\r\n--- Display information about a " ); - Console::WriteLine( L"constructed type, its" ); - Console::WriteLine( L" generic type definition, and an ordinary type." ); - - // Create a Dictionary of Test objects, using strings for the - // keys. - Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; - - // Display information for the constructed type and its generic - // type definition. - DisplayGenericTypeInfo( d->GetType() ); - DisplayGenericTypeInfo( d->GetType()->GetGenericTypeDefinition() ); - - // Display information for an ordinary type. - DisplayGenericTypeInfo( String::typeid ); - } - -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Display information about a constructed type, its - generic type definition, and an ordinary type. - -System.Collections.Generic.Dictionary[System.String,Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - -System.Collections.Generic.Dictionary[TKey,TValue] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - TKey (unassigned - parameter position 0) - TValue (unassigned - parameter position 1) - -System.String - Is this a generic type definition? False - Is it a generic type? False - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp deleted file mode 100644 index ae4ef65dd24..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -using namespace System; -using namespace System::Reflection; - -// -generic public ref class Base {}; - -generic public ref class G {}; - -generic public ref class Derived : Base -{ -public: - G^>^ F; - - ref class Nested {}; -}; -// - - -void main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp deleted file mode 100644 index 39b29ec5a65..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -generic public ref class Base {}; - -generic public ref class G {}; - -generic public ref class Derived : Base -{ -public: - G^>^ F; - - ref class Nested {}; -}; - -void DisplayGenericType(Type^ t, String^ caption) -{ - Console::WriteLine("\n{0}", caption); - Console::WriteLine(" Type: {0}", t); - - Console::WriteLine("\t IsGenericType: {0}", - t->IsGenericType); - Console::WriteLine("\t IsGenericTypeDefinition: {0}", - t->IsGenericTypeDefinition); - Console::WriteLine("\tContainsGenericParameters: {0}", - t->ContainsGenericParameters); - Console::WriteLine("\t IsGenericParameter: {0}", - t->IsGenericParameter); -} - -void main() -{ - // Get the generic type definition for Derived, and the base - // type for Derived. - // - Type^ tDerived = Derived::typeid; - Type^ tDerivedBase = tDerived->BaseType; - - // Declare an array of Derived, and get its type. - // - array^>^ d = gcnew array^>(0); - Type^ tDerivedArray = d->GetType(); - - // Get a generic type parameter, the type of a field, and a - // type that is nested in Derived. Notice that in order to - // get the nested type it is necessary to either (1) specify - // the generic type definition Derived::typeid, as shown here, - // or (2) specify a type parameter for Derived. - // - Type^ tT = Base::typeid->GetGenericArguments()[0]; - Type^ tF = tDerived->GetField("F")->FieldType; - Type^ tNested = Derived::Nested::typeid; - - DisplayGenericType(tDerived, "generic Derived"); - DisplayGenericType(tDerivedBase, "Base type of generic Derived"); - DisplayGenericType(tDerivedArray, "Array of Derived"); - DisplayGenericType(tT, "Type parameter T from generic Base"); - DisplayGenericType(tF, "Field type, G^>^"); - DisplayGenericType(tNested, "Nested type in generic Derived"); -} - -/* This code example produces the following output: - -generic Derived - Type: Derived`1[V] - IsGenericType: True - IsGenericTypeDefinition: True - ContainsGenericParameters: True - IsGenericParameter: False - -Base type of generic Derived - Type: Base`2[System.String,V] - IsGenericType: True - IsGenericTypeDefinition: False - ContainsGenericParameters: True - IsGenericParameter: False - -Array of Derived - Type: Derived`1[System.Int32][] - IsGenericType: False - IsGenericTypeDefinition: False - ContainsGenericParameters: False - IsGenericParameter: False - -Type parameter T from generic Base - Type: T - IsGenericType: False - IsGenericTypeDefinition: False - ContainsGenericParameters: True - IsGenericParameter: True - -Field type, G^>^ - Type: G`1[Derived`1[V]] - IsGenericType: True - IsGenericTypeDefinition: False - ContainsGenericParameters: True - IsGenericParameter: False - -Nested type in generic Derived - Type: Derived`1+Nested[V] - IsGenericType: True - IsGenericTypeDefinition: True - ContainsGenericParameters: True - IsGenericParameter: False - */ -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp deleted file mode 100644 index 7382ca1e398..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -public ref class Test -{ -private: - static void DisplayGenericTypeInfo( Type^ t ) - { - Console::WriteLine( L"\r\n{0}", t ); - Console::WriteLine( L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition ); - Console::WriteLine( L"\tIs it a generic type? {0}", - t->IsGenericType ); - - // - if ( t->IsGenericType ) - { - - // If this is a generic type, display the type arguments. - // - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine( L"\tList type arguments ({0}):", - typeArguments->Length ); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ tParam = safe_cast(myEnum->Current); - - // If this is a type parameter, display its - // position. - // - if ( tParam->IsGenericParameter ) - { - Console::WriteLine( - L"\t\t{0}\t(unassigned - parameter position {1})", - tParam, tParam->GenericParameterPosition ); - } - else - { - Console::WriteLine( L"\t\t{0}", tParam ); - } - } - } - // - } - - -public: - static void Main() - { - Console::Write( L"\r\n--- Display information about a " ); - Console::WriteLine( L"constructed type, its" ); - Console::WriteLine( L" generic type definition, and an ordinary type." ); - - // Create a Dictionary of Test objects, using strings for the - // keys. - Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; - - // Display information for the constructed type and its generic - // type definition. - DisplayGenericTypeInfo( d->GetType() ); - DisplayGenericTypeInfo( d->GetType()->GetGenericTypeDefinition() ); - - // Display information for an ordinary type. - DisplayGenericTypeInfo( String::typeid ); - } - -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Display information about a constructed type, its - generic type definition, and an ordinary type. - -System.Collections.Generic.Dictionary[System.String,Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - -System.Collections.Generic.Dictionary[TKey,TValue] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - TKey (unassigned - parameter position 0) - TValue (unassigned - parameter position 1) - -System.String - Is this a generic type definition? False - Is it a generic type? False - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp deleted file mode 100644 index 8332eed2ff0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -using namespace System; - -private ref class InternalOnly -{ -public: - ref class Nested {}; -}; - -public ref class Example -{ -public: - ref class Nested {}; -}; - - -// Entry point of example -int main() -{ - Type^ classType = InternalOnly::Nested::typeid; - Console::WriteLine( - "Is the {0} class visible outside the assembly? {1}", - classType->FullName, classType->IsVisible); - - classType = Example::Nested::typeid; - Console::WriteLine( - "Is the {0} class visible outside the assembly? {1}", - classType->FullName, classType->IsVisible); -} - -/* This example produces the following output: - -Is the InternalOnly+Nested class visible outside the assembly? False -Is the Example+Nested class visible outside the assembly? True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp deleted file mode 100644 index c9c917bc746..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Example -{ -public: - static void Main() - { - // Create a Type object that represents a one-dimensional - // array of Example objects. - Type^ t = Example::typeid->MakeArrayType(); - Console::WriteLine( L"\r\nArray of Example: {0}", t ); - - // Create a Type object that represents a two-dimensional - // array of Example objects. - t = Example::typeid->MakeArrayType( 2 ); - Console::WriteLine( L"\r\nTwo-dimensional array of Example: {0}", t ); - - // Demonstrate an exception when an invalid array rank is - // specified. - try - { - t = Example::typeid->MakeArrayType( -1 ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"\r\n{0}", ex ); - } - - // Create a Type object that represents a ByRef parameter - // of type Example. - t = Example::typeid->MakeByRefType(); - Console::WriteLine( L"\r\nByRef Example: {0}", t ); - - // Get a Type object representing the Example class, a - // MethodInfo representing the "Test" method, a ParameterInfo - // representing the parameter of type Example, and finally - // a Type object representing the type of this ByRef parameter. - // Compare this Type object with the Type object created using - // MakeByRefType. - Type^ t2 = Example::typeid; - MethodInfo^ mi = t2->GetMethod( L"Test" ); - ParameterInfo^ pi = mi->GetParameters()[ 0 ]; - Type^ pt = pi->ParameterType; - Console::WriteLine( L"Are the ByRef types equal? {0}", (t == pt) ); - - // Create a Type object that represents a pointer to an - // Example object. - t = Example::typeid->MakePointerType(); - Console::WriteLine( L"\r\nPointer to Example: {0}", t ); - } - - // A sample method with a ByRef parameter. - // - void Test( interior_ptr /*e*/ ) - { - } -}; - -int main() -{ - Example::Main(); -} - -/* This example produces output similar to the following: - -Array of Example: Example[] - -Two-dimensional array of Example: Example[,] - -System.IndexOutOfRangeException: Index was outside the bounds of the array. - at System.RuntimeType.MakeArrayType(Int32 rank) in c:\vbl\ndp\clr\src\BCL\System\RtType.cs:line 2999 - at Example.Main() - -ByRef Example: Example& -Are the ByRef types equal? True - -Pointer to Example: Example* - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp deleted file mode 100644 index b9aab72110f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// The following code example demonstrates that Type objects are returned -// by the typeid operator, and shows how Type objects are used in reflection -// to explore information about types and to invoke members of types. -// -#using - -using namespace System; -using namespace System::Reflection; - -void main() -{ - // Get a Type object representing the System.String type. - Type^ t = String::typeid; - - MethodInfo^ substr = t->GetMethod("Substring", - gcnew array { int::typeid, int::typeid }); - - Object^ result = - substr->Invoke("Hello, World!", gcnew array { 7, 5 }); - Console::WriteLine("{0} returned \"{1}\".", substr, result); -} - -/* This code example produces the following output: - -System.String Substring(Int32, Int32) returned "World". - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp deleted file mode 100644 index 84ebc81e817..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp +++ /dev/null @@ -1,153 +0,0 @@ - -// -using namespace System; - -/// Class that implements IConvertible* -public ref class Complex: public IConvertible -{ -private: - double x; - double y; - -public: - Complex( double x, double y ) - { - this->x = x; - this->y = y; - } - - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean( IFormatProvider^ provider ) - { - if ( (x != 0.0) || (y != 0.0) ) - return true; - else - return false; - } - - double GetDoubleValue() - { - return Math::Sqrt( x * x + y * y ); - } - - virtual Byte ToByte( IFormatProvider^ provider ) - { - return Convert::ToByte( GetDoubleValue() ); - } - - virtual Char ToChar( IFormatProvider^ provider ) - { - return Convert::ToChar( GetDoubleValue() ); - } - - virtual DateTime ToDateTime( IFormatProvider^ provider ) - { - return Convert::ToDateTime( GetDoubleValue() ); - } - - virtual Decimal ToDecimal( IFormatProvider^ provider ) - { - return Convert::ToDecimal( GetDoubleValue() ); - } - - virtual double ToDouble( IFormatProvider^ provider ) - { - return GetDoubleValue(); - } - - virtual short ToInt16( IFormatProvider^ provider ) - { - return Convert::ToInt16( GetDoubleValue() ); - } - - virtual int ToInt32( IFormatProvider^ provider ) - { - return Convert::ToInt32( GetDoubleValue() ); - } - - virtual Int64 ToInt64( IFormatProvider^ provider ) - { - return Convert::ToInt64( GetDoubleValue() ); - } - - virtual signed char ToSByte( IFormatProvider^ provider ) - { - return Convert::ToSByte( GetDoubleValue() ); - } - - virtual float ToSingle( IFormatProvider^ provider ) - { - return Convert::ToSingle( GetDoubleValue() ); - } - - virtual String^ ToString( IFormatProvider^ provider ) - { - return x.ToString() + ", " + y.ToString(); - } - - virtual Object^ ToType( Type^ conversionType, IFormatProvider^ provider ) - { - return Convert::ChangeType( GetDoubleValue(), conversionType ); - } - - virtual UInt16 ToUInt16( IFormatProvider^ provider ) - { - return Convert::ToUInt16( GetDoubleValue() ); - } - - virtual UInt32 ToUInt32( IFormatProvider^ provider ) - { - return Convert::ToUInt32( GetDoubleValue() ); - } - - virtual UInt64 ToUInt64( IFormatProvider^ provider ) - { - return Convert::ToUInt64( GetDoubleValue() ); - } -}; - - -// -void WriteObjectInfo( Object^ testObject ) -{ - TypeCode typeCode = Type::GetTypeCode( testObject->GetType() ); - switch ( typeCode ) - { - case TypeCode::Boolean: - Console::WriteLine( "Boolean: {0}", testObject ); - break; - - case TypeCode::Double: - Console::WriteLine( "Double: {0}", testObject ); - break; - - default: - Console::WriteLine( "{0}: {1}", typeCode, testObject ); - break; - } -} -// - -void main() -{ - Complex^ testComplex = gcnew Complex( 4,7 ); - WriteObjectInfo( testComplex ); - WriteObjectInfo( Convert::ToBoolean( testComplex ) ); - WriteObjectInfo( Convert::ToDecimal( testComplex ) ); - WriteObjectInfo( Convert::ToString( testComplex ) ); -} - -/* -This code example produces the following results: - -Object: ConsoleApplication2.Complex -Boolean: True -Decimal: 8.06225774829855 -String: ( 4 , 7 ) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp deleted file mode 100644 index e10fb59e8bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Lambda.cpp : main project file. - -//#include "stdafx.h" - -// -using namespace System; -using namespace System::Windows::Forms; - -public delegate void ShowValue(); - - -public ref class Name -{ -private: - String^ instanceName; - -public: - Name(String^ name) - { - instanceName = name; - } - - void DisplayToConsole() - { - Console::WriteLine(this->instanceName); - } - - void DisplayToWindow() - { - MessageBox::Show(this->instanceName); - } -}; - -int main() -{ - Name^ testName = gcnew Name(L"Koani"); - ShowValue^ showMethod; - showMethod = gcnew ShowValue(testName, &Name::DisplayToWindow); - showMethod(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj deleted file mode 100644 index 747bfeb6b76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj +++ /dev/null @@ -1,89 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9EC80F18-EB27-492B-9D70-40C7B2052756} - v4.0 - ManagedCProj - TestWinForms - - - - Application - true - Pure - Unicode - - - Application - false - Pure - Unicode - - - - - - - - - - - - - true - - - false - - - - Level3 - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - - - true - - - Windows - main - - - - - Level3 - WIN32;NDEBUG;%(PreprocessorDefinitions) - Use - - - true - - - Windows - main - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp deleted file mode 100644 index 8dd9c5712f8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -using namespace System; - -public ref class Dummy -{ -// - public: - generic where T:gcnew() - static T Bar() - { - return gcnew T(); - } -// -}; - - -void main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp deleted file mode 100644 index f739b8705dd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// The following example demonstrates using the ForEach method. - -// -using namespace System; - -public ref class SamplesArray -{ -public: - static void Main() - { - // create a three element array of integers - array^ intArray = gcnew array {2, 3, 4}; - - // set a delegate for the ShowSquares method - Action^ action = gcnew Action(ShowSquares); - - Array::ForEach(intArray, action); - } - -private: - static void ShowSquares(int val) - { - Console::WriteLine("{0:d} squared = {1:d}", val, val*val); - } -}; - -int main() -{ - SamplesArray::Main(); -} - -/* -This code produces the following output: - -2 squared = 4 -3 squared = 9 -4 squared = 16 -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp deleted file mode 100644 index fb3486b04d4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// The following example demonstrates using the Array.GetLength method. - -// -using namespace System; - -public ref class SamplesArray -{ -public: - static void Main() - { - // make a single dimension array - Array^ MyArray1 = Array::CreateInstance(int::typeid, 5); - - // make a 3 dimensional array - Array^ MyArray2 = Array::CreateInstance(int::typeid, 5, 3, 2); - - // make an array container - Array^ BossArray = Array::CreateInstance(Array::typeid, 2); - BossArray->SetValue(MyArray1, 0); - BossArray->SetValue(MyArray2, 1); - - int i = 0, j, rank; - for each (Array^ anArray in BossArray) - { - rank = anArray->Rank; - if (rank > 1) - { - Console::WriteLine("Lengths of {0:d} dimension array[{1:d}]", rank, i); - // show the lengths of each dimension - for (j = 0; j < rank; j++) - { - Console::WriteLine(" Length of dimension({0:d}) = {1:d}", j, anArray->GetLength(j)); - } - } - else - { - Console::WriteLine("Lengths of single dimension array[{0:d}]", i); - } - // show the total length of the entire array or all dimensions - Console::WriteLine(" Total length of the array = {0:d}", anArray->Length); - Console::WriteLine(); - i++; - } - } -}; - -int main() -{ - SamplesArray::Main(); -} - -/* -This code produces the following output: - -Lengths of single dimension array[0] - Total length of the array = 5 - -Lengths of 3 dimension array[1] - Length of dimension(0) = 5 - Length of dimension(1) = 3 - Length of dimension(2) = 2 - Total length of the array = 30 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp deleted file mode 100644 index 62891bfe86f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -using namespace System; - -void main() -{ - // Create a one-dimensional integer array. - array^ integers = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - // Get the upper and lower bound of the array. - int upper = integers->GetUpperBound(0); - int lower = integers->GetLowerBound(0); - Console::WriteLine("Elements from index {0} to {1}:", lower, upper); - // Iterate the array. - for (int ctr = lower; ctr <= upper; ctr++) - Console::Write("{0}{1}{2}", ctr == lower ? " " : "", - integers[ctr], - ctr < upper ? ", " : Environment::NewLine); - - Console::WriteLine(); - - // Create a two-dimensional integer array. - array^ integers2d = { {2, 4}, {3, 9}, {4, 16}, {5, 25}, - {6, 36}, {7, 49}, {8, 64}, {9, 81} }; - // Get the number of dimensions. - int rank = integers2d->Rank; - Console::WriteLine("Number of dimensions: {0}", rank); - for (int ctr = 0; ctr < rank; ctr++) - Console::WriteLine(" Dimension {0}: from {1} to {2}", - ctr, integers2d->GetLowerBound(ctr), - integers2d->GetUpperBound(ctr)); - - // Iterate the 2-dimensional array and display its values. - Console::WriteLine(" Values of array elements:"); - for (int outer = integers2d->GetLowerBound(0); outer <= integers2d->GetUpperBound(0); - outer++) - for (int inner = integers2d->GetLowerBound(1); inner <= integers2d->GetUpperBound(1); - inner++) - Console::WriteLine(" {3}{0}, {1}{4} = {2}", outer, inner, - integers2d->GetValue(outer, inner), "{", "}"); -} -// The example displays the following output: -// Elements from index 0 to 9: -// 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 -// -// Number of dimensions: 2 -// Dimension 0: from 0 to 7 -// Dimension 1: from 0 to 1 -// Values of array elements: -// {0, 0} = 2 -// {0, 1} = 4 -// {1, 0} = 3 -// {1, 1} = 9 -// {2, 0} = 4 -// {2, 1} = 16 -// {3, 0} = 5 -// {3, 1} = 25 -// {4, 0} = 6 -// {4, 1} = 36 -// {5, 0} = 7 -// {5, 1} = 49 -// {6, 0} = 8 -// {6, 1} = 64 -// {7, 0} = 9 -// {7, 1} = 81 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp deleted file mode 100644 index 7d01f577679..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Byte.Equals.cpp : main project file. - -// -using namespace System; - -void main() -{ - Byte byteVal1 = 0x7f; - Byte byteVal2 = 127; - Object^ objectVal3 = byteVal2; - - Console::WriteLine("byteVal1 = {0}, byteVal2 = {1}, objectVal3 = {2}\n", - byteVal1, byteVal2, objectVal3); - Console::WriteLine("byteVal1 equals byteVal2?: {0}", byteVal1.Equals(byteVal2)); - Console::WriteLine("byteVal1 equals objectVal3?: {0}", byteVal1.Equals(objectVal3)); -} -/* -This example displays the following output: - byteVal1 = 127, byteVal2 = 127, objectVal3 = 127 - - byteVal1 equals byteVal2?: True - byteVal1 equals objectVal3?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp deleted file mode 100644 index 65a52f0b6cc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -using namespace System; -using namespace System::IO; - -void main() -{ - try - { -// - Console::WriteLine("Hello World"); - FileStream^ fs = gcnew FileStream("Test.txt", FileMode::Create); - // First, save the standard output. - TextWriter^ tmp = Console::Out; - StreamWriter^ sw = gcnew StreamWriter(fs); - Console::SetOut(sw); - Console::WriteLine("Hello file"); - Console::SetOut(tmp); - Console::WriteLine("Hello World"); - sw->Close(); -// - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - Console::WriteLine(ex->StackTrace); - } -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp deleted file mode 100644 index 829d3eb8423..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Console.WindowLeft.cpp : main project file. - -// -using namespace System; - -void ShowConsoleStatistics() -{ - Console::WriteLine("Console statistics:"); - Console::WriteLine(" Buffer: {0} x {1}", Console::BufferHeight, Console::BufferWidth); - Console::WriteLine(" Window: {0} x {1}", Console::WindowHeight, Console::WindowWidth); - Console::WriteLine(" Window starts at {0}.", Console::WindowLeft); - Console::WriteLine("Press <- or -> to move window, Ctrl+C to exit."); -} - -int main() -{ - ConsoleKeyInfo key; - bool moved = false; - - Console::BufferWidth = 120; - Console::Clear(); - - ShowConsoleStatistics(); - - do { - key = Console::ReadKey(true); - if (key.Key == ConsoleKey::LeftArrow) - { - int pos = Console::WindowLeft - 1; - if (pos >= 0 && pos + Console::WindowWidth <= Console::BufferWidth) - { - Console::WindowLeft = pos; - moved = true; - } - } - else if (key.Key == ConsoleKey::RightArrow) - { - int pos = Console::WindowLeft + 1; - if (pos + Console::WindowWidth <= Console::BufferWidth) - { - Console::WindowLeft = pos; - moved = true; - } - } - if (moved) - { - ShowConsoleStatistics(); - moved = false; - } - Console::WriteLine(); - } while (true); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp deleted file mode 100644 index 2e488e00359..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -//void main(array ^args) -void main() -{ - DateTime dateRecorded(2009, 6, 15); - DateTime startTime(1, 1, 1, 0, 30, 0); - TimeSpan interval(12, 0, 0); - - Double temperature1 = 52.8; - Double temperature2 = 63.5; - - Console::Write("Date: {0:d}:\n Temperature at {1:t}: {2}\n Temperature at {3:t}: {4}\n", - dateRecorded, startTime, temperature1, - startTime.Add(interval), temperature2); - Console::ReadLine(); -} -// The example displays the following output: -// Date: 6/15/2009: -// Temperature at 12:30 AM: 52.8 -// Temperature at 12:30 PM: 63.5 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp deleted file mode 100644 index 33eb3685a6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// Convert.ChangeType00.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -ref class InterceptProvider : IFormatProvider -{ -public: - virtual Object^ GetFormat(Type^ formatType) - { - CultureInfo^ culture; - if (formatType == NumberFormatInfo::typeid) { - Console::WriteLine(" Returning a fr-FR numeric format provider."); - - culture = gcnew CultureInfo("fr-FR"); - return culture->NumberFormat; - } - else if (formatType == DateTimeFormatInfo::typeid) { - Console::WriteLine(" Returning an en-US date/time format provider."); - culture = gcnew CultureInfo("en-US"); - return culture->DateTimeFormat; - } - else { - Console::WriteLine(" Requesting a format provider of {0}.", formatType->Name); - return nullptr; - } - } -}; - -void main() -{ - array^ values = gcnew array { 103.5, gcnew DateTime(2010, 12, 26, 14, 34, 0) }; - IFormatProvider^ provider = gcnew InterceptProvider(); - - // Convert value to each of the types represented in TypeCode enum. - for each (Object^ value in values) - { - // Iterate types in TypeCode enum. - for each (TypeCode enumType in (array^) Enum::GetValues(TypeCode::typeid)) - { - if (enumType == TypeCode::DBNull || enumType == TypeCode::Empty) continue; - - try { - Console::WriteLine("{0} ({1}) --> {2} ({3}).", - value, value->GetType()->Name, - Convert::ChangeType(value, enumType, provider), - enumType.ToString()); - } - catch (InvalidCastException^ e) { - Console::WriteLine("Cannot convert a {0} to a {1}", - value->GetType()->Name, enumType.ToString()); - } - catch (OverflowException^ e) { - Console::WriteLine("Overflow: {0} is out of the range of a {1}", - value, enumType.ToString()); - } - } - Console::WriteLine(); - } -} -// The example displays the following output: -// 103.5 (Double) --> 103.5 (Object). -// 103.5 (Double) --> True (Boolean). -// Cannot convert a Double to a Char -// 103.5 (Double) --> 104 (SByte). -// 103.5 (Double) --> 104 (Byte). -// 103.5 (Double) --> 104 (Int16). -// 103.5 (Double) --> 104 (UInt16). -// 103.5 (Double) --> 104 (Int32). -// 103.5 (Double) --> 104 (UInt32). -// 103.5 (Double) --> 104 (Int64). -// 103.5 (Double) --> 104 (UInt64). -// 103.5 (Double) --> 103.5 (Single). -// 103.5 (Double) --> 103.5 (Double). -// 103.5 (Double) --> 103.5 (Decimal). -// Cannot convert a Double to a DateTime -// Returning a fr-FR numeric format provider. -// 103.5 (Double) --> 103,5 (String). -// -// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (Object). -// Cannot convert a DateTime to a Boolean -// Cannot convert a DateTime to a Char -// Cannot convert a DateTime to a SByte -// Cannot convert a DateTime to a Byte -// Cannot convert a DateTime to a Int16 -// Cannot convert a DateTime to a UInt16 -// Cannot convert a DateTime to a Int32 -// Cannot convert a DateTime to a UInt32 -// Cannot convert a DateTime to a Int64 -// Cannot convert a DateTime to a UInt64 -// Cannot convert a DateTime to a Single -// Cannot convert a DateTime to a Double -// Cannot convert a DateTime to a Decimal -// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (DateTime). -// Returning an en-US date/time format provider. -// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (String). -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp deleted file mode 100644 index 36b41bcee35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// Convert.ChangeType03.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -public ref class Temperature : IConvertible -{ -private: - Decimal m_Temp; - -public: - Temperature(Decimal temperature) - { - m_Temp = temperature; - } - - property Decimal Celsius { - Decimal get() { return m_Temp; } - } - - property Decimal Kelvin { - Decimal get() { return m_Temp + (Decimal) 273.15; } - } - - property Decimal Fahrenheit { - Decimal get() { return Math::Round((Decimal) (m_Temp * 9 / 5 + 32), 2); } - } - - virtual String^ ToString() - override { - return m_Temp.ToString("N2") + "C"; - } - - // IConvertible implementations. - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean(IFormatProvider^ provider) - { - if (m_Temp == 0) - return false; - else - return true; - } - - virtual Byte ToByte(IFormatProvider^ provider) - { - if (m_Temp < Byte::MinValue || m_Temp > Byte::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Byte type.", - m_Temp)); - else - return Decimal::ToByte(m_Temp); - } - - virtual Char ToChar(IFormatProvider^ provider) - { - throw gcnew InvalidCastException("Temperature to Char conversion is not supported."); - } - - virtual DateTime ToDateTime(IFormatProvider^ provider) - { - throw gcnew InvalidCastException("Temperature to DateTime conversion is not supported."); - } - - virtual Decimal ToDecimal(IFormatProvider^ provider) - { - return m_Temp; - } - - virtual Double ToDouble(IFormatProvider^ provider) - { - return Decimal::ToDouble(m_Temp); - } - - virtual Int16 ToInt16(IFormatProvider^ provider) - { - if (m_Temp < Int16::MinValue || m_Temp > Int16::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Int16 type.", - m_Temp)); - else - return Decimal::ToInt16(m_Temp); - } - - virtual Int32 ToInt32(IFormatProvider^ provider) - { - if (m_Temp < Int32::MinValue || m_Temp > Int32::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Int32 type.", - m_Temp)); - else - return Decimal::ToInt32(m_Temp); - } - - virtual Int64 ToInt64(IFormatProvider^ provider) - { - if (m_Temp < Int64::MinValue || m_Temp > Int64::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Int64 type.", - m_Temp)); - else - return Decimal::ToInt64(m_Temp); - } - - virtual SByte ToSByte(IFormatProvider^ provider) - { - if (m_Temp < SByte::MinValue || m_Temp > SByte::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the SByte type.", - m_Temp)); - else - return Decimal::ToSByte(m_Temp); - } - - virtual Single ToSingle(IFormatProvider^ provider) - { - return Decimal::ToSingle(m_Temp); - } - - virtual String^ ToString(IFormatProvider^ provider) - { - return m_Temp.ToString("N2", provider) + "C"; - } - - virtual Object^ ToType(Type^ conversionType, IFormatProvider^ provider) - { - switch (Type::GetTypeCode(conversionType)) - { - case TypeCode::Boolean: - return ToBoolean(nullptr); - case TypeCode::Byte: - return ToByte(nullptr); - case TypeCode::Char: - return ToChar(nullptr); - case TypeCode::DateTime: - return ToDateTime(nullptr); - case TypeCode::Decimal: - return ToDecimal(nullptr); - case TypeCode::Double: - return ToDouble(nullptr); - case TypeCode::Int16: - return ToInt16(nullptr); - case TypeCode::Int32: - return ToInt32(nullptr); - case TypeCode::Int64: - return ToInt64(nullptr); - case TypeCode::Object: - if (Temperature::typeid->Equals(conversionType)) - return this; - else - throw gcnew InvalidCastException(String::Format("Conversion to a {0} is not supported.", - conversionType->Name)); - case TypeCode::SByte: - return ToSByte(nullptr); - case TypeCode::Single: - return ToSingle(nullptr); - case TypeCode::String: - return ToString(provider); - case TypeCode::UInt16: - return ToUInt16(nullptr); - case TypeCode::UInt32: - return ToUInt32(nullptr); - case TypeCode::UInt64: - return ToUInt64(nullptr); - default: - throw gcnew InvalidCastException(String::Format("Conversion to {0} is not supported.", conversionType->Name)); - } - } - - virtual UInt16 ToUInt16(IFormatProvider^ provider) - { - if (m_Temp < UInt16::MinValue || m_Temp > UInt16::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the UInt16 type.", - m_Temp)); - else - return Decimal::ToUInt16(m_Temp); - } - - virtual UInt32 ToUInt32(IFormatProvider^ provider) - { - if (m_Temp < UInt32::MinValue || m_Temp > UInt32::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the UInt32 type.", - m_Temp)); - else - return Decimal::ToUInt32(m_Temp); - } - - virtual UInt64 ToUInt64(IFormatProvider^ provider) - { - if (m_Temp < UInt64::MinValue || m_Temp > UInt64::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the UInt64 type.", - m_Temp)); - else - return Decimal::ToUInt64(m_Temp); - } -}; -// - -// -void main() -{ - Temperature^ cool = gcnew Temperature(5); - array^ targetTypes = gcnew array { SByte::typeid, Int16::typeid, Int32::typeid, - Int64::typeid, Byte::typeid, UInt16::typeid, - UInt32::typeid, UInt64::typeid, Decimal::typeid, - Single::typeid, Double::typeid, String::typeid }; - CultureInfo^ provider = gcnew CultureInfo("fr-FR"); - - for each (Type^ targetType in targetTypes) - { - try { - Object^ value = Convert::ChangeType(cool, targetType, provider); - Console::WriteLine("Converted {0} {1} to {2} {3}.", - cool->GetType()->Name, cool->ToString(), - targetType->Name, value); - } - catch (InvalidCastException^) { - Console::WriteLine("Unsupported {0} --> {1} conversion.", - cool->GetType()->Name, targetType->Name); - } - catch (OverflowException^) { - Console::WriteLine("{0} is out of range of the {1} type.", - cool, targetType->Name); - } - } -} -// The example dosplays the following output: -// Converted Temperature 5.00C to SByte 5. -// Converted Temperature 5.00C to Int16 5. -// Converted Temperature 5.00C to Int32 5. -// Converted Temperature 5.00C to Int64 5. -// Converted Temperature 5.00C to Byte 5. -// Converted Temperature 5.00C to UInt16 5. -// Converted Temperature 5.00C to UInt32 5. -// Converted Temperature 5.00C to UInt64 5. -// Converted Temperature 5.00C to Decimal 5. -// Converted Temperature 5.00C to Single 5. -// Converted Temperature 5.00C to Double 5. -// Converted Temperature 5.00C to String 5,00C. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp deleted file mode 100644 index 162b7f8fc5b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// ChangeType01.cpp : main project file. - -// -using namespace System; - -void main() -{ - Double d = -2.345; - int i = (int) Convert::ChangeType(d, TypeCode::Int32); - - Console::WriteLine("The Double {0} when converted to an Int32 is {1}", d, i); - - String^ s = "12/12/2009"; - DateTime dt = (DateTime)Convert::ChangeType(s, DateTime::typeid); - - Console::WriteLine("The String {0} when converted to a Date is {1}", s, dt); -} -// The example displays the following output: -// The Double -2.345 when converted to an Int32 is -2 -// The String 12/12/2009 when converted to a Date is 12/12/2009 12:00:00 AM -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp deleted file mode 100644 index c114fe2f378..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Convert.ToByte.cpp : main project file. - -// -using namespace System; - -void main() -{ - bool falseFlag = false; - bool trueFlag = true; - - Console::WriteLine("{0} converts to {1}.", falseFlag, - Convert::ToByte(falseFlag)); - Console::WriteLine("{0} converts to {1}.", trueFlag, - Convert::ToByte(trueFlag)); -} -// The example displays the following output: -// False converts to 0. -// True converts to 1. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp deleted file mode 100644 index d4d8b439ff3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -using namespace System; - -void main() -{ - DateTime dateValue(2013, 9, 15, 12, 0, 0); - - array^ minutes = { .01667, .08333, .16667, .25, .33333, - .5, .66667, 1, 2, 15, 30, 17, 45, - 60, 180, 60 * 24 }; - - for each (Double minute in minutes) - Console::WriteLine("{0} + {1} minute(s) = {2}", dateValue, minute, - dateValue.AddMinutes(minute)); -} -// The example displays the following output on a system whose current culture is en-US: -// 9/15/2013 12:00:00 PM + 0.01667 minute(s) = 9/15/2013 12:00:01 PM -// 9/15/2013 12:00:00 PM + 0.08333 minute(s) = 9/15/2013 12:00:05 PM -// 9/15/2013 12:00:00 PM + 0.16667 minute(s) = 9/15/2013 12:00:10 PM -// 9/15/2013 12:00:00 PM + 0.25 minute(s) = 9/15/2013 12:00:15 PM -// 9/15/2013 12:00:00 PM + 0.33333 minute(s) = 9/15/2013 12:00:20 PM -// 9/15/2013 12:00:00 PM + 0.5 minute(s) = 9/15/2013 12:00:30 PM -// 9/15/2013 12:00:00 PM + 0.66667 minute(s) = 9/15/2013 12:00:40 PM -// 9/15/2013 12:00:00 PM + 1 minute(s) = 9/15/2013 12:01:00 PM -// 9/15/2013 12:00:00 PM + 2 minute(s) = 9/15/2013 12:02:00 PM -// 9/15/2013 12:00:00 PM + 15 minute(s) = 9/15/2013 12:15:00 PM -// 9/15/2013 12:00:00 PM + 30 minute(s) = 9/15/2013 12:30:00 PM -// 9/15/2013 12:00:00 PM + 17 minute(s) = 9/15/2013 12:17:00 PM -// 9/15/2013 12:00:00 PM + 45 minute(s) = 9/15/2013 12:45:00 PM -// 9/15/2013 12:00:00 PM + 60 minute(s) = 9/15/2013 1:00:00 PM -// 9/15/2013 12:00:00 PM + 180 minute(s) = 9/15/2013 3:00:00 PM -// 9/15/2013 12:00:00 PM + 1440 minute(s) = 9/16/2013 12:00:00 PM -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp deleted file mode 100644 index 6392ec34c1a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - DateTime localDate = DateTime::Now; - array^ cultureNames = { "en-US", "en-GB", "fr-FR", - "de-DE", "ru-RU" }; - - for each (String^ cultureName in cultureNames) { - CultureInfo^ culture = gcnew CultureInfo(cultureName); - Console::WriteLine("{0}: {1}", cultureName, - localDate.ToString(culture)); - } -} -// The example displays the following output: -// en-US: 6/19/2015 10:03:06 AM -// en-GB: 19/06/2015 10:03:06 -// fr-FR: 19/06/2015 10:03:06 -// de-DE: 19.06.2015 10:03:06 -// ru-RU: 19.06.2015 10:03:06 -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp deleted file mode 100644 index 3026aeda282..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - DateTime localDate = DateTime::Now; - DateTime utcDate = DateTime::UtcNow; - array^ cultureNames = { "en-US", "en-GB", "fr-FR", - "de-DE", "ru-RU" } ; - - for each (String^ cultureName in cultureNames) { - CultureInfo^ culture = gcnew CultureInfo(cultureName); - Console::WriteLine("{0}:", culture->NativeName); - Console::WriteLine(" Local date and time: {0}, {1:G}", - localDate.ToString(culture), localDate.Kind); - Console::WriteLine(" UTC date and time: {0}, {1:G}\n", - utcDate.ToString(culture), utcDate.Kind); - } -} -// The example displays the following output: -// English (United States): -// Local date and time: 6/19/2015 10:35:50 AM, Local -// UTC date and time: 6/19/2015 5:35:50 PM, Utc -// -// English (United Kingdom): -// Local date and time: 19/06/2015 10:35:50, Local -// UTC date and time: 19/06/2015 17:35:50, Utc -// -// français (France): -// Local date and time: 19/06/2015 10:35:50, Local -// UTC date and time: 19/06/2015 17:35:50, Utc -// -// Deutsch (Deutschland): -// Local date and time: 19.06.2015 10:35:50, Local -// UTC date and time: 19.06.2015 17:35:50, Utc -// -// русский (Россия): -// Local date and time: 19.06.2015 10:35:50, Local -// UTC date and time: 19.06.2015 17:35:50, Utc -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp deleted file mode 100644 index e2e407522b7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of decimal values. - array^ values = { Decimal::Parse("78"), - Decimal(78000,0,0,false,3), - Decimal::Parse("78.999"), - Decimal::Parse("255.999"), - Decimal::Parse("256"), - Decimal::Parse("127.999"), - Decimal::Parse("128"), - Decimal::Parse("-0.999"), - Decimal::Parse("-1"), - Decimal::Parse("-128.999"), - Decimal::Parse("-129") }; - for each (Decimal value in values) { - try { - SByte byteValue = (SByte) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, byteValue, - byteValue.GetType()->Name); - } - catch (OverflowException^ e) { - Console::WriteLine("OverflowException: Cannot convert {0}", - value); - } - } -} -// The example displays the following output: -// 78 (Decimal) --> 78 (SByte) -// 78.000 (Decimal) --> 78 (SByte) -// 78.999 (Decimal) --> 78 (SByte) -// OverflowException: Cannot convert 255.999 -// OverflowException: Cannot convert 256 -// 127.999 (Decimal) --> 127 (SByte) -// OverflowException: Cannot convert 128 -// -0.999 (Decimal) --> 0 (SByte) -// -1 (Decimal) --> -1 (SByte) -// -128.999 (Decimal) --> -128 (SByte) -// OverflowException: Cannot convert -129 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp deleted file mode 100644 index ddfc63d3603..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of Decimal values. - array^ values = { Decimal::Parse("0.0000000000000000000000000001"), - Decimal::Parse("0.0000000000123456789123456789"), - Decimal::Parse("123"), - Decimal(123000000, 0, 0, false, 6), - Decimal::Parse("123456789.123456789"), - Decimal::Parse("123456789123456789123456789"), - Decimal::MinValue, Decimal::MaxValue }; - // Convert each value to a double. - for each (Decimal value in values) { - float dblValue = (float) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, dblValue, - dblValue.GetType()->Name); - } -} -// The example displays the following output: -// 0.0000000000000000000000000001 (Decimal) --> 1E-28 (Single) -// 0.0000000000123456789123456789 (Decimal) --> 1.234568E-11 (Single) -// 123 (Decimal) --> 123 (Single) -// 123.000000 (Decimal) --> 123 (Single) -// 123456789.123456789 (Decimal) --> 1.234568E+08 (Single) -// 123456789123456789123456789 (Decimal) --> 1.234568E+26 (Single) -// -79228162514264337593543950335 (Decimal) --> -7.922816E+28 (Single) -// 79228162514264337593543950335 (Decimal) --> 7.922816E+28 (Single) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp deleted file mode 100644 index 94a5f963ddb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -using namespace System; - -public ref class TestClass{}; - -int main() -{ - TestClass^ test = gcnew TestClass; - array^ objectsToCompare = { test, test->ToString(), 123, - (123).ToString(), "some text", - "Some Text" }; - String^ s = "some text"; - for each (Object^ objectToCompare in objectsToCompare) { - try { - Int32 i = s->CompareTo(objectToCompare); - Console::WriteLine("Comparing '{0}' with '{1}': {2}", - s, objectToCompare, i); - } - catch (ArgumentException^ e) { - Console::WriteLine("Bad argument: {0} (type {1})", - objectToCompare, - objectToCompare->GetType()->Name); - Console::WriteLine("Exception information: {0}", e); - } - Console::WriteLine(); - } -} -// The example displays the following output: -// Bad argument: TestClass (type TestClass) -// Exception information: System.ArgumentException: Object must be of type String. -// at System.String.CompareTo(Object value) -// at Example.Main() -// -// Comparing 'some text' with 'TestClass': -1 -// -// Bad argument: 123 (type Int32) -// Exception information: System.ArgumentException: Object must be of type String. -// at System.String.CompareTo(Object value) -// at Example.Main() -// -// Comparing 'some text' with '123': 1 -// -// Comparing 'some text' with 'some text': 0 -// -// Comparing 'some text' with 'Some Text': -1 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp deleted file mode 100644 index ed84d371b80..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -using namespace System; -const long maxGarbage = 1000; -ref class MyGCCollectClass -{ -public: - void MakeSomeGarbage() - { - Version^ vt; - for ( int i = 0; i < maxGarbage; i++ ) - { - - // Create objects and release them to fill up memory - // with unused objects. - vt = gcnew Version; - - } - } - -}; - -int main() -{ - MyGCCollectClass^ myGCCol = gcnew MyGCCollectClass; - - // Determine the maximum number of generations the system - // garbage collector currently supports. - Console::WriteLine( "The highest generation is {0}", GC::MaxGeneration ); - myGCCol->MakeSomeGarbage(); - - // Determine which generation myGCCol object is stored in. - Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); - - // Determine the best available approximation of the number - // of bytes currently allocated in managed memory. - Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); - - // Perform a collection of generation 0 only. - GC::Collect( 0 ); - - // Determine which generation myGCCol object is stored in. - Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); - Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); - - // Perform a collection of all generations up to and including 2. - GC::Collect( 2 ); - - // Determine which generation myGCCol object is stored in. - Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); - Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp deleted file mode 100644 index b8f17f0074a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ numbersToConvert = gcnew array { 162345, 32183, -54000, - Int64::MaxValue/2 }; - Int32 newNumber; - for each (Int64 number in numbersToConvert) - { - if ((number >= Int32::MinValue) && (number <= Int32::MaxValue)) - { - newNumber = Convert::ToInt32(number); - Console::WriteLine("Successfully converted {0} to an Int32.", - newNumber); - } - else - { - Console::WriteLine("Unable to convert {0} to an Int32.", number); - } - } -} -// The example displays the following output to the console: -// Successfully converted 162345 to an Int32. -// Successfully converted 32183 to an Int32. -// Successfully converted -54000 to an Int32. -// Unable to convert 4611686018427387903 to an Int32. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp deleted file mode 100644 index e08099e7418..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -using namespace System; - -// Define the "titleAuthor" table of the Microsoft "pubs" database. -value struct titleAuthor -{ - public: - // Author ID; format ###-##-#### - String^ au_id; - // Title ID; format AA#### - String^ title_id; - // Author ORD is nullable. - Nullable au_ord; - // Royalty Percent is nullable. - Nullable royaltyper; - - // Display the values of the titleAuthor array elements. - static void Display(String^ dspTitle, - array^ dspAllTitleAuthors) - { - Console::WriteLine("*** {0} ***", dspTitle); - for each (titleAuthor dspTA in dspAllTitleAuthors) { - Console::WriteLine("Author ID ... {0}", dspTA.au_id); - Console::WriteLine("Title ID .... {0}", dspTA.title_id); - Console::WriteLine("Author ORD .. {0}", dspTA.au_ord.HasValue ? - dspTA.au_ord.Value : -1); - Console::WriteLine("Royalty % ... {0}", dspTA.royaltyper.HasValue ? - dspTA.royaltyper.Value : 0); - Console::WriteLine(); - } - } -}; - -void main() -{ - // Declare and initialize the titleAuthor array. - array^ ta = gcnew array(3); - ta[0].au_id = "712-32-1176"; - ta[0].title_id = "PS3333"; - ta[0].au_ord = 1; - ta[0].royaltyper = 100; - - ta[1].au_id = "213-46-8915"; - ta[1].title_id = "BU1032"; -// ta[1].au_ord = nullptr; -// ta[1].royaltyper = nullptr; - - ta[2].au_id = "672-71-3249"; - ta[2].title_id = "TC7777"; -// ta[2].au_ord = nullptr; - ta[2].royaltyper = 40; - - // Display the values of the array elements, and - // display a legend. - titleAuthor::Display("Title Authors Table", ta); - Console::WriteLine("Legend:"); - Console::WriteLine("An Author ORD of -1 means no value is defined."); - Console::WriteLine("A Royalty % of 0 means no value is defined."); -} -// The example displays the following output: -// *** Title Authors Table *** -// Author ID ... 712-32-1176 -// Title ID .... PS3333 -// Author ORD .. 1 -// Royalty % ... 100 -// -// Author ID ... 213-46-8915 -// Title ID .... BU1032 -// Author ORD .. -1 -// Royalty % ... 0 -// -// Author ID ... 672-71-3249 -// Title ID .... TC7777 -// Author ORD .. -1 -// Royalty % ... 40 -// -// Legend: -// An Author ORD of -1 means no value is defined. -// A Royalty % of 0 means no value is defined. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp deleted file mode 100644 index aed41164638..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -using namespace System; - -void main() -{ - Object^ obj = gcnew Object(); - Console::WriteLine(obj->ToString()); -} -// The example displays the following output: -// System.Object -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp deleted file mode 100644 index 555db31ba29..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; - -namespace Examples -{ - ref class Object1 - { - }; -} - -void main() -{ - Object^ obj1 = gcnew Examples::Object1(); - Console::WriteLine(obj1->ToString()); -} -// The example displays the following output: -// Examples.Object1 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp deleted file mode 100644 index 874d33085c2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -using namespace System; - -ref class Object2 -{ - private: - Object^ value; - - public: - Object2(Object^ value) - { - this->value = value; - } - - virtual String^ ToString() override - { - return Object::ToString() + ": " + value->ToString(); - } -}; - -void main() -{ - Object2^ obj2 = gcnew Object2(L'a'); - Console::WriteLine(obj2->ToString()); - -} -// The example displays the following output: -// Object2: a -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp deleted file mode 100644 index 2f65db80fc4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ s1 = "We went to a bookstore, "; - String^ s2 = "a movie, "; - String^ s3 = "and a restaurant."; - - String^ s = String::Concat(s1, s2, s3); - Console::WriteLine(s); -} -// The example displays the following output: -// We went to a bookstore, a movie, and a restaurant. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp deleted file mode 100644 index 013c216996e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Assignment.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" -// -using namespace System; - -void main() -{ - String^ value1 = L"This is a string."; - String^ value2 = value1; - Console::WriteLine(value1); - Console::WriteLine(value2); -} -// The example displays the following output: -// This is a string. -// This is a string. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp deleted file mode 100644 index a5ea741588d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Char1_Ctor.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - wchar_t characters[] = {L'H',L'e',L'l',L'l',L'o',L' ', - L'W',L'o',L'r',L'l',L'd',L'!',L'\x0000'}; - - Char* charPtr = characters; - String^ value = gcnew String(charPtr); - Console::WriteLine(value); -} -// The example displays the following output: -// Hello world! -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp deleted file mode 100644 index 94226ba6f8d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Char2_Ctor.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - - -void main() -{ - wchar_t characters[] = {L'H',L'e',L'l',L'l',L'o',L' ', - L'W',L'o',L'r',L'l',L'd',L'!',L'\x0000'}; - - Char* charPtr = characters; - int length = 0; - Char* iterator = charPtr; - - while (*iterator != '\x0000') - { - if (*iterator == L'!' || *iterator == L'.') - break; - *iterator++; - length++; - } - String^ value = gcnew String(charPtr, 0, length); - Console::WriteLine(value); -} -// The example displays the following output: -// Hello World -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp deleted file mode 100644 index 312c24bbe53..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - wchar_t chars[] = { L'a', L'b', L'c', L'd', L'\0', L'A', L'B', - L'C', L'D', L'\0' }; - Char* chPtr = chars; - String^ s = gcnew String(chPtr, 0, - sizeof(chars) / sizeof (wchar_t)); - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - Console::WriteLine(); - - s = gcnew String(chPtr); - - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - Console::WriteLine(); -} -// The example displays the following output: -// 0061 0062 0063 0064 0000 0041 0042 0043 0044 0000 -// 0061 0062 0063 0064 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp deleted file mode 100644 index 3116bd1e648..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; - -void main() -{ - char bytes[] = { 0x61, 0x62, 0x063, 0x064, 0x00, 0x41, 0x42,0x43, - 0x44, 0x00 }; - - char* bytePtr = bytes; - String^ s = gcnew String(bytePtr, 0, sizeof(bytes) / sizeof (char)); - - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - - Console::WriteLine(); - - s = gcnew String(bytePtr); - - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - Console::WriteLine(); -} -// The example displays the following output: -// 0061 0062 0063 0064 0000 0041 0042 0043 0044 0000 -// 0061 0062 0063 0064 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp deleted file mode 100644 index 7902bf7169d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ s; - - Console::WriteLine("The value of the string is '{0}'", s); - - try { - Console::WriteLine("String length is {0}", s->Length); - } - catch (NullReferenceException^ e) { - Console::WriteLine(e->Message); - } -} -// The example displays the following output: -// The value of the string is '' -// Object reference not set to an instance of an object. -// - -void Test() -{ - // - String^ s = ""; - Console::WriteLine("The length of '{0}' is {1}.", s, s->Length); - // The example displays the following output: - // The length of '' is 0. - // -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp deleted file mode 100644 index f7d1b9f1579..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -using namespace System; - -bool Test( String^ s ) -{ - bool result; - // - result = s == nullptr || s == String::Empty; - // - return result; -} - -int main() -{ - String^ s1; - String^ s2 = ""; - Console::WriteLine( "String s1 {0}.", Test( s1 ) ); - Console::WriteLine( "String s2 {0}.", Test( s2 ) ); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp deleted file mode 100644 index c61179db48d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ title = "The House of the Seven Gables"; - String^ searchString = "the"; - StringComparison comparison = StringComparison::InvariantCulture; - Console::WriteLine("'{0}':", title); - Console::WriteLine(" Starts with '{0}' ({1:G} comparison): {2}", - searchString, comparison, - title->StartsWith(searchString, comparison)); - - comparison = StringComparison::InvariantCultureIgnoreCase; - Console::WriteLine(" Starts with '{0}' ({1:G} comparison): {2}", - searchString, comparison, - title->StartsWith(searchString, comparison)); - } -// The example displays the following output: -// 'The House of the Seven Gables': -// Starts with 'the' (InvariantCulture comparison): False -// Starts with 'the' (InvariantCultureIgnoreCase comparison): True -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp deleted file mode 100644 index efd8df82bf8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ strings = gcnew array { {"ABCdef", "abc" }, - {"ABCdef", "abc" }, {"œil","oe" }, - { "læring}", "lae" } }; - for (int ctr1 = strings->GetLowerBound(0); ctr1 <= strings->GetUpperBound(0); ctr1++) - { - for each (String^ cmpName in Enum::GetNames(StringComparison::typeid)) - { - StringComparison strCmp = (StringComparison) Enum::Parse(StringComparison::typeid, - cmpName); - String^ instance = strings[ctr1, 0]; - String^ value = strings[ctr1, 1]; - Console::WriteLine("{0} starts with {1}: {2} ({3} comparison)", - instance, value, - instance->StartsWith(value, strCmp), - strCmp); - } - Console::WriteLine(); - } -} - -// The example displays the following output: -// ABCdef starts with abc: False (CurrentCulture comparison) -// ABCdef starts with abc: True (CurrentCultureIgnoreCase comparison) -// ABCdef starts with abc: False (InvariantCulture comparison) -// ABCdef starts with abc: True (InvariantCultureIgnoreCase comparison) -// ABCdef starts with abc: False (Ordinal comparison) -// ABCdef starts with abc: True (OrdinalIgnoreCase comparison) -// -// ABCdef starts with abc: False (CurrentCulture comparison) -// ABCdef starts with abc: True (CurrentCultureIgnoreCase comparison) -// ABCdef starts with abc: False (InvariantCulture comparison) -// ABCdef starts with abc: True (InvariantCultureIgnoreCase comparison) -// ABCdef starts with abc: False (Ordinal comparison) -// ABCdef starts with abc: True (OrdinalIgnoreCase comparison) -// -// œil starts with oe: True (CurrentCulture comparison) -// œil starts with oe: True (CurrentCultureIgnoreCase comparison) -// œil starts with oe: True (InvariantCulture comparison) -// œil starts with oe: True (InvariantCultureIgnoreCase comparison) -// œil starts with oe: False (Ordinal comparison) -// œil starts with oe: False (OrdinalIgnoreCase comparison) -// -// læring} starts with lae: True (CurrentCulture comparison) -// læring} starts with lae: True (CurrentCultureIgnoreCase comparison) -// læring} starts with lae: True (InvariantCulture comparison) -// læring} starts with lae: True (InvariantCultureIgnoreCase comparison) -// læring} starts with lae: False (Ordinal comparison) -// læring} starts with lae: False (OrdinalIgnoreCase comparison) -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp deleted file mode 100644 index 7b4d07bf1ce..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -using namespace System; - -// -generic ref class B { }; -generic ref class C : B { }; -// - - -int main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp deleted file mode 100644 index 3c606201207..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ -// - Type^ t = List::typeid->GetMethod("ConvertAll")->GetGenericArguments()[0]->DeclaringType; -// - Console::WriteLine("Declaring type: {0:s}", t->FullName); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp deleted file mode 100644 index 887160b2c0e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -using namespace System; - -// -generic public ref class B { }; -generic public ref class A -{ -public: - generic B^ GetSomething() - { - return gcnew B(); - } -}; -// - - -int main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp deleted file mode 100644 index 27ef62bdf1a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -using namespace System; - -// -generic - public ref class Base { }; -generic - public ref class Derived : Base { }; -// - -// -generic public ref class Outermost -{ -public: - generic ref class Inner - { - public: - generic ref class Innermost1 {}; - ref class Innermost2 {}; - }; -}; -// - - -int main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp deleted file mode 100644 index e36381d28c4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// This example demonstrates the Version.Revision, -// MajorRevision, and MinorRevision properties. -using namespace System; - -int main() -{ - String^ formatStandard = "Standard version:\n" + - " major.minor.build.revision = {0}.{1}.{2}.{3}"; - String^ formatInterim = "Interim version:\n" + - " major.minor.build.majRev/minRev = {0}.{1}.{2}.{3}/{4}"; - - Version^ standardVersion = gcnew Version(2, 4, 1128, 2); - Version^ interimVersion = gcnew Version(2, 4, 1128, (100 << 16) + 2); - - Console::WriteLine(formatStandard, standardVersion->Major, - standardVersion->Minor, standardVersion->Build, - standardVersion->Revision); - Console::WriteLine(formatInterim, interimVersion->Major, - interimVersion->Minor, interimVersion->Build, - interimVersion->MajorRevision, interimVersion->MinorRevision); -}; -/* -This code example produces the following results: - -Standard version: -major.minor.build.revision = 2.4.1128.2 -Interim version: -major.minor.build.majRev/minRev = 2.4.1128.100/2 - -*/ -// From 0897ec94ff65d8b260f4f5f0ba2b6e30e7bf8f79 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Sat, 31 May 2025 13:05:13 -0700 Subject: [PATCH 3/4] delete more snippet files --- .../ActivatorX/cpp/ActivatorX.cpp | 48 -- .../ActivatorX/cpp/source2.cpp | 67 -- .../AnimalAttributes/CPP/customattribute.cpp | 98 --- .../cpp/ArgumentException.cpp | 38 -- .../cpp/argumentexception2.cpp | 34 - .../ArrayList/CPP/ArrayListSample.cpp | 78 --- .../CPP/arraytypemismatch_constructor1.cpp | 56 -- .../CPP/arraytypemismatch_constructor2.cpp | 57 -- .../CPP/arraytypemismatch_constructor3.cpp | 56 -- .../Array_ConvertAll/cpp/source.cpp | 55 -- .../Array_FindEtAl/cpp/source.cpp | 169 ----- .../Array_FindIndex/cpp/source.cpp | 60 -- .../Array_FindLastIndex/cpp/source.cpp | 60 -- .../Array_IndexOf/cpp/source.cpp | 48 -- .../Array_LastIndexOf/cpp/source.cpp | 51 -- .../Array_Sort2IntIntIComparer/cpp/source.cpp | 124 ---- .../Array_SortComparison/cpp/source.cpp | 106 --- .../Array_SortIntIntIComparer/cpp/source.cpp | 80 --- .../Array_SortSearch/cpp/source.cpp | 91 --- .../Array_SortSearchComparer/cpp/source.cpp | 103 --- .../AttrTargs/CPP/attrtargs.cpp | 73 -- .../Console-EXPANDTABSEX/CPP/expandtabsex.cpp | 66 -- .../CPP/memoryexample.cpp | 170 ----- .../DateTime Operators/CPP/class1.cpp | 30 - .../DateTime.Add/CPP/class1.cpp | 12 - .../DateTime.AddDays/CPP/class1.cpp | 15 - .../DateTime.CompareTo/CPP/class1.cpp | 34 - .../DateTime.DayOfWeek/CPP/dow.cpp | 21 - .../DateTime.DaysInMonth/CPP/class1.cpp | 22 - .../DateTime.Equals/CPP/class1.cpp | 22 - .../DateTime.FromFileTime/CPP/class1.cpp | 44 -- .../CPP/class1.cpp | 34 - .../DateTime.Subtraction/CPP/class1.cpp | 27 - .../DateTime.ToFileTime/CPP/class1.cpp | 21 - .../CPP/class1.cpp | 49 -- .../Decimal Example/CPP/source.cpp | 144 ---- .../cpp/source.cpp | 56 -- .../Dir_CreateDir/CPP/dir_createdir.cpp | 35 - .../Double Example/CPP/source.cpp | 531 --------------- .../CPP/gettype.cpp | 30 - .../CPP/referenceequals.cpp | 24 - .../CPP/getcommandlineargs.cpp | 20 - .../CPP/getenvironmentvariables.cpp | 16 - .../CPP/getfolderpath.cpp | 16 - .../CPP/getlogicaldrives.cpp | 17 - .../CPP/machinename.cpp | 19 - .../Environment.NewLine/CPP/newline.cpp | 18 - .../Environment.StackTrace/CPP/stacktrace.cpp | 19 - .../CPP/systemdirectory.cpp | 18 - .../Environment.TickCount/CPP/tickcount.cpp | 20 - .../CPP/userinteractive.cpp | 16 - .../Environment.UserName/CPP/username.cpp | 13 - .../Environment.Version/CPP/version.cpp | 17 - .../Environment.WorkingSet/CPP/workingset.cpp | 15 - .../ExToString/CPP/extostring.cpp | 34 - .../GCNotification/cpp/program.cpp | 242 ------- .../GetCustomAttributes/CPP/ca1.cpp | 42 -- .../GetCustomAttributes/CPP/custattrs.cpp | 258 ------- .../IComparable Example/CPP/source.cpp | 81 --- .../IComparable`1 Example/CPP/source.cpp | 99 --- .../cpp/sample.cpp | 67 -- .../ImprovedInteropSnippets/CPP/codefile1.cpp | 14 - .../VS_Snippets_CLR/InnerEx/CPP/innerex.cpp | 53 -- .../Int16_Equals/CPP/int16_equals.cpp | 357 ---------- .../Int32_Equals/CPP/int32_equals.cpp | 357 ---------- .../Int64_Equals/CPP/int64_equals.cpp | 357 ---------- .../InvokeMem/CPP/invokemem.cpp | 90 --- .../IsDefaultAttribute/CPP/defattr.cpp | 85 --- .../IsDefined/CPP/isdefined.cpp | 276 -------- .../MathSample/CPP/mathsample.cpp | 88 --- .../cpp/MissingMethodException.cpp | 72 -- .../CPP/delegatestring.cpp | 149 ----- .../ObjDispEx/CPP/objdispexc.cpp | 20 - .../VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp | 107 --- .../OperatingSystem.ServicePack/CPP/sp.cpp | 18 - .../CPP/osvs.cpp | 20 - .../CPP/stringcompareordinal.cpp | 34 - .../StringCompareTo/CPP/stringcompareto.cpp | 40 -- .../VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp | 134 ---- .../cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp | 181 ----- .../TestBaseType/CPP/testbasetype.cpp | 10 - .../TestFullName/CPP/TestFullName.cpp | 14 - .../CPP/TestGetElementType.cpp | 23 - .../cpp/testisassignablefrom.cpp | 108 --- .../TestIsEnum/CPP/TestIsEnum.cpp | 21 - .../CPP/testisinstanceoftype.cpp | 38 -- .../TimeoutException.class/cpp/to.cpp | 53 -- .../Type.IsPublic/CPP/type_ispublic.cpp | 20 - .../CPP/Type.StructLayoutAttribute.cpp | 40 -- .../CPP/typeloadexception_constructor2.cpp | 32 - .../CPP/typeloadexception_constructor3.cpp | 56 -- .../CPP/typeloadexception_getobjectdata.cpp | 112 ---- .../CPP/typeloadexception_typename.cpp | 39 -- .../Type_Assembly/CPP/type_assembly.cpp | 20 - .../CPP/type_defaultbinder.cpp | 32 - .../CPP/type_filterattribute.cpp | 36 - .../CPP/type_filternameignorecase.cpp | 36 - .../CPP/type_findinterfaces.cpp | 69 -- .../Type_FindMembers/CPP/type_findmembers.cpp | 48 -- .../CPP/type_getarrayrank.cpp | 27 - .../CPP/type_getconstructor.cpp | 42 -- .../CPP/type_getconstructor2.cpp | 50 -- .../Type_GetEvent/CPP/type_getevent.cpp | 41 -- .../Type_GetField/CPP/type_getfield.cpp | 97 --- .../CPP/type_gethashcode_getfields.cpp | 49 -- .../CPP/type_getinterface.cpp | 52 -- .../CPP/type_getinterfaces1.cpp | 30 - .../Type_GetMember/CPP/type_getmember.cpp | 100 --- .../Type_GetMembers1/CPP/type_getmembers1.cpp | 52 -- .../Type_GetMembers2/CPP/type_getmembers2.cpp | 66 -- .../Type_GetMethod1/CPP/type_getmethod1.cpp | 24 - .../Type_GetMethod2/CPP/type_getmethod2.cpp | 25 - .../Type_GetMethod3/CPP/type_getmethod3.cpp | 64 -- .../Type_GetMethod4/CPP/type_getmethod4.cpp | 47 -- .../Type_GetMethod5/CPP/type_getmethod5.cpp | 59 -- .../Type_GetMethods2/CPP/type_getmethods2.cpp | 54 -- .../CPP/type_getnestedclassesabs.cpp | 56 -- .../CPP/type_getnestedtypes.cpp | 43 -- .../CPP/type_getproperties2.cpp | 153 ----- .../CPP/type_getproperty1.cpp | 45 -- .../CPP/type_getproperty2.cpp | 45 -- .../CPP/type_getproperty3.cpp | 58 -- .../CPP/type_getproperty2.cpp | 53 -- .../CPP/type_getproperty_types.cpp | 55 -- .../Type_GetType/CPP/type_gettype.cpp | 32 - .../Type_GetTypeCode/CPP/type_gettypecode.cpp | 72 -- .../CPP/type_gettypefromhandle.cpp | 23 - .../CPP/type_gettypefromprogid2.cpp | 32 - .../CPP/Type_GetTypeFromProgID3.cpp | 32 - .../CPP/Type_GetTypeFromProgID4.cpp | 35 - .../CPP/Type_GetTypeHandle.cpp | 57 -- .../Type_Guid/CPP/type_guid.cpp | 25 - .../CPP/type_haselementtype.cpp | 55 -- .../CPP/type_haselementtypeimpl.cpp | 86 --- .../Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp | 38 -- .../Type_IsArrayImpl/CPP/type_isarrayimpl.cpp | 68 -- .../CPP/type_isautolayout.cpp | 40 -- .../Type_IsClass/CPP/type_isclass.cpp | 23 - .../CPP/type_iscontextful.cpp | 49 -- .../CPP/type_iscontextfulimpl.cpp | 82 --- .../Type_IsInterface/CPP/type_isinterface.cpp | 35 - .../CPP/type_islayoutsequential.cpp | 40 -- .../CPP/type_ismarshalbyrefimpl.cpp | 81 --- .../CPP/type_isprimitiveimpl.cpp | 73 -- .../Type_IsSealed/CPP/type_issealed.cpp | 21 - .../CPP/type_isserializable.cpp | 37 - .../Type_IsValueType/CPP/type_isvaluetype.cpp | 24 - .../Type_ToString/CPP/type_tostring.cpp | 31 - .../Type_TypeHandle/CPP/type_typehandle.cpp | 42 -- .../UInt16 Example/CPP/source.cpp | 631 ------------------ .../UInt16_Equals/CPP/uint16_equals.cpp | 34 - .../UInt32 Example/CPP/source.cpp | 417 ------------ .../UInt32_Equals/CPP/uint32_equals.cpp | 34 - .../UInt64 Example/CPP/source.cpp | 405 ----------- .../UInt64_Equals/CPP/uint64_equals.cpp | 23 - .../Uri_IsHexDigit/CPP/uri_ishexdigit.cpp | 43 -- .../ValueType.Equals Example/CPP/source.cpp | 28 - .../VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp | 57 -- .../char.surrogate/CPP/sur.cpp | 85 --- .../VS_Snippets_CLR/console.beep/CPP/beep.cpp | 42 -- .../VS_Snippets_CLR/console.beep2/CPP/b2.cpp | 124 ---- .../console.bufferHW/CPP/hw.cpp | 18 - .../console.cancelkeypress/cpp/ckp.cpp | 74 -- .../console.cursorLTS/CPP/lts.cpp | 75 --- .../console.cursorsize/CPP/csize.cpp | 45 -- .../console.cursorvis/CPP/vis.cpp | 75 --- .../console.keyavailable/CPP/ka.cpp | 40 -- .../VS_Snippets_CLR/console.read/CPP/read.cpp | 82 --- .../console.readkey1/CPP/rk.cpp | 37 - .../console.readkey2/CPP/rkbool.cpp | 35 - .../console.setwindowsize/CPP/sws.cpp | 55 -- .../console.title/CPP/mytitle.cpp | 26 - .../console.windowLT/CPP/wlt.cpp | 135 ---- .../console.writelineFmt1/cpp/wl.cpp | 102 --- .../consolein/CPP/consolein.cpp | 15 - .../convert.tobase64chararray/CPP/tb64ca.cpp | 100 --- .../convert.tobase64string/CPP/tb64s.cpp | 113 ---- .../CPP/convertchangetype.cpp | 14 - .../datetime.ctor_Int64/CPP/ticks.cpp | 39 -- .../enum.tostring/CPP/tostr.cpp | 47 -- .../enumcompareto/CPP/EnumCompareTo.cpp | 31 - .../enumequals/CPP/EnumEquals.cpp | 44 -- .../enumformat/CPP/EnumFormat.cpp | 20 - .../enumgetname/CPP/EnumGetName.cpp | 22 - .../enumgetnames/CPP/EnumGetNames.cpp | 49 -- .../enumgetvalues/CPP/EnumGetValues.cpp | 48 -- .../enumparse/CPP/EnumParse.cpp | 42 -- .../CPP/commandline.cpp | 19 - .../CPP/expandenvironmentvariables.cpp | 23 - .../environment.class/CPP/env0.cpp | 104 --- .../environment.processorcount/CPP/pc.cpp | 16 - .../eventsoverview/cpp/programwithdata.cpp | 67 -- .../exception.data/CPP/data.cpp | 89 --- .../VS_Snippets_CLR/math.atanx/CPP/atan.cpp | 47 -- .../math.bigmul/CPP/bigmul.cpp | 22 - .../cpp/VS_Snippets_CLR/math.max/CPP/max.cpp | 59 -- .../cpp/VS_Snippets_CLR/math.min/CPP/min.cpp | 59 -- .../VS_Snippets_CLR/math.sign/CPP/sign.cpp | 59 -- .../platformID.class/CPP/pid.cpp | 39 -- .../string.LastIndexOf7/CPP/lastixof7.cpp | 39 -- .../string.LastIndexOf8/CPP/lastixof8.cpp | 44 -- .../string.LastIndexOfAny1/CPP/lastixany1.cpp | 38 -- .../string.LastIndexOfAny2/CPP/lastixany2.cpp | 38 -- .../string.LastIndexOfAny3/CPP/lastixany3.cpp | 38 -- .../string.ToCharArray1/CPP/tocharry1.cpp | 32 - .../string.comp4/CPP/string.comp4.cpp | 34 - .../string.compare3/CPP/comp3.cpp | 28 - .../string.compare4/CPP/comp4.cpp | 40 -- .../string.compare5/CPP/comp5.cpp | 41 -- .../string.compareordinal/CPP/comp0.cpp | 28 - .../string.concat5/CPP/string.concat5.cpp | 33 - .../string.contains/CPP/cont.cpp | 21 - .../string.equals/CPP/equals.cpp | 55 -- .../string.gettypecode/CPP/gtc.cpp | 16 - .../string.indexof1/CPP/ixof1.cpp | 42 -- .../string.indexof8/CPP/ixof8.cpp | 49 -- .../string.indexofany2/CPP/ixany2.cpp | 38 -- .../string.indexofany3/CPP/ixany3.cpp | 40 -- .../string.intern/CPP/string_intern.cpp | 26 - .../string.isNullOrEmpty/CPP/inoe.cpp | 25 - .../string.isinterned/CPP/isin.cpp | 45 -- .../string.join2/CPP/join2.cpp | 22 - .../string.lastindexof1/CPP/lastixof1.cpp | 37 - .../string.lastindexof2/CPP/lastixof2.cpp | 44 -- .../string.length/CPP/length.cpp | 20 - .../string.normalize/CPP/norm.cpp | 117 ---- .../VS_Snippets_CLR/string.remove/CPP/r.cpp | 25 - .../string.replace1/CPP/string.replace1.cpp | 16 - .../string.split3/CPP/omit.cpp | 76 --- .../string.tolower1/CPP/tolower.cpp | 75 --- .../string.tostring/CPP/string.tostring.cpp | 26 - .../stringconcat3/CPP/stringconcat3.cpp | 22 - .../stringconcat4/CPP/stringconcat4.cpp | 23 - .../stringcopyto/CPP/stringcopyto.cpp | 31 - .../stringendswith/CPP/stringendswith.cpp | 76 --- .../stringexample1/CPP/source.cpp | 80 --- .../stringindexof4/CPP/stringindexof4.cpp | 38 -- .../stringinsert/CPP/stringinsert.cpp | 30 - .../stringjoin/CPP/stringjoin.cpp | 24 - .../stringlowerupper/CPP/stringtolower.cpp | 53 -- .../stringremove/CPP/stringremove.cpp | 21 - .../stringreplace/CPP/stringreplace.cpp | 22 - .../stringstartswith/CPP/stringstartswith.cpp | 61 -- .../type_getevents1/CPP/type_getevents1.cpp | 38 -- .../type_getevents2/CPP/type_getevents2.cpp | 41 -- 245 files changed, 15482 deletions(-) delete mode 100644 snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp deleted file mode 100644 index 23f9d8bfc08..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Text; - -public ref class SomeType -{ -public: - void DoSomething(int x) - { - Console::WriteLine("100 / {0} = {1}", x, 100 / x); - } -}; - -void main() -{ - // - // Create an instance of the StringBuilder type using - // Activator.CreateInstance. - Object^ o = Activator::CreateInstance(StringBuilder::typeid); - - // Append a string into the StringBuilder object and display the - // StringBuilder. - StringBuilder^ sb = (StringBuilder^) o; - sb->Append("Hello, there."); - Console::WriteLine(sb); - // - - // - // Create an instance of the SomeType class that is defined in this - // assembly. - System::Runtime::Remoting::ObjectHandle^ oh = - Activator::CreateInstanceFrom(Assembly::GetEntryAssembly()->CodeBase, - SomeType::typeid->FullName); - - // Call an instance method defined by the SomeType type using this object. - SomeType^ st = (SomeType^) oh->Unwrap(); - - st->DoSomething(5); - // -}; - -/* This code produces the following output: - -Hello, there. -100 / 5 = 20 - */ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp deleted file mode 100644 index d02d7ca37f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; - -ref class DynamicInstanceList -{ -private: - static String^ instanceSpec = "System.EventArgs;System.Random;" + - "System.Exception;System.Object;System.Version"; - -public: - static void Main() - { - array^ instances = instanceSpec->Split(';'); - Array^ instlist = Array::CreateInstance(Object::typeid, instances->Length); - Object^ item; - - for (int i = 0; i < instances->Length; i++) - { - // create the object from the specification string - Console::WriteLine("Creating instance of: {0}", instances[i]); - item = Activator::CreateInstance(Type::GetType(instances[i])); - instlist->SetValue(item, i); - } - Console::WriteLine("\nObjects and their default values:\n"); - for each (Object^ o in instlist) - { - Console::WriteLine("Type: {0}\nValue: {1}\nHashCode: {2}\n", - o->GetType()->FullName, o->ToString(), o->GetHashCode()); - } - } -}; - -int main() -{ - DynamicInstanceList::Main(); -} - -// This program will display output similar to the following: -// -// Creating instance of: System.EventArgs -// Creating instance of: System.Random -// Creating instance of: System.Exception -// Creating instance of: System.Object -// Creating instance of: System.Version -// -// Objects and their default values: -// -// Type: System.EventArgs -// Value: System.EventArgs -// HashCode: 46104728 -// -// Type: System.Random -// Value: System.Random -// HashCode: 12289376 -// -// Type: System.Exception -// Value: System.Exception: Exception of type 'System.Exception' was thrown. -// HashCode: 55530882 -// -// Type: System.Object -// Value: System.Object -// HashCode: 30015890 -// -// Type: System.Version -// Value: 0.0 -// HashCode: 1048575 -// diff --git a/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp b/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp deleted file mode 100644 index 46b9455a618..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// An enumeration of animals. Start at 1 (0 = uninitialized). -public enum class Animal -{ - // Pets. - Dog = 1, - Cat, Bird -}; - -// A custom attribute to allow a target to have a pet. -public ref class AnimalTypeAttribute: public Attribute -{ -public: - - // The constructor is called when the attribute is set. - AnimalTypeAttribute( Animal pet ) - { - thePet = pet; - } - - -protected: - - // Keep a variable internally ... - Animal thePet; - -public: - - property Animal Pet - { - // .. and show a copy to the outside world. - Animal get() - { - return thePet; - } - - void set( Animal value ) - { - thePet = value; - } - } -}; - -// A test class where each method has its own pet. -ref class AnimalTypeTestClass -{ -public: - - [AnimalType(Animal::Dog)] - void DogMethod(){} - - - [AnimalType(Animal::Cat)] - void CatMethod(){} - - [AnimalType(Animal::Bird)] - void BirdMethod(){} - -}; - -int main() -{ - AnimalTypeTestClass^ testClass = gcnew AnimalTypeTestClass; - Type^ type = testClass->GetType(); - - // Iterate through all the methods of the class. - System::Collections::IEnumerator^ myEnum = - type->GetMethods()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MethodInfo^ mInfo = safe_cast(myEnum->Current); - - // Iterate through all the Attributes for each method. - System::Collections::IEnumerator^ myEnum1 = - Attribute::GetCustomAttributes( mInfo )->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum1->Current); - - // Check for the AnimalType attribute. - if ( attr->GetType() == AnimalTypeAttribute::typeid ) - Console::WriteLine( "Method {0} has a pet {1} attribute.", - mInfo->Name, (dynamic_cast(attr))->Pet ); - } - } -} - -/* - * Output: - * Method DogMethod has a pet Dog attribute. - * Method CatMethod has a pet Cat attribute. - * Method BirdMethod has a pet Bird attribute. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp deleted file mode 100644 index 34a424f0c5f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Types:System.ArgumentException -// -using namespace System; - -// -int DivideByTwo(int num) -{ - // If num is an odd number, throw an ArgumentException. - if ((num & 1) == 1) - { - throw gcnew ArgumentException("Number must be even", "num"); - } - // num is even, return half of its value. - return num / 2; -} -// - -int main() -{ - // ArgumentException is not thrown because 10 is an even number. - Console::WriteLine("10 divided by 2 is {0}", DivideByTwo(10)); - try - { - // ArgumentException is thrown because 7 is not an even number. - Console::WriteLine("7 divided by 2 is {0}", DivideByTwo(7)); - } - catch (ArgumentException^) - { - // Show the user that 7 cannot be divided by 2. - Console::WriteLine("7 is not divided by 2 integrally."); - } -} - -// This code produces the following output. -// -// 10 divided by 2 is 5 -// 7 is not divided by 2 integrally. -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp deleted file mode 100644 index 63ffdbb6142..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; - -static int DivideByTwo(int num) -{ - // If num is an odd number, throw an ArgumentException. - if ((num & 1) == 1) - throw gcnew ArgumentException(String::Format("{0} is not an even number", num), - "num"); - - // num is even, return half of its value. - return num / 2; -} - -void main() -{ - // Define some integers for a division operation. - array^ values = { 10, 7 }; - for each (int value in values) { - try { - Console::WriteLine("{0} divided by 2 is {1}", value, DivideByTwo(value)); - } - catch (ArgumentException^ e) { - Console::WriteLine("{0}: {1}", e->GetType()->Name, e->Message); - } - Console::WriteLine(); - } -} -// This example displays the following output: -// 10 divided by 2 is 5 -// -// ArgumentException: 7 is not an even number -// Parameter name: num -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp deleted file mode 100644 index dfe97aa75c8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; - -// -ref class ReverseStringComparer: public IComparer -{ -public: - virtual int Compare( Object^ x, Object^ y ) - { - String^ s1 = dynamic_cast(x); - String^ s2 = dynamic_cast(y); - - //negate the return value to get the reverse order - return -String::Compare( s1, s2 ); - } - -}; -// - -// -void PrintValues( String^ title, IEnumerable^ myList ) -{ - Console::Write( "{0,10}: ", title ); - StringBuilder^ sb = gcnew StringBuilder; - { - IEnumerator^ en = myList->GetEnumerator(); - String^ s; - while ( en->MoveNext() ) - { - s = en->Current->ToString(); - sb->AppendFormat( "{0}, ", s ); - } - } - sb->Remove( sb->Length - 2, 2 ); - Console::WriteLine( sb ); -} -// - -void main() -{ - // - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "Eric" ); - myAL->Add( "Mark" ); - myAL->Add( "Lance" ); - myAL->Add( "Rob" ); - myAL->Add( "Kris" ); - myAL->Add( "Brad" ); - myAL->Add( "Kit" ); - myAL->Add( "Bradley" ); - myAL->Add( "Keith" ); - myAL->Add( "Susan" ); - - // Displays the properties and values of the ArrayList. - Console::WriteLine( "Count: {0}", myAL->Count.ToString() ); - // - - PrintValues( "Unsorted", myAL ); - - // - myAL->Sort(); - PrintValues( "Sorted", myAL ); - // - - // - myAL->Sort( gcnew ReverseStringComparer ); - PrintValues( "Reverse", myAL ); - // - - // - array^names = dynamic_cast^>(myAL->ToArray( String::typeid )); - // -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp deleted file mode 100644 index 3bd578173ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// System::ArrayTypeMismatchException::ArrayTypeMismatchException -/* - * The following example demonstrates the 'ArrayTypeMismatchException()' constructor of class - * ArrayTypeMismatchException class. It creates a function which takes two arrays as arguments. - * It checks whether the two arrays are of same type or not. If two arrays are not of same type - * then a new 'ArrayTypeMismatchException' object is created and thrown. That exception is caught - * in the calling method. - */ -// -using namespace System; -public ref class ArrayTypeMisMatchConst -{ -public: - void CopyArray( Array^ myArray, Array^ myArray1 ) - { - String^ typeArray1 = myArray->GetType()->ToString(); - String^ typeArray2 = myArray1->GetType()->ToString(); - - // Check whether the two arrays are of same type or not. - if ( typeArray1 == typeArray2 ) - { - - // Copy the values from one array to another. - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 ); - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 ); - } - else - { - - // Throw an exception of type 'ArrayTypeMismatchException'. - throw gcnew ArrayTypeMismatchException; - } - } - -}; - -int main() -{ - try - { - array^myStringArray = gcnew array(2); - myStringArray->SetValue( "Jones", 0 ); - myStringArray->SetValue( "John", 1 ); - array^myIntArray = gcnew array(2); - ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; - myArrayType->CopyArray( myStringArray, myIntArray ); - } - catch ( ArrayTypeMismatchException^ e ) - { - Console::WriteLine( "The Exception is : {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp deleted file mode 100644 index d83f12c18e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -// System::ArrayTypeMismatchException::ArrayTypeMismatchException -/* - The following example demonstrates the 'ArrayTypeMismatchException(String*)' - constructor of class ArrayTypeMismatchException class. A function has been - created which takes two arrays as arguments. It checks whether the two arrays - are of same type or not. If two arrays are of not same type then a new - 'ArrayTypeMismatchException' object is created and thrown. That exception is - caught in the calling method. - */ -// -using namespace System; -public ref class ArrayTypeMisMatchConst -{ -public: - void CopyArray( Array^ myArray, Array^ myArray1 ) - { - String^ typeArray1 = myArray->GetType()->ToString(); - String^ typeArray2 = myArray1->GetType()->ToString(); - - // Check whether the two arrays are of same type or not. - if ( typeArray1 == typeArray2 ) - { - - // Copies the values from one array to another. - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 ); - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 ); - } - else - { - - // Throw an exception of type 'ArrayTypeMismatchException' with a message String* as parameter. - throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are not of same type." ); - } - } - -}; - -int main() -{ - try - { - array^myStringArray = gcnew array(2); - myStringArray->SetValue( "Jones", 0 ); - myStringArray->SetValue( "John", 1 ); - array^myIntArray = gcnew array(2); - ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; - myArrayType->CopyArray( myStringArray, myIntArray ); - } - catch ( ArrayTypeMismatchException^ e ) - { - Console::WriteLine( "The Exception Message is : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp deleted file mode 100644 index 83d9a347667..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// System::ArrayTypeMismatchException::ArrayTypeMismatchException -/* - The following example demonstrates the 'ArrayTypeMismatchException(String*, innerException)' - constructor of class ArrayTypeMismatchException class. It creates a - function which takes two arrays as arguments. It copies elements of - one array to another array. If two arrays are of not same type then - an exception has been thrown. In the 'Catch' block a new 'WebException' - object is created and thrown to the caller. That exception is caught - in the calling method and the error message is displayed to the console. - */ -// -using namespace System; -public ref class ArrayTypeMisMatchConst -{ -public: - void CopyArray( Array^ myArray, Array^ myArray1 ) - { - try - { - - // Copies the value of one array into another array. - myArray->SetValue( myArray1->GetValue( 0 ), 0 ); - myArray->SetValue( myArray1->GetValue( 1 ), 1 ); - } - catch ( Exception^ e ) - { - - // Throw an exception of with a message and innerexception. - throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are of not same type.",e ); - } - - } - -}; - -int main() -{ - try - { - array^myStringArray = gcnew array(2); - myStringArray->SetValue( "Jones", 0 ); - myStringArray->SetValue( "John", 1 ); - array^myIntArray = gcnew array(2); - ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; - myArrayType->CopyArray( myStringArray, myIntArray ); - } - catch ( ArrayTypeMismatchException^ e ) - { - Console::WriteLine( "The Exception Message is : {0}", e->Message ); - Console::WriteLine( "The Inner exception is : {0}", e->InnerException ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp deleted file mode 100644 index 6ea5b937007..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections::Generic; - -Point PointFToPoint(PointF pf) -{ - return Point((int) pf.X, (int) pf.Y); -}; - -void main() -{ - // Create an array of PointF objects. - array^ apf = { - PointF(27.8F, 32.62F), - PointF(99.3F, 147.273F), - PointF(7.5F, 1412.2F) }; - - - // Display each element in the PointF array. - Console::WriteLine(); - for each(PointF p in apf) - { - Console::WriteLine(p); - } - - // Convert each PointF element to a Point object. - array^ ap = - Array::ConvertAll(apf, - gcnew Converter(PointFToPoint) - ); - - // Display each element in the Point array. - Console::WriteLine(); - for each(Point p in ap) - { - Console::WriteLine(p); - } -} - -/* This code example produces the following output: - -{X=27.8, Y=32.62} -{X=99.3, Y=147.273} -{X=7.5, Y=1412.2} - -{X=27,Y=32} -{X=99,Y=147} -{X=7,Y=1412} - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp deleted file mode 100644 index 61bb710737e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// -using namespace System; - -public ref class DinoDiscoverySet -{ -public: - static void Main() - { - array^ dinosaurs = - { - "Compsognathus", "Amargasaurus", "Oviraptor", - "Velociraptor", "Deinonychus", "Dilophosaurus", - "Gallimimus", "Triceratops" - }; - - DinoDiscoverySet^ GoMesozoic = gcnew DinoDiscoverySet(dinosaurs); - - GoMesozoic->DiscoverAll(); - GoMesozoic->DiscoverByEnding("saurus"); - } - - DinoDiscoverySet(array^ items) - { - dinosaurs = items; - } - - void DiscoverAll() - { - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - } - - void DiscoverByEnding(String^ Ending) - { - Predicate^ dinoType; - - if (Ending->ToLower() == "raptor") - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithRaptor); - } - else if (Ending->ToLower() == "tops") - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithTops); - } - else if (Ending->ToLower() == "saurus") - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus); - } - else - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus); - } - - Console::WriteLine( - "\nArray::Exists(dinosaurs, \"{0}\"): {1}", - Ending, - Array::Exists(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::TrueForAll(dinosaurs, \"{0}\"): {1}", - Ending, - Array::TrueForAll(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::Find(dinosaurs, \"{0}\"): {1}", - Ending, - Array::Find(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::FindLast(dinosaurs, \"{0}\"): {1}", - Ending, - Array::FindLast(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::FindAll(dinosaurs, \"{0}\"):", Ending); - - array^ subArray = - Array::FindAll(dinosaurs, dinoType); - - for each(String^ dinosaur in subArray) - { - Console::WriteLine(dinosaur); - } - } - -private: - array^ dinosaurs; - - // Search predicate returns true if a string ends in "saurus". - static bool EndsWithSaurus(String^ s) - { - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "saurus")) - { - return true; - } - else - { - return false; - } - } - - // Search predicate returns true if a string ends in "raptor". - static bool EndsWithRaptor(String^ s) - { - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "raptor")) - { - return true; - } - else - { - return false; - } - } - - // Search predicate returns true if a string ends in "tops". - static bool EndsWithTops(String^ s) - { - if ((s->Length > 3) && - (s->Substring(s->Length - 4)->ToLower() == "tops")) - { - return true; - } - else - { - return false; - } - } -}; - -int main() -{ - DinoDiscoverySet::Main(); -} - -/* This code example produces the following output: - -Compsognathus -Amargasaurus -Oviraptor -Velociraptor -Deinonychus -Dilophosaurus -Gallimimus -Triceratops - -Array.Exists(dinosaurs, "saurus"): True - -Array.TrueForAll(dinosaurs, "saurus"): False - -Array.Find(dinosaurs, "saurus"): Amargasaurus - -Array.FindLast(dinosaurs, "saurus"): Dilophosaurus - -Array.FindAll(dinosaurs, "saurus"): -Amargasaurus -Dilophosaurus -*/ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp deleted file mode 100644 index da0510c1de8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; - -// Search predicate returns true if a string ends in "saurus". -bool EndsWithSaurus(String^ s) -{ - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "saurus")) - { - return true; - } - else - { - return false; - } -}; - -void main() -{ - array^ dinosaurs = { "Compsognathus", - "Amargasaurus", "Oviraptor", "Velociraptor", - "Deinonychus", "Dilophosaurus", "Gallimimus", - "Triceratops" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nArray::FindIndex(dinosaurs, EndsWithSaurus): {0}", - Array::FindIndex(dinosaurs, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, EndsWithSaurus): {0}", - Array::FindIndex(dinosaurs, 2, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): {0}", - Array::FindIndex(dinosaurs, 2, 3, gcnew Predicate(EndsWithSaurus))); -} - -/* This code example produces the following output: - -Compsognathus -Amargasaurus -Oviraptor -Velociraptor -Deinonychus -Dilophosaurus -Gallimimus -Triceratops - -Array::FindIndex(dinosaurs, EndsWithSaurus): 1 - -Array::FindIndex(dinosaurs, 2, EndsWithSaurus): 5 - -Array::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp deleted file mode 100644 index 2ce93684dce..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; - -// Search predicate returns true if a string ends in "saurus". -bool EndsWithSaurus(String^ s) -{ - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "saurus")) - { - return true; - } - else - { - return false; - } -}; - -void main() -{ - array^ dinosaurs = { "Compsognathus", - "Amargasaurus", "Oviraptor", "Velociraptor", - "Deinonychus", "Dilophosaurus", "Gallimimus", - "Triceratops" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nArray::FindLastIndex(dinosaurs, EndsWithSaurus): {0}", - Array::FindLastIndex(dinosaurs, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, EndsWithSaurus): {0}", - Array::FindLastIndex(dinosaurs, 4, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): {0}", - Array::FindLastIndex(dinosaurs, 4, 3, gcnew Predicate(EndsWithSaurus))); -} - -/* This code example produces the following output: - -Compsognathus -Amargasaurus -Oviraptor -Velociraptor -Deinonychus -Dilophosaurus -Gallimimus -Triceratops - -Array::FindLastIndex(dinosaurs, EndsWithSaurus): 5 - -Array::FindLastIndex(dinosaurs, 4, EndsWithSaurus): 1 - -Array::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp deleted file mode 100644 index 946551d8cde..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ dinosaurs = { "Tyrannosaurus", - "Amargasaurus", - "Mamenchisaurus", - "Brachiosaurus", - "Deinonychus", - "Tyrannosaurus", - "Compsognathus" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\"): {0}", - Array::IndexOf(dinosaurs, "Tyrannosaurus")); - - Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}", - Array::IndexOf(dinosaurs, "Tyrannosaurus", 3)); - - Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 2, 2): {0}", - Array::IndexOf(dinosaurs, "Tyrannosaurus", 2, 2)); -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Deinonychus -Tyrannosaurus -Compsognathus - -Array.IndexOf(dinosaurs, "Tyrannosaurus"): 0 - -Array.IndexOf(dinosaurs, "Tyrannosaurus", 3): 5 - -Array.IndexOf(dinosaurs, "Tyrannosaurus", 2, 2): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp deleted file mode 100644 index 2f297639c6a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ dinosaurs = { "Tyrannosaurus", - "Amargasaurus", - "Mamenchisaurus", - "Brachiosaurus", - "Deinonychus", - "Tyrannosaurus", - "Compsognathus" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine( - "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\"): {0}", - Array::LastIndexOf(dinosaurs, "Tyrannosaurus")); - - Console::WriteLine( - "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}", - Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 3)); - - Console::WriteLine( - "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 4, 4): {0}", - Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4)); -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Deinonychus -Tyrannosaurus -Compsognathus - -Array.LastIndexOf(dinosaurs, "Tyrannosaurus"): 5 - -Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 3): 0 - -Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp deleted file mode 100644 index 0eece7d8c34..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class ReverseComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - // Compare y and x in reverse order. - return y->CompareTo(x); - } -}; - -void main() -{ - array^ dinosaurs = { - "Seismosaurus", - "Chasmosaurus", - "Coelophysis", - "Mamenchisaurus", - "Caudipteryx", - "Cetiosaurus" }; - - array^ dinosaurSizes = { 40, 5, 3, 22, 1, 18 }; - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes)"); - Array::Sort(dinosaurs, dinosaurSizes); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - ReverseComparer^ rc = gcnew ReverseComparer(); - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, rc)"); - Array::Sort(dinosaurs, dinosaurSizes, rc); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3)"); - Array::Sort(dinosaurs, dinosaurSizes, 3, 3); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3, rc)"); - Array::Sort(dinosaurs, dinosaurSizes, 3, 3, rc); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } -} - -/* This code example produces the following output: - -Seismosaurus: up to 40 meters long. -Chasmosaurus: up to 5 meters long. -Coelophysis: up to 3 meters long. -Mamenchisaurus: up to 22 meters long. -Caudipteryx: up to 1 meters long. -Cetiosaurus: up to 18 meters long. - -Sort(dinosaurs, dinosaurSizes) - -Caudipteryx: up to 1 meters long. -Cetiosaurus: up to 18 meters long. -Chasmosaurus: up to 5 meters long. -Coelophysis: up to 3 meters long. -Mamenchisaurus: up to 22 meters long. -Seismosaurus: up to 40 meters long. - -Sort(dinosaurs, dinosaurSizes, rc) - -Seismosaurus: up to 40 meters long. -Mamenchisaurus: up to 22 meters long. -Coelophysis: up to 3 meters long. -Chasmosaurus: up to 5 meters long. -Cetiosaurus: up to 18 meters long. -Caudipteryx: up to 1 meters long. - -Sort(dinosaurs, dinosaurSizes, 3, 3) - -Seismosaurus: up to 40 meters long. -Mamenchisaurus: up to 22 meters long. -Coelophysis: up to 3 meters long. -Caudipteryx: up to 1 meters long. -Cetiosaurus: up to 18 meters long. -Chasmosaurus: up to 5 meters long. - -Sort(dinosaurs, dinosaurSizes, 3, 3, rc) - -Seismosaurus: up to 40 meters long. -Mamenchisaurus: up to 22 meters long. -Coelophysis: up to 3 meters long. -Chasmosaurus: up to 5 meters long. -Cetiosaurus: up to 18 meters long. -Caudipteryx: up to 1 meters long. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp deleted file mode 100644 index 8570582fcc3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -int CompareDinosByLength(String^ x, String^ y) -{ - if (x == nullptr) - { - if (y == nullptr) - { - // If x is null and y is null, they're - // equal. - return 0; - } - else - { - // If x is null and y is not null, y - // is greater. - return -1; - } - } - else - { - // If x is not null... - // - if (y == nullptr) - // ...and y is null, x is greater. - { - return 1; - } - else - { - // ...and y is not null, compare the - // lengths of the two strings. - // - int retval = x->Length.CompareTo(y->Length); - - if (retval != 0) - { - // If the strings are not of equal length, - // the longer string is greater. - // - return retval; - } - else - { - // If the strings are of equal length, - // sort them with ordinary string comparison. - // - return x->CompareTo(y); - } - } - } -}; - -void Display(array^ arr) -{ - Console::WriteLine(); - for each(String^ s in arr) - { - if (s == nullptr) - Console::WriteLine("(null)"); - else - Console::WriteLine("\"{0}\"", s); - } -}; - -void main() -{ - array^ dinosaurs = { - "Pachycephalosaurus", - "Amargasaurus", - "", - nullptr, - "Mamenchisaurus", - "Deinonychus" }; - Display(dinosaurs); - - Console::WriteLine("\nSort with generic Comparison delegate:"); - Array::Sort(dinosaurs, - gcnew Comparison(CompareDinosByLength)); - Display(dinosaurs); - -} - -/* This code example produces the following output: - -"Pachycephalosaurus" -"Amargasaurus" -"" -(null) -"Mamenchisaurus" -"Deinonychus" - -Sort with generic Comparison delegate: - -(null) -"" -"Deinonychus" -"Amargasaurus" -"Mamenchisaurus" -"Pachycephalosaurus" - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp deleted file mode 100644 index d51b2194310..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class ReverseComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - // Compare y and x in reverse order. - return y->CompareTo(x); - } -}; - -void main() -{ - array^ dinosaurs = {"Pachycephalosaurus", - "Amargasaurus", - "Mamenchisaurus", - "Tarbosaurus", - "Tyrannosaurus", - "Albertasaurus"}; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nSort(dinosaurs, 3, 3)"); - Array::Sort(dinosaurs, 3, 3); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - ReverseComparer^ rc = gcnew ReverseComparer(); - - Console::WriteLine("\nSort(dinosaurs, 3, 3, rc)"); - Array::Sort(dinosaurs, 3, 3, rc); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Tarbosaurus -Tyrannosaurus -Albertasaurus - -Sort(dinosaurs, 3, 3) - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Albertasaurus -Tarbosaurus -Tyrannosaurus - -Sort(dinosaurs, 3, 3, rc) - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Tyrannosaurus -Tarbosaurus -Albertasaurus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp deleted file mode 100644 index 1d9c96cc967..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -generic void ShowWhere(array^ arr, int index) -{ - if (index<0) - { - // If the index is negative, it represents the bitwise - // complement of the next larger element in the array. - // - index = ~index; - - Console::Write("Not found. Sorts between: "); - - if (index == 0) - Console::Write("beginning of array and "); - else - Console::Write("{0} and ", arr[index-1]); - - if (index == arr->Length) - Console::WriteLine("end of array."); - else - Console::WriteLine("{0}.", arr[index]); - } - else - { - Console::WriteLine("Found at index {0}.", index); - } -}; - -void main() -{ - array^ dinosaurs = {"Pachycephalosaurus", - "Amargasaurus", - "Tyrannosaurus", - "Mamenchisaurus", - "Deinonychus", - "Edmontosaurus"}; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nSort"); - Array::Sort(dinosaurs); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nBinarySearch for 'Coelophysis':"); - int index = Array::BinarySearch(dinosaurs, "Coelophysis"); - ShowWhere(dinosaurs, index); - - Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':"); - index = Array::BinarySearch(dinosaurs, "Tyrannosaurus"); - ShowWhere(dinosaurs, index); -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Tyrannosaurus -Mamenchisaurus -Deinonychus -Edmontosaurus - -Sort - -Amargasaurus -Deinonychus -Edmontosaurus -Mamenchisaurus -Pachycephalosaurus -Tyrannosaurus - -BinarySearch for 'Coelophysis': -Not found. Sorts between: Amargasaurus and Deinonychus. - -BinarySearch for 'Tyrannosaurus': -Found at index 5. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp deleted file mode 100644 index d19063bd802..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class ReverseComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - // Compare y and x in reverse order. - return y->CompareTo(x); - } -}; - -generic void ShowWhere(array^ arr, int index) -{ - if (index<0) - { - // If the index is negative, it represents the bitwise - // complement of the next larger element in the array. - // - index = ~index; - - Console::Write("Not found. Sorts between: "); - - if (index == 0) - Console::Write("beginning of array and "); - else - Console::Write("{0} and ", arr[index-1]); - - if (index == arr->Length) - Console::WriteLine("end of array."); - else - Console::WriteLine("{0}.", arr[index]); - } - else - { - Console::WriteLine("Found at index {0}.", index); - } -}; - -void main() -{ - array^ dinosaurs = {"Pachycephalosaurus", - "Amargasaurus", - "Tyrannosaurus", - "Mamenchisaurus", - "Deinonychus", - "Edmontosaurus"}; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - ReverseComparer^ rc = gcnew ReverseComparer(); - - Console::WriteLine("\nSort"); - Array::Sort(dinosaurs, rc); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nBinarySearch for 'Coelophysis':"); - int index = Array::BinarySearch(dinosaurs, "Coelophysis", rc); - ShowWhere(dinosaurs, index); - - Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':"); - index = Array::BinarySearch(dinosaurs, "Tyrannosaurus", rc); - ShowWhere(dinosaurs, index); -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Tyrannosaurus -Mamenchisaurus -Deinonychus -Edmontosaurus - -Sort - -Tyrannosaurus -Pachycephalosaurus -Mamenchisaurus -Edmontosaurus -Deinonychus -Amargasaurus - -BinarySearch for 'Coelophysis': -Not found. Sorts between: Deinonychus and Amargasaurus. - -BinarySearch for 'Tyrannosaurus': -Found at index 0. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp b/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp deleted file mode 100644 index 41f69f4f144..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -using namespace System; - -namespace AttTargsCS -{ - - // This attribute is only valid on a class. - - [AttributeUsage(AttributeTargets::Class)] - public ref class ClassTargetAttribute: public Attribute{}; - - - // This attribute is only valid on a method. - - [AttributeUsage(AttributeTargets::Method)] - public ref class MethodTargetAttribute: public Attribute{}; - - - // This attribute is only valid on a constructor. - - [AttributeUsage(AttributeTargets::Constructor)] - public ref class ConstructorTargetAttribute: public Attribute{}; - - - // This attribute is only valid on a field. - - [AttributeUsage(AttributeTargets::Field)] - public ref class FieldTargetAttribute: public Attribute{}; - - - // This attribute is valid on a class or a method. - - [AttributeUsage(AttributeTargets::Class|AttributeTargets::Method)] - public ref class ClassMethodTargetAttribute: public Attribute{}; - - - // This attribute is valid on any target. - - [AttributeUsage(AttributeTargets::All)] - public ref class AllTargetsAttribute: public Attribute{}; - - - [ClassTarget] - [ClassMethodTarget] - [AllTargets] - public ref class TestClassAttribute - { - private: - - [ConstructorTarget] - [AllTargets] - TestClassAttribute(){} - - - public: - - [MethodTarget] - [ClassMethodTarget] - [AllTargets] - void Method1(){} - - - [FieldTarget] - [AllTargets] - int myInt; - static void Main(){} - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp b/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp deleted file mode 100644 index 3c72773fc05..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp +++ /dev/null @@ -1,66 +0,0 @@ - - -// This sample takes a given input and replaces each -// occurence of the tab character with 4 space characters. -// It also takes two command-line arguements: input file name, & output file name. -// Usage: -// EXPANDTABS inputfile.txt outputfile.txt -// System.Console.Read -// System.Console.WriteLine -// System.Console.Write -// System.Console.SetIn -// System.Console.SetOut -// System.Console.Error -// System.Console.Out -// -using namespace System; -using namespace System::IO; - -void main() -{ - const int tabSize = 4; - array^args = Environment::GetCommandLineArgs(); - String^ usageText = "Usage: EXPANDTABSEX inputfile.txt outputfile.txt"; - StreamWriter^ writer = nullptr; - - if ( args->Length < 3 ) - { - Console::WriteLine( usageText ); - return; - } - - try - { - writer = gcnew StreamWriter( args[ 2 ] ); - Console::SetOut( writer ); - Console::SetIn( gcnew StreamReader( args[ 1 ] ) ); - } - catch ( IOException^ e ) - { - TextWriter^ errorWriter = Console::Error; - errorWriter->WriteLine( e->Message ); - errorWriter->WriteLine( usageText ); - return; - } - - int i; - while ( (i = Console::Read()) != -1 ) - { - Char c = (Char)i; - if ( c == '\t' ) - Console::Write( ((String^)"")->PadRight( tabSize, ' ' ) ); - else - Console::Write( c ); - } - - writer->Close(); - - // Recover the standard output stream so that a - // completion message can be displayed. - StreamWriter^ standardOutput = gcnew StreamWriter(Console::OpenStandardOutput()); - standardOutput->AutoFlush = true; - Console::SetOut(standardOutput); - Console::WriteLine( "EXPANDTABSEX has completed the processing of {0}.", args[ 0 ] ); - return; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp deleted file mode 100644 index f1d7dc04657..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp +++ /dev/null @@ -1,170 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -using namespace System::IO; - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv); -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv); - -int main() -{ - try - { - array^ key; - array^ iv; - - // Create a new TripleDES object to generate a random key - // and initialization vector (IV). - { - TripleDES^ tripleDes; - - try - { - tripleDes = TripleDES::Create(); - key = tripleDes->Key; - iv = tripleDes->IV; - } - finally - { - delete tripleDes; - } - } - - // Create a string to encrypt. - String^ original = "Here is some data to encrypt."; - - // Encrypt the string to an in-memory buffer. - array^ encrypted = EncryptTextToMemory(original, key, iv); - - // Decrypt the buffer back to a string. - String^ decrypted = DecryptTextFromMemory(encrypted, key, iv); - - // Display the decrypted string to the console. - Console::WriteLine(decrypted); - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - - try - { - // Create a MemoryStream. - mStream = gcnew MemoryStream; - - TripleDES^ tripleDes = nullptr; - ICryptoTransform^ encryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create a new TripleDES object. - tripleDes = TripleDES::Create(); - // Create a TripleDES encryptor from the key and IV - encryptor = tripleDes->CreateEncryptor(key, iv); - // Create a CryptoStream using the MemoryStream and encryptor - cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write); - - // Convert the provided string to a byte array. - array^ toEncrypt = Encoding::UTF8->GetBytes(text); - - // Write the byte array to the crypto stream. - cStream->Write(toEncrypt, 0, toEncrypt->Length); - - // Disposing the CryptoStream completes the encryption and flushes the stream. - delete cStream; - - // Get an array of bytes from the MemoryStream that holds the encrypted data. - array^ ret = mStream->ToArray(); - - // Return the encrypted buffer. - return ret; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (encryptor != nullptr) - delete encryptor; - - if (tripleDes != nullptr) - delete tripleDes; - } - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (mStream != nullptr) - delete mStream; - } -} - -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - TripleDES^ tripleDes = nullptr; - ICryptoTransform^ decryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create buffer to hold the decrypted data. - // TripleDES-encrypted data will always be slightly bigger than the decrypted data. - array^ decrypted = gcnew array(encrypted->Length); - Int32 offset = 0; - - // Create a new MemoryStream using the provided array of encrypted data. - mStream = gcnew MemoryStream(encrypted); - // Create a new TripleDES object. - tripleDes = TripleDES::Create(); - // Create a TripleDES decryptor from the key and IV - decryptor = tripleDes->CreateDecryptor(key, iv); - // Create a CryptoStream using the MemoryStream and decryptor - cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read); - - // Keep reading from the CryptoStream until it finishes (returns 0). - Int32 read = 1; - - while (read > 0) - { - read = cStream->Read(decrypted, offset, decrypted->Length - offset); - offset += read; - } - - // Convert the buffer into a string and return it. - return Encoding::UTF8->GetString(decrypted, 0, offset); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (decryptor != nullptr) - delete decryptor; - - if (tripleDes != nullptr) - delete tripleDes; - - if (mStream != nullptr) - delete mStream; - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp deleted file mode 100644 index e1bc418aedf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp +++ /dev/null @@ -1,30 +0,0 @@ -using namespace System; - -int main() -{ - // Addition operator - // - System::DateTime dTime( 1980, 8, 5 ); - - // tSpan is 17 days, 4 hours, 2 minutes and 1 second. - System::TimeSpan tSpan( 17, 4, 2, 1 ); - - // Result gets 8/22/1980 4:02:01 AM. - System::DateTime result = dTime + tSpan; - // - - System::Console::WriteLine( result ); - - // Equality operator. - // - System::DateTime april19( 2001, 4, 19 ); - System::DateTime otherDate( 1991, 6, 5 ); - - // areEqual gets false. - bool areEqual = april19 == otherDate; - - otherDate = DateTime( 2001, 4, 19 ); - // areEqual gets true. - areEqual = april19 == otherDate; - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp deleted file mode 100644 index 8d23921d77c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -using namespace System; - -int main() -{ - // - // Calculate what day of the week is 36 days from this instant. - System::DateTime today = System::DateTime::Now; - System::TimeSpan duration( 36, 0, 0, 0 ); - System::DateTime answer = today.Add( duration ); - System::Console::WriteLine( " {0:dddd}", answer ); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp deleted file mode 100644 index 0cd42a84a60..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -using namespace System; - -int main() -{ - // Calculate what day of the week is 36 days from this instant. - DateTime today = System::DateTime::Now; - DateTime answer = today.AddDays( 36 ); - Console::WriteLine("Today: {0:dddd}", today); - Console::WriteLine("36 days from today: {0:dddd}", answer); -} -// The example displays output like the following: -// Today: Wednesday -// 36 days from today: Thursday -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp deleted file mode 100644 index 90e6be09498..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; -void main() -{ - - - System::DateTime theDay(System::DateTime::Today.Year,7,28); - int compareValue; - try - { - compareValue = theDay.CompareTo( System::DateTime::Today ); - } - catch ( ArgumentException^ ) - { - System::Console::WriteLine( "Value is not a DateTime" ); - return; - } - - if ( compareValue < 0 ) - { - System::Console::WriteLine( "{0:d} is in the past.", theDay ); - } - else - if ( compareValue == 0 ) - { - System::Console::WriteLine( "{0:d} is today!", theDay ); - } - else - // compareValue > 0 - { - System::Console::WriteLine( "{0:d} has not come yet.", theDay ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp deleted file mode 100644 index 9c3486e2cfa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -// This example demonstrates the DateTime.DayOfWeek property -using namespace System; -int main() -{ - - // Assume the current culture is en-US. - // Create a DateTime for the first of May, 2003. - DateTime dt = DateTime(2003,5,1); - Console::WriteLine( "Is Thursday the day of the week for {0:d}?: {1}", dt, dt.DayOfWeek == DayOfWeek::Thursday ); - Console::WriteLine( "The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek ); -} - -/* -This example produces the following results: - -Is Thursday the day of the week for 5/1/2003?: True -The day of the week for 5/1/2003 is Thursday. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp deleted file mode 100644 index 4cd3cdc577f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; - -int main() -{ - const int July = 7; - const int Feb = 2; - - int daysInJuly = System::DateTime::DaysInMonth( 2001, July ); - Console::WriteLine(daysInJuly); - // daysInFeb gets 28 because the year 1998 was not a leap year. - int daysInFeb = System::DateTime::DaysInMonth( 1998, Feb ); - Console::WriteLine(daysInFeb); - // daysInFebLeap gets 29 because the year 1996 was a leap year. - int daysInFebLeap = System::DateTime::DaysInMonth( 1996, Feb ); - Console::WriteLine(daysInFebLeap); -} -// The example displays the following output: -// 31 -// 28 -// 29 -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp deleted file mode 100644 index 3bccccac024..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -using namespace System; - -int main() -{ - // - System::DateTime today1 = System::DateTime( - System::DateTime::Today.Ticks ); - System::DateTime today2 = System::DateTime( - System::DateTime::Today.Ticks ); - System::DateTime tomorrow = System::DateTime( - System::DateTime::Today.AddDays( 1 ).Ticks ); - - // todayEqualsToday gets true. - bool todayEqualsToday = System::DateTime::Equals( today1, today2 ); - - // todayEqualsTomorrow gets false. - bool todayEqualsTomorrow = System::DateTime::Equals( today1, tomorrow ); - // - - System::Console::WriteLine( todayEqualsToday ); - System::Console::WriteLine( todayEqualsTomorrow ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp deleted file mode 100644 index 6e94f44f925..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp +++ /dev/null @@ -1,44 +0,0 @@ -using namespace System; -using namespace System::IO; - -// This function takes a file's creation time as an unsigned long, -// and returns its age. -// -System::TimeSpan FileAge( long fileCreationTime ) -{ - System::DateTime now = System::DateTime::Now; - try - { - System::DateTime fCreationTime = - System::DateTime::FromFileTime( fileCreationTime ); - System::TimeSpan fileAge = now.Subtract( fCreationTime ); - return fileAge; - } - catch ( ArgumentOutOfRangeException^ ) - { - // fileCreationTime is not valid, so re-throw the exception. - throw; - } -} -// - -void main() -{ - System::Console::WriteLine( "Enter a file's path" ); - String^ filePath = System::Console::ReadLine(); - System::IO::FileInfo^ fInfo; - try - { - fInfo = gcnew System::IO::FileInfo( filePath ); - } - catch ( Exception^ ) - { - System::Console::WriteLine( "Error opening {0}", filePath ); - return; - } - - long fileTime = System::Convert::ToInt64( - fInfo->CreationTime.ToFileTime() ); - System::TimeSpan fileAge = FileAge( fileTime ); - System::Console::WriteLine( " {0}", fileAge ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp deleted file mode 100644 index 436ff3e6d0e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -using namespace System; - -int main() -{ - // - DateTime july28 = DateTime(2009, 7, 28, 5, 23, 15, 16); - array^july28Formats = july28.GetDateTimeFormats(); - - // Print [Out] july28* in all DateTime formats using the default culture. - System::Collections::IEnumerator^ myEnum = july28Formats->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ format = safe_cast(myEnum->Current); - System::Console::WriteLine( format ); - } - // - - // - DateTime juil28 = DateTime(2009, 7, 28, 5, 23, 15, 16); - IFormatProvider^ culture = gcnew System::Globalization::CultureInfo("fr-FR", true ); - - // Get the short date formats using the S"fr-FR" culture. - array^frenchJuly28Formats = juil28.GetDateTimeFormats(culture ); - - // Print [Out] july28* in all DateTime formats using fr-FR culture. - System::Collections::IEnumerator^ myEnum2 = frenchJuly28Formats->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - String^ format = safe_cast(myEnum2->Current); - System::Console::WriteLine(format ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp deleted file mode 100644 index d3d290772b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp +++ /dev/null @@ -1,27 +0,0 @@ -using namespace System; - -int main() -{ - // - System::DateTime date1 = System::DateTime( 1996, 6, 3, 22, 15, 0 ); - System::DateTime date2 = System::DateTime( 1996, 12, 6, 13, 2, 0 ); - System::DateTime date3 = System::DateTime( 1996, 10, 12, 8, 42, 0 ); - - // diff1 gets 185 days, 14 hours, and 47 minutes. - System::TimeSpan diff1 = date2.Subtract( date1 ); - - // date4 gets 4/9/1996 5:55:00 PM. - System::DateTime date4 = date3.Subtract( diff1 ); - - // diff2 gets 55 days 4 hours and 20 minutes. - System::TimeSpan diff2 = date2 - date3; - - // date5 gets 4/9/1996 5:55:00 PM. - System::DateTime date5 = date1 - diff2; - // - - System::Console::WriteLine( diff1 ); - System::Console::WriteLine( date4 ); - System::Console::WriteLine( diff2 ); - System::Console::WriteLine( date4 ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp deleted file mode 100644 index fd732ab14d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -using namespace System; - -// -int main() -{ - System::Console::WriteLine( "Enter the file path:" ); - String^ filePath = System::Console::ReadLine(); - if ( System::IO::File::Exists( filePath ) ) - { - System::DateTime fileCreationDateTime = System::IO::File::GetCreationTime( filePath ); - __int64 fileCreationFileTime = fileCreationDateTime.ToFileTime(); - System::Console::WriteLine( "{0} in file time is {1}.", fileCreationDateTime, fileCreationFileTime ); - } - else - { - System::Console::WriteLine( "{0} is an invalid file", filePath ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp deleted file mode 100644 index 9b140cbb13e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::WriteLine("Enter a date and time."); - String^ strDateTime = Console::ReadLine(); - - DateTime localDateTime, univDateTime; - try - { - localDateTime = DateTime::Parse(strDateTime); - univDateTime = localDateTime.ToUniversalTime(); - - Console::WriteLine("{0} local time is {1} universal time.", - localDateTime, univDateTime ); - } - catch (FormatException^) - { - Console::WriteLine("Invalid format."); - return; - } - - Console::WriteLine("Enter a date and time in universal time."); - strDateTime = Console::ReadLine(); - - try - { - univDateTime = DateTime::Parse(strDateTime); - localDateTime = univDateTime.ToLocalTime(); - - Console::WriteLine("{0} universal time is {1} local time.", - univDateTime, localDateTime ); - } - catch (FormatException^) - { - Console::WriteLine("Invalid format."); - return; - } -} -// The example displays output like the following when run on a -// computer whose culture is en-US in the Pacific Standard Time zone: -// Enter a date and time. -// 12/10/2015 6:18 AM -// 12/10/2015 6:18:00 AM local time is 12/10/2015 2:18:00 PM universal time. -// Enter a date and time in universal time. -// 12/20/2015 6:42:00 -// 12/20/2015 6:42:00 AM universal time is 12/19/2015 10:42:00 PM local time. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp deleted file mode 100644 index 1d76e0d1879..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp +++ /dev/null @@ -1,144 +0,0 @@ -using namespace System; - -namespace Snippets -{ -// - /// - /// Keeping my fortune in Decimals to avoid the round-off errors. - /// - public ref class PiggyBank - { - protected: - Decimal MyFortune; - - public: - void AddPenny() - { - MyFortune = System::Decimal::Add( MyFortune, Decimal(.01) ); - } - - System::Decimal Capacity() - { - return MyFortune.MaxValue; - } - - Decimal Dollars() - { - return Decimal::Floor( MyFortune ); - } - - Decimal Cents() - { - return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) ); - } - - virtual System::String^ ToString() override - { - return MyFortune.ToString("C")+" in piggy bank"; - } - }; -} -// - -using namespace Snippets; -int main( void ) -{ - PiggyBank ^ pb = gcnew PiggyBank; - for ( Int32 i = 0; i < 378; i++ ) - { - pb->AddPenny(); - - } - Console::WriteLine( pb ); -} - - -namespace Snippets2 -{ - // - public ref class PiggyBank - { - public: - Decimal Capacity() - { - return MyFortune.MaxValue; - } - - void AddPenny() - { - MyFortune = Decimal::Add(MyFortune, (Decimal).01); - } - - protected: - Decimal MyFortune; - }; - -} -// - -namespace Snippets3 -{ - // - public ref class PiggyBank - { - public: - Decimal Dollars() - { - return Decimal::Floor( MyFortune ); - } - - void AddPenny() - { - MyFortune = Decimal::Add(MyFortune, (Decimal).01); - } - - protected: - Decimal MyFortune; - }; - -} -// - -namespace Snippets4 -{ -// - public ref class PiggyBank - { - public: - Decimal Cents() - { - return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) ); - } - - void AddPenny() - { - MyFortune = Decimal::Add(MyFortune, (Decimal).01); - } - - protected: - Decimal MyFortune; - }; -} -// - -namespace Snippets5 -{ -// - public ref class PiggyBank - { - public: - void AddPenny() - { - MyFortune = Decimal::Add( MyFortune, (Decimal).01 ); - } - - virtual System::String^ ToString() override - { - return MyFortune.ToString("C")+" in piggy bank"; - } - - protected: - Decimal MyFortune; - }; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp deleted file mode 100644 index e8b0c924c07..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Define two classes to use in the demonstration, a base class and -// a class that derives from it. -// -public ref class Base {}; - -public ref class Derived : Base -{ - // Define a static method to use in the demonstration. The method - // takes an instance of Base and returns an instance of Derived. - // For the purposes of the demonstration, it is not necessary for - // the method to do anything useful. - // -public: - static Derived^ MyMethod(Base^ arg) - { - Base^ dummy = arg; - return gcnew Derived(); - } -}; - -// Define a delegate that takes an instance of Derived and returns an -// instance of Base. -// -public delegate Base^ Example(Derived^ arg); - -void main() -{ - // The binding flags needed to retrieve MyMethod. - BindingFlags flags = BindingFlags::Public | BindingFlags::Static; - - // Get a MethodInfo that represents MyMethod. - MethodInfo^ minfo = Derived::typeid->GetMethod("MyMethod", flags); - - // Demonstrate contravariance of parameter types and covariance - // of return types by using the delegate Example to represent - // MyMethod. The delegate binds to the method because the - // parameter of the delegate is more restrictive than the - // parameter of the method (that is, the delegate accepts an - // instance of Derived, which can always be safely passed to - // a parameter of type Base), and the return type of MyMethod - // is more restrictive than the return type of Example (that - // is, the method returns an instance of Derived, which can - // always be safely cast to type Base). - // - Example^ ex = - (Example^) Delegate::CreateDelegate(Example::typeid, minfo); - - // Execute MyMethod using the delegate Example. - // - Base^ b = ex(gcnew Derived()); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp deleted file mode 100644 index 550cc864617..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Specify the directory you want to manipulate. - String^ path = "c:\\MyDir"; - try - { - - // Determine whether the directory exists. - if ( Directory::Exists( path ) ) - { - Console::WriteLine( "That path exists already." ); - return 0; - } - - // Try to create the directory. - DirectoryInfo^ di = Directory::CreateDirectory( path ); - Console::WriteLine( "The directory was created successfully at {0}.", Directory::GetCreationTime( path ) ); - - // Delete the directory. - di->Delete(); - Console::WriteLine( "The directory was deleted successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp deleted file mode 100644 index 95b5dde57f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp +++ /dev/null @@ -1,531 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -namespace Snippets -{ - // - // The Temperature class stores the temperature as a Double - // and delegates most of the functionality to the Double - // implementation. - public ref class Temperature: public IComparable, public IFormattable - { - // IComparable.CompareTo implementation. - public: - virtual int CompareTo( Object^ obj ) - { - if (obj == nullptr) return 1; - - if (dynamic_cast(obj) ) - { - Temperature^ temp = (Temperature^)(obj); - return m_value.CompareTo( temp->m_value ); - } - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - // IFormattable.ToString implementation. - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - return m_value.ToString( format, provider ); - } - - // Parses the temperature from a string in the form - // [ws][sign]digits['F|'C][ws] - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = Double::Parse( s, styles, provider ); - } - return temp; - } - - protected: - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; - // - - ref class Launcher - { - public: - static void Main() - { - Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Float, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - - String^ str1 = t1->ToString( "C", nullptr ); - Console::WriteLine( str1 ); - - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Float, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t2 ) ); - - Temperature^ t3 = Temperature::Parse( "20'C", NumberStyles::Float, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t3 ) ); - - Console::ReadLine(); - } - }; -} - -namespace Snippets2 -{ - // - public ref class Temperature - { - public: - static property double MinValue - { - double get() - { - return Double::MinValue; - } - } - - static property double MaxValue - { - double get() - { - return Double::MaxValue; - } - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets3 -{ - // - public ref class Temperature: public IComparable - { - // IComparable.CompareTo implementation. - public: - virtual int CompareTo( Object^ obj ) - { - if (obj == nullptr) return 1; - - if ( dynamic_cast(obj) ) - { - Temperature^ temp = dynamic_cast(obj); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets4 -{ - // - public ref class Temperature: public IFormattable - { - // IFormattable.ToString implementation. - public: - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - - return m_value.ToString( format, provider ); - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets5 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = Double::Parse( s ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets6 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = Double::Parse( s, provider ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets7 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = Double::Parse( s, styles ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets8 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in the form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = Double::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -int main() -{ - Snippets::Launcher::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp deleted file mode 100644 index 6ee946709cf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; - -public ref class MyBaseClass {}; - -public ref class MyDerivedClass: MyBaseClass{}; - -int main() -{ - MyBaseClass^ myBase = gcnew MyBaseClass; - MyDerivedClass^ myDerived = gcnew MyDerivedClass; - Object^ o = myDerived; - MyBaseClass^ b = myDerived; - Console::WriteLine( "mybase: Type is {0}", myBase->GetType() ); - Console::WriteLine( "myDerived: Type is {0}", myDerived->GetType() ); - Console::WriteLine( "object o = myDerived: Type is {0}", o->GetType() ); - Console::WriteLine( "MyBaseClass b = myDerived: Type is {0}", b->GetType() ); -} - -/* - -This code produces the following output. - -mybase: Type is MyBaseClass -myDerived: Type is MyDerivedClass -object o = myDerived: Type is MyDerivedClass -MyBaseClass b = myDerived: Type is MyDerivedClass - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp deleted file mode 100644 index 994eab40042..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -int main() -{ - Object^ o = nullptr; - Object^ p = nullptr; - Object^ q = gcnew Object; - Console::WriteLine( Object::ReferenceEquals( o, p ) ); - p = q; - Console::WriteLine( Object::ReferenceEquals( p, q ) ); - Console::WriteLine( Object::ReferenceEquals( o, p ) ); -} - -/* - -This code produces the following output. - -True -True -False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp deleted file mode 100644 index 91579bc8326..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; - -int main() -{ - Console::WriteLine(); - - // Invoke this sample with an arbitrary set of command line arguments. - array^ arguments = Environment::GetCommandLineArgs(); - Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) ); -} -/* -This example produces output like the following: - - C:\>GetCommandLineArgs ARBITRARY TEXT - - GetCommandLineArgs: GetCommandLineArgs, ARBITRARY, TEXT -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp deleted file mode 100644 index e99e9275e62..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -int main() -{ - Console::WriteLine( "GetEnvironmentVariables: " ); - for each (DictionaryEntry^ de in Environment::GetEnvironmentVariables()) - Console::WriteLine( " {0} = {1}", de->Key, de->Value ); -} -// Output from the example is not shown, since it is: -// Lengthy. -// Specific to the machine on which the example is run. -// May reveal information that should remain secure. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp deleted file mode 100644 index 724d32024ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// Sample for the Environment::GetFolderPath method -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) ); -} - -/* -This example produces the following results: - -GetFolderPath: C:\WINNT\System32 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp deleted file mode 100644 index 214308f0a70..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -// -// Sample for the Environment::GetLogicalDrives method -using namespace System; -int main() -{ - Console::WriteLine(); - array^drives = Environment::GetLogicalDrives(); - Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) ); -} - -/* -This example produces the following results: - -GetLogicalDrives: A:\, C:\, D:\ -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp deleted file mode 100644 index 344e571ae41..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -// Sample for the Environment::MachineName property -using namespace System; -int main() -{ - Console::WriteLine(); - - // <-- Keep this information secure! --> - Console::WriteLine( "MachineName: {0}", Environment::MachineName ); -} - -/* -This example produces the following results: -(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".) - -MachineName: !---OMITTED---! -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp deleted file mode 100644 index f1681245632..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// Sample for the Environment::NewLine property -using namespace System; - -int main() -{ - Console::WriteLine(); - Console::WriteLine("NewLine: {0} first line {0} second line", Environment::NewLine); -} - -/* -This example produces the following results: - -NewLine: -first line -second line -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp deleted file mode 100644 index b6f0511a800..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -// Sample for the Environment::StackTrace property -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace ); -} - -/* -This example produces the following results: - -StackTrace: ' at System::Environment::GetStackTrace(Exception e) -at System::Environment::GetStackTrace(Exception e) -at System::Environment::get_StackTrace() -at Sample::Main()' -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp deleted file mode 100644 index 687b4f85405..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -// Sample for the Environment::SystemDirectory property -using namespace System; -int main() -{ - Console::WriteLine(); - - // <-- Keep this information secure! --> - Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory ); -} - -/* -This example produces the following results: - -SystemDirectory: C:\WINNT\System32 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp deleted file mode 100644 index 009bcb3a1d1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -// Sample for the Environment::TickCount property -// TickCount cycles between Int32::MinValue, which is a negative -// number, and Int32::MaxValue once every 49.8 days. This sample -// removes the sign bit to yield a nonnegative number that cycles -// between zero and Int32::MaxValue once every 24.9 days. -using namespace System; -int main() -{ - int result = Environment::TickCount & Int32::MaxValue; - Console::WriteLine( "TickCount: {0}", result ); -} - -/* -This example produces an output similar to the following: - -TickCount: 101931139 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp deleted file mode 100644 index b3fe458162d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// Sample for the Environment::UserInteractive property -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive ); -} - -/* -This example produces the following results: - -UserInteractive: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp deleted file mode 100644 index 9fd924b3c30..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -// Sample for the Environment::UserName property -using namespace System; -int main() -{ - Console::WriteLine(); - - // <-- Keep this information secure! --> - Console::WriteLine( "UserName: {0}", Environment::UserName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp deleted file mode 100644 index cba784628bf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -// -// Sample for the Environment::Version property -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "Version: {0}", Environment::Version ); -} - -/* -This example produces the following results: -(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".) - -Version: !---OMITTED---! -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp deleted file mode 100644 index 10d59ac8fe5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -// -// Sample for the Environment::WorkingSet property -using namespace System; -int main() -{ - Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet ); -} - -/* -This example produces the following results: - -WorkingSet: 5038080 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp b/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp deleted file mode 100644 index c94bc78e16b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; - -public ref class TestClass{}; - -int main() -{ - TestClass^ test = gcnew TestClass; - array^ objectsToCompare = { test, test->ToString(), 123, - (123).ToString(), "some text", - "Some Text" }; - String^ s = "some text"; - for each (Object^ objectToCompare in objectsToCompare) { - try { - Int32 i = s->CompareTo(objectToCompare); - Console::WriteLine("Comparing '{0}' with '{1}': {2}", - s, objectToCompare, i); - } - catch (ArgumentException^ e) { - Console::WriteLine("Bad argument: {0} (type {1})", - objectToCompare, - objectToCompare->GetType()->Name); - } - } -} -// The example displays the following output: -// Bad argument: TestClass (type TestClass) -// Comparing 'some text' with 'TestClass': -1 -// Bad argument: 123 (type Int32) -// Comparing 'some text' with '123': 1 -// Comparing 'some text' with 'some text': 0 -// Comparing 'some text' with 'Some Text': -1 -// diff --git a/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp deleted file mode 100644 index 44aa0f37782..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// -// -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Threading; - -namespace GCNotify -{ - ref class Program - { - private: - // Variable for continual checking in the - // While loop in the WaitForFullGCProc method. - static bool checkForNotify = false; - - // Variable for suspending work - // (such servicing allocated server requests) - // after a notification is received and then - // resuming allocation after inducing a garbage collection. - static bool bAllocate = false; - - // Variable for ending the example. - static bool finalExit = false; - - // Collection for objects that - // simulate the server request workload. - static List^>^ load = gcnew List^>(); - - - public: - static void Main() - { - try - { - // Register for a notification. - GC::RegisterForFullGCNotification(10, 10); - Console::WriteLine("Registered for GC notification."); - - checkForNotify = true; - bAllocate = true; - - // Start a thread using WaitForFullGCProc. - Thread^ thWaitForFullGC = gcnew Thread(gcnew ThreadStart(&WaitForFullGCProc)); - thWaitForFullGC->Start(); - - // While the thread is checking for notifications in - // WaitForFullGCProc, create objects to simulate a server workload. - try - { - int lastCollCount = 0; - int newCollCount = 0; - - - while (true) - { - if (bAllocate) - { - load->Add(gcnew array(1000)); - newCollCount = GC::CollectionCount(2); - if (newCollCount != lastCollCount) - { - // Show collection count when it increases: - Console::WriteLine("Gen 2 collection count: {0}", GC::CollectionCount(2).ToString()); - lastCollCount = newCollCount; - } - - // For ending the example (arbitrary). - if (newCollCount == 500) - { - finalExit = true; - checkForNotify = false; - break; - } - } - } - - } - catch (OutOfMemoryException^) - { - Console::WriteLine("Out of memory."); - } - - - // - finalExit = true; - checkForNotify = false; - GC::CancelFullGCNotification(); - // - - } - catch (InvalidOperationException^ invalidOp) - { - - Console::WriteLine("GC Notifications are not supported while concurrent GC is enabled.\n" - + invalidOp->Message); - } - } - - // - public: - static void OnFullGCApproachNotify() - { - Console::WriteLine("Redirecting requests."); - - // Method that tells the request queuing - // server to not direct requests to this server. - RedirectRequests(); - - // Method that provides time to - // finish processing pending requests. - FinishExistingRequests(); - - // This is a good time to induce a GC collection - // because the runtime will induce a full GC soon. - // To be very careful, you can check precede with a - // check of the GC.GCCollectionCount to make sure - // a full GC did not already occur since last notified. - GC::Collect(); - Console::WriteLine("Induced a collection."); - - } - // - - - // - public: - static void OnFullGCCompleteEndNotify() - { - // Method that informs the request queuing server - // that this server is ready to accept requests again. - AcceptRequests(); - Console::WriteLine("Accepting requests again."); - } - // - - // - public: - static void WaitForFullGCProc() - { - while (true) - { - // CheckForNotify is set to true and false in Main. - while (checkForNotify) - { - // - // Check for a notification of an approaching collection. - GCNotificationStatus s = GC::WaitForFullGCApproach(); - if (s == GCNotificationStatus::Succeeded) - { - Console::WriteLine("GC Notifiction raised."); - OnFullGCApproachNotify(); - } - else if (s == GCNotificationStatus::Canceled) - { - Console::WriteLine("GC Notification cancelled."); - break; - } - else - { - // This can occur if a timeout period - // is specified for WaitForFullGCApproach(Timeout) - // or WaitForFullGCComplete(Timeout) - // and the time out period has elapsed. - Console::WriteLine("GC Notification not applicable."); - break; - } - // - - // - // Check for a notification of a completed collection. - s = GC::WaitForFullGCComplete(); - if (s == GCNotificationStatus::Succeeded) - { - Console::WriteLine("GC Notification raised."); - OnFullGCCompleteEndNotify(); - } - else if (s == GCNotificationStatus::Canceled) - { - Console::WriteLine("GC Notification cancelled."); - break; - } - else - { - // Could be a time out. - Console::WriteLine("GC Notification not applicable."); - break; - } - // - } - - - Thread::Sleep(500); - // FinalExit is set to true right before - // the main thread cancelled notification. - if (finalExit) - { - break; - } - } - } - // - - // - private: - static void RedirectRequests() - { - // Code that sends requests - // to other servers. - - // Suspend work. - bAllocate = false; - - } - - static void FinishExistingRequests() - { - // Code that waits a period of time - // for pending requests to finish. - - // Clear the simulated workload. - load->Clear(); - - } - - static void AcceptRequests() - { - // Code that resumes processing - // requests on this server. - - // Resume work. - bAllocate = true; - } - // - }; -} - -int main() -{ - GCNotify::Program::Main(); -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp deleted file mode 100644 index d3c27fc9117..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -[assembly:AssemblyTitle("CustAttrs1CPP")]; -[assembly:AssemblyDescription("GetCustomAttributes() Demo")]; -[assembly:AssemblyCompany("Microsoft")]; - -ref class Example -{}; - -static void main() -{ - Type^ clsType = Example::typeid; - - // Get the Assembly type to access its metadata. - Assembly^ assy = clsType->Assembly; - - // Iterate through the attributes for the assembly. - System::Collections::IEnumerator^ myEnum = Attribute::GetCustomAttributes( assy )->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum->Current); - - // Check for the AssemblyTitle attribute. - if ( attr->GetType() == AssemblyTitleAttribute::typeid ) - Console::WriteLine( "Assembly title is \"{0}\".", (dynamic_cast(attr))->Title ); - // Check for the AssemblyDescription attribute. - else - // Check for the AssemblyDescription attribute. - if ( attr->GetType() == AssemblyDescriptionAttribute::typeid ) - Console::WriteLine( "Assembly description is \"{0}\".", (dynamic_cast(attr))->Description ); - // Check for the AssemblyCompany attribute. - else if ( attr->GetType() == AssemblyCompanyAttribute::typeid ) - Console::WriteLine( "Assembly company is {0}.", (dynamic_cast(attr))->Company ); - } -} -// The example displays the following output: -// Assembly description is "GetCustomAttributes() Demo". -// Assembly company is Microsoft. -// Assembly title is "CustAttrs1CPP". -// diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp deleted file mode 100644 index 1756e0d976f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp +++ /dev/null @@ -1,258 +0,0 @@ - - -// -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; - -// Assign some attributes to the module. -// Set the module's CLSCompliant attribute to false -// The CLSCompliant attribute is applicable for /target:module. -[module:Description("A sample description")]; -[module:CLSCompliant(false)]; -namespace CustAttrs2CS -{ - ref class DemoClass - { - public: - static void Main() - { - Type^ clsType = DemoClass::typeid; - - // Get the Module type to access its metadata. - Module^ module = clsType->Module; - - // Iterate through all the attributes for the module. - System::Collections::IEnumerator^ myEnum1 = Attribute::GetCustomAttributes( module )->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum1->Current); - - // Check for the Description attribute. - if ( attr->GetType() == DescriptionAttribute::typeid ) - Console::WriteLine( "Module {0} has the description \"{1}\".", module->Name, (dynamic_cast(attr))->Description ); - // Check for the CLSCompliant attribute. - else - - // Check for the CLSCompliant attribute. - if ( attr->GetType() == CLSCompliantAttribute::typeid ) - Console::WriteLine( "Module {0} {1} CLSCompliant.", module->Name, (dynamic_cast(attr))->IsCompliant ? (String^)"is" : "is not" ); - } - } - }; -} - - -/* - * Output: - * Module CustAttrs2CS.exe is not CLSCompliant. - * Module CustAttrs2CS.exe has the description "A sample description". - */ -// -// -using namespace System; -using namespace System::Runtime::InteropServices; - -namespace CustAttrs3CS -{ - // Set a GUID and ProgId attribute for this class. - - [Guid("BF235B41-52D1-46CC-9C55-046793DB363F")] - [ProgId("CustAttrs3CS.ClassWithGuidAndProgId")] - public ref class ClassWithGuidAndProgId{}; - - ref class DemoClass - { - public: - static void Main() - { - // Get the Class type to access its metadata. - Type^ clsType = ClassWithGuidAndProgId::typeid; - - // Iterate through all the attributes for the class. - System::Collections::IEnumerator^ myEnum2 = Attribute::GetCustomAttributes( clsType )->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum2->Current); - - // Check for the Guid attribute. - if ( attr->GetType() == GuidAttribute::typeid ) - { - // Display the GUID. - Console::WriteLine( "Class {0} has a GUID.", clsType->Name ); - Console::WriteLine( "GUID: {{0}}.", (dynamic_cast(attr))->Value ); - } - // Check for the ProgId attribute. - else - - // Check for the ProgId attribute. - if ( attr->GetType() == ProgIdAttribute::typeid ) - { - // Display the ProgId. - Console::WriteLine( "Class {0} has a ProgId.", clsType->Name ); - Console::WriteLine( "ProgId: \"{0}\".", (dynamic_cast(attr))->Value ); - } - } - } - }; -} - - -/* - * Output: - * Class ClassWithGuidAndProgId has a GUID. - * GUID: {BF235B41-52D1-46CC-9C55-046793DB363F}. - * Class ClassWithGuidAndProgId has a ProgId. - * ProgId: "CustAttrs3CS.ClassWithGuidAndProgId". - */ -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -using namespace System::Runtime::InteropServices; - -namespace CustAttrs4CS -{ - // Create a class for Win32 imported unmanaged functions. - public ref class Win32 - { - public: - - [DllImport("user32.dll", CharSet = CharSet::Unicode)] - static int MessageBox( int hWnd, String^ text, String^ caption, UInt32 type ); - }; - - public ref class AClass - { - public: - - // Add some attributes to the Win32CallMethod. - - [Obsolete("This method is obsolete. Use managed MsgBox instead.")] - void Win32CallMethod() - { - Win32::MessageBox( 0, "This is an unmanaged call.", "Be Careful!", 0 ); - } - - }; - - ref class DemoClass - { - public: - static void Main() - { - // Get the Class type to access its metadata. - Type^ clsType = AClass::typeid; - - // Get the type information for the Win32CallMethod. - MethodInfo^ mInfo = clsType->GetMethod( "Win32CallMethod" ); - if ( mInfo != nullptr ) - { - // Iterate through all the attributes for the method. - System::Collections::IEnumerator^ myEnum3 = Attribute::GetCustomAttributes( mInfo )->GetEnumerator(); - while ( myEnum3->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum3->Current); - - // Check for the Obsolete attribute. - if ( attr->GetType() == ObsoleteAttribute::typeid ) - { - Console::WriteLine( "Method {0} is obsolete. " - "The message is:", mInfo->Name ); - Console::WriteLine( (dynamic_cast(attr))->Message ); - } - // Check for the SuppressUnmanagedCodeSecurity attribute. - else - - // Check for the SuppressUnmanagedCodeSecurity attribute. - if ( attr->GetType() == SuppressUnmanagedCodeSecurityAttribute::typeid ) - { - Console::WriteLine( "This method calls unmanaged code " - "with no security check." ); - Console::WriteLine( "Please do not use unless absolutely necessary." ); - AClass^ myCls = gcnew AClass; - myCls->Win32CallMethod(); - } - } - } - } - }; -} - - -/* - * Output: - * Method Win32CallMethod is obsolete. The message is: - * This method is obsolete. Use managed MsgBox instead. - * This method calls unmanaged code with no security check. - * Please do not use unless absolutely necessary. - */ -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; - -namespace CustAttrs5CS -{ - public ref class AClass - { - public: - void ParamArrayAndDesc( - // Add ParamArray and Description attributes. - [Description("This argument is a ParamArray")] - array^args ) - {} - }; - - ref class DemoClass - { - public: - static void Main() - { - // Get the Class type to access its metadata. - Type^ clsType = AClass::typeid; - - // Get the type information for the method. - MethodInfo^ mInfo = clsType->GetMethod( "ParamArrayAndDesc" ); - if ( mInfo != nullptr ) - { - // Get the parameter information. - array^pInfo = mInfo->GetParameters(); - if ( pInfo != nullptr ) - { - // Iterate through all the attributes for the parameter. - System::Collections::IEnumerator^ myEnum4 = Attribute::GetCustomAttributes( pInfo[ 0 ] )->GetEnumerator(); - while ( myEnum4->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum4->Current); - - // Check for the ParamArray attribute. - if ( attr->GetType() == ParamArrayAttribute::typeid ) - Console::WriteLine( "Parameter {0} for method {1} " - "has the ParamArray attribute.", pInfo[ 0 ]->Name, mInfo->Name ); - // Check for the Description attribute. - else - - // Check for the Description attribute. - if ( attr->GetType() == DescriptionAttribute::typeid ) - { - Console::WriteLine( "Parameter {0} for method {1} " - "has a description attribute.", pInfo[ 0 ]->Name, mInfo->Name ); - Console::WriteLine( "The description is: \"{0}\"", (dynamic_cast(attr))->Description ); - } - } - } - } - } - }; -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp deleted file mode 100644 index b421c5517db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// IComparableExample.cpp : main project file. - -// -using namespace System; -using namespace System::Collections; - -public ref class Temperature: public IComparable { - /// - /// IComparable.CompareTo implementation. - /// -protected: - // The value holder - Double m_value; - -public: - virtual Int32 CompareTo( Object^ obj ) { - - if (obj == nullptr) return 1; - - if ( obj->GetType() == Temperature::typeid ) { - Temperature^ temp = dynamic_cast(obj); - - return m_value.CompareTo( temp->m_value ); - } - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - property Double Value { - Double get() { - return m_value; - } - void set( Double value ) { - m_value = value; - } - } - - property Double Celsius { - Double get() { - return (m_value - 32) / 1.8; - } - void set( Double value ) { - m_value = (value * 1.8) + 32; - } - } -}; - -int main() -{ - ArrayList^ temperatures = gcnew ArrayList; - // Initialize random number generator. - Random^ rnd = gcnew Random; - - // Generate 10 temperatures between 0 and 100 randomly. - for (int ctr = 1; ctr <= 10; ctr++) - { - int degrees = rnd->Next(0, 100); - Temperature^ temp = gcnew Temperature; - temp->Value = degrees; - temperatures->Add(temp); - } - - // Sort ArrayList. - temperatures->Sort(); - - for each (Temperature^ temp in temperatures) - Console::WriteLine(temp->Value); - return 0; -} -// The example displays the following output to the console (individual -// values may vary because they are randomly generated): -// 2 -// 7 -// 16 -// 17 -// 31 -// 37 -// 58 -// 66 -// 72 -// 95 -// diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp deleted file mode 100644 index 8c4f0f164e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Collections::Generic; - -public ref class Temperature: public IComparable { - -protected: - // The underlying temperature value. - Double m_value; - -public: - // Implement the generic CompareTo method with the Temperature class - // as the Type parameter. - virtual Int32 CompareTo( Temperature^ other ) { - - // If other is not a valid object reference, this instance - // is greater. - if (other == nullptr) return 1; - - // The temperature comparison depends on the comparison of the - // the underlying Double values. - return m_value.CompareTo( other->m_value ); - } - - // Define the is greater than operator. - bool operator>= (Temperature^ other) - { - return CompareTo(other) >= 0; - } - - // Define the is less than operator. - bool operator< (Temperature^ other) - { - return CompareTo(other) < 0; - } - - // Define the is greater than or equal to operator. - bool operator> (Temperature^ other) - { - return CompareTo(other) > 0; - } - - // Define the is less than or equal to operator. - bool operator<= (Temperature^ other) - { - return CompareTo(other) <= 0; - } - - property Double Celsius { - Double get() { - return m_value + 273.15; - } - } - - property Double Kelvin { - Double get() { - return m_value; - } - void set( Double value ) { - if (value < 0) - throw gcnew ArgumentException("Temperature cannot be less than absolute zero."); - else - m_value = value; - } - } - - Temperature(Double kelvins) { - this->Kelvin = kelvins; - } -}; - -int main() { - SortedList^ temps = - gcnew SortedList(); - - // Add entries to the sorted list, out of order. - temps->Add(gcnew Temperature(2017.15), "Boiling point of Lead"); - temps->Add(gcnew Temperature(0), "Absolute zero"); - temps->Add(gcnew Temperature(273.15), "Freezing point of water"); - temps->Add(gcnew Temperature(5100.15), "Boiling point of Carbon"); - temps->Add(gcnew Temperature(373.15), "Boiling point of water"); - temps->Add(gcnew Temperature(600.65), "Melting point of Lead"); - - for each( KeyValuePair^ kvp in temps ) - { - Console::WriteLine("{0} is {1} degrees Celsius.", kvp->Value, kvp->Key->Celsius); - } -} -/* The example displays the following output: - Absolute zero is 273.15 degrees Celsius. - Freezing point of water is 546.3 degrees Celsius. - Boiling point of water is 646.3 degrees Celsius. - Melting point of Lead is 873.8 degrees Celsius. - Boiling point of Lead is 2290.3 degrees Celsius. - Boiling point of Carbon is 5373.3 degrees Celsius. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp deleted file mode 100644 index 5bd01722472..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::AccessControl; - -// Adds an ACL entry on the specified file for the specified account. - -void AddFileSecurity(String^ fileName, String^ account, - FileSystemRights rights, AccessControlType controlType) -{ - // Get a FileSecurity object that represents the - // current security settings. - FileSecurity^ fSecurity = File::GetAccessControl(fileName); - - // Add the FileSystemAccessRule to the security settings. - fSecurity->AddAccessRule(gcnew FileSystemAccessRule - (account,rights, controlType)); - - // Set the new access settings. - File::SetAccessControl(fileName, fSecurity); -} - -// Removes an ACL entry on the specified file for the specified account. - -void RemoveFileSecurity(String^ fileName, String^ account, - FileSystemRights rights, AccessControlType controlType) -{ - - // Get a FileSecurity object that represents the - // current security settings. - FileSecurity^ fSecurity = File::GetAccessControl(fileName); - - // Remove the FileSystemAccessRule from the security settings. - fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule - (account,rights, controlType)); - - // Set the new access settings. - File::SetAccessControl(fileName, fSecurity); -} - -int main() -{ - try - { - String^ fileName = "test.xml"; - - Console::WriteLine("Adding access control entry for " + fileName); - - // Add the access control entry to the file. - AddFileSecurity(fileName, "MYDOMAIN\\MyAccount", - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Removing access control entry from " + fileName); - - // Remove the access control entry from the file. - RemoveFileSecurity(fileName, "MYDOMAIN\\MyAccount", - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Done."); - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp deleted file mode 100644 index f485421aac8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -//System::Runtime::InteropServices::IDispatchImplAttribute* -//System::Runtime::InteropServices::IDispatchImplType* -// -using namespace System; -using namespace System::Runtime::InteropServices; - -// by default all classes in this assembly will use COM implementaion -// // But this class will use runtime implementaion - -[assembly:IDispatchImpl(IDispatchImplType::CompatibleImpl)]; -[IDispatchImpl(IDispatchImplType::InternalImpl)] -ref class MyClass{}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp b/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp deleted file mode 100644 index b75ca626687..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; - -public ref class AppException: public Exception -{ -public: - AppException(String^ message ) : Exception(message) - {} - - AppException(String^ message, Exception^ inner) : Exception(message, inner) - {} -}; - -public ref class Example -{ -public: - void ThrowInner() - { - throw gcnew AppException("Exception in ThrowInner method."); - } - - void CatchInner() - { - try { - this->ThrowInner(); - } - catch (AppException^ e) { - throw gcnew AppException("Error in CatchInner caused by calling the ThrowInner method.", e); - } - } -}; - -int main() -{ - Example^ ex = gcnew Example(); - try { - ex->CatchInner(); - } - catch (AppException^ e) { - Console::WriteLine("In catch block of Main method."); - Console::WriteLine("Caught: {0}", e->Message); - if (e->InnerException != nullptr) - Console::WriteLine("Inner exception: {0}", e->InnerException); - } -} -// The example displays the following output: -// In catch block of Main method. -// Caught: Error in CatchInner caused by calling the ThrowInner method. -// Inner exception: AppException: Exception in ThrowInner method. -// at Example.ThrowInner() -// at Example.CatchInner() -// diff --git a/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp deleted file mode 100644 index 0d107fe1e0e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp +++ /dev/null @@ -1,357 +0,0 @@ - -// System::Int16::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'Int16'. This compares an instance of 'Int16' with the -passed in Object* and returns true if they are equal. -*/ -using namespace System; -int main() -{ - try - { - - // - Int16 myVariable1 = 20; - Int16 myVariable2 = 20; - - // Get and display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -/* expected return values: -20'F --6'C -20'F -0 -72'F --52 -*/ -/* -namespace Snippets2 { - // - - public __gc class Temperature { - // The value holder - protected: - short m_value; - - public: - __property static short get_MinValue() { - return Int16.MinValue; - } - - __property static short get_MaxValue() { - return Int16.MaxValue; - } - - __property short get_Value(){ - return m_value; - } - __property void set_Value( short value){ - m_value = value; - } - - __property short get_Celsius(){ - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value){ - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets3 { - // - public __gc class Temperature : IComparable { - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - protected: - short m_value; - - public: - Int32 CompareTo(Object* obj) { - if(obj->GetType() == __typeof(Temperature)) { - Temperature temp = dynamic_cast(obj); - return m_value.CompareTo(temp.m_value); - } - - throw new ArgumentException("object is not a Temperature"); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( Int32 value) { - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets4 { - // - public __gc class Temperature : IFormattable { - /// - /// IFormattable.ToString implementation. - /// - // The value holder - protected: - short m_value; - - public: - String* ToString(String* format, IFormatProvider provider) { - if( format != NULL ) { - if( format->Equals("F") ) { - return String::Format("{0}'F", this->Value->ToString()); - } - if( format->Equals("C") ) { - return String::Format("{0}'C", this->Celsius->ToString()); - } - } - - return m_value->ToString(format, provider); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets5 { - // - public __gc class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - temp->Value = Int16::Parse(s); - } - } - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - } - // -} -namespace Snippets6 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, IFormatProvider provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - temp->Value = Int16::Parse(s, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets7 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - temp->Value = Int16::Parse(s, styles); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets8 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - temp->Value = Int16::Parse(s, styles, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp deleted file mode 100644 index a5199f2b75d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp +++ /dev/null @@ -1,357 +0,0 @@ - -// System::Int32::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'Int32'. This compares an instance of 'Int32' with the -passed in object and returns true if they are equal. -*/ -using namespace System; -int main() -{ - try - { - - // - Int32 myVariable1 = 60; - Int32 myVariable2 = 60; - - // Get and display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -/* expected return values: -20'F --6'C -20'F -0 -72'F --52 -*/ -/* -namespace Snippets2 { - // - - public __gc class Temperature { - // The value holder - protected: - short m_value; - - public: - __property static short get_MinValue() { - return Int32.MinValue; - } - - __property static short get_MaxValue() { - return Int32.MaxValue; - } - - __property short get_Value(){ - return m_value; - } - __property void set_Value( short value){ - m_value = value; - } - - __property short get_Celsius(){ - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value){ - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets3 { - // - public __gc class Temperature : IComparable { - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - protected: - short m_value; - - public: - Int32 CompareTo(Object* obj) { - if(obj->GetType() == __typeof(Temperature)) { - Temperature temp = dynamic_cast(obj); - return m_value.CompareTo(temp.m_value); - } - - throw new ArgumentException("object is not a Temperature"); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( Int32 value) { - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets4 { - // - public __gc class Temperature : IFormattable { - /// - /// IFormattable.ToString implementation. - /// - // The value holder - protected: - short m_value; - - public: - String* ToString(String* format, IFormatProvider provider) { - if( format != NULL ) { - if( format->Equals("F") ) { - return String::Format("{0}'F", this->Value->ToString()); - } - if( format->Equals("C") ) { - return String::Format("{0}'C", this->Celsius->ToString()); - } - } - - return m_value->ToString(format, provider); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets5 { - // - public __gc class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - temp->Value = Int32::Parse(s); - } - } - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - } - // -} -namespace Snippets6 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, IFormatProvider provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - temp->Value = Int32::Parse(s, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets7 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - temp->Value = Int32::Parse(s, styles); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets8 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - temp->Value = Int32::Parse(s, styles, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp deleted file mode 100644 index b4f54b5d004..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp +++ /dev/null @@ -1,357 +0,0 @@ - -// System::Int64::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'Int64'. This compares an instance of 'Int64' with the -passed in Object and returns true if they are equal. -*/ -using namespace System; -int main() -{ - try - { - - // - Int64 myVariable1 = 80; - Int64 myVariable2 = 80; - - // Get and display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is ' {0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is ' {0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -/* expected return values: -20'F --6'C -20'F -0 -72'F --52 -*/ -/* -namespace Snippets2 { - // - - public __gc class Temperature { - // The value holder - protected: - short m_value; - - public: - __property static short get_MinValue() { - return Int64.MinValue; - } - - __property static short get_MaxValue() { - return Int64.MaxValue; - } - - __property short get_Value(){ - return m_value; - } - __property void set_Value( short value){ - m_value = value; - } - - __property short get_Celsius(){ - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value){ - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets3 { - // - public __gc class Temperature : IComparable { - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - protected: - short m_value; - - public: - Int64 CompareTo(Object* obj) { - if(obj->GetType() == __typeof(Temperature)) { - Temperature temp = dynamic_cast(obj); - return m_value.CompareTo(temp.m_value); - } - - throw new ArgumentException("object is not a Temperature"); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( Int64 value) { - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets4 { - // - public __gc class Temperature : IFormattable { - /// - /// IFormattable.ToString implementation. - /// - // The value holder - protected: - short m_value; - - public: - String* ToString(String* format, IFormatProvider provider) { - if( format != NULL ) { - if( format->Equals("F") ) { - return String::Format("{0}'F", this->Value->ToString()); - } - if( format->Equals("C") ) { - return String::Format("{0}'C", this->Celsius->ToString()); - } - } - - return m_value->ToString(format, provider); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets5 { - // - public __gc class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - temp->Value = Int64::Parse(s); - } - } - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - } - // -} -namespace Snippets6 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, IFormatProvider provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - temp->Value = Int64::Parse(s, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets7 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - temp->Value = Int64::Parse(s, styles); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets8 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - temp->Value = Int64::Parse(s, styles, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp b/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp deleted file mode 100644 index ce2f1b81b12..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// This sample class has a field, constructor, method, and property. -ref class MyType -{ -private: - Int32 myField; - -public: - MyType( interior_ptr x ) - { - *x *= 5; - } - - virtual String^ ToString() override - { - return myField.ToString(); - } - - property Int32 MyProp - { - Int32 get() - { - return myField; - } - - void set( Int32 value ) - { - if ( value < 1 ) - throw gcnew ArgumentOutOfRangeException( "value",value,"value must be > 0" ); - - myField = value; - } - } -}; - -int main() -{ - Type^ t = MyType::typeid; - - // Create an instance of a type. - array^args = {8}; - Console::WriteLine( "The value of x before the constructor is called is {0}.", args[ 0 ] ); - Object^ obj = t->InvokeMember( nullptr, static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, args ); - Console::WriteLine( "Type: {0}", obj->GetType() ); - Console::WriteLine( "The value of x after the constructor returns is {0}.", args[ 0 ] ); - - // Read and write to a field. - array^obj5 = {5}; - t->InvokeMember( "myField", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetField), nullptr, obj, obj5 ); - Int32 v = safe_cast(t->InvokeMember( "myField", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::GetField), nullptr, obj, nullptr )); - Console::WriteLine( "myField: {0}", v ); - - // Call a method. - String^ s = safe_cast(t->InvokeMember( "ToString", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::InvokeMethod), nullptr, obj, nullptr )); - Console::WriteLine( "ToString: {0}", s ); - - // Read and write a property. First, attempt to assign an - // invalid value; then assign a valid value; finally, get - // the value. - try - { - // Assign the value zero to MyProp. The Property Set - // throws an exception, because zero is an invalid value. - // InvokeMember catches the exception, and throws - // TargetInvocationException. To discover the real cause - // you must catch TargetInvocationException and examine - // the inner exception. - array^obj0 = {(int^)0}; - t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetProperty), nullptr, obj, obj0 ); - } - catch ( TargetInvocationException^ e ) - { - // If the property assignment failed for some unexpected - // reason, rethrow the TargetInvocationException. - if ( e->InnerException->GetType() != ArgumentOutOfRangeException::typeid ) - throw; - - Console::WriteLine( "An invalid value was assigned to MyProp." ); - } - - array^obj2 = {2}; - t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetProperty), nullptr, obj, obj2 ); - v = safe_cast(t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::GetProperty), nullptr, obj, nullptr )); - Console::WriteLine( "MyProp: {0}", v ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp deleted file mode 100644 index bbdb493fd1b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// An enumeration of animals. Start at 1 (0 = uninitialized). -public enum class Animal -{ - // Pets. - Dog = 1, - Cat, Bird -}; - - -// A custom attribute to allow a target to have a pet. -public ref class AnimalTypeAttribute: public Attribute -{ -public: - - // The constructor is called when the attribute is set. - AnimalTypeAttribute( Animal pet ) - { - thePet = pet; - } - - // Provide a default constructor and make Dog the default. - AnimalTypeAttribute() - { - thePet = Animal::Dog; - } - -protected: - - // Keep a variable internally ... - Animal thePet; - -public: - - property Animal Pet - { - // .. and show a copy to the outside world. - Animal get() - { - return thePet; - } - void set( Animal value ) - { - thePet = value; - } - - } - - // Override IsDefaultAttribute to return the correct response. - virtual bool IsDefaultAttribute() override - { - return thePet == Animal::Dog; - } -}; - -public ref class TestClass -{ -public: - - // Use the default constructor. - - [AnimalType] - void Method1(){} -}; - -int main() -{ - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // Get type information for the method. - MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); - - // Get the AnimalType attribute for the method. - AnimalTypeAttribute^ atAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, AnimalTypeAttribute::typeid )); - - // Check to see if the default attribute is applied. - Console::WriteLine( "The attribute {0} for method {1} in class {2}", atAttr->Pet, mInfo->Name, clsType->Name ); - Console::WriteLine( "{0} the default for the AnimalType attribute.", atAttr->IsDefaultAttribute() ? (String^)"is" : "is not" ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp deleted file mode 100644 index cf2f401b63a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp +++ /dev/null @@ -1,276 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Add an AssemblyDescription attribute -[assembly:AssemblyDescription("A sample description")]; -namespace IsDef1CS -{ - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = DemoClass::typeid; - - // Get the assembly object. - Assembly^ assy = clsType->Assembly; - - // Store the assembly's name. - String^ assyName = assy->GetName()->Name; - - //Type assyType = assy.GetType(); - // See if the Assembly Description is defined. - bool isdef = Attribute::IsDefined( assy, AssemblyDescriptionAttribute::typeid ); - if ( isdef ) - { - - // Affirm that the attribute is defined. - Console::WriteLine( "The AssemblyDescription attribute " - "is defined for assembly {0}.", assyName ); - - // Get the description attribute itself. - AssemblyDescriptionAttribute^ adAttr = dynamic_cast(Attribute::GetCustomAttribute( assy, AssemblyDescriptionAttribute::typeid )); - - // Display the description. - if ( adAttr != nullptr ) - Console::WriteLine( "The description is \"{0}\".", adAttr->Description ); - else - Console::WriteLine( "The description could not " - "be retrieved." ); - } - else - Console::WriteLine( "The AssemblyDescription attribute is not " - "defined for assembly {0}.", assyName ); - } - - }; - -} - - -/* - * Output: - * The AssemblyDescription attributeis defined for assembly IsDef1CS. - * The description is "A sample description". - */ -// -// -using namespace System; -using namespace System::Diagnostics; - -// Add the Debuggable attribute to the module. -[module:Debuggable(true,false)]; -namespace IsDef2CS -{ - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = DemoClass::typeid; - - // See if the Debuggable attribute is defined for this module. - bool isDef = Attribute::IsDefined( clsType->Module, DebuggableAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The Debuggable attribute {0} " - "defined for Module {1}.", isDef ? (String^)"is" : "is not", clsType->Module->Name ); - - // If the attribute is defined, display the JIT settings. - if ( isDef ) - { - - // Retrieve the attribute itself. - DebuggableAttribute^ dbgAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType->Module, DebuggableAttribute::typeid )); - if ( dbgAttr != nullptr ) - { - Console::WriteLine( "JITTrackingEnabled is {0}.", dbgAttr->IsJITTrackingEnabled ); - Console::WriteLine( "JITOptimizerDisabled is {0}.", dbgAttr->IsJITOptimizerDisabled ); - } - else - Console::WriteLine( "The Debuggable attribute " - "could not be retrieved." ); - } - } - - }; - -} - - -/* - * Output: - * The Debuggable attribute is defined for Module IsDef2CS.exe. - * JITTrackingEnabled is True. - * JITOptimizerDisabled is False. - */ -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -namespace IsDef3CS -{ - - // Assign a Guid attribute to a class. - - [Guid("BF235B41-52D1-46cc-9C55-046793DB363F")] - public ref class TestClass{}; - - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // See if the Guid attribute is defined for the class. - bool isDef = Attribute::IsDefined( clsType, GuidAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The Guid attribute {0} defined for class {1}.", isDef ? (String^)"is" : "is not", clsType->Name ); - - // If it's defined, display the GUID. - if ( isDef ) - { - GuidAttribute^ guidAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType, GuidAttribute::typeid )); - if ( guidAttr != nullptr ) - Console::WriteLine( "GUID: {{0}}.", guidAttr->Value ); - else - Console::WriteLine( "The Guid attribute could " - "not be retrieved." ); - } - } - - }; - -} - - -/* - * Output: - * The Guid attribute is defined for class TestClass. - * GUID: {BF235B41-52D1-46cc-9C55-046793DB363F}. - */ -// -// -using namespace System; -using namespace System::Reflection; - -namespace IsDef4CS -{ - public ref class TestClass - { - public: - - // Assign the Obsolete attribute to a method. - - [Obsolete("This method is obsolete. Use Method2 instead.")] - void Method1(){} - - void Method2(){} - - }; - - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // Get the MethodInfo object for Method1. - MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); - - // See if the Obsolete attribute is defined for this method. - bool isDef = Attribute::IsDefined( mInfo, ObsoleteAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The Obsolete Attribute {0} defined for {1} of class {2}.", isDef ? (String^)"is" : "is not", mInfo->Name, clsType->Name ); - - // If it's defined, display the attribute's message. - if ( isDef ) - { - ObsoleteAttribute^ obsAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, ObsoleteAttribute::typeid )); - if ( obsAttr != nullptr ) - Console::WriteLine( "The message is: \"{0}\".", obsAttr->Message ); - else - Console::WriteLine( "The message could not be retrieved." ); - } - } - - }; - -} - - -/* - * Output: - * The Obsolete Attribute is defined for Method1 of class TestClass. - * The message is: "This method is obsolete. Use Method2 instead.". - */ -// -// -using namespace System; -using namespace System::Reflection; - -namespace IsDef5CS -{ - public ref class TestClass - { - public: - - // Assign a ParamArray attribute to the parameter using the keyword. - void Method1(... array^args ){} - - }; - - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // Get the MethodInfo object for Method1. - MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); - - // Get the ParameterInfo array for the method parameters. - array^pInfo = mInfo->GetParameters(); - if ( pInfo != nullptr ) - { - - // See if the ParamArray attribute is defined. - bool isDef = Attribute::IsDefined( pInfo[ 0 ], ParamArrayAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The ParamArray attribute {0} defined for " - "parameter {1} of method {2}.", isDef ? (String^)"is" : "is not", pInfo[ 0 ]->Name, mInfo->Name ); - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); - } - - }; - -} - -/* - * Output: - * The ParamArray attribute is defined for parameter args of method Method1. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp b/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp deleted file mode 100644 index b71de67675c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp +++ /dev/null @@ -1,88 +0,0 @@ - - -// -/// -/// The following class represents simple functionality of the trapezoid. -/// -using namespace System; - -public ref class MathTrapezoidSample -{ -private: - double m_longBase; - double m_shortBase; - double m_leftLeg; - double m_rightLeg; - -public: - MathTrapezoidSample( double longbase, double shortbase, double leftLeg, double rightLeg ) - { - m_longBase = Math::Abs( longbase ); - m_shortBase = Math::Abs( shortbase ); - m_leftLeg = Math::Abs( leftLeg ); - m_rightLeg = Math::Abs( rightLeg ); - } - - -private: - double GetRightSmallBase() - { - return (Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( m_leftLeg, 2.0 ) + Math::Pow( m_longBase, 2.0 ) + Math::Pow( m_shortBase, 2.0 ) - 2 * m_shortBase * m_longBase) / (2 * (m_longBase - m_shortBase)); - } - - -public: - double GetHeight() - { - double x = GetRightSmallBase(); - return Math::Sqrt( Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( x, 2.0 ) ); - } - - double GetSquare() - { - return GetHeight() * m_longBase / 2.0; - } - - double GetLeftBaseRadianAngle() - { - double sinX = GetHeight() / m_leftLeg; - return Math::Round( Math::Asin( sinX ), 2 ); - } - - double GetRightBaseRadianAngle() - { - double x = GetRightSmallBase(); - double cosX = (Math::Pow( m_rightLeg, 2.0 ) + Math::Pow( x, 2.0 ) - Math::Pow( GetHeight(), 2.0 )) / (2 * x * m_rightLeg); - return Math::Round( Math::Acos( cosX ), 2 ); - } - - double GetLeftBaseDegreeAngle() - { - double x = GetLeftBaseRadianAngle() * 180 / Math::PI; - return Math::Round( x, 2 ); - } - - double GetRightBaseDegreeAngle() - { - double x = GetRightBaseRadianAngle() * 180 / Math::PI; - return Math::Round( x, 2 ); - } - -}; - -int main() -{ - MathTrapezoidSample^ trpz = gcnew MathTrapezoidSample( 20.0,10.0,8.0,6.0 ); - Console::WriteLine( "The trapezoid's bases are 20.0 and 10.0, the trapezoid's legs are 8.0 and 6.0" ); - double h = trpz->GetHeight(); - Console::WriteLine( "Trapezoid height is: {0}", h.ToString() ); - double dxR = trpz->GetLeftBaseRadianAngle(); - Console::WriteLine( "Trapezoid left base angle is: {0} Radians", dxR.ToString() ); - double dyR = trpz->GetRightBaseRadianAngle(); - Console::WriteLine( "Trapezoid right base angle is: {0} Radians", dyR.ToString() ); - double dxD = trpz->GetLeftBaseDegreeAngle(); - Console::WriteLine( "Trapezoid left base angle is: {0} Degrees", dxD.ToString() ); - double dyD = trpz->GetRightBaseDegreeAngle(); - Console::WriteLine( "Trapezoid right base angle is: {0} Degrees", dyD.ToString() ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp b/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp deleted file mode 100644 index 5f170354fb3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//Types:System.MissingMethodException -//Types:System.MissingMemberException -//Types:System.MissingFieldException -// -using namespace System; -using namespace System::Reflection; - -ref class App -{ -}; - -int main() -{ - // - try - { - // Attempt to call a static DoSomething method defined in the App class. - // However, because the App class does not define this method, - // a MissingMethodException is thrown. - App::typeid->InvokeMember("DoSomething", BindingFlags::Static | - BindingFlags::InvokeMethod, nullptr, nullptr, nullptr); - } - catch (MissingMethodException^ ex) - { - // Show the user that the DoSomething method cannot be called. - Console::WriteLine("Unable to call the DoSomething method: {0}", - ex->Message); - } - // - - // - try - { - // Attempt to access a static AField field defined in the App class. - // However, because the App class does not define this field, - // a MissingFieldException is thrown. - App::typeid->InvokeMember("AField", BindingFlags::Static | - BindingFlags::SetField, nullptr, nullptr, gcnew array{5}); - } - catch (MissingFieldException^ ex) - { - // Show the user that the AField field cannot be accessed. - Console::WriteLine("Unable to access the AField field: {0}", - ex->Message); - } - // - - // - try - { - // Attempt to access a static AnotherField field defined in the App class. - // However, because the App class does not define this field, - // a MissingFieldException is thrown. - App::typeid->InvokeMember("AnotherField", BindingFlags::Static | - BindingFlags::GetField, nullptr, nullptr, nullptr); - } - catch (MissingMemberException^ ex) - { - // Notice that this code is catching MissingMemberException which is the - // base class of MissingMethodException and MissingFieldException. - // Show the user that the AnotherField field cannot be accessed. - Console::WriteLine("Unable to access the AnotherField field: {0}", - ex->Message); - } - // -} -// This code produces the following output. -// -// Unable to call the DoSomething method: Method 'App.DoSomething' not found. -// Unable to access the AField field: Field 'App.AField' not found. -// Unable to access the AnotherField field: Field 'App.AnotherField' not found. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp b/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp deleted file mode 100644 index 0017618eb8d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -ref class StringContainer -{ -private: - // A generic list object that holds the strings. - List^ container = gcnew List; - -public: - // Define a delegate to handle string display. - delegate void CheckAndDisplayDelegate(String^ str); - - // A method that adds more strings to the collection. - void AddString(String^ str) - { - container->Add(str); - } - - // Iterate through the strings and invoke the method(s) that the delegate points to. - void DisplayAllQualified(CheckAndDisplayDelegate^ displayDelegate) - { - for each (String^ str in container) - displayDelegate(str); -// System::Collections::IEnumerator^ myEnum = container->GetEnumerator(); -// while ( myEnum->MoveNext() ) -// { -// String^ str = safe_cast(myEnum->Current); -// displayDelegate(str); -// } - } -}; - -//end of class StringContainer -// This class contains a few sample methods -ref class StringFuncs -{ -public: - - // This method prints a String* that it is passed if the String* starts with a vowel - static void ConStart(String^ str) - { - if ( !(str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') ) - Console::WriteLine( str ); - } - - // This method prints a String* that it is passed if the String* starts with a consonant - static void VowelStart( String^ str ) - { - if ( (str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') ) - Console::WriteLine( str ); - } -}; - -// This function demonstrates using Delegates, including using the Remove and -// Combine methods to create and modify delegate combinations. -int main() -{ - // Declare the StringContainer class and add some strings - StringContainer^ container = gcnew StringContainer; - container->AddString( "This" ); - container->AddString( "is" ); - container->AddString( "a" ); - container->AddString( "multicast" ); - container->AddString( "delegate" ); - container->AddString( "example" ); - -// RETURN HERE. - // Create two delegates individually using different methods - StringContainer::CheckAndDisplayDelegate^ conStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::ConStart ); - StringContainer::CheckAndDisplayDelegate^ vowelStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::VowelStart ); - - // Get the list of all delegates assigned to this MulticastDelegate instance. - array^ delegateList = conStart->GetInvocationList(); - Console::WriteLine("conStart contains {0} delegate(s).", delegateList->Length); - delegateList = vowelStart->GetInvocationList(); - Console::WriteLine("vowelStart contains {0} delegate(s).\n", delegateList->Length ); - - // Determine whether the delegates are System::Multicast delegates - if ( dynamic_cast(conStart) && dynamic_cast(vowelStart) ) - { - Console::WriteLine("conStart and vowelStart are derived from MulticastDelegate.\n"); - } - - // Execute the two delegates. - Console::WriteLine("Executing the conStart delegate:" ); - container->DisplayAllQualified(conStart); - Console::WriteLine(); - Console::WriteLine("Executing the vowelStart delegate:" ); - container->DisplayAllQualified(vowelStart); - - // Create a new MulticastDelegate and call Combine to add two delegates. - StringContainer::CheckAndDisplayDelegate^ multipleDelegates = - dynamic_cast(Delegate::Combine(conStart, vowelStart)); - - // How many delegates does multipleDelegates contain? - delegateList = multipleDelegates->GetInvocationList(); - Console::WriteLine("\nmultipleDelegates contains {0} delegates.\n", - delegateList->Length ); - - // // Pass this multicast delegate to DisplayAllQualified. - Console::WriteLine("Executing the multipleDelegate delegate."); - container->DisplayAllQualified(multipleDelegates); - // Call remove and combine to change the contained delegates. - multipleDelegates = dynamic_cast - (Delegate::Remove(multipleDelegates, vowelStart)); - multipleDelegates = dynamic_cast - (Delegate::Combine(multipleDelegates, conStart)); - - // Pass multipleDelegates to DisplayAllQualified again. - Console::WriteLine("\nExecuting the multipleDelegate delegate with two conStart delegates:"); - container->DisplayAllQualified(multipleDelegates); -} -// The example displays the following output: -// conStart contains 1 delegate(s). -// vowelStart contains 1 delegate(s). -// -// conStart and vowelStart are derived from MulticastDelegate. -// -// Executing the conStart delegate: -// This -// multicast -// delegate -// -// Executing the vowelStart delegate: -// is -// a -// example -// -// -// multipleDelegates contains 2 delegates. -// -// Executing the multipleDelegate delegate. -// This -// is -// a -// multicast -// delegate -// example -// -// Executing the multipleDelegate delegate with two conStart delegates: -// This -// This -// multicast -// multicast -// delegate -// delegate -// diff --git a/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp b/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp deleted file mode 100644 index 90c4a5a1302..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - MemoryStream^ ms = gcnew MemoryStream( 16 ); - ms->Close(); - try - { - ms->ReadByte(); - } - catch ( ObjectDisposedException^ e ) - { - Console::WriteLine( "Caught: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp b/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp deleted file mode 100644 index d13e56d248d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//Types:System.Object -// -using namespace System; - -// The Point class is derived from System.Object. -ref class Point -{ -public: - int x; -public: - int y; - -public: - Point(int x, int y) - { - this->x = x; - this->y = y; - } - - // -public: - virtual bool Equals(Object^ obj) override - { - // If this and obj do not refer to the same type, - // then they are not equal. - if (obj->GetType() != this->GetType()) - { - return false; - } - - // Return true if x and y fields match. - Point^ other = (Point^) obj; - return (this->x == other->x) && (this->y == other->y); - } - // - - // - // Return the XOR of the x and y fields. -public: - virtual int GetHashCode() override - { - return x ^ y; - } - // - - // - // Return the point's value as a string. -public: - virtual String^ ToString() override - { - return String::Format("({0}, {1})", x, y); - } - // - - // - // Return a copy of this point object by making a simple - // field copy. -public: - Point^ Copy() - { - return (Point^) this->MemberwiseClone(); - } - // -}; - -int main() -{ - // Construct a Point object. - Point^ p1 = gcnew Point(1, 2); - - // Make another Point object that is a copy of the first. - Point^ p2 = p1->Copy(); - - // Make another variable that references the first - // Point object. - Point^ p3 = p1; - - // - // The line below displays false because p1 and - // p2 refer to two different objects. - Console::WriteLine( - Object::ReferenceEquals(p1, p2)); - // - - // - // The line below displays true because p1 and p2 refer - // to two different objects that have the same value. - Console::WriteLine(Object::Equals(p1, p2)); - // - - // The line below displays true because p1 and - // p3 refer to one object. - Console::WriteLine(Object::ReferenceEquals(p1, p3)); - - // - // The line below displays: p1's value is: (1, 2) - Console::WriteLine("p1's value is: {0}", p1->ToString()); - // -} - -// This code produces the following output. -// -// False -// True -// True -// p1's value is: (1, 2) -// diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp deleted file mode 100644 index c2c7e1cf179..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -// This example demonstrates the OperatingSystem.ServicePack property. -using namespace System; -int main() -{ - OperatingSystem^ os = Environment::OSVersion; - String^ sp = os->ServicePack; - Console::WriteLine( "Service pack version = \"{0}\"", sp ); -} - -/* -This example produces the following results: - -Service pack version = "Service Pack 1" - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp deleted file mode 100644 index 6c87d9dff1f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -// This example demonstrates the VersionString property. -using namespace System; -int main() -{ - OperatingSystem^ os = Environment::OSVersion; - - // Display the value of OperatingSystem.VersionString. By default, this is - // the same value as OperatingSystem.ToString. - Console::WriteLine( L"This operating system is {0}", os->VersionString ); - return 0; -} - -/* -This example produces the following results: - -This operating system is Microsoft Windows NT 5.1.2600.0 Service Pack 1 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp deleted file mode 100644 index 6541e6b0a6e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; -int main() -{ - String^ strLow = "abc"; - String^ strCap = "ABC"; - String^ result = "equal to "; - int x = 0; - int pos = 1; - - // The Unicode codepoint for 'b' is greater than the codepoint for 'B'. - x = String::CompareOrdinal( strLow, pos, strCap, pos, 1 ); - if ( x < 0 ) - result = "less than"; - - if ( x > 0 ) - result = "greater than"; - - Console::WriteLine( "CompareOrdinal(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos ); - Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] ); - - // In U.S. English culture, 'b' is linguistically less than 'B'. - x = String::Compare( strLow, pos, strCap, pos, 1, false, gcnew CultureInfo( "en-US" ) ); - if ( x < 0 ) - result = "less than"; - else - if ( x > 0 ) - result = "greater than"; - - Console::WriteLine( "Compare(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos ); - Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp deleted file mode 100644 index 389943d7364..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; - -String^ CompareStrings(String^ str1, String^ str2) -{ - // compare the values, using the CompareTo method on the first string - int cmpVal = str1->CompareTo(str2); - if (cmpVal == 0) - // the values are the same - return "The strings occur in the same position in the sort order."; - else if (cmpVal < 0) - return "The first string precedes the second in the sort order."; - else - return "The first string follows the second in the sort order."; -} - -int main() -{ - String^ strFirst = "Goodbye"; - String^ strSecond = "Hello"; - String^ strThird = "a small String*"; - String^ strFourth = "goodbye"; - - // Compare a string to itself. - Console::WriteLine(CompareStrings(strFirst, strFirst)); - Console::WriteLine(CompareStrings(strFirst, strSecond)); - Console::WriteLine(CompareStrings(strFirst, strThird)); - - // Compare a string to another string that varies only by case. - Console::WriteLine(CompareStrings(strFirst, strFourth)); - Console::WriteLine(CompareStrings(strFourth, strFirst)); -} -// The example displays the following output: -// The strings occur in the same position in the sort order. -// The first string precedes the second in the sort order. -// The first string follows the second in the sort order. -// The first string follows the second in the sort order. -// The first string precedes the second in the sort order. -// diff --git a/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp b/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp deleted file mode 100644 index 10d4eb14002..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -// -// This example demonstrates the two versions of the -// CompareTo method for several base types. -// The general version takes a parameter of type Object, while the specific -// version takes a type-specific parameter, such as Boolean, Int32, or Double. -using namespace System; - -void Show( String^ caption, Object^ var1, Object^ var2, int resultGeneric, int resultNonGeneric ) -{ - String^ relation; - Console::Write( caption ); - if ( resultGeneric == resultNonGeneric ) - { - if ( resultGeneric < 0 ) - relation = "less than"; - else - if ( resultGeneric > 0 ) - relation = "greater than"; - else - relation = "equal to"; - Console::WriteLine( "{0} is {1} {2}", var1, relation, var2 ); - } - // The following condition will never occur because the generic and non-generic - // CompareTo methods are equivalent. - else - { - Console::WriteLine( "Generic CompareTo = {0}; non-generic CompareTo = {1}", resultGeneric, resultNonGeneric ); - } -} - -int main() -{ - String^ nl = Environment::NewLine; - String^ msg = "{0}The following is the result of using the generic and non-generic{0}" - "versions of the CompareTo method for several base types:{0}"; - Object^ obj; // An Object used to insure CompareTo(Object) is called. - - DateTime now = DateTime::Now; - - // Time span = 11 days, 22 hours, 33 minutes, 44 seconds - TimeSpan tsX = TimeSpan(11,22,33,44); - - // Version = 1.2.333.4 - Version^ versX = gcnew Version( "1.2.333.4" ); - - // Guid = CA761232-ED42-11CE-BACD-00AA0057B223 - Guid guidX = Guid( "{CA761232-ED42-11CE-BACD-00AA0057B223}"); - Boolean a1 = true,a2 = true; - Byte b1 = 1,b2 = 1; - Int16 c1 = -2,c2 = 2; - Int32 d1 = 3,d2 = 3; - Int64 e1 = 4,e2 = -4; - Decimal f1 = Decimal(-5.5), f2 = Decimal(5.5); - Single g1 = 6.6f,g2 = 6.6f; - Double h1 = 7.7,h2 = -7.7; - Char i1 = 'A',i2 = 'A'; - String^ j1 = "abc", ^j2 = "abc"; - DateTime k1 = now,k2 = now; - TimeSpan l1 = tsX,l2 = tsX; - Version^ m1 = versX, ^m2 = gcnew Version( "2.0" ); - Guid n1 = guidX,n2 = guidX; - - // The following types are not CLS-compliant. - SByte w1 = 8,w2 = 8; - UInt16 x1 = 9,x2 = 9; - UInt32 y1 = 10,y2 = 10; - UInt64 z1 = 11,z2 = 11; - - // - Console::WriteLine( msg, nl ); - try - { - Show( "Boolean: ", a1, a2, a1.CompareTo( a2 ), a1.CompareTo( a2 ) ); - Show( "Byte: ", b1, b2, b1.CompareTo( b2 ), b1.CompareTo( b2 ) ); - Show( "Int16: ", c1, c2, c1.CompareTo( c2 ), c1.CompareTo( c2 ) ); - Show( "Int32: ", d1, d2, d1.CompareTo( d2 ), d1.CompareTo( d2 ) ); - Show( "Int64: ", e1, e2, e1.CompareTo( e2 ), e1.CompareTo( e2 ) ); - Show( "Decimal: ", f1, f2, f1.CompareTo( f2 ), f1.CompareTo( f2 ) ); - Show( "Single: ", g1, g2, g1.CompareTo( g2 ), g1.CompareTo( g2 ) ); - Show( "Double: ", h1, h2, h1.CompareTo( h2 ), h1.CompareTo( h2 ) ); - Show( "Char: ", i1, i2, i1.CompareTo( i2 ), i1.CompareTo( i2 ) ); - - // Use an anonymous object to hide the String object. - obj = j2; - Show( "String: ", j1, j2, j1->CompareTo( j2 ), j1->CompareTo( obj ) ); - Show( "DateTime:", k1, k2, k1.CompareTo( k2 ), k1.CompareTo( k2 ) ); - Show( "TimeSpan: ", l1, l2, l1.CompareTo( l2 ), l1.CompareTo( l2 ) ); - - // Use an anonymous object to hide the Version object. - obj = m2; - Show( "Version: ", m1, m2, m1->CompareTo( m2 ), m1->CompareTo( obj ) ); - Show( "Guid: ", n1, n2, n1.CompareTo( n2 ), n1.CompareTo( n2 ) ); - - // - Console::WriteLine( "{0}The following types are not CLS-compliant:", nl ); - Show( "SByte: ", w1, w2, w1.CompareTo( w2 ), w1.CompareTo( w2 ) ); - Show( "UInt16: ", x1, x2, x1.CompareTo( x2 ), x1.CompareTo( x2 ) ); - Show( "UInt32: ", y1, y2, y1.CompareTo( y2 ), y1.CompareTo( y2 ) ); - Show( "UInt64: ", z1, z2, z1.CompareTo( z2 ), z1.CompareTo( z2 ) ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - -} -// This example displays the following output: -// -// The following is the result of using the generic and non-generic versions of the -// CompareTo method for several base types: -// -// Boolean: True is equal to True -// Byte: 1 is equal to 1 -// Int16: -2 is less than 2 -// Int32: 3 is equal to 3 -// Int64: 4 is greater than -4 -// Decimal: -5.5 is less than 5.5 -// Single: 6.6 is equal to 6.6 -// Double: 7.7 is greater than -7.7 -// Char: A is equal to A -// String: abc is equal to abc -// DateTime: 12/1/2003 5:37:46 PM is equal to 12/1/2003 5:37:46 PM -// TimeSpan: 11.22:33:44 is equal to 11.22:33:44 -// Version: 1.2.333.4 is less than 2.0 -// Guid: ca761232-ed42-11ce-bacd-00aa0057b223 is equal to ca761232-ed42-11ce-bacd-00 -// aa0057b223 -// -// The following types are not CLS-compliant: -// SByte: 8 is equal to 8 -// UInt16: 9 is equal to 9 -// UInt32: 10 is equal to 10 -// UInt64: 11 is equal to 11 -// diff --git a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp b/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp deleted file mode 100644 index cc253499947..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// -// This example demonstrates overloads of the TryParse method for -// several base types, and the TryParseExact method for DateTime. -// In most cases, this example uses the most complex overload; that is, the overload -// with the most parameters for a particular type. If a complex overload specifies -// null (Nothing in Visual Basic) for the IFormatProvider parameter, formatting -// information is obtained from the culture associated with the current thread. -// If a complex overload specifies the style parameter, the parameter value is -// the default value used by the equivalent simple overload. -using namespace System; -using namespace System::Globalization; - -static void Show( bool parseResult, String^ typeName, String^ parseValue ) -{ - String^ msgSuccess = L"Parse for {0} = {1}"; - String^ msgFailure = L"** Parse for {0} failed. Invalid input."; - - // - if ( parseResult ) - Console::WriteLine( msgSuccess, typeName, parseValue ); - else - Console::WriteLine( msgFailure, typeName ); -} - -void main() -{ - bool result; - CultureInfo^ ci; - String^ nl = Environment::NewLine; - String^ msg1 = L"This example demonstrates overloads of the TryParse method for{0}" - L"several base types, as well as the TryParseExact method for DateTime.{0}"; - String^ msg2 = L"Non-numeric types:{0}"; - String^ msg3 = L"{0}Numeric types:{0}"; - String^ msg4 = L"{0}The following types are not CLS-compliant:{0}"; - - // Non-numeric types. - Boolean booleanVal; - Char charVal; - DateTime datetimeVal; - - // Numeric types. - Byte byteVal; - Int16 int16Val; - Int32 int32Val; - Int64 int64Val; - Decimal decimalVal; - Single singleVal; - Double doubleVal; - - // The following types are not CLS-compliant. - SByte sbyteVal; - UInt16 uint16Val; - UInt32 uint32Val; - UInt64 uint64Val; - - // - Console::WriteLine( msg1, nl ); - - // Non-numeric types: - Console::WriteLine( msg2, nl ); - - // DateTime - // TryParse: - // Assume current culture is en-US, and dates of the form: MMDDYYYY. - result = DateTime::TryParse( L"7/4/2004 12:34:56", datetimeVal ); - Show( result, L"DateTime #1", datetimeVal.ToString() ); - - // Use fr-FR culture, and dates of the form: DDMMYYYY. - ci = gcnew CultureInfo( L"fr-FR" ); - result = DateTime::TryParse( L"4/7/2004 12:34:56", ci, DateTimeStyles::None, datetimeVal ); - Show( result, L"DateTime #2", datetimeVal.ToString() ); - - // TryParseExact: - // Use fr-FR culture. The format, "G", is short date and long time. - result = DateTime::TryParseExact( L"04/07/2004 12:34:56", L"G", ci, DateTimeStyles::None, datetimeVal ); - Show( result, L"DateTime #3", datetimeVal.ToString() ); - - // Assume en-US culture. - array^dateFormats = {L"f",L"F",L"g",L"G"}; - result = DateTime::TryParseExact( L"7/4/2004 12:34:56 PM", dateFormats, nullptr, DateTimeStyles::None, datetimeVal ); - Show( result, L"DateTime #4", datetimeVal.ToString() ); - Console::WriteLine(); - - // Boolean - result = Boolean::TryParse( L"true", booleanVal ); - Show( result, L"Boolean", booleanVal.ToString() ); - - // Char - result = Char::TryParse( L"A", charVal ); - Show( result, L"Char", charVal.ToString() ); - - // Numeric types: - Console::WriteLine( msg3, nl ); - - // Byte - result = Byte::TryParse( L"1", NumberStyles::Integer, nullptr, byteVal ); - Show( result, L"Byte", byteVal.ToString() ); - - // Int16 - result = Int16::TryParse( L"-2", NumberStyles::Integer, nullptr, int16Val ); - Show( result, L"Int16", int16Val.ToString() ); - - // Int32 - result = Int32::TryParse( L"3", NumberStyles::Integer, nullptr, int32Val ); - Show( result, L"Int32", int32Val.ToString() ); - - // Int64 - result = Int64::TryParse( L"4", NumberStyles::Integer, nullptr, int64Val ); - Show( result, L"Int64", int64Val.ToString() ); - - // Decimal - result = Decimal::TryParse( L"-5.5", NumberStyles::Number, nullptr, decimalVal ); - Show( result, L"Decimal", decimalVal.ToString() ); - - // Single - result = Single::TryParse( L"6.6", static_cast((NumberStyles::Float | NumberStyles::AllowThousands)), nullptr, singleVal ); - Show( result, L"Single", singleVal.ToString() ); - - // Double - result = Double::TryParse( L"-7", static_cast(NumberStyles::Float | NumberStyles::AllowThousands), nullptr, doubleVal ); - Show( result, L"Double", doubleVal.ToString() ); - - // Use the simple Double.TryParse overload, but specify an invalid value. - result = Double::TryParse( L"abc", doubleVal ); - Show( result, L"Double #2", doubleVal.ToString() ); - - // - Console::WriteLine( msg4, nl ); - - // SByte - result = SByte::TryParse( L"-8", NumberStyles::Integer, nullptr, sbyteVal ); - Show( result, L"SByte", sbyteVal.ToString() ); - - // UInt16 - result = UInt16::TryParse( L"9", NumberStyles::Integer, nullptr, uint16Val ); - Show( result, L"UInt16", uint16Val.ToString() ); - - // UInt32 - result = UInt32::TryParse( L"10", NumberStyles::Integer, nullptr, uint32Val ); - Show( result, L"UInt32", uint32Val.ToString() ); - - // UInt64 - result = UInt64::TryParse( L"11", NumberStyles::Integer, nullptr, uint64Val ); - Show( result, L"UInt64", uint64Val.ToString() ); -} - -/* -This example produces the following results: - -This example demonstrates overloads of the TryParse method for -several base types, as well as the TryParseExact method for DateTime. - -Non-numeric types: - -Parse for DateTime #1 = 7/4/2004 12:34:56 PM -Parse for DateTime #2 = 7/4/2004 12:34:56 PM -Parse for DateTime #3 = 7/4/2004 12:34:56 PM -Parse for DateTime #4 = 7/4/2004 12:34:56 PM - -Parse for Boolean = True -Parse for Char = A - -Numeric types: - -Parse for Byte = 1 -Parse for Int16 = -2 -Parse for Int32 = 3 -Parse for Int64 = 4 -Parse for Decimal = -5.5 -Parse for Single = 6.6 -Parse for Double = -7 -** Parse for Double #2 failed. Invalid input. - -The following types are not CLS-compliant: - -Parse for SByte = -8 -Parse for UInt16 = 9 -Parse for UInt32 = 10 -Parse for UInt64 = 11 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp b/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp deleted file mode 100644 index e6f659eaf11..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp +++ /dev/null @@ -1,10 +0,0 @@ - -// -using namespace System; -void main() -{ - Type^ t = int::typeid; - Console::WriteLine( "{0} inherits from {1}.", t, t->BaseType ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp b/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp deleted file mode 100644 index 9faf8c82ca5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -// -using namespace System; -int main() -{ - Type^ t = Array::typeid; - Console::WriteLine( "The full name of the Array type is {0}.", t->FullName ); -} - -/* This example produces the following output: - -The full name of the Array type is System.Array. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp b/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp deleted file mode 100644 index 801fb6bb503..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -public ref class TestGetElementType{}; - -int main() -{ - array^array = {1,2,3}; - Type^ t = array->GetType(); - Type^ t2 = t->GetElementType(); - Console::WriteLine( "The element type of {0} is {1}.", array, t2 ); - TestGetElementType^ newMe = gcnew TestGetElementType; - t = newMe->GetType(); - t2 = t->GetElementType(); - Console::WriteLine( "The element type of {0} is {1}.", newMe, t2 == nullptr ? "null" : t2->ToString() ); -} - -/* This code produces the following output: - -The element type of System.Int32[] is System.Int32. -The element type of TestGetElementType is null. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp deleted file mode 100644 index aea549667ea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -ref class Room -{ -}; - -ref class Kitchen : Room -{ -}; - -ref class Bedroom : Room -{ -}; - -ref class Guestroom : Bedroom -{ -}; - -ref class MasterBedroom : Bedroom -{ -}; - -ref class Program -{ -public: - static void Main() - { - // Demonstrate classes: - Console::WriteLine("Defined Classes:"); - Room^ room1 = gcnew Room(); - Kitchen^ kitchen1 = gcnew Kitchen(); - Bedroom^ bedroom1 = gcnew Bedroom(); - Guestroom^ guestroom1 = gcnew Guestroom(); - MasterBedroom^ masterbedroom1 = gcnew MasterBedroom(); - - Type^ room1Type = room1->GetType(); - Type^ kitchen1Type = kitchen1->GetType(); - Type^ bedroom1Type = bedroom1->GetType(); - Type^ guestroom1Type = guestroom1->GetType(); - Type^ masterbedroom1Type = masterbedroom1->GetType(); - - Console::WriteLine("room assignable from kitchen: {0}", room1Type->IsAssignableFrom(kitchen1Type)); - Console::WriteLine("bedroom assignable from guestroom: {0}", bedroom1Type->IsAssignableFrom(guestroom1Type)); - Console::WriteLine("kitchen assignable from masterbedroom: {0}", kitchen1Type->IsAssignableFrom(masterbedroom1Type)); - - // Demonstrate arrays: - Console::WriteLine(); - Console::WriteLine("Integer arrays:"); - array^ array2 = gcnew array(2); - array^ array10 = gcnew array(10); - array^ array22 = gcnew array(2, 2); - array^ array24 = gcnew array(2, 4); - - Type^ array2Type = array2->GetType(); - Type^ array10Type = array10->GetType(); - Type^ array22Type = array22->GetType(); - Type^ array24Type = array24->GetType(); - - Console::WriteLine("Int32[2] assignable from Int32[10]: {0}", array2Type->IsAssignableFrom(array10Type)); - Console::WriteLine("Int32[2] assignable from Int32[2,4]: {0}", array2Type->IsAssignableFrom(array24Type)); - Console::WriteLine("Int32[2,4] assignable from Int32[2,2]: {0}", array24Type->IsAssignableFrom(array22Type)); - - // Demonstrate generics: - Console::WriteLine(); - Console::WriteLine("Generics:"); - - // Note that "int?[]" is the same as "Nullable[]" - //int?[] arrayNull = new int?[10]; - array^ arrayNull = gcnew array(10); - List^ genIntList = gcnew List(); - List^ genTList = gcnew List(); - - Type^ arrayNullType = arrayNull->GetType(); - Type^ genIntListType = genIntList->GetType(); - Type^ genTListType = genTList->GetType(); - - Console::WriteLine("Int32[10] assignable from Nullable[10]: {0}", array10Type->IsAssignableFrom(arrayNullType)); - Console::WriteLine("List assignable from List: {0}", genIntListType->IsAssignableFrom(genTListType)); - Console::WriteLine("List assignable from List: {0}", genTListType->IsAssignableFrom(genIntListType)); - - Console::ReadLine(); - } -}; - -int main() -{ - Program::Main(); -} - -//This code example produces the following output: -// -// Defined Classes: -// room assignable from kitchen: True -// bedroom assignable from guestroom: True -//kitchen assignable from masterbedroom: False -// -// Integer arrays: -// Int32[2] assignable from Int32[10]: True -// Int32[2] assignable from Int32[2,4]: False -// Int32[2,4] assignable from Int32[2,2]: True -// -// Generics: -// Int32[10] assignable from Nullable[10]: False -// List assignable from List: False -// List assignable from List: False -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp deleted file mode 100644 index 9c1f8344454..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -enum class Color -{ Red, Blue, Green }; - -int main() -{ - Type^ colorType = Color::typeid; - Type^ enumType = Enum::typeid; - Console::WriteLine( "Is Color an enum? {0}.", colorType->IsEnum ); - Console::WriteLine( "Is Color a value type? {0}.", colorType->IsValueType ); - Console::WriteLine( "Is Enum an enum Type? {0}.", enumType->IsEnum ); - Console::WriteLine( "Is Enum a value type? {0}.", enumType->IsValueType ); -} -// The example displays the following output: -// Is Color an enum? True. -// Is Color a value type? True. -// Is Enum an enum type? False. -// Is Enum a value type? False. -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp deleted file mode 100644 index b2152ac3fa7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; - -public interface class IExample{}; - -public ref class BaseClass: IExample{}; - -public ref class DerivedClass: BaseClass{}; - -void main() -{ - Type^ interfaceType = IExample::typeid; - BaseClass^ base1 = gcnew BaseClass; - Type^ base1Type = base1->GetType(); - BaseClass^ derived1 = gcnew DerivedClass; - Type^ derived1Type = derived1->GetType(); - array^ arr = gcnew array(11); - Type^ arrayType = Array::typeid; - - Console::WriteLine("Is Int32[] an instance of the Array class? {0}.", - arrayType->IsInstanceOfType( arr ) ); - Console::WriteLine("Is myclass an instance of BaseClass? {0}.", - base1Type->IsInstanceOfType( base1 ) ); - Console::WriteLine("Is myderivedclass an instance of BaseClass? {0}.", - base1Type->IsInstanceOfType( derived1 ) ); - Console::WriteLine("Is myclass an instance of IExample? {0}.", - interfaceType->IsInstanceOfType( base1 ) ); - Console::WriteLine("Is myderivedclass an instance of IExample? {0}.", - interfaceType->IsInstanceOfType( derived1 ) ); -} -// The example displays the following output: -// Is int[] an instance of the Array class? True. -// Is base1 an instance of BaseClass? True. -// Is derived1 an instance of BaseClass? True. -// Is base1 an instance of IExample? True. -// Is derived1 an instance of IExample? True. -// diff --git a/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp b/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp deleted file mode 100644 index 29339b956eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -// This example demonstrates the use of the TimeoutException -// exception in conjunction with the SerialPort class. - -#using - -using namespace System; -using namespace System::IO::Ports; - -int main() -{ - String^ input; - try - { - // Set the COM1 serial port to speed = 4800 baud, parity = odd, - // data bits = 8, stop bits = 1. - SerialPort^ port = gcnew SerialPort("COM1", - 4800, Parity::Odd, 8, StopBits::One); - // Timeout after 2 seconds. - port->ReadTimeout = 2000; - port->Open(); - - // Read until either the default newline termination string - // is detected or the read operation times out. - input = port->ReadLine(); - - port->Close(); - - // Echo the input. - Console::WriteLine(input); - } - - // Only catch timeout exceptions. - catch (TimeoutException^ ex) - { - Console::WriteLine(ex); - } -}; -/* -This example produces the following results: - -(Data received at the serial port is echoed to the console if the -read operation completes successfully before the specified timeout period -expires. Otherwise, a timeout exception like the following is thrown.) - -System.TimeoutException: The operation has timed-out. -at System.IO.Ports.SerialStream.ReadByte(Int32 timeout) -at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout) -at System.IO.Ports.SerialPort.ReadTo(String value) -at System.IO.Ports.SerialPort.ReadLine() -at Sample.Main() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp b/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp deleted file mode 100644 index 813adf57610..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; - -// Declare MyTestClass as public. -public ref class TestClass{}; - -int main() -{ - TestClass^ testClassInstance = gcnew TestClass; - - // Get the type of myTestClassInstance. - Type^ testType = testClassInstance->GetType(); - - // Get the IsPublic property of the myTestClassInstance. - bool isPublic = testType->IsPublic; - Console::WriteLine( "Is {0} public? {1}", testType->FullName, isPublic); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp deleted file mode 100644 index 3f49f739983..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::InteropServices; -value struct Test1 -{ -public: - Byte B1; - short S; - Byte B2; -}; - - -[StructLayout(LayoutKind::Explicit,Pack=1)] -value struct Test2 -{ -public: - - [FieldOffset(0)] - Byte B1; - - [FieldOffset(1)] - short S; - - [FieldOffset(3)] - Byte B2; -}; - -static void DisplayLayoutAttribute( StructLayoutAttribute^ sla ) -{ - Console::WriteLine( L"\r\nCharSet: {0}\r\n Pack: {1}\r\n Size: {2}\r\n Value: {3}", sla->CharSet, sla->Pack, sla->Size, sla->Value ); -} - -int main() -{ - DisplayLayoutAttribute( Test1::typeid->StructLayoutAttribute ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp deleted file mode 100644 index cb8e0c58917..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; - -class TypeLoadExceptionDemoClass -{ - public: - static bool GenerateException() - { - // Throw a TypeLoadException with a custom message. - throw gcnew TypeLoadException("This is a custom TypeLoadException error message."); - } -}; - -int main() -{ - try { - // Call a method that throws an exception. - TypeLoadExceptionDemoClass::GenerateException(); - } - catch ( TypeLoadException^ e ) { - Console::WriteLine("TypeLoadException:\n {0}", e->Message); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message ); - } - -} -// The example displays the following output: -// TypeLoadException: -// This is a custom TypeLoadException error message. -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp deleted file mode 100644 index 649e2fc5034..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// System::TypeLoadException::TypeLoadException -/* This program demonstrates the 'TypeLoadException(String*, Exception)' - constructor of 'TypeLoadException' class. It attempts to call a - non-existent method located in NonExistentDLL.dll, which will - throw an exception. A new exception is thrown with this exception - as an inner exception. -*/ -// -using namespace System; -using namespace System::Runtime::InteropServices; -ref class TypeLoadExceptionDemoClass -{ -public: - - // A call to this method will raise a TypeLoadException. - - [DllImport("NonExistentDLL.DLL",EntryPoint="MethodNotExists")] - static void NonExistentMethod(); - static void GenerateException() - { - try - { - NonExistentMethod(); - } - catch ( TypeLoadException^ e ) - { - - // Rethrow exception with the exception as inner exception - throw gcnew TypeLoadException( "This exception was raised due to a call to an invalid method.",e ); - } - - } - -}; - -int main() -{ - Console::WriteLine( "Calling a method in a non-existent DLL which triggers a TypeLoadException." ); - try - { - TypeLoadExceptionDemoClass::GenerateException(); - } - catch ( TypeLoadException^ e ) - { - Console::WriteLine( "TypeLoadException: \n\tError Message = {0}", e->Message ); - Console::WriteLine( "TypeLoadException: \n\tInnerException Message = {0}", e->InnerException->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp deleted file mode 100644 index 6b8fd92068e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp +++ /dev/null @@ -1,112 +0,0 @@ - - -// System::TypeLoadException::GetObjectData -// System::TypeLoadException -/* This program demonstrates the 'GetObjectData' method and the - protected constructor TypeLoadException(SerializationInfo, StreamingContext) - of 'TypeLoadException' class. It generates an exception and - serializes the exception data to a file and then reconstitutes the - exception. -*/ -// -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Serialization::Formatters::Soap; -using namespace System::IO; - -// This class overrides the GetObjectData method and initializes -// its data with current time. - -[Serializable] -public ref class MyTypeLoadExceptionChild: public TypeLoadException -{ -public: - System::DateTime ErrorDateTime; - MyTypeLoadExceptionChild() - { - ErrorDateTime = DateTime::Now; - } - - MyTypeLoadExceptionChild( DateTime myDateTime ) - { - ErrorDateTime = myDateTime; - } - - -protected: - MyTypeLoadExceptionChild( SerializationInfo^ sInfo, StreamingContext * sContext ) - { - - // Reconstitute the deserialized information into the instance. - ErrorDateTime = sInfo->GetDateTime( "ErrorDate" ); - } - - -public: - void GetObjectData( SerializationInfo^ sInfo, StreamingContext * sContext ) - { - - // Add a value to the Serialization information. - sInfo->AddValue( "ErrorDate", ErrorDateTime ); - } - -}; - -int main() -{ - - // Load the mscorlib assembly and get a reference to it. - // You must supply the fully qualified assembly name for mscorlib.dll here. - Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" ); - try - { - Console::WriteLine( "Attempting to load a type not present in the assembly 'mscorlib'" ); - - // This loading of invalid type raises a TypeLoadException - Type^ myType = myAssembly->GetType( "System::NonExistentType", true ); - } - catch ( TypeLoadException^ ) - { - - // Serialize the exception to disk and reconstitute it back again. - try - { - System::DateTime ErrorDatetime = DateTime::Now; - Console::WriteLine( "A TypeLoadException has been raised." ); - - // Create MyTypeLoadException instance with current time. - MyTypeLoadExceptionChild^ myTypeLoadExceptionChild = gcnew MyTypeLoadExceptionChild( ErrorDatetime ); - IFormatter^ myFormatter = gcnew SoapFormatter; - Stream^ myFileStream = gcnew FileStream( "typeload.xml",FileMode::Create,FileAccess::Write,FileShare::None ); - Console::WriteLine( "Serializing the TypeLoadException with DateTime as {0}", ErrorDatetime ); - - // Serialize the MyTypeLoadException instance to a file. - myFormatter->Serialize( myFileStream, myTypeLoadExceptionChild ); - myFileStream->Close(); - Console::WriteLine( "Deserializing the Exception." ); - myFileStream = gcnew FileStream( "typeload.xml",FileMode::Open,FileAccess::Read,FileShare::None ); - - // Deserialize and reconstitute the instance from file. - myTypeLoadExceptionChild = safe_cast(myFormatter->Deserialize( myFileStream )); - myFileStream->Close(); - Console::WriteLine( "Deserialized exception has ErrorDateTime = {0}", myTypeLoadExceptionChild->ErrorDateTime ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp deleted file mode 100644 index 102cf32f110..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// System::TypeLoadException::TypeName;System::TypeLoadException::Message - -/* This program demonstrates the 'TypeName' and 'Message' properties - of the 'TypeLoadException' class. It attempts to load a - non-existent type from the mscorlib assembly which throws an - exception. This exception is caught and the TypeName and Message - values are displayed. -*/ - -using namespace System; -using namespace System::Reflection; - -int main() -{ - // - // - // Load the mscorlib assembly and get a reference to it. - // You must supply the fully qualified assembly name for mscorlib.dll here. - Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" ); - try - { - Console::WriteLine( "This program throws an exception upon successful run." ); - - // Attempt to load a non-existent type from an assembly. - Type^ myType = myAssembly->GetType( "System.NonExistentType", true ); - } - catch ( TypeLoadException^ e ) - { - // Display the name of the Type that was not found. - Console::WriteLine( "TypeLoadException: \n\tError loading the type '{0}' from the assembly 'mscorlib'", e->TypeName ); - Console::WriteLine( "\tError Message = {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: Error Message = {0}", e->Message ); - } - // - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp deleted file mode 100644 index 4ae236700c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Type^ objType = System::Array::typeid; - - // Print the full assembly name. - Console::WriteLine( "Full assembly name: {0}.", objType->Assembly->FullName ); - - // Print the qualified assembly name. - Console::WriteLine( "Qualified assembly name: {0}.", objType->AssemblyQualifiedName ); -} -// The example displays the following output if run under the .NET Framework 4.5: -// Full assembly name: -// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. -// Qualified assembly name: -// System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp b/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp deleted file mode 100644 index f9301b87911..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -public: - void HelloWorld() - { - Console::WriteLine( "Hello World" ); - } - -}; - -int main() -{ - try - { - Binder^ defaultBinder = Type::DefaultBinder; - MyClass^ myClass = gcnew MyClass; - - // Invoke the HelloWorld method of MyClass. - myClass->GetType()->InvokeMember( "HelloWorld", BindingFlags::InvokeMethod, defaultBinder, myClass, nullptr ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp deleted file mode 100644 index bcb5e2a58a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; -using namespace System::Security; -int main() -{ - try - { - MemberFilter^ myFilter = Type::FilterAttribute; - Type^ myType = System::String::typeid; - array^myMemberInfoArray = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, MethodAttributes::SpecialName ); - IEnumerator^ myEnum = myMemberInfoArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MemberInfo^ myMemberinfo = safe_cast(myEnum->Current); - Console::Write( "\n {0}", myMemberinfo->Name ); - Console::Write( " is a {0}", myMemberinfo->MemberType ); - } - } - catch ( ArgumentNullException^ e ) - { - Console::Write( "ArgumentNullException : {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::Write( "SecurityException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::Write( "Exception : {0}", e->Message ); - } - -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp deleted file mode 100644 index 38bf38a1528..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; -using namespace System::Security; -int main() -{ - try - { - MemberFilter^ myFilter = Type::FilterNameIgnoreCase; - Type^ myType = System::String::typeid; - array^myMemberinfo1 = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, "C*" ); - IEnumerator^ myEnum = myMemberinfo1->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MemberInfo^ myMemberinfo2 = safe_cast(myEnum->Current); - Console::Write( "\n {0}", myMemberinfo2->Name ); - MemberTypes Mymembertypes = myMemberinfo2->MemberType; - Console::WriteLine( " is a {0}", Mymembertypes ); - } - } - catch ( ArgumentNullException^ e ) - { - Console::Write( "ArgumentNullException : {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::Write( "SecurityException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::Write( "Exception : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp deleted file mode 100644 index 12d2c367f57..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Reflection; -public ref class MyFindInterfacesSample -{ -public: - static bool MyInterfaceFilter(Type^ typeObj, Object^ criteriaObj) - { - if(typeObj->ToString()->Equals(criteriaObj->ToString())) - return true; - else - return false; - } -}; - -int main() -{ - try - { - XmlDocument^ myXMLDoc = gcnew XmlDocument; - myXMLDoc->LoadXml("" - + "Pride And Prejudice "); - Type^ myType = myXMLDoc->GetType(); - - // Specify the TypeFilter delegate that compares the interfaces - // against filter criteria. - TypeFilter^ myFilter = gcnew TypeFilter( - MyFindInterfacesSample::MyInterfaceFilter); - array^myInterfaceList = {"System.Collections.IEnumerable", - "System.Collections.ICollection"}; - for(int index = 0; index < myInterfaceList->Length; index++) - { - array^myInterfaces = myType->FindInterfaces( - myFilter, myInterfaceList[index]); - if(myInterfaces->Length > 0) - { - Console::WriteLine("\n{0} implements the interface {1}.", - myType, myInterfaceList[index]); - for(int j = 0; j < myInterfaces->Length; j++) - Console::WriteLine("Interfaces supported: {0}.", - myInterfaces[j]); - } - else - Console::WriteLine( - "\n{0} does not implement the interface {1}.", - myType, myInterfaceList[index]); - - } - } - catch(ArgumentNullException^ e) - { - Console::WriteLine("ArgumentNullException: {0}", e->Message); - } - catch(TargetInvocationException^ e) - { - Console::WriteLine("TargetInvocationException: {0}", e->Message); - } - catch(Exception^ e) - { - Console::WriteLine("Exception: {0}", e->Message); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp deleted file mode 100644 index 759df40e831..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyFindMembersClass -{ -public: - static void Test() - { - Object^ objTest = gcnew Object; - Type^ objType = objTest->GetType(); - array^arrayMemberInfo; - try - { - - //Find all static or public methods in the Object class that match the specified name. - arrayMemberInfo = objType->FindMembers( MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), gcnew MemberFilter( DelegateToSearchCriteria ), "ReferenceEquals" ); - for ( int index = 0; index < arrayMemberInfo->Length; index++ ) - Console::WriteLine( "Result of FindMembers -\t {0}", String::Concat( arrayMemberInfo[ index ], "\n" ) ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e ); - } - - } - - static bool DelegateToSearchCriteria( MemberInfo^ objMemberInfo, Object^ objSearch ) - { - - // Compare the name of the member function with the filter criteria. - if ( objMemberInfo->Name->Equals( objSearch->ToString() ) ) - return true; - else - return false; - } - -}; - -int main() -{ - MyFindMembersClass::Test(); -} -/* The example produces the following output: - -Result of FindMembers - Boolean ReferenceEquals(System.Object, System.Object) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp deleted file mode 100644 index 0917b237224..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - array^myArray = gcnew array(3,4,5); - Type^ myType = myArray->GetType(); - Console::WriteLine( "myArray has {0} dimensions.", myType->GetArrayRank() ); - } - catch ( NotSupportedException^ e ) - { - Console::WriteLine( "NotSupportedException raised." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp deleted file mode 100644 index b0cdfecb09c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -public ref class MyClass1 -{ -public: - MyClass1(){} - - MyClass1( int i ){} - -}; - -int main() -{ - try - { - Type^ myType = MyClass1::typeid; - array^types = gcnew array(1); - types[ 0 ] = int::typeid; - - // Get the constructor that takes an integer as a parameter. - ConstructorInfo^ constructorInfoObj = myType->GetConstructor( types ); - if ( constructorInfoObj != nullptr ) - { - Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is: " ); - Console::WriteLine( constructorInfoObj ); - } - else - { - Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is not available." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp deleted file mode 100644 index 66f4064a45d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -public ref class MyClass1 -{ -public: - MyClass1( int i ){} - -}; - -int main() -{ - try - { - Type^ myType = MyClass1::typeid; - array^types = gcnew array(1); - types[ 0 ] = int::typeid; - - // Get the constructor that is public and takes an integer parameter. - ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast(BindingFlags::Instance | BindingFlags::Public), nullptr, types, nullptr ); - if ( constructorInfoObj != nullptr ) - { - Console::WriteLine( "The constructor of MyClass1 that is public and takes an integer as a parameter is:" ); - Console::WriteLine( constructorInfoObj ); - } - else - { - Console::WriteLine( "The constructor of the MyClass1 that is public and takes an integer as a parameter is not available." ); - } - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e->Message ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( "ArgumentException: {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp deleted file mode 100644 index f6faf3d5c38..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -int main() -{ - try - { - Type^ myType = System::Windows::Forms::Button::typeid; - EventInfo^ myEvent = myType->GetEvent( "Click" ); - if ( myEvent != nullptr ) - { - Console::WriteLine( "Looking for the Click event in the Button class." ); - Console::WriteLine( myEvent ); - } - else - Console::WriteLine( "The Click event is not available in the Button class." ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp deleted file mode 100644 index 1921939e115..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -public ref class MyFieldClassA -{ -public: - String^ field; - MyFieldClassA() - { - field = "A Field"; - } - - - property String^ Field - { - String^ get() - { - return field; - } - - void set( String^ value ) - { - if ( field != value ) - { - field = value; - } - } - - } - -}; - -public ref class MyFieldClassB -{ -public: - String^ field; - MyFieldClassB() - { - field = "B Field"; - } - - - property String^ Field - { - String^ get() - { - return field; - } - - void set( String^ value ) - { - if ( field != value ) - { - field = value; - } - } - - } - -}; - -int main() -{ - try - { - MyFieldClassB^ myFieldObjectB = gcnew MyFieldClassB; - MyFieldClassA^ myFieldObjectA = gcnew MyFieldClassA; - Type^ myTypeA = Type::GetType( "MyFieldClassA" ); - FieldInfo^ myFieldInfo = myTypeA->GetField( "field" ); - Type^ myTypeB = Type::GetType( "MyFieldClassB" ); - FieldInfo^ myFieldInfo1 = myTypeB->GetField( "field", static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine( "The value of the field is : {0} ", myFieldInfo->GetValue( myFieldObjectA ) ); - Console::WriteLine( "The value of the field is : {0} ", myFieldInfo1->GetValue( myFieldObjectB ) ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Exception Raised!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "Exception Raised!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Raised!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp deleted file mode 100644 index 38a4f53dbdb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Security; -using namespace System::Reflection; - -int main() -{ - Type^ myType = System::Net::IPAddress::typeid; - array^myFields = myType->GetFields( static_cast(BindingFlags::Static | BindingFlags::NonPublic) ); - Console::WriteLine( "\nThe IPAddress class has the following nonpublic fields: " ); - System::Collections::IEnumerator^ myEnum = myFields->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FieldInfo^ myField = safe_cast(myEnum->Current); - Console::WriteLine( myField ); - } - - Type^ myType1 = System::Net::IPAddress::typeid; - array^myFields1 = myType1->GetFields(); - Console::WriteLine( "\nThe IPAddress class has the following public fields: " ); - System::Collections::IEnumerator^ myEnum2 = myFields1->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - FieldInfo^ myField = safe_cast(myEnum2->Current); - Console::WriteLine( myField ); - } - - try - { - Console::WriteLine( "The HashCode of the System::Windows::Forms::Button type is: {0}", System::Windows::Forms::Button::typeid->GetHashCode() ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp deleted file mode 100644 index 6bd012509e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -/* -System::Type::GetInterface(String) -System::Type::GetInterface(String, bool) -System::Type::GetInterfaceMap - -The following program get the type of Hashtable class and searches for the interface -with the specified name. Then prints the method name of that interface. -*/ -using namespace System; -using namespace System::Reflection; -using namespace System::Collections; - -// -// -// -int main() -{ - Hashtable^ hashtableObj = gcnew Hashtable; - Type^ objType = hashtableObj->GetType(); - array^arrayMemberInfo; - array^arrayMethodInfo; - try - { - // Get the methods implemented in 'IDeserializationCallback' interface. - arrayMethodInfo = objType->GetInterface( "IDeserializationCallback" )->GetMethods(); - Console::WriteLine( "\nMethods of 'IDeserializationCallback' Interface :" ); - for ( int index = 0; index < arrayMethodInfo->Length; index++ ) - Console::WriteLine( arrayMethodInfo[ index ] ); - - // Get FullName for interface by using Ignore case search. - Console::WriteLine( "\nMethods of 'IEnumerable' Interface" ); - arrayMethodInfo = objType->GetInterface( "ienumerable", true )->GetMethods(); - for ( int index = 0; index < arrayMethodInfo->Length; index++ ) - Console::WriteLine( arrayMethodInfo[ index ] ); - - //Get the Interface methods for 'IDictionary*' interface - InterfaceMapping interfaceMappingObj; - interfaceMappingObj = objType->GetInterfaceMap( IDictionary::typeid ); - arrayMemberInfo = interfaceMappingObj.InterfaceMethods; - Console::WriteLine( "\nHashtable class Implements the following IDictionary Interface methods :" ); - for ( int index = 0; index < arrayMemberInfo->Length; index++ ) - Console::WriteLine( arrayMemberInfo[ index ] ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e ); - } -} -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp deleted file mode 100644 index d6ba8989b72..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - Console::WriteLine("\r\nInterfaces implemented by Dictionary:\r\n"); - - for each (Type^ tinterface in Dictionary::typeid->GetInterfaces()) - { - Console::WriteLine(tinterface->ToString()); - } - - //Console::ReadLine() // Uncomment this line for Visual Studio. -} - -/* This example produces output similar to the following: - -Interfaces implemented by Dictionary: - -System.Collections.Generic.IDictionary`2[System.Int32,System.String] -System.Collections.Generic.ICollection`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]] -System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]] -System.Collection.IEnumerable -System.Collection.IDictionary -System.Collection.ICollection -System.Runtime.Serialization.ISerializable -System.Runtime.Serialization.IDeserializationCallback - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp deleted file mode 100644 index 509f20ff956..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Reflection; - -// forward declarations: -void GetMemberInfo(); -void GetPublicStaticMemberInfo(); -void GetPublicInstanceMethodMemberInfo(); -int main() -{ - try - { - GetMemberInfo(); - GetPublicStaticMemberInfo(); - GetPublicInstanceMethodMemberInfo(); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( NotSupportedException^ e ) - { - Console::WriteLine( "NotSupportedException occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -void GetMemberInfo() -{ - String^ myString = "GetMember_String"; - Type^ myType = myString->GetType(); - - // Get the members for myString starting with the letter C. - array^myMembers = myType->GetMember( "C*" ); - if ( myMembers->Length > 0 ) - { - Console::WriteLine( "\nThe member(s) starting with the letter C for type {0}:", myType ); - for ( int index = 0; index < myMembers->Length; index++ ) - Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); - } - else - Console::WriteLine( "No members match the search criteria." ); -} -// - -// -void GetPublicStaticMemberInfo() -{ - String^ myString = "GetMember_String_BindingFlag"; - Type^ myType = myString->GetType(); - - // Get the public static members for the class myString starting with the letter C - array^myMembers = myType->GetMember( "C*", static_cast(BindingFlags::Public | BindingFlags::Static) ); - if ( myMembers->Length > 0 ) - { - Console::WriteLine( "\nThe public static member(s) starting with the letter C for type {0}:", myType ); - for ( int index = 0; index < myMembers->Length; index++ ) - Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); - } - else - Console::WriteLine( "No members match the search criteria." ); -} -// - -// -void GetPublicInstanceMethodMemberInfo() -{ - String^ myString = "GetMember_String_MemberType_BindingFlag"; - Type^ myType = myString->GetType(); - - // Get the public instance methods for myString starting with the letter C. - array^myMembers = myType->GetMember( "C*", MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Instance) ); - if ( myMembers->Length > 0 ) - { - Console::WriteLine( "\nThe public instance method(s) starting with the letter C for type {0}:", myType ); - for ( int index = 0; index < myMembers->Length; index++ ) - Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); - } - else - Console::WriteLine( "No members match the search criteria." ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp deleted file mode 100644 index f80aa9bb4c3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// System::Type::GetMembers() -/* -This program demonstrates GetMembers() method of System::Type Class. -Get the members (properties, methods, fields, events, and so on) -of the class 'MyClass' and displays the same to the console. -*/ -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -// -ref class MyClass -{ -public: - int myInt; - String^ myString; - MyClass(){} - - void Myfunction(){} - -}; - -int main() -{ - try - { - MyClass^ myObject = gcnew MyClass; - array^myMemberInfo; - - // Get the type of 'MyClass'. - Type^ myType = myObject->GetType(); - - // Get the information related to all public members of 'MyClass'. - myMemberInfo = myType->GetMembers(); - Console::WriteLine( "\nThe members of class '{0}' are :\n", myType ); - for ( int i = 0; i < myMemberInfo->Length; i++ ) - { - - // Display name and type of the concerned member. - Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp deleted file mode 100644 index 41bb6aea10f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// System::Type::GetMembers(BindingFlags) -/* -This program demonstrates 'GetMembers(BindingFlags)' method of -System::Type Class. This will get all the public instance members -declared or inherited by this type and displays the members to -the console. -*/ -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -// -ref class MyClass -{ -public: - int * myInt; - String^ myString; - MyClass(){} - - void Myfunction(){} - -}; - -int main() -{ - try - { - MyClass^ MyObject = gcnew MyClass; - array^myMemberInfo; - - // Get the type of the class 'MyClass'. - Type^ myType = MyObject->GetType(); - - // Get the public instance members of the class 'MyClass'. - myMemberInfo = myType->GetMembers( static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine( "\nThe public instance members of class '{0}' are : \n", myType ); - for ( int i = 0; i < myMemberInfo->Length; i++ ) - { - - // Display name and type of the member of 'MyClass'. - Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException : {0}", e->Message ); - } - - - //Output: - //The public instance members of class 'MyClass' are : - - //'Myfunction' is a Method - //'ToString' is a Method - //'Equals' is a Method - //'GetHashCode' is a Method - //'GetType' is a Method - //'.ctor' is a Constructor - //'myInt' is a Field - //'myString' is a Field - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp deleted file mode 100644 index baf1615c7c0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class Program -{ - - public: - - // Method to get: - void MethodA() { } - - }; - - int main() - { - - // Get MethodA() - MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA"); - Console::WriteLine("Found method: {0}", mInfo ); - - } -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp deleted file mode 100644 index b4f0669dc23..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class Program -{ - - public: - - // Method to get: - void MethodA() { } - - }; - - int main() - { - - // Get MethodA() - MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance)); - Console::WriteLine("Found method: {0}", mInfo ); - - } -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp deleted file mode 100644 index 635d6dcd96c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Program -{ - -public: - // Methods to get: - - void MethodA(int i, int j) { } - - void MethodA(array^ iarry) { } - - void MethodA(double *ip) { } - - // Method that takes a managed reference paramter. - void MethodA(int% r) {} -}; - -int main() -{ - MethodInfo^ mInfo; - - - // Get MethodA(int i, int j) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {int::typeid, int::typeid}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(array^ iarry) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {int::typeid->MakeArrayType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(double *ip) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {double::typeid->MakePointerType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(int% r) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {int::typeid->MakeByRefType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp deleted file mode 100644 index 5e67e5d4695..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class Program -{ - -public: - // Methods to get: - - void MethodA(int i, int j) { } - - void MethodA(array^ iarry) { } - - void MethodA(double *ip) { } - - // Method that takes a managed reference parameter. - void MethodA(int% r) {} -}; - -int main() -{ - MethodInfo^ mInfo; - - - // Get MethodA(int i, int j) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid,int::typeid}); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(array^ iarry) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeArrayType()}); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(double *ip) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {double::typeid->MakePointerType()}); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(int% r) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeByRefType()}); - // Display the method information. - Console::WriteLine("Found method: {0}", mInfo ); - -} -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp deleted file mode 100644 index 8fb1d143de6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Program -{ - -public: - // Methods to get: - - void MethodA(int i, int j) { } - - void MethodA(array^ iarry) { } - - void MethodA(double *ip) { } - - // Method that takes a managed reference parameter. - void MethodA(int% r) {} -}; - -int main() -{ - MethodInfo^ mInfo; - - - // Get MethodA(int i, int j) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {int::typeid, int::typeid}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(array^ iarry) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {int::typeid->MakeArrayType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(double *ip) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {double::typeid->MakePointerType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(int% r) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {int::typeid->MakeByRefType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp deleted file mode 100644 index c249289de27..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// Create a class having two public methods and one protected method. -public ref class MyTypeClass -{ -public: - void MyMethods(){} - - int MyMethods1() - { - return 3; - } - - -protected: - String^ MyMethods2() - { - return "hello"; - } -}; - -void DisplayMethodInfo( array^myArrayMethodInfo ) -{ - // Display information for all methods. - for ( int i = 0; i < myArrayMethodInfo->Length; i++ ) - { - MethodInfo^ myMethodInfo = dynamic_cast(myArrayMethodInfo[ i ]); - Console::WriteLine( "\nThe name of the method is {0}.", myMethodInfo->Name ); - } -} - -int main() -{ - Type^ myType = MyTypeClass::typeid; - - // Get the public methods. - array^myArrayMethodInfo = myType->GetMethods( static_cast(BindingFlags::Public | BindingFlags::Instance | BindingFlags::DeclaredOnly) ); - Console::WriteLine( "\nThe number of public methods is {0}->", myArrayMethodInfo->Length ); - - // Display all the methods. - DisplayMethodInfo( myArrayMethodInfo ); - - // Get the nonpublic methods. - array^myArrayMethodInfo1 = myType->GetMethods( static_cast(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly) ); - Console::WriteLine( "\nThe number of protected methods is {0}->", myArrayMethodInfo1->Length ); - - // Display information for all methods. - DisplayMethodInfo( myArrayMethodInfo1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp deleted file mode 100644 index 8c37fe7a44c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Create a class with two nested public classes and two nested protected classes. -public ref class MyTypeClass -{ - public: - ref class Myclass1{}; - - public: - ref class Myclass2{}; - - protected: - ref class MyClass3{}; - - protected: - ref class MyClass4{}; -}; - -void DisplayTypeInfo(array^ myArrayType) -{ - // Display the information for all the nested classes. - for each (Type^ t in myArrayType) - Console::WriteLine( "The name of the nested class is {0}.", t->FullName); -} - -int main() -{ - Type^ myType = MyTypeClass::typeid; - - // Get the public nested classes. - array^myTypeArray = myType->GetNestedTypes( static_cast(BindingFlags::Public)); - Console::WriteLine( "The number of nested public classes is {0}.", myTypeArray->Length ); - - // Display all the public nested classes. - DisplayTypeInfo( myTypeArray ); - Console::WriteLine(); - - // Get the nonpublic nested classes. - array^myTypeArray1 = myType->GetNestedTypes( static_cast(BindingFlags::NonPublic)); - Console::WriteLine( "The number of nested protected classes is {0}.", myTypeArray1->Length ); - - // Display all the nonpublic nested classes. - DisplayTypeInfo( myTypeArray1 ); -} -// The example displays the following output: -// The number of public nested classes is 2. -// The name of the nested class is MyTypeClass+Myclass1. -// The name of the nested class is MyTypeClass+Myclass2. -// -// The number of protected nested classes is 2. -// The name of the nested class is MyTypeClass+MyClass3. -// The name of the nested class is MyTypeClass+MyClass4. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp deleted file mode 100644 index 53d43153bd8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyClass -{ -public: - ref class NestClass - { - public: - static int myPublicInt = 0; - }; - - ref struct NestStruct - { - public: - static int myPublicInt = 0; - }; -}; - -int main() -{ - try - { - // Get the Type object corresponding to MyClass. - Type^ myType = MyClass::typeid; - - // Get an array of nested type objects in MyClass. - array^nestType = myType->GetNestedTypes(); - Console::WriteLine( "The number of nested types is {0}.", nestType->Length ); - System::Collections::IEnumerator^ myEnum = nestType->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ t = safe_cast(myEnum->Current); - Console::WriteLine( "Nested type is {0}.", t ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp deleted file mode 100644 index 9be794b12cf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Create a class having three properties. -public ref class PropertyClass -{ - -public: - property String^ Property1 - { - String^ get() - { - return "hello"; - } - } - - property String^ Property2 - { - String^ get() - { - return "hello"; - } - } - -protected: - property String^ Property3 - { - String^ get() - { - return "hello"; - } - } - -private: - property int Property4 - { - int get() - { - return 32; - } - } - -internal: - property String^ Property5 - { - String^ get() - { - return "value"; - } - } - -public protected: - property String^ Property6 - { - String^ get() - { - return "value"; - } - } -}; - -String^ GetVisibility(MethodInfo^ accessor) -{ - if (accessor->IsPublic) - return "Public"; - else if (accessor->IsPrivate) - return "Private"; - else if (accessor->IsFamily) - return "Protected"; - else if (accessor->IsAssembly) - return "Internal/Friend"; - else - return "Protected Internal/Friend"; -} - -void DisplayPropertyInfo(array^ propInfos ) -{ - // Display information for all properties. - for each(PropertyInfo^ propInfo in propInfos) { - bool readable = propInfo->CanRead; - bool writable = propInfo->CanWrite; - - Console::WriteLine(" Property name: {0}", propInfo->Name); - Console::WriteLine(" Property type: {0}", propInfo->PropertyType); - Console::WriteLine(" Read-Write: {0}", readable && writable); - if (readable) { - MethodInfo^ getAccessor = propInfo->GetMethod; - Console::WriteLine(" Visibility: {0}", - GetVisibility(getAccessor)); - } - if (writable) { - MethodInfo^ setAccessor = propInfo->SetMethod; - Console::WriteLine(" Visibility: {0}", - GetVisibility(setAccessor)); - } - Console::WriteLine(); - } -} - -void main() -{ - Type^ myType = PropertyClass::typeid; - - // Get the public properties. - array^propInfos = myType->GetProperties( static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine("The number of public properties: {0}.\n", - propInfos->Length); - // Display the public properties. - DisplayPropertyInfo( propInfos ); - - // Get the non-public properties. - array^propInfos1 = myType->GetProperties( static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - Console::WriteLine("The number of non-public properties: {0}.\n", - propInfos1->Length); - // Display all the non-public properties. - DisplayPropertyInfo(propInfos1); -} -// The example displays the following output: -// The number of public properties: 2. -// -// Property name: Property2 -// Property type: System.String -// Read-Write: False -// Visibility: Public -// -// Property name: Property1 -// Property type: System.String -// Read-Write: False -// Visibility: Public -// -// The number of non-public properties: 4. -// -// Property name: Property6 -// Property type: System.String -// Read-Write: False -// Visibility: Protected Internal/Friend -// -// Property name: Property5 -// Property type: System.String -// Read-Write: False -// Visibility: Internal/Friend -// -// Property name: Property4 -// Property type: System.Int32 -// Read-Write: False -// Visibility: Private -// -// Property name: Property3 -// Property type: System.String -// Read-Write: False -// Visibility: Protected -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp deleted file mode 100644 index 8ae8ea145d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -private: - int myProperty; - -public: - - property int MyProperty - { - // Declare MyProperty. - int get() - { - return myProperty; - } - - void set( int value ) - { - myProperty = value; - } - } -}; - -int main() -{ - try - { - // Get the Type object corresponding to MyClass. - Type^ myType = MyClass::typeid; - - // Get the PropertyInfo object by passing the property name. - PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty" ); - - // Display the property name. - Console::WriteLine( "The {0} property exists in MyClass.", myPropInfo->Name ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "The property does not exist in MyClass. {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp deleted file mode 100644 index 9301970d3b4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -private: - int myProperty; - -public: - - property int MyProperty - { - // Declare MyProperty. - int get() - { - return myProperty; - } - - void set( int value ) - { - myProperty = value; - } - } -}; - -int main() -{ - try - { - // Get Type object of MyClass. - Type^ myType = MyClass::typeid; - - // Get the PropertyInfo by passing the property name and specifying the BindingFlags. - PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty", static_cast(BindingFlags::Public | BindingFlags::Instance) ); - - // Display Name property to console. - Console::WriteLine( "{0} is a property of MyClass.", myPropInfo->Name ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "MyProperty does not exist in MyClass. {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp deleted file mode 100644 index 8b7ac89dba4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass1 -{ -private: - array^myArray; - -public: - - property int Item [int, int] - { - - // Declare an indexer. - int get( int i, int j ) - { - return myArray[ i,j ]; - } - - void set( int i, int j, int value ) - { - myArray[ i,j ] = value; - } - - } - -}; - -int main() -{ - try - { - - // Get the Type object. - Type^ myType = MyClass1::typeid; - array^myTypeArr = gcnew array(2); - - // Create an instance of a Type array. - myTypeArr->SetValue( int::typeid, 0 ); - myTypeArr->SetValue( int::typeid, 1 ); - - // Get the PropertyInfo object for the indexed property Item, which has two integer parameters. - PropertyInfo^ myPropInfo = myType->GetProperty( "Item", myTypeArr ); - - // Display the property. - Console::WriteLine( "The {0} property exists in MyClass1.", myPropInfo ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp deleted file mode 100644 index 905e696e9f8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyPropertyClass -{ -private: - array^ myPropertyArray; - -public: - - property int Item [int, int] - { - // Declare an indexer. - int get( int i, int j ) - { - return myPropertyArray[ i,j ]; - } - - void set( int i, int j, int value ) - { - myPropertyArray[ i,j ] = value; - } - - } - -}; - -int main() -{ - try - { - Type^ myType = MyPropertyClass::typeid; - array^myTypeArray = gcnew array(2); - - // Create an instance of the Type array representing the number, order - // and type of the parameters for the property. - myTypeArray->SetValue( int::typeid, 0 ); - myTypeArray->SetValue( int::typeid, 1 ); - - // Search for the indexed property whose parameters match the - // specified argument types and modifiers. - PropertyInfo^ myPropertyInfo = myType->GetProperty( "Item", int::typeid, myTypeArray, nullptr ); - Console::WriteLine( "{0}.{1} has a property type of {2}", myType->FullName, myPropertyInfo->Name, myPropertyInfo->PropertyType ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "An exception occurred {0}", ex->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp deleted file mode 100644 index 406346579d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass1 -{ -private: - String^ myMessage; - -public: - - property String^ MyProperty1 - { - String^ get() - { - return myMessage; - } - - void set( String^ value ) - { - myMessage = value; - } - } -}; - -int main() -{ - try - { - Type^ myType = MyClass1::typeid; - - // Get the PropertyInfo Object* representing MyProperty1. - PropertyInfo^ myStringProperties1 = myType->GetProperty( "MyProperty1", String::typeid ); - Console::WriteLine( "The name of the first property of MyClass1 is {0}.", myStringProperties1->Name ); - Console::WriteLine( "The type of the first property of MyClass1 is {0}.", myStringProperties1->PropertyType ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException : {0}", e->Message ); - } - catch ( AmbiguousMatchException^ e ) - { - Console::WriteLine( "AmbiguousMatchException : {0}", e->Message ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - //Output: - //The name of the first property of MyClass1 is MyProperty1. - //The type of the first property of MyClass1 is System.String. - -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp deleted file mode 100644 index eb10775df99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; - -int main() -{ - try { - // Get the type of a specified class. - Type^ myType1 = Type::GetType( "System.Int32" ); - Console::WriteLine( "The full name is {0}.\n", myType1->FullName ); - } - catch ( TypeLoadException^ e ) { - Console::WriteLine("{0}: Unable to load type System.Int32", - e->GetType()->Name); - } - - try { - // Since NoneSuch does not exist in this assembly, GetType throws a TypeLoadException. - Type^ myType2 = Type::GetType( "NoneSuch", true ); - Console::WriteLine( "The full name is {0}.", myType2->FullName ); - } - catch ( TypeLoadException^ e ) { - Console::WriteLine("{0}: Unable to load type NoneSuch", - e->GetType()->Name); - } - -} -// The example displays the following output: -// The full name is System.Int32. -// -// TypeLoadException: Unable to load type NoneSuch -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp deleted file mode 100644 index 4eedf13f6b4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -// System::Type::GetTypeCode() -// System::Type::GetProperties() -// System::Type::GetTypeArray() -// System::Type::GetType(String, Boolean, Boolean) -/* The following example demonstrates the 'GetTypeCode()', 'GetProperties()', 'GetTypeArray()', -'GetType(String, Boolean, Boolean)' methods of 'Type' class. -An object of 'Type' corresponding to 'System::Int32 is obtained '. Properties of 'System::Type' -is retrieved into 'PropertyInfo' array and displayed. Array of 'Type' objects is created -which represents the type specified by an arbitary set of objects. When 'Type' object is -attempted to create for 'sYSTem.iNT32', an exception is thrown when case-sensitive search -is done. -*/ -using namespace System; -using namespace System::Reflection; -int main() -{ - // - // Create an object of 'Type' class. - Type^ myType1 = Type::GetType( "System.Int32" ); - - // Get the 'TypeCode' of the 'Type' class object created above. - TypeCode myTypeCode = Type::GetTypeCode( myType1 ); - Console::WriteLine( "TypeCode is: {0}", myTypeCode ); - // - - // - array^myPropertyInfo; - - // Get the properties of 'Type' class object. - myPropertyInfo = Type::GetType( "System.Type" )->GetProperties(); - Console::WriteLine( "Properties of System.Type are:" ); - for ( int i = 0; i < myPropertyInfo->Length; i++ ) - { - Console::WriteLine( myPropertyInfo[ i ] ); - - } - // - - // - array^myObject = gcnew array(3); - myObject[ 0 ] = 66; - myObject[ 1 ] = "puri"; - myObject[ 2 ] = 33.33; - - // Get the array of 'Type' class objects. - array^myTypeArray = Type::GetTypeArray( myObject ); - Console::WriteLine( "Full names of the 'Type' objects in the array are:" ); - for ( int h = 0; h < myTypeArray->Length; h++ ) - { - Console::WriteLine( myTypeArray[ h ]->FullName ); - - } - // - - // - try - { - // Throws 'TypeLoadException' because of case-sensitive search. - Type^ myType2 = Type::GetType( "sYSTem.iNT32", true, false ); - Console::WriteLine( myType2->FullName ); - } - catch ( TypeLoadException^ e ) - { - Console::WriteLine( e->Message ); - } - // - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp deleted file mode 100644 index 3bdbda50535..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// System::Type::GetTypeFromHandle(RuntimeTypeHandle) - -/* -The following example demonstrates the 'GetTypeFromHandle(RuntimeTypeHandle)' method -of the 'Type' Class. -It defines an empty class 'Myclass1' and obtains an object of 'Myclass1'. Then the runtime handle of -the object is obtained and passed as an argument to 'GetTypeFromHandle(RuntimeTypeHandle)'method. That -returns the type referenced by the specified type handle. -*/ - -using namespace System; -using namespace System::Reflection; -public ref class MyClass1{}; - -int main() -{ - // - MyClass1^ myClass1 = gcnew MyClass1; - // Get the type referenced by the specified type handle. - Type^ myClass1Type = Type::GetTypeFromHandle( Type::GetTypeHandle( myClass1 ) ); - Console::WriteLine( "The Names of the Attributes : {0}", myClass1Type->Attributes ); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp deleted file mode 100644 index f5e69fb913a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - - // Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. - String^ myString1 = "DIRECT.ddPalette.3"; - - // Use a nonexistent ProgID WrongProgID. - String^ myString2 = "WrongProgID"; - - // Make a call to the method to get the type information of the given ProgID. - Type^ myType1 = Type::GetTypeFromProgID( myString1, true ); - Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); - - // Throw an exception because the ProgID is invalid and the throwOnError - // parameter is set to True. - Type^ myType2 = Type::GetTypeFromProgID( myString2, true ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp deleted file mode 100644 index 1e6853e4688..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - - // Use the ProgID localhost\HKEY_CLASSES_ROOT\DirControl::DirList.1. - String^ theProgramID = "DirControl.DirList.1"; - - // Use the server name localhost. - String^ theServer = "localhost"; - - // Make a call to the method to get the type information for the given ProgID. - Type^ myType = Type::GetTypeFromProgID( theProgramID, theServer ); - if ( myType == nullptr ) - { - throw gcnew Exception( "Invalid ProgID or Server." ); - } - Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType->GUID ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp deleted file mode 100644 index 706229d1e8d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - - // Use server localhost. - String^ theServer = "localhost"; - - // Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. - String^ myString1 = "DirControl.DirList.1"; - - // Use a wrong ProgID WrongProgID. - String^ myString2 = "WrongProgID"; - - // Make a call to the method to get the type information for the given ProgID. - Type^ myType1 = Type::GetTypeFromProgID( myString1, theServer, true ); - Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); - - // Throw an exception because the ProgID is invalid and the throwOnError - // parameter is set to True. - Type^ myType2 = Type::GetTypeFromProgID( myString2, theServer, true ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred. The ProgID is wrong." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp deleted file mode 100644 index fe262565879..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class MyClass1 -{ -private: - int x; - -public: - int MyMethod() - { - return x; - } -}; - -int main() -{ - MyClass1^ myClass1 = gcnew MyClass1; - - // Get the RuntimeTypeHandle from an object. - RuntimeTypeHandle myRTHFromObject = Type::GetTypeHandle( myClass1 ); - - // Get the RuntimeTypeHandle from a type. - RuntimeTypeHandle myRTHFromType = MyClass1::typeid->TypeHandle; - - Console::WriteLine( "\nmyRTHFromObject.Value: {0}", myRTHFromObject.Value ); - Console::WriteLine( "myRTHFromObject.GetType(): {0}", myRTHFromObject.GetType() ); - Console::WriteLine( "Get the type back from the handle..." ); - Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromObject): {0}", - Type::GetTypeFromHandle(myRTHFromObject) ); - - Console::WriteLine( "\nmyRTHFromObject.Equals(myRTHFromType): {0}", - myRTHFromObject.Equals(myRTHFromType) ); - - Console::WriteLine( "\nmyRTHFromType.Value: {0}", myRTHFromType.Value ); - Console::WriteLine( "myRTHFromType.GetType(): {0}", myRTHFromType.GetType() ); - Console::WriteLine( "Get the type back from the handle..." ); - Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromType): {0}", - Type::GetTypeFromHandle(myRTHFromType) ); -} - -/* This code example produces output similar to the following: - -myRTHFromObject.Value: 3295832 -myRTHFromObject.GetType(): System.RuntimeTypeHandle -Get the type back from the handle... -Type::GetTypeFromHandle(myRTHFromObject): MyClass1 - -myRTHFromObject.Equals(myRTHFromType): True - -myRTHFromType.Value: 3295832 -myRTHFromType.GetType(): System.RuntimeTypeHandle -Get the type back from the handle... -Type::GetTypeFromHandle(myRTHFromType): MyClass1 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp deleted file mode 100644 index 5f399d51673..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -ref class MyGetTypeFromCLSID -{ -public: - ref class MyClass1 - { - public: - void MyMethod1(){} - }; -}; - -int main() -{ - - // Get the type corresponding to the class MyClass. - Type^ myType = MyGetTypeFromCLSID::MyClass1::typeid; - - // Get the Object* of the Guid. - Guid myGuid = (Guid)myType->GUID; - Console::WriteLine( "The name of the class is {0}", myType ); - Console::WriteLine( "The ClassId of MyClass is {0}", myType->GUID ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp deleted file mode 100644 index c11f4e80d20..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -public ref class Example -{ -public: - // This method is for demonstration purposes. It includes a - // tracking reference (C# ref, VB ByRef), an out parameter, - // and a pointer. - void Test(int% x, [OutAttribute()] int% y, int* z) - { - *z = x = y = 0; - } -}; - -int main() -{ - // All of the following display 'True'. - - // Define a managed array, get its type, and display HasElementType. - array^ examples = {gcnew Example(), gcnew Example()}; - Type^ t = examples::typeid; - Console::WriteLine(t); - Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType); - - // When you use Reflection Emit to emit dynamic methods and - // assemblies, you can create array types using MakeArrayType. - // The following creates the type 'array of Example'. - t = Example::typeid->MakeArrayType(); - Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType); - - // When you reflect over methods, HasElementType is true for - // ref, out, and pointer parameter types. The following - // gets the Test method, defined above, and examines its - // parameters. - MethodInfo^ mi = Example::typeid->GetMethod("Test"); - array^ parms = mi->GetParameters(); - t = parms[0]->ParameterType; - Console::WriteLine("HasElementType is '{0}' for ref parameter types.", t->HasElementType); - t = parms[1]->ParameterType; - Console::WriteLine("HasElementType is '{0}' for out parameter types.", t->HasElementType); - t = parms[2]->ParameterType; - Console::WriteLine("HasElementType is '{0}' for pointer parameter types.", t->HasElementType); - - // When you use Reflection Emit to emit dynamic methods and - // assemblies, you can create pointer and ByRef types to use - // when you define method parameters. - t = Example::typeid->MakePointerType(); - Console::WriteLine("HasElementType is '{0}' for pointer types.", t->HasElementType); - t = Example::typeid->MakeByRefType(); - Console::WriteLine("HasElementType is '{0}' for ByRef types.", t->HasElementType); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp deleted file mode 100644 index a2a8c92e5cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp +++ /dev/null @@ -1,86 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyTypeDelegator: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegator( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - - -protected: - - // Override Type::HasElementTypeImpl(). - virtual bool HasElementTypeImpl() override - { - - // Determine whether the type is an array. - if ( myType->IsArray ) - { - myElementType = "array"; - return true; - } - - - // Determine whether the type is a reference. - if ( myType->IsByRef ) - { - myElementType = "reference"; - return true; - } - - - // Determine whether the type is a pointer. - if ( myType->IsPointer ) - { - myElementType = "pointer"; - return true; - } - - - // Return false if the type is not a reference, array, or pointer type. - return false; - } - -}; - -int main() -{ - try - { - int myInt = 0; - array^myArray = gcnew array(5); - MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() ); - - // Determine whether myType is an array, pointer, reference type. - Console::WriteLine( "\nDetermine whether a variable is an array, pointer, or reference type.\n" ); - if ( myType->HasElementType ) - Console::WriteLine( "The type of myArray is {0}.", myType->myElementType ); - else - Console::WriteLine( "myArray is not an array, pointer, or reference type." ); - myType = gcnew MyTypeDelegator( myInt.GetType() ); - - // Determine whether myType is an array, pointer, reference type. - if ( myType->HasElementType ) - Console::WriteLine( "The type of myInt is {0}.", myType->myElementType ); - else - Console::WriteLine( "myInt is not an array, pointer, or reference type." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp deleted file mode 100644 index 6bdc99f8a1b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyClass -{ -protected: - String^ myField; - -public: - MyClass() - { - myField = "A sample protected field"; - } -}; - -int main() -{ - try - { - MyClass^ myObject = gcnew MyClass; - - // Get the type of the 'MyClass'. - Type^ myType = MyClass::typeid; - - // Get the field information and the attributes associated with MyClass. - FieldInfo^ myFieldInfo = myType->GetField( "myField", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - Console::WriteLine( "\nChecking for the AnsiClass attribute for a field.\n" ); - - // Get and display the name, field, and the AnsiClass attribute. - Console::WriteLine( "Name of Class: {0} \nValue of Field: {1} \nIsAnsiClass = {2}", myType->FullName, myFieldInfo->GetValue( myObject ), myType->IsAnsiClass ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp deleted file mode 100644 index dadf165d511..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyTypeDelegator: public TypeDelegator -{ -public: - String^ myElementType; - Type^ myType; - MyTypeDelegator( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - - -protected: - - // Override IsArrayImpl(). - virtual bool IsArrayImpl() override - { - - // Determine whether the type is an array. - if ( myType->IsArray ) - { - myElementType = "array"; - return true; - } - - - // Return false if the type is not an array. - return false; - } - -}; - -int main() -{ - try - { - int myInt = 0; - - // Create an instance of an array element. - array^myArray = gcnew array(5); - MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() ); - Console::WriteLine( "\nDetermine whether the variable is an array.\n" ); - - // Determine whether myType is an array type. - if ( myType->IsArray ) - Console::WriteLine( "The type of myArray is {0}.", myType->myElementType ); - else - Console::WriteLine( "myArray is not an array." ); - myType = gcnew MyTypeDelegator( myInt.GetType() ); - - // Determine whether myType is an array type. - if ( myType->IsArray ) - Console::WriteLine( "The type of myInt is {0}.", myType->myElementType ); - else - Console::WriteLine( "myInt is not an array." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp deleted file mode 100644 index 9c15d3604d7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; -using namespace System::Runtime::InteropServices; - -// The MyDemoAttribute class is selected as AutoLayout. - -[StructLayoutAttribute(LayoutKind::Auto)] -public ref class MyDemoAttribute{}; - -void MyAutoLayoutMethod( String^ typeName ) -{ - try - { - - // Create an instance of the Type class using the GetType method. - Type^ myType = Type::GetType( typeName ); - - // Get and display the IsAutoLayout property of the - // MyDemoAttribute instance. - Console::WriteLine( "\nThe AutoLayout property for the MyDemoAttribute is {0}.", myType->IsAutoLayout ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); - } - -} - -int main() -{ - MyAutoLayoutMethod( "MyDemoAttribute" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp deleted file mode 100644 index 028383c4410..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyDemoClass{}; - -int main() -{ - try - { - Type^ myType = Type::GetType( "MyDemoClass" ); - - // Get and display the 'IsClass' property of the 'MyDemoClass' instance. - Console::WriteLine( "\nIs the specified type a class? {0}.", myType->IsClass ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp deleted file mode 100644 index a9a34cadfd5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::Remoting::Contexts; - -public ref class ContextBoundClass: public ContextBoundObject -{ - public: - String^ Value; -}; - -public ref class Example -{ -public: - void Demo() - { - // Determine whether the types can be hosted in a Context. - Console::WriteLine("The IsContextful property for the {0} type is {1}.", - Example::typeid->Name, Example::typeid->IsContextful); - Console::WriteLine("The IsContextful property for the {0} type is {1}.", - ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsContextful); - - // Determine whether the types are marshalled by reference. - Console::WriteLine("The IsMarshalByRef property of {0} is {1}.", - Example::typeid->Name, Example::typeid->IsMarshalByRef ); - Console::WriteLine("The IsMarshalByRef property of {0} is {1}.", - ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsMarshalByRef ); - - // Determine whether the types are primitive datatypes. - Console::WriteLine("{0} is a primitive data type: {1}.", - int::typeid->Name, int::typeid->IsPrimitive ); - Console::WriteLine("{0} is a primitive data type: {1}.", - String::typeid->Name, String::typeid->IsPrimitive ); - } -}; - -int main() -{ - Example^ ex = gcnew Example; - ex->Demo(); -} -// The example displays the following output: -// The IsContextful property for the Example type is False. -// The IsContextful property for the ContextBoundClass type is True. -// The IsMarshalByRef property of Example is False. -// The IsMarshalByRef property of ContextBoundClass is True. -// Int32 is a primitive data type: True. -// String is a primitive data type: False. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp deleted file mode 100644 index 1ce5137c1af..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class MyTypeDelegatorClass: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegatorClass( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - -protected: - - // Override IsContextfulImpl. - virtual bool IsContextfulImpl() override - { - - // Check whether the type is contextful. - if ( myType->IsContextful ) - { - myElementType = " is contextful "; - return true; - } - - return false; - } - -}; - -public ref class MyTypeDemoClass{}; - - -// This class demonstrates IsContextfulImpl. -public ref class MyContextBoundClass: public ContextBoundObject -{ -public: - String^ myString; -}; - -int main() -{ - try - { - MyTypeDelegatorClass^ myType; - Console::WriteLine( "Check whether MyContextBoundClass can be hosted in a context." ); - - // Check whether MyContextBoundClass is contextful. - myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid ); - if ( myType->IsContextful ) - { - Console::WriteLine( "{0} can be hosted in a context.", MyContextBoundClass::typeid ); - } - else - { - Console::WriteLine( "{0} cannot be hosted in a context.", MyContextBoundClass::typeid ); - } - myType = gcnew MyTypeDelegatorClass( MyTypeDemoClass::typeid ); - Console::WriteLine( "\nCheck whether MyTypeDemoClass can be hosted in a context." ); - if ( myType->IsContextful ) - { - Console::WriteLine( "{0} can be hosted in a context.", MyTypeDemoClass::typeid ); - } - else - { - Console::WriteLine( "{0} cannot be hosted in a context.", MyTypeDemoClass::typeid ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp deleted file mode 100644 index f8e795207a6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; - -// Declare an interface. -interface class myIFace{}; -public ref class MyIsInterface{}; - -void main() -{ - try - { - // Get the IsInterface attribute for myIFace. - bool myBool1 = myIFace::typeid->IsInterface; - - //Display the IsInterface attribute for myIFace. - Console::WriteLine( "Is the specified type an interface? {0}.", myBool1 ); - - // Get the attribute IsInterface for MyIsInterface. - bool myBool2 = MyIsInterface::typeid->IsInterface; - - //Display the IsInterface attribute for MyIsInterface. - Console::WriteLine( "Is the specified type an interface? {0}.", myBool2 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); - } -} -/* The example produces the following output: - -Is the specified type an interface? True. -Is the specified type an interface? False. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp deleted file mode 100644 index db0652f266e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; -using namespace System::Runtime::InteropServices; -ref class MyTypeSequential1{}; - - -[StructLayoutAttribute(LayoutKind::Sequential)] -ref class MyTypeSequential2{}; - -int main() -{ - try - { - - // Create an instance of myTypeSeq1. - MyTypeSequential1^ myObj1 = gcnew MyTypeSequential1; - - // Check for and display the SequentialLayout attribute. - Console::WriteLine( "\nThe object myObj1 has IsLayoutSequential: {0}.", myObj1->GetType()->IsLayoutSequential ); - - // Create an instance of 'myTypeSeq2' class. - MyTypeSequential2^ myObj2 = gcnew MyTypeSequential2; - - // Check for and display the SequentialLayout attribute. - Console::WriteLine( "\nThe object myObj2 has IsLayoutSequential: {0}.", myObj2->GetType()->IsLayoutSequential ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp deleted file mode 100644 index d6c5c85b0f9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp +++ /dev/null @@ -1,81 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyTypeDelegatorClass: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegatorClass( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - -protected: - - // Override IsMarshalByRefImpl. - virtual bool IsMarshalByRefImpl() override - { - // Determine whether the type is marshalled by reference. - if ( myType->IsMarshalByRef ) - { - myElementType = " marshalled by reference"; - return true; - } - - return false; - } -}; - -public ref class MyTypeDemoClass{}; - - -// This class is used to demonstrate the IsMarshalByRefImpl method. -public ref class MyContextBoundClass: public ContextBoundObject -{ -public: - String^ myString; -}; - -int main() -{ - try - { - MyTypeDelegatorClass^ myType; - Console::WriteLine( "Determine whether MyContextBoundClass is marshalled by reference." ); - - // Determine whether MyContextBoundClass type is marshalled by reference. - myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid ); - if ( myType->IsMarshalByRef ) - { - Console::WriteLine( "{0} is marshalled by reference.", MyContextBoundClass::typeid ); - } - else - { - Console::WriteLine( "{0} is not marshalled by reference.", MyContextBoundClass::typeid ); - } - - // Determine whether int type is marshalled by reference. - myType = gcnew MyTypeDelegatorClass( int::typeid ); - Console::WriteLine( "\nDetermine whether int is marshalled by reference." ); - if ( myType->IsMarshalByRef ) - { - Console::WriteLine( "{0} is marshalled by reference.", int::typeid ); - } - else - { - Console::WriteLine( "{0} is not marshalled by reference.", int::typeid ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp deleted file mode 100644 index 777086959b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class MyTypeDelegatorClass: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegatorClass( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - -protected: - - // Override the IsPrimitiveImpl. - virtual bool IsPrimitiveImpl() override - { - - // Determine whether the type is a primitive type. - if ( myType->IsPrimitive ) - { - myElementType = "primitive"; - return true; - } - - return false; - } -}; - -int main() -{ - try - { - Console::WriteLine( "Determine whether int is a primitive type." ); - MyTypeDelegatorClass^ myType; - myType = gcnew MyTypeDelegatorClass( int::typeid ); - - // Determine whether int is a primitive type. - if ( myType->IsPrimitive ) - { - Console::WriteLine( "{0} is a primitive type.", int::typeid ); - } - else - { - Console::WriteLine( "{0} is not a primitive type.", int::typeid ); - } - Console::WriteLine( "\nDetermine whether String is a primitive type." ); - myType = gcnew MyTypeDelegatorClass( String::typeid ); - - // Determine if String is a primitive type. - if ( myType->IsPrimitive ) - { - Console::WriteLine( "{0} is a primitive type.", String::typeid ); - } - else - { - Console::WriteLine( "{0} is not a primitive type.", String::typeid ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp deleted file mode 100644 index ef24b8b9c18..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; - -// Declare MyTestClass as sealed. -ref class TestClass sealed{}; - -int main() -{ - TestClass^ testClassInstance = gcnew TestClass; - - // Get the type of testClassInstance. - Type^ type = testClassInstance->GetType(); - - // Get the IsSealed property of the myTestClassInstance. - bool sealed = type->IsSealed; - Console::WriteLine("{0} is sealed: {1}.", type->FullName, sealed); -} -// The example displays the following output: -// TestClass is sealed: True. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp deleted file mode 100644 index 80e31b7ccbb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -public ref class MyClass -{ -public: - - // Declare a public class with the [Serializable] attribute. - - [Serializable] - ref class MyTestClass{}; - - -}; - -int main() -{ - try - { - bool myBool = false; - MyClass::MyTestClass^ myTestClassInstance = gcnew MyClass::MyTestClass; - - // Get the type of myTestClassInstance. - Type^ myType = myTestClassInstance->GetType(); - - // Get the IsSerializable property of myTestClassInstance. - myBool = myType->IsSerializable; - Console::WriteLine( "\nIs {0} serializable? {1}.", myType->FullName, myBool ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp deleted file mode 100644 index c8ad8156905..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; - -// Declare an enum type. -public enum class NumEnum -{ - One, Two -}; - -int main() -{ - bool flag = false; - NumEnum testEnum = NumEnum::One; - - // Get the type of testEnum. - Type^ t = testEnum.GetType(); - - // Get the IsValueType property of the testEnum - // variable. - flag = t->IsValueType; - Console::WriteLine("{0} is a value type: {1}", t->FullName, flag); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp b/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp deleted file mode 100644 index d6e8a01a328..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; - -namespace MyNamespace -{ - ref class MyClass - { - }; -} - -void main() -{ - Type^ myType = MyNamespace::MyClass::typeid; - Console::WriteLine("Displaying information about {0}:", myType ); - - // Get the namespace of the class MyClass. - Console::WriteLine(" Namespace: {0}", myType->Namespace ); - - // Get the name of the module. - Console::WriteLine(" Module: {0}", myType->Module ); - - // Get the fully qualified common language runtime namespace. - Console::WriteLine(" Fully qualified type: {0}", myType ); -} -// The example displays the following output: -// Displaying information about MyNamespace.MyClass: -// Namespace: MyNamespace -// Module: type_tostring.exe -// Fully qualified name: MyNamespace.MyClass -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp deleted file mode 100644 index 23ac79f22ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -public: - int myField; -}; - -void DisplayTypeHandle( RuntimeTypeHandle myTypeHandle ) -{ - - // Get the type from the handle. - Type^ myType = Type::GetTypeFromHandle( myTypeHandle ); - - // Display the type. - Console::WriteLine( "\nDisplaying the type from the handle:\n" ); - Console::WriteLine( "The type is {0}.", myType ); -} - -int main() -{ - try - { - MyClass^ myClass = gcnew MyClass; - - // Get the type of MyClass. - Type^ myClassType = myClass->GetType(); - - // Get the runtime handle of MyClass. - RuntimeTypeHandle myClassHandle = myClassType->TypeHandle; - DisplayTypeHandle( myClassHandle ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp deleted file mode 100644 index 439589d1a61..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp +++ /dev/null @@ -1,631 +0,0 @@ - -// This is the main DLL file. -using namespace System; -using namespace System::Globalization; - -#define NULL 0 - -// -/// -/// Temperature class stores the value as UInt16 -/// and delegates most of the functionality -/// to the UInt16 implementation. -/// -public ref class Temperature: public IComparable, public IFormattable -{ -protected: - - /// - /// IComparable.CompareTo implementation. - /// - short m_value; - -public: - virtual Int32 CompareTo( Object^ obj ) - { - if ( obj->GetType() == Temperature::typeid ) - { - Temperature^ temp = dynamic_cast(obj); - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - - return m_value.ToString( format, provider ); - } - - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->EndsWith( "F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - if ( s->EndsWith( "C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt16::Parse( s, styles, provider ); - } - } - - return temp; - } - - - property short Value - { - - // The value holder - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - static property short MinValue - { - short get() - { - return UInt16::MinValue; - } - - } - - static property short MaxValue - { - short get() - { - return UInt16::MaxValue; - } - - } - -}; -// - -void main() -{ - Temperature^ t1 = Temperature::Parse( "40'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - String^ str1 = t1->ToString( "C", nullptr ); - Console::WriteLine( str1 ); - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - Console::WriteLine( t1->CompareTo( t2 ) ); - Temperature^ t3 = Temperature::Parse( "40'C", NumberStyles::Integer, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - Console::WriteLine( t1->CompareTo( t3 ) ); -} - - -/* expected return values: -40'F -4'C -40'F -0 -112'F --72 -*/ -namespace Snippets2 -{ - // - public ref class Temperature - { - protected: - - // The value holder - short m_value; - - public: - - static property short MinValue - { - short get() - { - return UInt16::MinValue; - } - - } - - static property short MaxValue - { - short get() - { - return UInt16::MaxValue; - } - - } - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets3 -{ - - // - public ref class Temperature: public IComparable - { - protected: - - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - short m_value; - - public: - virtual Int32 CompareTo( Object^ obj ) - { - if ( obj->GetType() == Temperature::typeid ) - { - Temperature^ temp = dynamic_cast(obj); - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets4 -{ - - // - public ref class Temperature: public IFormattable - { - protected: - - /// - /// IFormattable.ToString implementation. - /// - // The value holder - short m_value; - - public: - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - - return m_value.ToString( format, provider ); - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets5 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = UInt16::Parse( s ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets6 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = UInt16::Parse( s, provider ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets7 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = UInt16::Parse( s, styles ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets8 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt16::Parse( s, styles, provider ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp deleted file mode 100644 index 03bba64ea5d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// System::UInt16::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'UInt16'. This compares an instance of 'UInt16' with the -passed in Object* and returns true if they are equal. -*/ -using namespace System; - -int main() -{ - try - { - // - UInt16 myVariable1 = 10; - UInt16 myVariable2 = 10; - - //Display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp deleted file mode 100644 index 75a62e5c82b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp +++ /dev/null @@ -1,417 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -namespace Snippets -{ - // - /// - /// Temperature class stores the value as UInt32 - /// and delegates most of the functionality - /// to the UInt32 implementation. - /// - public ref class Temperature: public IComparable, public IFormattable - { - public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt32::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets2 -{ - // - public ref class Temperature - { - public: - static property UInt32 MinValue - { - UInt32 get() - { - return UInt32::MinValue; - } - } - - static property UInt32 MaxValue - { - UInt32 get() - { - return UInt32::MaxValue; - } - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets3 -{ - // - public ref class Temperature: public IComparable - { - public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets4 -{ - // - public ref class Temperature: public IFormattable - { - public: - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets5 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = UInt32::Parse( s ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets6 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = UInt32::Parse( s, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets7 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = UInt32::Parse( s, styles ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets8 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt32::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets -{ - void Main() - { - Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - - String^ str1 = t1->ToString( "G", nullptr ); - Console::WriteLine( str1 ); - - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t2 ) ); - - Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t3 ) ); - - Console::ReadLine(); - } -} - -int main() -{ - Snippets::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp deleted file mode 100644 index 66564fc6421..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// System::UInt32::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'UInt32'. This compares an instance of 'UInt32' with the -passed in Object* and returns true if they are equal. -*/ -using namespace System; - -int main() -{ - try - { - // - UInt32 myVariable1 = 20; - UInt32 myVariable2 = 20; - - // Display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp deleted file mode 100644 index 0e4d7eef2ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp +++ /dev/null @@ -1,405 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -// -/// -/// Temperature class stores the value as UInt64 -/// and delegates most of the functionality -/// to the UInt64 implementation. -/// -public ref class Temperature: public IComparable, public IFormattable -{ -public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt64::Parse( s, styles, provider ); - } - - return temp; - } - -protected: - // The value holder - UInt64 m_value; - -public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } -}; -// - -namespace Snippets2 -{ - // - public ref class Temperature - { - public: - static property Int64 MinValue - { - Int64 get() - { - return UInt64::MinValue; - } - } - - static property UInt64 MaxValue - { - UInt64 get() - { - return UInt64::MaxValue; - } - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets3 -{ - // - public ref class Temperature: public IComparable - { - public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets4 -{ - // - public ref class Temperature: public IFormattable - { - public: - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets5 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = UInt64::Parse( s ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets6 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = UInt64::Parse( s, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets7 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = UInt64::Parse( s, styles ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets8 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt64::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -int main() -{ - Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - - String^ str1 = t1->ToString( "G", nullptr ); - Console::WriteLine( str1 ); - - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t2 ) ); - - Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t3 ) ); - - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp deleted file mode 100644 index b5928f9ee25..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -int main() -{ - UInt64 value1 = 50; - UInt64 value2 = 50; - - // Display the values. - Console::WriteLine("value1: Type: {0} Value: {1}", - value1.GetType()->Name, value1); - Console::WriteLine("value2: Type: {0} Value: {1}", - value2.GetType()->Name, value2); - - // Compare the two values. - Console::WriteLine("value1 and value2 are equal: {0}", - value1.Equals(value2)); -} -// The example displays the following output: -// value1: Type: UInt64 Value: 50 -// value2: Type: UInt64 Value: 50 -// value1 and value2 are equal: True -// diff --git a/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp b/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp deleted file mode 100644 index 6a1f8f2f542..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -/* -System.Uri.IsHexDigit - -The following program reads a string from console and determines whether the -specified character is valid hexadecimal digit. -*/ -#using - -using namespace System; -int main() -{ - try - { - // - Console::Write( "Type a string : " ); - String^ myString = Console::ReadLine(); - for ( int i = 0; i < myString->Length; i++ ) - if ( Uri::IsHexDigit( myString[ i ] ) ) - Console::WriteLine( "{0} is a hexadecimal digit.", myString[ i ] ); - else - Console::WriteLine( "{0} is not a hexadecimal digit.", myString[ i ] ); - // The example produces output like the following: - // Type a string : 3f5EaZ - // 3 is a hexadecimal digit. - // f is a hexadecimal digit. - // 5 is a hexadecimal digit. - // E is a hexadecimal digit. - // a is a hexadecimal digit. - // Z is not a hexadecimal digit. - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} - -// ***** Output ***** -/* - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp deleted file mode 100644 index dfec68d03a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -using namespace System; - -// -public ref struct Complex -{ -public: - double m_Re; - double m_Im; - virtual bool Equals( Object^ ob ) override - { - if ( dynamic_cast(ob) ) - { - Complex^ c = dynamic_cast(ob); - return m_Re == c->m_Re && m_Im == c->m_Im; - } - else - { - return false; - } - } - - virtual int GetHashCode() override - { - return m_Re.GetHashCode() ^ m_Im.GetHashCode(); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp b/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp deleted file mode 100644 index 7cd42aba971..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -// -// This example demonstrates the Char.ConvertFromUtf32() method -// and Char.ConvertToUtf32() overloads. -using namespace System; -void Show( String^ s ) -{ -// Console::Write( "0x{0:X}, 0x{1:X}", (int)s->get_Chars( 0 ), (int)s->get_Chars( 1 ) ); - Console::Write( "0x{0:X}, 0x{1:X}", (int)s[ 0 ], (int)s[ 1 ] ); -} - -int main() -{ - int music = 0x1D161; //U+1D161 = MUSICAL SYMBOL SIXTEENTH NOTE - - String^ s1; - String^ comment1a = "Create a UTF-16 encoded string from a code point."; - String^ comment1b = "Create a code point from a surrogate pair at a certain position in a string."; - String^ comment1c = "Create a code point from a high surrogate and a low surrogate code point."; - - // ------------------------------------------------------------------- - // Convert the code point U+1D161 to UTF-16. The UTF-16 equivalent of - // U+1D161 is a surrogate pair with hexadecimal values D834 and DD61. - Console::WriteLine( comment1a ); - s1 = Char::ConvertFromUtf32( music ); - Console::Write( " 1a) 0x{0:X} => ", music ); - Show( s1 ); - Console::WriteLine(); - - // Convert the surrogate pair in the string at index position - // zero to a code point. - Console::WriteLine( comment1b ); - music = Char::ConvertToUtf32( s1, 0 ); - Console::Write( " 1b) " ); - Show( s1 ); - Console::WriteLine( " => 0x{0:X}", music ); - - // Convert the high and low characters in the surrogate pair into a code point. - Console::WriteLine( comment1c ); - music = Char::ConvertToUtf32( s1[ 0 ], s1[ 1 ] ); - Console::Write( " 1c) " ); - Show( s1 ); - Console::WriteLine( " => 0x{0:X}", music ); -} - -/* -This example produces the following results: - -Create a UTF-16 encoded string from a code point. - 1a) 0x1D161 => 0xD834, 0xDD61 -Create a code point from a surrogate pair at a certain position in a string. - 1b) 0xD834, 0xDD61 => 0x1D161 -Create a code point from a high surrogate and a low surrogate code point. - 1c) 0xD834, 0xDD61 => 0x1D161 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp b/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp deleted file mode 100644 index 1a9d98b34ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// -// This example demonstrates the Char.IsLowSurrogate() method -// IsHighSurrogate() method -// IsSurrogatePair() method -using namespace System; -int main() -{ - Char cHigh = L'\xD800'; - Char cLow = L'\xDC00'; - array^temp0 = {L'a',L'\xD800',L'\xDC00',L'z'}; - String^ s1 = gcnew String( temp0 ); - String^ divider = String::Concat( Environment::NewLine, gcnew String( '-',70 ), Environment::NewLine ); - Console::WriteLine(); - Console::WriteLine( "Hexadecimal code point of the character, cHigh: {0:X4}", (int)cHigh ); - Console::WriteLine( "Hexadecimal code point of the character, cLow: {0:X4}", (int)cLow ); - Console::WriteLine(); - Console::WriteLine( "Characters in string, s1: 'a', high surrogate, low surrogate, 'z'" ); - Console::WriteLine( "Hexadecimal code points of the characters in string, s1: " ); - for ( int i = 0; i < s1->Length; i++ ) - { - Console::WriteLine( "s1[{0}] = {1:X4} ", i, (int)s1[ i ] ); - } - Console::WriteLine( divider ); - Console::WriteLine( "Is each of the following characters a high surrogate?" ); - Console::WriteLine( "A1) cLow? - {0}", Char::IsHighSurrogate( cLow ) ); - Console::WriteLine( "A2) cHigh? - {0}", Char::IsHighSurrogate( cHigh ) ); - Console::WriteLine( "A3) s1[0]? - {0}", Char::IsHighSurrogate( s1, 0 ) ); - Console::WriteLine( "A4) s1[1]? - {0}", Char::IsHighSurrogate( s1, 1 ) ); - Console::WriteLine( divider ); - Console::WriteLine( "Is each of the following characters a low surrogate?" ); - Console::WriteLine( "B1) cLow? - {0}", Char::IsLowSurrogate( cLow ) ); - Console::WriteLine( "B2) cHigh? - {0}", Char::IsLowSurrogate( cHigh ) ); - Console::WriteLine( "B3) s1[0]? - {0}", Char::IsLowSurrogate( s1, 0 ) ); - Console::WriteLine( "B4) s1[2]? - {0}", Char::IsLowSurrogate( s1, 2 ) ); - Console::WriteLine( divider ); - Console::WriteLine( "Is each of the following pairs of characters a surrogate pair?" ); - Console::WriteLine( "C1) cHigh and cLow? - {0}", Char::IsSurrogatePair( cHigh, cLow ) ); - Console::WriteLine( "C2) s1[0] and s1[1]? - {0}", Char::IsSurrogatePair( s1, 0 ) ); - Console::WriteLine( "C3) s1[1] and s1[2]? - {0}", Char::IsSurrogatePair( s1, 1 ) ); - Console::WriteLine( "C4) s1[2] and s1[3]? - {0}", Char::IsSurrogatePair( s1, 2 ) ); - Console::WriteLine( divider ); -} - -/* -This example produces the following results: - -Hexadecimal code point of the character, cHigh: D800 -Hexadecimal code point of the character, cLow: DC00 - -Characters in string, s1: 'a', high surrogate, low surrogate, 'z' -Hexadecimal code points of the characters in string, s1: -s1[0] = 0061 -s1[1] = D800 -s1[2] = DC00 -s1[3] = 007A - ----------------------------------------------------------------------- - -Is each of the following characters a high surrogate? -A1) cLow? - False -A2) cHigh? - True -A3) s1[0]? - False -A4) s1[1]? - True - ----------------------------------------------------------------------- - -Is each of the following characters a low surrogate? -B1) cLow? - True -B2) cHigh? - False -B3) s1[0]? - False -B4) s1[2]? - True - ----------------------------------------------------------------------- - -Is each of the following pairs of characters a surrogate pair? -C1) cHigh and cLow? - True -C2) s1[0] and s1[1]? - False -C3) s1[1] and s1[2]? - True -C4) s1[2] and s1[3]? - False - ----------------------------------------------------------------------- - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp deleted file mode 100644 index 23e5a5ec992..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -// This example demonstrates the Console.Beep() method. -using namespace System; -int main() -{ - array^args = Environment::GetCommandLineArgs(); - int x = 0; - - // - if ( (args->Length == 2) && (Int32::TryParse( args[ 1 ], x )) && ((x >= 1) && (x <= 9)) ) - { - for ( int i = 1; i <= x; i++ ) - { - Console::WriteLine( "Beep number {0}.", i ); - Console::Beep(); - - } - } - else - Console::WriteLine( "Usage: Enter the number of times (between 1 and 9) to beep." ); -} - -/* -This example produces the following results: - ->beep -Usage: Enter the number of times (between 1 and 9) to beep - ->beep 9 -Beep number 1. -Beep number 2. -Beep number 3. -Beep number 4. -Beep number 5. -Beep number 6. -Beep number 7. -Beep number 8. -Beep number 9. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp deleted file mode 100644 index d933d3fdf50..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp +++ /dev/null @@ -1,124 +0,0 @@ - -// -// This example demonstrates the Console.Beep(Int32, Int32) method -using namespace System; -using namespace System::Threading; -ref class Sample -{ -protected: - - // Define the frequencies of notes in an octave, as well as - // silence (rest). - enum class Tone - { - REST = 0, - GbelowC = 196, - A = 220, - Asharp = 233, - B = 247, - C = 262, - Csharp = 277, - D = 294, - Dsharp = 311, - E = 330, - F = 349, - Fsharp = 370, - G = 392, - Gsharp = 415 - }; - - - // Define the duration of a note in units of milliseconds. - enum class Duration - { - WHOLE = 1600, - HALF = Duration::WHOLE / 2, - QUARTER = Duration::HALF / 2, - EIGHTH = Duration::QUARTER / 2, - SIXTEENTH = Duration::EIGHTH / 2 - }; - - -public: - - // Define a note as a frequency (tone) and the amount of - // time (duration) the note plays. - value struct Note - { - public: - Tone toneVal; - Duration durVal; - - // Define a constructor to create a specific note. - Note( Tone frequency, Duration time ) - { - toneVal = frequency; - durVal = time; - } - - - property Tone NoteTone - { - - // Define properties to return the note's tone and duration. - Tone get() - { - return toneVal; - } - - } - - property Duration NoteDuration - { - Duration get() - { - return durVal; - } - - } - - }; - - -protected: - - // Play the notes in a song. - static void Play( array^ tune ) - { - System::Collections::IEnumerator^ myEnum = tune->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Note n = *safe_cast(myEnum->Current); - if ( n.NoteTone == Tone::REST ) - Thread::Sleep( (int)n.NoteDuration ); - else - Console::Beep( (int)n.NoteTone, (int)n.NoteDuration ); - } - } - - -public: - static void Main() - { - - // Declare the first few notes of the song, "Mary Had A Little Lamb". - array^ Mary = {Note( Tone::B, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::GbelowC, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::HALF ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::HALF ),Note( Tone::B, Duration::QUARTER ),Note( Tone::D, Duration::QUARTER ),Note( Tone::D, Duration::HALF )}; - - // Play the song - Play( Mary ); - } - -}; - -int main() -{ - Sample::Main(); -} - -/* -This example produces the following results: - -This example plays the first few notes of "Mary Had A Little Lamb" -through the console speaker. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp b/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp deleted file mode 100644 index 75f186ab055..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -// This example demonstrates the Console.BufferHeight and -// Console.BufferWidth properties. -using namespace System; -int main() -{ - Console::WriteLine( "The current buffer height is {0} rows.", Console::BufferHeight ); - Console::WriteLine( "The current buffer width is {0} columns.", Console::BufferWidth ); -} - -/* -This example produces the following results: - -The current buffer height is 300 rows. -The current buffer width is 85 columns. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp b/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp deleted file mode 100644 index 4ad4c4573e5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -using namespace System; - -void OnCancelKeyPressed(Object^ sender, - ConsoleCancelEventArgs^ args) -{ - Console::WriteLine("{0}The read operation has been interrupted.", - Environment::NewLine); - - Console::WriteLine(" Key pressed: {0}", args->SpecialKey); - - Console::WriteLine(" Cancel property: {0}", args->Cancel); - - // Set the Cancel property to true to prevent the process from - // terminating. - Console::WriteLine("Setting the Cancel property to true..."); - args->Cancel = true; - - // Announce the new value of the Cancel property. - Console::WriteLine(" Cancel property: {0}", args->Cancel); - Console::WriteLine("The read operation will resume...{0}", - Environment::NewLine); -} - -int main() -{ - // Clear the screen. - Console::Clear(); - - // Establish an event handler to process key press events. - Console::CancelKeyPress += - gcnew ConsoleCancelEventHandler(OnCancelKeyPressed); - - while (true) - { - // Prompt the user. - Console::Write("Press any key, or 'X' to quit, or "); - Console::WriteLine("CTRL+C to interrupt the read operation:"); - - // Start a console read operation. Do not display the input. - ConsoleKeyInfo^ keyInfo = Console::ReadKey(true); - - // Announce the name of the key that was pressed . - Console::WriteLine(" Key pressed: {0}{1}", keyInfo->Key, - Environment::NewLine); - - // Exit if the user pressed the 'X' key. - if (keyInfo->Key == ConsoleKey::X) - { - break; - } - } -} -// The example displays output similar to the following: -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// Key pressed: J -// -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// Key pressed: Enter -// -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// -// The read operation has been interrupted. -// Key pressed: ControlC -// Cancel property: False -// Setting the Cancel property to true... -// Cancel property: True -// The read operation will resume... -// -// Key pressed: Q -// -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// Key pressed: X -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp deleted file mode 100644 index fb1544c6848..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// -// This example demonstrates the -// Console.CursorLeft and -// Console.CursorTop properties, and the -// Console.SetCursorPosition and -// Console.Clear methods. -using namespace System; -int origRow; -int origCol; -void WriteAt( String^ s, int x, int y ) -{ - try - { - Console::SetCursorPosition( origCol + x, origRow + y ); - Console::Write( s ); - } - catch ( ArgumentOutOfRangeException^ e ) - { - Console::Clear(); - Console::WriteLine( e->Message ); - } - -} - -int main() -{ - - // Clear the screen, then save the top and left coordinates. - Console::Clear(); - origRow = Console::CursorTop; - origCol = Console::CursorLeft; - - // Draw the left side of a 5x5 rectangle, from top to bottom. - WriteAt( "+", 0, 0 ); - WriteAt( "|", 0, 1 ); - WriteAt( "|", 0, 2 ); - WriteAt( "|", 0, 3 ); - WriteAt( "+", 0, 4 ); - - // Draw the bottom side, from left to right. - WriteAt( "-", 1, 4 ); // shortcut: WriteAt("---", 1, 4) - WriteAt( "-", 2, 4 ); // ... - WriteAt( "-", 3, 4 ); // ... - WriteAt( "+", 4, 4 ); - - // Draw the right side, from bottom to top. - WriteAt( "|", 4, 3 ); - WriteAt( "|", 4, 2 ); - WriteAt( "|", 4, 1 ); - WriteAt( "+", 4, 0 ); - - // Draw the top side, from right to left. - WriteAt( "-", 3, 0 ); // shortcut: WriteAt("---", 1, 0) - WriteAt( "-", 2, 0 ); // ... - WriteAt( "-", 1, 0 ); // ... - - // - WriteAt( "All done!", 0, 6 ); - Console::WriteLine(); -} - -/* -This example produces the following results: - -+---+ -| | -| | -| | -+---+ - -All done! - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp deleted file mode 100644 index d04872cd7db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -// This example demonstrates the Console.CursorSize property. -using namespace System; -int main() -{ - String^ m0 = "This example increments the cursor size from 1% to 100%:\n"; - String^ m1 = "Cursor size = {0}%. (Press any key to continue...)"; - array^sizes = {1,10,20,30,40,50,60,70,80,90,100}; - int saveCursorSize; - - // - saveCursorSize = Console::CursorSize; - Console::WriteLine( m0 ); - System::Collections::IEnumerator^ myEnum = sizes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - int size = *safe_cast(myEnum->Current); - Console::CursorSize = size; - Console::WriteLine( m1, size ); - Console::ReadKey(); - } - - Console::CursorSize = saveCursorSize; -} - -/* -This example produces the following results: - -This example increments the cursor size from 1% to 100%: - -Cursor size = 1%. (Press any key to continue...) -Cursor size = 10%. (Press any key to continue...) -Cursor size = 20%. (Press any key to continue...) -Cursor size = 30%. (Press any key to continue...) -Cursor size = 40%. (Press any key to continue...) -Cursor size = 50%. (Press any key to continue...) -Cursor size = 60%. (Press any key to continue...) -Cursor size = 70%. (Press any key to continue...) -Cursor size = 80%. (Press any key to continue...) -Cursor size = 90%. (Press any key to continue...) -Cursor size = 100%. (Press any key to continue...) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp deleted file mode 100644 index bf60e0028a7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -// This example demonstrates the Console.CursorVisible property. -using namespace System; - -int main() -{ - String^ m1 = "\nThe cursor is {0}.\nType any text then press Enter. " - "Type '+' in the first column to show \n" - "the cursor, '-' to hide the cursor, " - "or lowercase 'x' to quit:"; - String^ s; - bool saveCursorVisibile; - int saveCursorSize; - - // - Console::CursorVisible = true; // Initialize the cursor to visible. - saveCursorVisibile = Console::CursorVisible; - saveCursorSize = Console::CursorSize; - Console::CursorSize = 100; // Emphasize the cursor. - for ( ; ; ) - { - Console::WriteLine( m1, ((Console::CursorVisible == true) ? (String^)"VISIBLE" : "HIDDEN") ); - s = Console::ReadLine(); - if ( !String::IsNullOrEmpty( s ) ) - if ( s[ 0 ] == '+' ) - Console::CursorVisible = true; - else - if ( s[ 0 ] == '-' ) - Console::CursorVisible = false; - else - if ( s[ 0 ] == 'x' ) - break; - - } - Console::CursorVisible = saveCursorVisibile; - Console::CursorSize = saveCursorSize; -} - -/* -This example produces the following results. Note that these results -cannot depict cursor visibility. You must run the example to see the -cursor behavior: - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -The quick brown fox - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -- - -The cursor is HIDDEN. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -jumps over - -The cursor is HIDDEN. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -+ - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -the lazy dog. - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -x - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp b/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp deleted file mode 100644 index 8b8f1a06db8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -int main() -{ - ConsoleKeyInfo cki; - do - { - Console::WriteLine( "\nPress a key to display; press the 'x' key to quit." ); - - // Your code could perform some useful task in the following loop. However, - // for the sake of this example we'll merely pause for a quarter second. - while ( !Console::KeyAvailable ) - Thread::Sleep( 250 ); - cki = Console::ReadKey( true ); - Console::WriteLine( "You pressed the '{0}' key.", cki.Key ); - } - while ( cki.Key != ConsoleKey::X ); -} - -/* -This example produces results similar to the following: - -Press a key to display; press the 'x' key to quit. -You pressed the 'H' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'E' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'PageUp' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'DownArrow' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'X' key. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp b/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp deleted file mode 100644 index fa7edff4517..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -// This example demonstrates the Console.Read() method. -using namespace System; -int main() -{ - String^ m1 = "\nType a string of text then press Enter. " - "Type '+' anywhere in the text to quit:\n"; - String^ m2 = "Character '{0}' is hexadecimal 0x{1:x4}."; - String^ m3 = "Character is hexadecimal 0x{0:x4}."; - Char ch; - int x; - - // - Console::WriteLine( m1 ); - do - { - x = Console::Read(); - try - { - ch = Convert::ToChar( x ); - if ( Char::IsWhiteSpace( ch ) ) - { - Console::WriteLine( m3, x ); - if ( ch == 0x0a ) - Console::WriteLine( m1 ); - } - else - Console::WriteLine( m2, ch, x ); - } - catch ( OverflowException^ e ) - { - Console::WriteLine( "{0} Value read = {1}.", e->Message, x ); - ch = Char::MinValue; - Console::WriteLine( m1 ); - } - - } - while ( ch != '+' ); -} - -/* -This example produces the following results: - -Type a string of text then press Enter. Type '+' anywhere in the text to quit: - -The quick brown fox. -Character 'T' is hexadecimal 0x0054. -Character 'h' is hexadecimal 0x0068. -Character 'e' is hexadecimal 0x0065. -Character is hexadecimal 0x0020. -Character 'q' is hexadecimal 0x0071. -Character 'u' is hexadecimal 0x0075. -Character 'i' is hexadecimal 0x0069. -Character 'c' is hexadecimal 0x0063. -Character 'k' is hexadecimal 0x006b. -Character is hexadecimal 0x0020. -Character 'b' is hexadecimal 0x0062. -Character 'r' is hexadecimal 0x0072. -Character 'o' is hexadecimal 0x006f. -Character 'w' is hexadecimal 0x0077. -Character 'n' is hexadecimal 0x006e. -Character is hexadecimal 0x0020. -Character 'f' is hexadecimal 0x0066. -Character 'o' is hexadecimal 0x006f. -Character 'x' is hexadecimal 0x0078. -Character '.' is hexadecimal 0x002e. -Character is hexadecimal 0x000d. -Character is hexadecimal 0x000a. - -Type a string of text then press Enter. Type '+' anywhere in the text to quit: - -^Z -Value was either too large or too small for a character. Value read = -1. - -Type a string of text then press Enter. Type '+' anywhere in the text to quit: - -+ -Character '+' is hexadecimal 0x002b. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp deleted file mode 100644 index d2f1a175be4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Console.ReadKey.cpp : main project file. - -// -using namespace System; - -void main() -{ - ConsoleKeyInfo cki; - // Prevent example from ending if CTL+C is pressed. - Console::TreatControlCAsInput = true; - - Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key."); - Console::WriteLine("Press the Escape (Esc) key to quit: \n"); - do - { - cki = Console::ReadKey(); - Console::Write(" --- You pressed "); - if((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+"); - if((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+"); - if((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+"); - Console::WriteLine(cki.Key.ToString()); - } while (cki.Key != ConsoleKey::Escape); -} -// This example displays output similar to the following: -// Press any combination of CTL, ALT, and SHIFT, and a console key. -// Press the Escape (Esc) key to quit: -// -// a --- You pressed A -// k --- You pressed ALT+K -// ► --- You pressed CTL+P -// --- You pressed RightArrow -// R --- You pressed SHIFT+R -// --- You pressed CTL+I -// j --- You pressed ALT+J -// O --- You pressed SHIFT+O -// § --- You pressed CTL+U } -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp deleted file mode 100644 index f354fdf3929..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Console.ReadKey2.cpp : main project file. - -// -using namespace System; - -void main() -{ - ConsoleKeyInfo cki; - // Prevent example from ending if CTL+C is pressed. - Console::TreatControlCAsInput = true; - - Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key."); - Console::WriteLine("Press the Escape (Esc) key to quit: \n"); - do { - cki = Console::ReadKey(true); - Console::Write("You pressed "); - if ((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+"); - if ((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+"); - if ((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+"); - Console::WriteLine("{0} (character '{1}')", cki.Key, cki.KeyChar); - } while (cki.Key != ConsoleKey::Escape); -} -// This example displays output similar to the following: -// Press any combination of CTL, ALT, and SHIFT, and a console key. -// Press the Escape (Esc) key to quit: -// -// You pressed CTL+A (character '☺') -// You pressed C (character 'c') -// You pressed CTL+C (character '♥') -// You pressed K (character 'k') -// You pressed ALT+I (character 'i') -// You pressed ALT+U (character 'u') -// You pressed ALT+SHIFT+H (character 'H') -// You pressed Escape (character '←') -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp b/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp deleted file mode 100644 index 074acc11362..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -// This example demonstrates the Console.SetWindowSize method, -// the Console.WindowWidth property, -// and the Console.WindowHeight property. -using namespace System; -int main() -{ - int origWidth; - int width; - int origHeight; - int height; - String^ m1 = "The current window width is {0}, and the " - "current window height is {1}."; - String^ m2 = "The new window width is {0}, and the new " - "window height is {1}."; - String^ m4 = " (Press any key to continue...)"; - - // - // Step 1: Get the current window dimensions. - // - origWidth = Console::WindowWidth; - origHeight = Console::WindowHeight; - Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight ); - Console::WriteLine( m4 ); - Console::ReadKey( true ); - - // - // Step 2: Cut the window to 1/4 its original size. - // - width = origWidth / 2; - height = origHeight / 2; - Console::SetWindowSize( width, height ); - Console::WriteLine( m2, Console::WindowWidth, Console::WindowHeight ); - Console::WriteLine( m4 ); - Console::ReadKey( true ); - - // - // Step 3: Restore the window to its original size. - // - Console::SetWindowSize( origWidth, origHeight ); - Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight ); -} - -/* -This example produces the following results: - -The current window width is 85, and the current window height is 43. - (Press any key to continue...) -The new window width is 42, and the new window height is 21. - (Press any key to continue...) -The current window width is 85, and the current window height is 43. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp b/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp deleted file mode 100644 index 9fd1a51bc1b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -// This example demonstrates the Console.Title property. -using namespace System; -int main() -{ - Console::WriteLine( "The current console title is: \"{0}\"", Console::Title ); - Console::WriteLine( " (Press any key to change the console title.)" ); - Console::ReadKey( true ); - Console::Title = "The title has changed!"; - Console::WriteLine( "Note that the new console title is \"{0}\"\n" - " (Press any key to quit.)", Console::Title ); - Console::ReadKey( true ); -} - -/* -This example produces the following results: - ->myTitle -The current console title is: "Command Prompt - myTitle" - (Press any key to change the console title.) -Note that the new console title is "The title has changed!" - (Press any key to quit.) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp b/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp deleted file mode 100644 index cb5364bab15..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp +++ /dev/null @@ -1,135 +0,0 @@ - -// -// This example demonstrates the Console.WindowLeft and -// Console.WindowTop properties. -using namespace System; -using namespace System::Text; -using namespace System::IO; - -// -int saveBufferWidth; -int saveBufferHeight; -int saveWindowHeight; -int saveWindowWidth; -bool saveCursorVisible; - -// -int main() -{ - String^ m1 = "1) Press the cursor keys to move the console window.\n" - "2) Press any key to begin. When you're finished...\n" - "3) Press the Escape key to quit."; - String^ g1 = "+----"; - String^ g2 = "| "; - String^ grid1; - String^ grid2; - StringBuilder^ sbG1 = gcnew StringBuilder; - StringBuilder^ sbG2 = gcnew StringBuilder; - ConsoleKeyInfo cki; - int y; - - // - try - { - saveBufferWidth = Console::BufferWidth; - saveBufferHeight = Console::BufferHeight; - saveWindowHeight = Console::WindowHeight; - saveWindowWidth = Console::WindowWidth; - saveCursorVisible = Console::CursorVisible; - - // - Console::Clear(); - Console::WriteLine( m1 ); - Console::ReadKey( true ); - - // Set the smallest possible window size before setting the buffer size. - Console::SetWindowSize( 1, 1 ); - Console::SetBufferSize( 80, 80 ); - Console::SetWindowSize( 40, 20 ); - - // Create grid lines to fit the buffer. (The buffer width is 80, but - // this same technique could be used with an arbitrary buffer width.) - for ( y = 0; y < Console::BufferWidth / g1->Length; y++ ) - { - sbG1->Append( g1 ); - sbG2->Append( g2 ); - - } - sbG1->Append( g1, 0, Console::BufferWidth % g1->Length ); - sbG2->Append( g2, 0, Console::BufferWidth % g2->Length ); - grid1 = sbG1->ToString(); - grid2 = sbG2->ToString(); - Console::CursorVisible = false; - Console::Clear(); - for ( y = 0; y < Console::BufferHeight - 1; y++ ) - { - if ( y % 3 == 0 ) - Console::Write( grid1 ); - else - Console::Write( grid2 ); - - } - Console::SetWindowPosition( 0, 0 ); - do - { - cki = Console::ReadKey( true ); - switch ( cki.Key ) - { - case ConsoleKey::LeftArrow: - if ( Console::WindowLeft > 0 ) - Console::SetWindowPosition( Console::WindowLeft - 1, Console::WindowTop ); - break; - - case ConsoleKey::UpArrow: - if ( Console::WindowTop > 0 ) - Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop - 1 ); - break; - - case ConsoleKey::RightArrow: - if ( Console::WindowLeft < (Console::BufferWidth - Console::WindowWidth) ) - Console::SetWindowPosition( Console::WindowLeft + 1, Console::WindowTop ); - break; - - case ConsoleKey::DownArrow: - if ( Console::WindowTop < (Console::BufferHeight - Console::WindowHeight) ) - Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop + 1 ); - break; - } - } - while ( cki.Key != ConsoleKey::Escape ); - } - catch ( IOException^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - Console::Clear(); - Console::SetWindowSize( 1, 1 ); - Console::SetBufferSize( saveBufferWidth, saveBufferHeight ); - Console::SetWindowSize( saveWindowWidth, saveWindowHeight ); - Console::CursorVisible = saveCursorVisible; - } - -} // end Main - - -/* -This example produces results similar to the following: - -1) Press the cursor keys to move the console window. -2) Press any key to begin. When you're finished... -3) Press the Escape key to quit. - -... - -+----+----+----+- -| | | | -| | | | -+----+----+----+- -| | | | -| | | | -+----+----+----+- - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp b/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp deleted file mode 100644 index b31dd5edc66..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// -// This code example demonstrates the Console.WriteLine() method. -// Formatting for this example uses the "en-US" culture. - -using namespace System; - -public enum class Color {Yellow = 1, Blue, Green}; - -int main() -{ - DateTime thisDate = DateTime::Now; - Console::Clear(); - - // Format a negative integer or floating-point number in various ways. - Console::WriteLine("Standard Numeric Format Specifiers"); - Console::WriteLine( - "(C) Currency: . . . . . . . . {0:C}\n" + - "(D) Decimal:. . . . . . . . . {0:D}\n" + - "(E) Scientific: . . . . . . . {1:E}\n" + - "(F) Fixed point:. . . . . . . {1:F}\n" + - "(G) General:. . . . . . . . . {0:G}\n" + - " (default):. . . . . . . . {0} (default = 'G')\n" + - "(N) Number: . . . . . . . . . {0:N}\n" + - "(P) Percent:. . . . . . . . . {1:P}\n" + - "(R) Round-trip: . . . . . . . {1:R}\n" + - "(X) Hexadecimal:. . . . . . . {0:X}\n", - -123, -123.45f); - - // Format the current date in various ways. - Console::WriteLine("Standard DateTime Format Specifiers"); - Console::WriteLine( - "(d) Short date: . . . . . . . {0:d}\n" + - "(D) Long date:. . . . . . . . {0:D}\n" + - "(t) Short time: . . . . . . . {0:t}\n" + - "(T) Long time:. . . . . . . . {0:T}\n" + - "(f) Full date/short time: . . {0:f}\n" + - "(F) Full date/long time:. . . {0:F}\n" + - "(g) General date/short time:. {0:g}\n" + - "(G) General date/long time: . {0:G}\n" + - " (default):. . . . . . . . {0} (default = 'G')\n" + - "(M) Month:. . . . . . . . . . {0:M}\n" + - "(R) RFC1123:. . . . . . . . . {0:R}\n" + - "(s) Sortable: . . . . . . . . {0:s}\n" + - "(u) Universal sortable: . . . {0:u} (invariant)\n" + - "(U) Universal full date/time: {0:U}\n" + - "(Y) Year: . . . . . . . . . . {0:Y}\n", - thisDate); - - // Format a Color enumeration value in various ways. - Console::WriteLine("Standard Enumeration Format Specifiers"); - Console::WriteLine( - "(G) General:. . . . . . . . . {0:G}\n" + - " (default):. . . . . . . . {0} (default = 'G')\n" + - "(F) Flags:. . . . . . . . . . {0:F} (flags or integer)\n" + - "(D) Decimal number: . . . . . {0:D}\n" + - "(X) Hexadecimal:. . . . . . . {0:X}\n", - Color::Green); - -}; - - -/* -This code example produces the following results: - -Standard Numeric Format Specifiers -(C) Currency: . . . . . . . . ($123.00) -(D) Decimal:. . . . . . . . . -123 -(E) Scientific: . . . . . . . -1.234500E+002 -(F) Fixed point:. . . . . . . -123.45 -(G) General:. . . . . . . . . -123 -(default):. . . . . . . . -123 (default = 'G') -(N) Number: . . . . . . . . . -123.00 -(P) Percent:. . . . . . . . . -12,345.00 % -(R) Round-trip: . . . . . . . -123.45 -(X) Hexadecimal:. . . . . . . FFFFFF85 - -Standard DateTime Format Specifiers -(d) Short date: . . . . . . . 6/26/2004 -(D) Long date:. . . . . . . . Saturday, June 26, 2004 -(t) Short time: . . . . . . . 8:11 PM -(T) Long time:. . . . . . . . 8:11:04 PM -(f) Full date/short time: . . Saturday, June 26, 2004 8:11 PM -(F) Full date/long time:. . . Saturday, June 26, 2004 8:11:04 PM -(g) General date/short time:. 6/26/2004 8:11 PM -(G) General date/long time: . 6/26/2004 8:11:04 PM -(default):. . . . . . . . 6/26/2004 8:11:04 PM (default = 'G') -(M) Month:. . . . . . . . . . June 26 -(R) RFC1123:. . . . . . . . . Sat, 26 Jun 2004 20:11:04 GMT -(s) Sortable: . . . . . . . . 2004-06-26T20:11:04 -(u) Universal sortable: . . . 2004-06-26 20:11:04Z (invariant) -(U) Universal full date/time: Sunday, June 27, 2004 3:11:04 AM -(Y) Year: . . . . . . . . . . June, 2004 - -Standard Enumeration Format Specifiers -(G) General:. . . . . . . . . Green -(default):. . . . . . . . Green (default = 'G') -(F) Flags:. . . . . . . . . . Green (flags or integer) -(D) Decimal number: . . . . . 3 -(X) Hexadecimal:. . . . . . . 00000003 - -*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp b/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp deleted file mode 100644 index 528816ff13d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - TextReader^ tIn = Console::In; - TextWriter^ tOut = Console::Out; - tOut->WriteLine( "Hola Mundo!" ); - tOut->Write( "What is your name: " ); - String^ name = tIn->ReadLine(); - tOut->WriteLine( "Buenos Dias, {0}!", name ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp deleted file mode 100644 index a876518582c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -// -// This example demonstrates the Convert.ToBase64CharArray() and -// Convert.FromBase64CharArray methods -using namespace System; -bool ArraysAreEqual( array^a1, array^a2 ); -int main() -{ - array^byteArray1 = gcnew array(256); - array^byteArray2 = gcnew array(256); - array^charArray = gcnew array(352); - int charArrayLength; - String^ nl = Environment::NewLine; - String^ ruler1a = " 1 2 3 4"; - String^ ruler2a = "1234567890123456789012345678901234567890"; - String^ ruler3a = "----+----+----+----+----+----+----+----+"; - String^ ruler1b = " 5 6 7 "; - String^ ruler2b = "123456789012345678901234567890123456"; - String^ ruler3b = "----+----+----+----+----+----+----+-"; - String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b ); - - // 1) Initialize and display a Byte array of arbitrary data. - Console::WriteLine( "1) Input: A Byte array of arbitrary data.{0}", nl ); - for ( int x = 0; x < byteArray1->Length; x++ ) - { - byteArray1[ x ] = (Byte)x; - Console::Write( "{0:X2} ", byteArray1[ x ] ); - if ( ((x + 1) % 20) == 0 ) - Console::WriteLine(); - - } - Console::Write( "{0}{0}", nl ); - - // 2) Convert the input Byte array to a Char array, with newlines inserted. - charArrayLength = Convert::ToBase64CharArray( byteArray1, 0, byteArray1->Length, - charArray, 0, - Base64FormattingOptions::InsertLineBreaks ); - Console::WriteLine( "2) Convert the input Byte array to a Char array with newlines." ); - Console::Write( " Output: A Char array (length = {0}). ", charArrayLength ); - Console::WriteLine( "The elements of the array are:{0}", nl ); - Console::WriteLine( ruler ); - Console::WriteLine( gcnew String( charArray ) ); - Console::WriteLine(); - - // 3) Convert the Char array back to a Byte array. - Console::WriteLine( "3) Convert the Char array to an output Byte array." ); - byteArray2 = Convert::FromBase64CharArray( charArray, 0, charArrayLength ); - - // 4) Are the input and output Byte arrays equivalent? - Console::WriteLine( "4) The output Byte array is equal to the input Byte array: {0}", ArraysAreEqual( byteArray1, byteArray2 ) ); -} - -bool ArraysAreEqual( array^a1, array^a2 ) -{ - if ( a1->Length != a2->Length ) - return false; - - for ( int i = 0; i < a1->Length; i++ ) - if ( a1[ i ] != a2[ i ] ) - return false; - - return true; -} - -/* -This example produces the following results: - -1) Input: A Byte array of arbitrary data. - -00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 -14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 -28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B -3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F -50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 -64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 -78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B -8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F -A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 -B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 -C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB -DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF -F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -2) Convert the input Byte array to a Char array with newlines. - Output: A Char array (length = 352). The elements of the array are: - - 1 2 3 4 5 6 7 -1234567890123456789012345678901234567890123456789012345678901234567890123456 -----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+- -AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4 -OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx -cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq -q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj -5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== - -3) Convert the Char array to an output Byte array. -4) The output Byte array is equal to the input Byte array: True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp deleted file mode 100644 index 316e8eeab95..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp +++ /dev/null @@ -1,113 +0,0 @@ - -// -// This example demonstrates the Convert.ToBase64String() and -// Convert.FromBase64String() methods -using namespace System; -bool ArraysAreEqual( array^a1, array^a2 ); -int main() -{ - array^inArray = gcnew array(256); - array^outArray = gcnew array(256); - String^ s2; - String^ s3; - String^ step1 = "1) The input is a byte array (inArray) of arbitrary data."; - String^ step2 = "2) Convert a subarray of the input data array to a base 64 string."; - String^ step3 = "3) Convert the entire input data array to a base 64 string."; - String^ step4 = "4) The two methods in steps 2 and 3 produce the same result: {0}"; - String^ step5 = "5) Convert the base 64 string to an output byte array (outArray)."; - String^ step6 = "6) The input and output arrays, inArray and outArray, are equal: {0}"; - int x; - String^ nl = Environment::NewLine; - String^ ruler1a = " 1 2 3 4"; - String^ ruler2a = "1234567890123456789012345678901234567890"; - String^ ruler3a = "----+----+----+----+----+----+----+----+"; - String^ ruler1b = " 5 6 7 "; - String^ ruler2b = "123456789012345678901234567890123456"; - String^ ruler3b = "----+----+----+----+----+----+----+-"; - String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b, nl ); - - // 1) Display an arbitrary array of input data (inArray). The data could be - // derived from user input, a file, an algorithm, etc. - Console::WriteLine( step1 ); - Console::WriteLine(); - for ( x = 0; x < inArray->Length; x++ ) - { - inArray[ x ] = (Byte)x; - Console::Write( "{0:X2} ", inArray[ x ] ); - if ( ((x + 1) % 20) == 0 ) - Console::WriteLine(); - - } - Console::Write( "{0}{0}", nl ); - - // 2) Convert a subarray of the input data to a base64 string. In this case, - // the subarray is the entire input data array. New lines (CRLF) are inserted. - Console::WriteLine( step2 ); - s2 = Convert::ToBase64String( inArray, 0, inArray->Length, Base64FormattingOptions::InsertLineBreaks ); - Console::WriteLine( "{0}{1}{2}{3}", nl, ruler, s2, nl ); - - // 3) Convert the input data to a base64 string. In this case, the entire - // input data array is converted by default. New lines (CRLF) are inserted. - Console::WriteLine( step3 ); - s3 = Convert::ToBase64String( inArray, Base64FormattingOptions::InsertLineBreaks ); - - // 4) Test whether the methods in steps 2 and 3 produce the same result. - Console::WriteLine( step4, s2->Equals( s3 ) ); - - // 5) Convert the base 64 string to an output array (outArray). - Console::WriteLine( step5 ); - outArray = Convert::FromBase64String( s2 ); - - // 6) Is outArray equal to inArray? - Console::WriteLine( step6, ArraysAreEqual( inArray, outArray ) ); -} - -bool ArraysAreEqual( array^a1, array^a2 ) -{ - if ( a1->Length != a2->Length ) - return false; - - for ( int i = 0; i < a1->Length; i++ ) - if ( a1[ i ] != a2[ i ] ) - return false; - - return true; -} - -/* -This example produces the following results: - -1) The input is a byte array (inArray) of arbitrary data. - -00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 -14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 -28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B -3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F -50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 -64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 -78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B -8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F -A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 -B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 -C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB -DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF -F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -2) Convert a subarray of the input data array to a base 64 string. - - 1 2 3 4 5 6 7 -1234567890123456789012345678901234567890123456789012345678901234567890123456 -----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+- -AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4 -OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx -cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq -q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj -5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== - -3) Convert the entire input data array to a base 64 string. -4) The two methods in steps 2 and 3 produce the same result: True -5) Convert the base 64 string to an output byte array (outArray). -6) The input and output arrays, inArray and outArray, are equal: True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp b/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp deleted file mode 100644 index 38f78b48eef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -// -using namespace System; - -int main() -{ - Double d = -2.345; - int i = *safe_cast(Convert::ChangeType( d, int::typeid )); - Console::WriteLine( "The double value {0} when converted to an int becomes {1}", d, i ); - String^ s = "12/12/98"; - DateTime dt = *safe_cast(Convert::ChangeType( s, DateTime::typeid )); - Console::WriteLine( "The string value {0} when converted to a Date becomes {1}", s, dt ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp b/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp deleted file mode 100644 index 1e507f938a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -// This example demonstrates the DateTime(Int64) constructor. -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Instead of using the implicit, default "G" date and time format string, we - // use a custom format string that aligns the results and inserts leading zeroes. - String^ format = "{0}) The {1} date and time is {2:MM/dd/yyyy hh:mm:ss tt}"; - - // Create a DateTime for the maximum date and time using ticks. - DateTime dt1 = DateTime(DateTime::MaxValue.Ticks); - - // Create a DateTime for the minimum date and time using ticks. - DateTime dt2 = DateTime(DateTime::MinValue.Ticks); - - // Create a custom DateTime for 7/28/1979 at 10:35:05 PM using a - // calendar based on the "en-US" culture, and ticks. - Int64 ticks = DateTime(1979,07,28,22,35,5,(gcnew CultureInfo( "en-US",false ))->Calendar).Ticks; - DateTime dt3 = DateTime(ticks); - Console::WriteLine( format, 1, "maximum", dt1 ); - Console::WriteLine( format, 2, "minimum", dt2 ); - Console::WriteLine( format, 3, "custom ", dt3 ); - Console::WriteLine( "\nThe custom date and time is created from {0:N0} ticks.", ticks ); -} - -/* -This example produces the following results: - -1) The maximum date and time is 12/31/9999 11:59:59 PM -2) The minimum date and time is 01/01/0001 12:00:00 AM -3) The custom date and time is 07/28/1979 10:35:05 PM - -The custom date and time is created from 624,376,461,050,000,000 ticks. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp b/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp deleted file mode 100644 index a798bc4a24c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -// Sample for Enum::ToString(String) - -using namespace System; - -public enum class Colors -{ - Red, Green, Blue, Yellow = 12 -}; - -int main() -{ - Colors myColor = Colors::Yellow; - Console::WriteLine( "Colors::Red = {0}", Colors::Red.ToString( "d" ) ); - Console::WriteLine( "Colors::Green = {0}", Colors::Green.ToString( "d" ) ); - Console::WriteLine( "Colors::Blue = {0}", Colors::Blue.ToString( "d" ) ); - Console::WriteLine( "Colors::Yellow = {0}", Colors::Yellow.ToString( "d" ) ); - Console::WriteLine( " {0}myColor = Colors::Yellow {0}", Environment::NewLine ); - Console::WriteLine( "myColor->ToString(\"g\") = {0}", myColor.ToString( "g" ) ); - Console::WriteLine( "myColor->ToString(\"G\") = {0}", myColor.ToString( "G" ) ); - Console::WriteLine( "myColor->ToString(\"x\") = {0}", myColor.ToString( "x" ) ); - Console::WriteLine( "myColor->ToString(\"X\") = {0}", myColor.ToString( "X" ) ); - Console::WriteLine( "myColor->ToString(\"d\") = {0}", myColor.ToString( "d" ) ); - Console::WriteLine( "myColor->ToString(\"D\") = {0}", myColor.ToString( "D" ) ); - Console::WriteLine( "myColor->ToString(\"f\") = {0}", myColor.ToString( "f" ) ); - Console::WriteLine( "myColor->ToString(\"F\") = {0}", myColor.ToString( "F" ) ); -} - -/* -This example produces the following results: -Colors::Red = 0 -Colors::Green = 1 -Colors::Blue = 2 -Colors::Yellow = 12 - -myColor = Colors::Yellow - -myColor->ToString("g") = Yellow -myColor->ToString("G") = Yellow -myColor->ToString("x") = 0000000C -myColor->ToString("X") = 0000000C -myColor->ToString("d") = 12 -myColor->ToString("D") = 12 -myColor->ToString("f") = Yellow -myColor->ToString("F") = Yellow -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp b/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp deleted file mode 100644 index 8d067455708..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; - -public enum class VehicleDoors -{ - Motorbike = 0, - Sportscar = 2, - Sedan = 4, - Hatchback = 5 -}; - -int main() -{ - VehicleDoors myVeh = VehicleDoors::Sportscar; - VehicleDoors yourVeh = VehicleDoors::Motorbike; - VehicleDoors otherVeh = VehicleDoors::Sedan; - Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, yourVeh ); - Int32 iRes = myVeh.CompareTo( yourVeh ); - Console::WriteLine( "{0}{1}", iRes > 0 ? (String^)"Yes" : "No", Environment::NewLine ); - Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, otherVeh ); - iRes = myVeh.CompareTo( otherVeh ); - Console::WriteLine( "{0}", iRes > 0 ? (String^)"Yes" : "No" ); -} -// The example displays the following output: -// Does a Sportscar have more doors than a Motorbike? -// Yes -// -// Does a Sportscar have more doors than a Sedan? -// No -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp b/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp deleted file mode 100644 index 2c8b0fb26db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -public enum class Colors -{ - Red, Green, Blue, Yellow -}; - -public enum class Mammals -{ - Cat, Dog, Horse, Dolphin -}; - -int main() -{ - Mammals myPet = Mammals::Cat; - Colors myColor = Colors::Red; - Mammals yourPet = Mammals::Dog; - Colors yourColor = Colors::Red; - Console::WriteLine( "My favorite animal is a {0}", myPet ); - Console::WriteLine( "Your favorite animal is a {0}", yourPet ); - Console::WriteLine( "Do we like the same animal? {0}", myPet.Equals( yourPet ) ? (String^)"Yes" : "No" ); - Console::WriteLine(); - Console::WriteLine( "My favorite color is {0}", myColor ); - Console::WriteLine( "Your favorite color is {0}", yourColor ); - Console::WriteLine( "Do we like the same color? {0}", myColor.Equals( yourColor ) ? (String^)"Yes" : "No" ); - Console::WriteLine(); - Console::WriteLine( "The value of my color ({0}) is {1}", myColor, Enum::Format( Colors::typeid, myColor, "d" ) ); - Console::WriteLine( "The value of my pet (a {0}) is {1}", myPet, Enum::Format( Mammals::typeid, myPet, "d" ) ); - Console::WriteLine( "Even though they have the same value, are they equal? {0}", myColor.Equals( myPet ) ? (String^)"Yes" : "No" ); -} -// The example displays the following output: -// My favorite animal is a Cat -// Your favorite animal is a Dog -// Do we like the same animal? No -// -// My favorite color is Red -// Your favorite color is Red -// Do we like the same color? Yes -// -// The value of my color (Red) is 0 -// The value of my pet (a Cat) is 0 -// Even though they have the same value, are they equal? No -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp b/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp deleted file mode 100644 index 1176bcd60d1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -public enum class Colors -{ - Red, Green, Blue, Yellow -}; - -int main() -{ - Colors myColor = Colors::Blue; - Console::WriteLine( "My favorite color is {0}.", myColor ); - Console::WriteLine( "The value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "d" ) ); - Console::WriteLine( "The hex value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "x" ) ); -} -// The example displays the folowing output: -// My favorite color is Blue. -// The value of my favorite color is 2. -// The hex value of my favorite color is 00000002. -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp deleted file mode 100644 index f5f08936cf6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; - -enum class Colors -{ - Red, Green, Blue, Yellow -}; - -enum class Styles -{ - Plaid, Striped, Tartan, Corduroy -}; - -int main() -{ - Console::WriteLine( "The 4th value of the Colors Enum is {0}", Enum::GetName( Colors::typeid, 3 ) ); - Console::WriteLine( "The 4th value of the Styles Enum is {0}", Enum::GetName( Styles::typeid, 3 ) ); -} -// The example displays the following output: -// The 4th value of the Colors Enum is Yellow -// The 4th value of the Styles Enum is Corduroy -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp deleted file mode 100644 index 5c01de3f879..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -using namespace System; -enum class Colors -{ - Red, Green, Blue, Yellow -}; - -enum class Styles -{ - Plaid, Striped, Tartan, Corduroy -}; - -int main() -{ - Console::WriteLine( "The members of the Colors enum are:" ); - Array^ a = Enum::GetNames( Colors::typeid ); - Int32 i = 0; - do - { - Object^ o = a->GetValue( i ); - Console::WriteLine( o->ToString() ); - } - while ( ++i < a->Length ); - - Console::WriteLine(); - Console::WriteLine( "The members of the Styles enum are:" ); - Array^ b = Enum::GetNames( Styles::typeid ); - i = 0; - do - { - Object^ o = b->GetValue( i ); - Console::WriteLine( o->ToString() ); - } - while ( ++i < b->Length ); -} -// The example displays the following output: -// The members of the Colors enum are: -// Red -// Green -// Blue -// Yellow -// -// The members of the Styles enum are: -// Plaid -// Striped -// Tartan -// Corduroy -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp deleted file mode 100644 index 69416cafd99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -enum class Colors -{ - Red, Green, Blue, Yellow -}; - -enum class Styles -{ - Plaid = 0, - Striped = 23, - Tartan = 65, - Corduroy = 78 -}; - -int main() -{ - Console::WriteLine( "The values of the Colors Enum are:" ); - Array^ a = Enum::GetValues( Colors::typeid ); - for ( Int32 i = 0; i < a->Length; i++ ) - { - Object^ o = a->GetValue( i ); - Console::WriteLine( "{0}", Enum::Format( Colors::typeid, o, "D" ) ); - } - Console::WriteLine(); - Console::WriteLine( "The values of the Styles Enum are:" ); - Array^ b = Enum::GetValues( Styles::typeid ); - for ( Int32 i = 0; i < b->Length; i++ ) - { - Object^ o = b->GetValue( i ); - Console::WriteLine( "{0}", Enum::Format( Styles::typeid, o, "D" ) ); - - } -} -// The example produces the following output: -// The values of the Colors Enum are: -// 0 -// 1 -// 2 -// 3 -// -// The values of the Styles Enum are: -// 0 -// 23 -// 65 -// 78 -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp b/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp deleted file mode 100644 index a5fc6c7c51d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -using namespace System; - -[Flags] -enum class Colors -{ - Red = 1, - Green = 2, - Blue = 4, - Yellow = 8 -}; - -int main() -{ - Console::WriteLine( "The entries of the Colors enumeration are:" ); - Array^ a = Enum::GetNames( Colors::typeid ); - Int32 i = 0; - while ( i < a->Length ) - { - Object^ o = a->GetValue( i ); - Console::WriteLine( o->ToString() ); - i++; - } - - Console::WriteLine(); - Object^ orange = Enum::Parse( Colors::typeid, "Red, Yellow" ); - Console::WriteLine("The orange value has the combined entries of {0}", orange ); -} - -/* -This code example produces the following results: - -The entries of the Colors Enum are: -Red -Green -Blue -Yellow - -The orange value has the combined entries of Red, Yellow - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp b/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp deleted file mode 100644 index d8cae622055..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -using namespace System; - -int main() -{ - Console::WriteLine(); - - // Invoke this sample with an arbitrary set of command line arguments. - Console::WriteLine( "CommandLine: {0}", Environment::CommandLine ); -} -/* -The example displays output like the following: - -C:\>env0 ARBITRARY TEXT - -CommandLine: env0 ARBITRARY TEXT -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp deleted file mode 100644 index 8da45abecdb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -// Sample for the Environment::ExpandEnvironmentVariables method -using namespace System; -int main() -{ - String^ str; - String^ nl = Environment::NewLine; - Console::WriteLine(); - - // <-- Keep this information secure! --> - String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%"; - str = Environment::ExpandEnvironmentVariables( query ); - Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str ); -} - -/* -This example produces the following results: - -ExpandEnvironmentVariables: -My system drive is C: and my system root is C:\WINNT -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp b/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp deleted file mode 100644 index 3da3cc965d5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp +++ /dev/null @@ -1,104 +0,0 @@ - -// -// Sample for Environment class summary -using namespace System; -using namespace System::Collections; -int main() -{ - String^ str; - String^ nl = Environment::NewLine; - - // - Console::WriteLine(); - Console::WriteLine( "-- Environment members --" ); - - // Invoke this sample with an arbitrary set of command line arguments. - Console::WriteLine( "CommandLine: {0}", Environment::CommandLine ); - array^arguments = Environment::GetCommandLineArgs(); - Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) ); - - // <-- Keep this information secure! --> - Console::WriteLine( "CurrentDirectory: {0}", Environment::CurrentDirectory ); - Console::WriteLine( "ExitCode: {0}", Environment::ExitCode ); - Console::WriteLine( "HasShutdownStarted: {0}", Environment::HasShutdownStarted ); - - // <-- Keep this information secure! --> - Console::WriteLine( "MachineName: {0}", Environment::MachineName ); - Console::WriteLine( "NewLine: {0} first line {0} second line {0} third line", Environment::NewLine ); - Console::WriteLine( "OSVersion: {0}", Environment::OSVersion ); - Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace ); - - // <-- Keep this information secure! --> - Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory ); - Console::WriteLine( "TickCount: {0}", Environment::TickCount ); - - // <-- Keep this information secure! --> - Console::WriteLine( "UserDomainName: {0}", Environment::UserDomainName ); - Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive ); - - // <-- Keep this information secure! --> - Console::WriteLine( "UserName: {0}", Environment::UserName ); - Console::WriteLine( "Version: {0}", Environment::Version ); - Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet ); - - // No example for Exit(exitCode) because doing so would terminate this example. - // <-- Keep this information secure! --> - String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%"; - str = Environment::ExpandEnvironmentVariables( query ); - Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str ); - Console::WriteLine( "GetEnvironmentVariable: {0} My temporary directory is {1}.", nl, Environment::GetEnvironmentVariable( "TEMP" ) ); - Console::WriteLine( "GetEnvironmentVariables: " ); - IDictionary^ environmentVariables = Environment::GetEnvironmentVariables(); - IEnumerator^ myEnum = environmentVariables->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ de = safe_cast(myEnum->Current); - Console::WriteLine( " {0} = {1}", de->Key, de->Value ); - } - - Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) ); - array^drives = Environment::GetLogicalDrives(); - Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) ); -} - -/* -This example produces results similar to the following: -(Any result that is lengthy or reveals information that should remain -secure has been omitted and marked S"!---OMITTED---!".) - -C:\>env0 ARBITRARY TEXT - --- Environment members -- -CommandLine: env0 ARBITRARY TEXT -GetCommandLineArgs: env0, ARBITRARY, TEXT -CurrentDirectory: C:\Documents and Settings\!---OMITTED---! -ExitCode: 0 -HasShutdownStarted: False -MachineName: !---OMITTED---! -NewLine: - first line - second line - third line -OSVersion: Microsoft Windows NT 5.1.2600.0 -StackTrace: ' at System::Environment::GetStackTrace(Exception e) - at System::Environment::GetStackTrace(Exception e) - at System::Environment::get_StackTrace() - at Sample::Main()' -SystemDirectory: C:\WINNT\System32 -TickCount: 17995355 -UserDomainName: !---OMITTED---! -UserInteractive: True -UserName: !---OMITTED---! -Version: !---OMITTED---! -WorkingSet: 5038080 -ExpandEnvironmentVariables: - My system drive is C: and my system root is C:\WINNT -GetEnvironmentVariable: - My temporary directory is C:\DOCUME~1\!---OMITTED---!\LOCALS~1\Temp. -GetEnvironmentVariables: - !---OMITTED---! -GetFolderPath: C:\WINNT\System32 -GetLogicalDrives: A:\, C:\, D:\ - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp b/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp deleted file mode 100644 index 8a06d998c6d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// This example demonstrates the -// Environment.ProcessorCount property. -using namespace System; -int main() -{ - Console::WriteLine( "The number of processors on this computer is {0}.", Environment::ProcessorCount ); -} - -/* -This example produces the following results: - -The number of processors on this computer is 1. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp b/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp deleted file mode 100644 index d1bc63b6472..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; - -public ref class ThresholdReachedEventArgs : public EventArgs -{ - public: - property int Threshold; - property DateTime TimeReached; -}; - -public ref class Counter -{ - private: - int threshold; - int total; - - public: - Counter() {}; - - Counter(int passedThreshold) - { - threshold = passedThreshold; - } - - void Add(int x) - { - total += x; - if (total >= threshold) { - ThresholdReachedEventArgs^ args = gcnew ThresholdReachedEventArgs(); - args->Threshold = threshold; - args->TimeReached = DateTime::Now; - OnThresholdReached(args); - } - } - - event EventHandler^ ThresholdReached; - - protected: - virtual void OnThresholdReached(ThresholdReachedEventArgs^ e) - { - ThresholdReached(this, e); - } -}; - -public ref class SampleHandler -{ - public: - static void c_ThresholdReached(Object^ sender, ThresholdReachedEventArgs^ e) - { - Console::WriteLine("The threshold of {0} was reached at {1}.", - e->Threshold, e->TimeReached); - Environment::Exit(0); - } -}; - -void main() -{ - Counter^ c = gcnew Counter((gcnew Random())->Next(10)); - c->ThresholdReached += gcnew EventHandler(SampleHandler::c_ThresholdReached); - - Console::WriteLine("press 'a' key to increase total"); - while (Console::ReadKey(true).KeyChar == 'a') { - Console::WriteLine("adding one"); - c->Add(1); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp b/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp deleted file mode 100644 index 57b3be51deb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -using namespace System; -using namespace System::Collections; - -void NestedRunTest( bool displayDetails ); // forward declarations -void NestedRoutine1( bool displayDetails ); -void NestedRoutine2( bool displayDetails ); -void RunTest( bool displayDetails ); - -int main() -{ - Console::WriteLine("\nException with some extra information..." ); - RunTest(false); - Console::WriteLine("\nException with all extra information..." ); - RunTest(true); -} - -void RunTest( bool displayDetails ) -{ - try - { - NestedRoutine1( displayDetails ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown." ); - Console::WriteLine( e->Message ); - if ( e->Data != nullptr ) - { - Console::WriteLine( " Extra details:" ); - - for each (DictionaryEntry de in e->Data) - Console::WriteLine(" Key: {0,-20} Value: {1}", - "'" + de.Key->ToString() + "'", de.Value); - } - } -} - -void NestedRoutine1( bool displayDetails ) -{ - try - { - NestedRoutine2( displayDetails ); - } - catch ( Exception^ e ) - { - e->Data[ "ExtraInfo" ] = "Information from NestedRoutine1."; - e->Data->Add( "MoreExtraInfo", "More information from NestedRoutine1." ); - throw; - } -} - -void NestedRoutine2( bool displayDetails ) -{ - Exception^ e = gcnew Exception( "This statement is the original exception message." ); - if ( displayDetails ) - { - String^ s = "Information from NestedRoutine2."; - int i = -903; - DateTime dt = DateTime::Now; - e->Data->Add( "stringInfo", s ); - e->Data[ "IntInfo" ] = i; - e->Data[ "DateTimeInfo" ] = dt; - } - - throw e; -} - -/* -This example produces the following results: - -Exception with some extra information... -An exception was thrown. -This statement is the original exception message. - Extra details: - The key is 'ExtraInfo' and the value is: Information from NestedRoutine1. - The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1. - -Exception with all extra information... -An exception was thrown. -This statement is the original exception message. - Extra details: - The key is 'stringInfo' and the value is: Information from NestedRoutine2. - The key is 'IntInfo' and the value is: -903 - The key is 'DateTimeInfo' and the value is: 11/26/2002 2:12:58 PM - The key is 'ExtraInfo' and the value is: Information from NestedRoutine1. - The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp b/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp deleted file mode 100644 index 66e8c71ecbd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// This example demonstrates Math.Atan() -// Math.Atan2() -// Math.Tan() -using namespace System; -int main() -{ - double x = 1.0; - double y = 2.0; - double angle; - double radians; - double result; - - // Calculate the tangent of 30 degrees. - angle = 30; - radians = angle * (Math::PI / 180); - result = Math::Tan( radians ); - Console::WriteLine( "The tangent of 30 degrees is {0}.", result ); - - // Calculate the arctangent of the previous tangent. - radians = Math::Atan( result ); - angle = radians * (180 / Math::PI); - Console::WriteLine( "The previous tangent is equivalent to {0} degrees.", angle ); - - // Calculate the arctangent of an angle. - String^ line1 = "{0}The arctangent of the angle formed by the x-axis and "; - String^ line2 = "a vector to point ({0},{1}) is {2}, "; - String^ line3 = "which is equivalent to {0} degrees."; - radians = Math::Atan2( y, x ); - angle = radians * (180 / Math::PI); - Console::WriteLine( line1, Environment::NewLine ); - Console::WriteLine( line2, x, y, radians ); - Console::WriteLine( line3, angle ); -} - -/* -This example produces the following results: - -The tangent of 30 degrees is 0.577350269189626. -The previous tangent is equivalent to 30 degrees. - -The arctangent of the angle formed by the x-axis and -a vector to point (1,2) is 1.10714871779409, -which is equivalent to 63.434948822922 degrees. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp b/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp deleted file mode 100644 index ce21aac3d31..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -// This example demonstrates Math.BigMul() -using namespace System; -int main() -{ - int int1 = Int32::MaxValue; - int int2 = Int32::MaxValue; - Int64 longResult; - - // - longResult = Math::BigMul( int1, int2 ); - Console::WriteLine( "Calculate the product of two Int32 values:" ); - Console::WriteLine( "{0} * {1} = {2}", int1, int2, longResult ); -} - -/* -This example produces the following results: -Calculate the product of two Int32 values: -2147483647 * 2147483647 = 4611686014132420609 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp b/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp deleted file mode 100644 index 30f8d543207..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// This example demonstrates Math.Max() -using namespace System; -int main() -{ - String^ str = "{0}: The greater of {1,3} and {2,3} is {3}."; - String^ nl = Environment::NewLine; - Byte xByte1 = 1,xByte2 = 51; - short xShort1 = -2,xShort2 = 52; - int xInt1 = -3,xInt2 = 53; - long xLong1 = -4,xLong2 = 54; - float xSingle1 = 5.0f,xSingle2 = 55.0f; - double xDouble1 = 6.0,xDouble2 = 56.0; - Decimal xDecimal1 = 7,xDecimal2 = 57; - - // The following types are not CLS-compliant. - SByte xSbyte1 = 101,xSbyte2 = 111; - UInt16 xUshort1 = 102,xUshort2 = 112; - UInt32 xUint1 = 103,xUint2 = 113; - UInt64 xUlong1 = 104,xUlong2 = 114; - Console::WriteLine( "{0}Display the greater of two values:{0}", nl ); - Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Max( xByte1, xByte2 ) ); - Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Max( xShort1, xShort2 ) ); - Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Max( xInt1, xInt2 ) ); - Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Max( xLong1, xLong2 ) ); - Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Max( xSingle1, xSingle2 ) ); - Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Max( xDouble1, xDouble2 ) ); - Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Max( xDecimal1, xDecimal2 ) ); - - // - Console::WriteLine( "{0}The following types are not CLS-compliant.{0}", nl ); - Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Max( xSbyte1, xSbyte2 ) ); - Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Max( xUshort1, xUshort2 ) ); - Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Max( xUint1, xUint2 ) ); - Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Max( xUlong1, xUlong2 ) ); -} - -/* -This example produces the following results: - -Display the greater of two values: - -Byte : The greater of 1 and 51 is 51. -Int16 : The greater of -2 and 52 is 52. -Int32 : The greater of -3 and 53 is 53. -Int64 : The greater of -4 and 54 is 54. -Single : The greater of 5 and 55 is 55. -Double : The greater of 6 and 56 is 56. -Decimal: The greater of 7 and 57 is 57. - -(The following types are not CLS-compliant.) - -SByte : The greater of 101 and 111 is 111. -UInt16 : The greater of 102 and 112 is 112. -UInt32 : The greater of 103 and 113 is 113. -UInt64 : The greater of 104 and 114 is 114. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp b/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp deleted file mode 100644 index fe4036cee2d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// This example demonstrates Math.Min() -using namespace System; -int main() -{ - String^ str = "{0}: The lesser of {1,3} and {2,3} is {3}."; - String^ nl = Environment::NewLine; - Byte xByte1 = 1,xByte2 = 51; - short xShort1 = -2,xShort2 = 52; - int xInt1 = -3,xInt2 = 53; - long xLong1 = -4,xLong2 = 54; - float xSingle1 = 5.0f,xSingle2 = 55.0f; - double xDouble1 = 6.0,xDouble2 = 56.0; - Decimal xDecimal1 = 7,xDecimal2 = 57; - - // The following types are not CLS-compliant. - SByte xSbyte1 = 101,xSbyte2 = 111; - UInt16 xUshort1 = 102,xUshort2 = 112; - UInt32 xUint1 = 103,xUint2 = 113; - UInt64 xUlong1 = 104,xUlong2 = 114; - Console::WriteLine( "{0}Display the lesser of two values:{0}", nl ); - Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Min( xByte1, xByte2 ) ); - Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Min( xShort1, xShort2 ) ); - Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Min( xInt1, xInt2 ) ); - Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Min( xLong1, xLong2 ) ); - Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Min( xSingle1, xSingle2 ) ); - Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Min( xDouble1, xDouble2 ) ); - Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Min( xDecimal1, xDecimal2 ) ); - - // - Console::WriteLine( "{0}The following types are not CLS-compliant:{0}", nl ); - Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Min( xSbyte1, xSbyte2 ) ); - Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Min( xUshort1, xUshort2 ) ); - Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Min( xUint1, xUint2 ) ); - Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Min( xUlong1, xUlong2 ) ); -} - -/* -This example produces the following results: - -Display the lesser of two values: - -Byte : The lesser of 1 and 51 is 1. -Int16 : The lesser of -2 and 52 is -2. -Int32 : The lesser of -3 and 53 is -3. -Int64 : The lesser of -4 and 54 is -4. -Single : The lesser of 5 and 55 is 5. -Double : The lesser of 6 and 56 is 6. -Decimal: The lesser of 7 and 57 is 7. - -The following types are not CLS-compliant: - -SByte : The lesser of 101 and 111 is 101. -UInt16 : The lesser of 102 and 112 is 102. -UInt32 : The lesser of 103 and 113 is 103. -UInt64 : The lesser of 104 and 114 is 104. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp b/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp deleted file mode 100644 index 200dda534ac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// This example demonstrates Math.Sign() -using namespace System; -String^ Test( int compare ) -{ - if ( compare == 0 ) - return "equal to"; - else - if ( compare < 0 ) - return "less than"; - else - return "greater than"; -} - -int main() -{ - String^ str = "{0}: {1,3} is {2} zero."; - String^ nl = Environment::NewLine; - Byte xByte1 = 0; - short xShort1 = -2; - int xInt1 = -3; - long xLong1 = -4; - float xSingle1 = 0.0f; - double xDouble1 = 6.0; - Decimal xDecimal1 = -7; - - // The following type is not CLS-compliant. - SByte xSbyte1 = -101; - Console::WriteLine( "{0}Test the sign of the following types of values:", nl ); - Console::WriteLine( str, "Byte ", xByte1, Test( Math::Sign( xByte1 ) ) ); - Console::WriteLine( str, "Int16 ", xShort1, Test( Math::Sign( xShort1 ) ) ); - Console::WriteLine( str, "Int32 ", xInt1, Test( Math::Sign( xInt1 ) ) ); - Console::WriteLine( str, "Int64 ", xLong1, Test( Math::Sign( xLong1 ) ) ); - Console::WriteLine( str, "Single ", xSingle1, Test( Math::Sign( xSingle1 ) ) ); - Console::WriteLine( str, "Double ", xDouble1, Test( Math::Sign( xDouble1 ) ) ); - Console::WriteLine( str, "Decimal", xDecimal1, Test( Math::Sign( xDecimal1 ) ) ); - - // - Console::WriteLine( "{0}The following type is not CLS-compliant.", nl ); - Console::WriteLine( str, "SByte ", xSbyte1, Test( Math::Sign( xSbyte1 ) ) ); -} - -/* -This example produces the following results: - -Test the sign of the following types of values: -Byte : 0 is equal to zero. -Int16 : -2 is less than zero. -Int32 : -3 is less than zero. -Int64 : -4 is less than zero. -Single : 0 is equal to zero. -Double : 6 is greater than zero. -Decimal: -7 is less than zero. - -The following type is not CLS-compliant. -SByte : -101 is less than zero. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp b/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp deleted file mode 100644 index 0db73927f0c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -// This example demonstrates the PlatformID enumeration. -using namespace System; -int main() -{ - String^ msg1 = L"This is a Windows operating system."; - String^ msg2 = L"This is a Unix operating system."; - String^ msg3 = L"ERROR: This platform identifier is invalid."; - - // Assume this example is run on a Windows operating system. - OperatingSystem^ os = Environment::OSVersion; - PlatformID pid = os->Platform; - switch ( pid ) - { - case PlatformID::Win32NT: - case PlatformID::Win32S: - case PlatformID::Win32Windows: - case PlatformID::WinCE: - Console::WriteLine( msg1 ); - break; - - case PlatformID::Unix: - Console::WriteLine( msg2 ); - break; - - default: - Console::WriteLine( msg3 ); - break; - } - return 1; -} - -/* -This example produces the following results: - -This is a Windows operating system. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp deleted file mode 100644 index 985c85cb847..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -// Sample for String::LastIndexOf(String, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - start = str->Length - 1; - Console::WriteLine( "All occurrences of 'he' from position {0} to 0.", start ); - Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str ); - Console::Write( "The string 'he' occurs at position(s): " ); - at = 0; - while ( (start > -1) && (at > -1) ) - { - at = str->LastIndexOf( "he", start ); - if ( at > -1 ) - { - Console::Write( " {0} ", at ); - start = at - 1; - } - } - - Console::WriteLine(); -} - -/* -This example produces the following results: -All occurrences of 'he' from position 66 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The string 'he' occurs at position(s): 56 45 8 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp deleted file mode 100644 index 707743dd829..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Sample for String::LastIndexOf(String, Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - int end; - start = str->Length - 1; - end = start / 2 - 1; - Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "The string 'he' occurs at position(s): " ); - count = 0; - at = 0; - while ( (start > -1) && (at > -1) ) - { - count = start - end; //Count must be within the substring. - at = str->LastIndexOf( "he", start, count ); - if ( at > -1 ) - { - Console::Write( "{0} ", at ); - start = at - 1; - } - } - - Console::Write( "{0} {0} {0}", Environment::NewLine ); -} - -/* -This example produces the following results: -All occurrences of 'he' from position 66 to 32. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The string 'he' occurs at position(s): 56 45 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp deleted file mode 100644 index 545ffd356be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::LastIndexOfAny(Char[]) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - String^ target = "is"; - array^anyOf = target->ToCharArray(); - start = str->Length - 1; - Console::WriteLine( "The last character occurrence from position {0} to 0.", start ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->LastIndexOfAny( anyOf ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::Write( "{0}{0}{0}", Environment::NewLine ); -} - -/* -This example produces the following results: -The last character occurrence from position 66 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'is' occurs at position: 58 - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp deleted file mode 100644 index 4328318576a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::LastIndexOfAny(Char, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - String^ target = "is"; - array^anyOf = target->ToCharArray(); - start = (str->Length - 1) / 2; - Console::WriteLine( "The last character occurrence from position {0} to 0.", start ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->LastIndexOfAny( anyOf, start ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::Write( "{0}{0}{0}", Environment::NewLine ); -} - -/* -This example produces the following results: -The last character occurrence from position 33 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'is' occurs at position: 12 - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp deleted file mode 100644 index 2c3f5ecd695..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::LastIndexOfAny(Char[], Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - String^ target = "aid"; - array^anyOf = target->ToCharArray(); - start = ((str->Length - 1) * 2) / 3; - count = (str->Length - 1) / 3; - Console::WriteLine( "The last character occurrence from position {0} for {1} characters.", start, count ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->LastIndexOfAny( anyOf, start, count ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::Write( "{0}{0}{0}", Environment::NewLine ); -} - -/* -This example produces the following results: -The last character occurrence from position 44 for 22 characters. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'aid' occurs at position: 27 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp b/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp deleted file mode 100644 index 338ffdc3b4f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -// Sample for String::ToCharArray(Int32, Int32) -using namespace System; -using namespace System::Collections; -int main() -{ - String^ str = "012wxyz789"; - array^arr; - arr = str->ToCharArray( 3, 4 ); - Console::Write( "The letters in '{0}' are: '", str ); - Console::Write( arr ); - Console::WriteLine( "'" ); - Console::WriteLine( "Each letter in '{0}' is:", str ); - IEnumerator^ myEnum = arr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::WriteLine( c ); - } -} - -/* -This example produces the following results: -The letters in '012wxyz789' are: 'wxyz' -Each letter in '012wxyz789' is: -w -x -y -z -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp deleted file mode 100644 index 67cba53ecab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -String^ symbol( int r ) -{ - String^ s = "="; - if ( r < 0 ) - s = "<"; - else - if ( r > 0 ) - s = ">"; - - - return s; -} - -int main() -{ - String^ str1 = "change"; - String^ str2 = "dollar"; - String^ relation = nullptr; - relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "en-US" ) ) ); - Console::WriteLine( "For en-US: {0} {1} {2}", str1, relation, str2 ); - relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "cs-CZ" ) ) ); - Console::WriteLine( "For cs-CZ: {0} {1} {2}", str1, relation, str2 ); -} - -/* -This example produces the following results. -For en-US: change < dollar -For cs-CZ: change > dollar -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp deleted file mode 100644 index 069e685cc76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Sample for String::Compare(String, Int32, String, Int32, Int32) -using namespace System; -int main() -{ - - // 0123456 - String^ str1 = "machine"; - String^ str2 = "device"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - result = String::Compare( str1, 2, str2, 0, 2 ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in ' {1}' is ", str1->Substring( 2, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in ' {1}'.", str2->Substring( 0, 2 ), str2 ); -} - -/* -This example produces the following results: - -str1 = 'machine', str2 = 'device' -Substring 'ch' in 'machine' is less than substring 'de' in 'device'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp deleted file mode 100644 index 0e2fd3df934..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean) -using namespace System; -int main() -{ - - // 0123456 - String^ str1 = "MACHINE"; - String^ str2 = "machine"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - Console::WriteLine( "Ignore case:" ); - result = String::Compare( str1, 2, str2, 2, 2, true ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 ); - Console::WriteLine(); - Console::WriteLine( "Honor case:" ); - result = String::Compare( str1, 2, str2, 2, 2, false ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 ); -} - -/* -This example produces the following results: - -str1 = 'MACHINE', str2 = 'machine' -Ignore case: -Substring 'CH' in 'MACHINE' is equal to substring 'ch' in 'machine'. - -Honor case: -Substring 'CH' in 'MACHINE' is greater than substring 'ch' in 'machine'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp deleted file mode 100644 index 3afdbfd074c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean, CultureInfo) -using namespace System; -using namespace System::Globalization; -int main() -{ - - // 0123456 - String^ str1 = "MACHINE"; - String^ str2 = "machine"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - Console::WriteLine( "Ignore case, Turkish culture:" ); - result = String::Compare( str1, 4, str2, 4, 2, true, gcnew CultureInfo( "tr-TR" ) ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 ); - Console::WriteLine(); - Console::WriteLine( "Ignore case, invariant culture:" ); - result = String::Compare( str1, 4, str2, 4, 2, true, CultureInfo::InvariantCulture ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 ); -} - -/* -This example produces the following results: - -str1 = 'MACHINE', str2 = 'machine' -Ignore case, Turkish culture: -Substring 'IN' in 'MACHINE' is less than substring 'in' in 'machine'. - -Ignore case, invariant culture: -Substring 'IN' in 'MACHINE' is equal to substring 'in' in 'machine'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp b/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp deleted file mode 100644 index 52112724b74..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Sample for String::CompareOrdinal(String, String) -using namespace System; -int main() -{ - String^ str1 = "ABCD"; - String^ str2 = "abcd"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "Compare the numeric values of the corresponding Char objects in each string." ); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - result = String::CompareOrdinal( str1, str2 ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "String '{0}' is ", str1 ); - Console::Write( "{0} ", str ); - Console::WriteLine( "String '{0}'.", str2 ); -} - -/* -This example produces the following results: - -Compare the numeric values of the corresponding Char objects in each string. -str1 = 'ABCD', str2 = 'abcd' -String 'ABCD' is less than String 'abcd'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp b/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp deleted file mode 100644 index 4b457f0078d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -using namespace System; - -int main() -{ - int i = -123; - Object^ o = i; - array^objs = { -123, -456, -789}; - Console::WriteLine("Concatenate 1, 2, and 3 objects:"); - Console::WriteLine("1) {0}", String::Concat(o)); - Console::WriteLine("2) {0}", String::Concat(o, o)); - Console::WriteLine("3) {0}", String::Concat(o, o, o)); - - Console::WriteLine("\nConcatenate 4 objects and a variable length parameter list:" ); - Console::WriteLine("4) {0}", String::Concat(o, o, o, o)); - Console::WriteLine("5) {0}", String::Concat( o, o, o, o, o)); - Console::WriteLine("\nConcatenate a 3-element object array:"); - Console::WriteLine("6) {0}", String::Concat(objs)); -} -// The example displays the following output: -// Concatenate 1, 2, and 3 objects: -// 1) -123 -// 2) -123-123 -// 3) -123-123-123 -// -// Concatenate 4 objects and a variable length parameter list: -// 4) -123-123-123-123 -// 5) -123-123-123-123-123 -// -// Concatenate a 3-element object array: -// 6) -123-456-789 -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp b/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp deleted file mode 100644 index d9beeec7af6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; - -int main() -{ - String^ s1 = "The quick brown fox jumps over the lazy dog"; - String^ s2 = "fox"; - bool b = s1->Contains( s2 ); - Console::WriteLine( "Is the string, s2, in the string, s1?: {0}", b ); - if (b) { - int index = s1->IndexOf(s2); - if (index >= 0) - Console::WriteLine("'{0} begins at character position {1}", - s2, index + 1); - } -} -// This example displays the following output: -// 'fox' is in the string 'The quick brown fox jumps over the lazy dog': True -// 'fox begins at character position 17 -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp deleted file mode 100644 index 94de0334063..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -// Sample for String::Equals(Object) -// String::Equals(String) -// String::Equals(String, String) -using namespace System; -using namespace System::Text; -int main() -{ - StringBuilder^ sb = gcnew StringBuilder( "abcd" ); - String^ str1 = "abcd"; - String^ str2 = nullptr; - Object^ o2 = nullptr; - Console::WriteLine(); - Console::WriteLine( " * The value of String str1 is '{0}'.", str1 ); - Console::WriteLine( " * The value of StringBuilder sb is '{0}'.", sb ); - Console::WriteLine(); - Console::WriteLine( "1a) String::Equals(Object). Object is a StringBuilder, not a String." ); - Console::WriteLine( " Is str1 equal to sb?: {0}", str1->Equals( sb ) ); - Console::WriteLine(); - Console::WriteLine( "1b) String::Equals(Object). Object is a String." ); - str2 = sb->ToString(); - o2 = str2; - Console::WriteLine( " * The value of Object o2 is '{0}'.", o2 ); - Console::WriteLine( " Is str1 equal to o2?: {0}", str1->Equals( o2 ) ); - Console::WriteLine(); - Console::WriteLine( " 2) String::Equals(String)" ); - Console::WriteLine( " * The value of String str2 is '{0}'.", str2 ); - Console::WriteLine( " Is str1 equal to str2?: {0}", str1->Equals( str2 ) ); - Console::WriteLine(); - Console::WriteLine( " 3) String::Equals(String, String)" ); - Console::WriteLine( " Is str1 equal to str2?: {0}", String::Equals( str1, str2 ) ); -} - -/* -This example produces the following results: - - * The value of String str1 is 'abcd'. - * The value of StringBuilder sb is 'abcd'. - -1a) String::Equals(Object). Object is a StringBuilder, not a String. - Is str1 equal to sb?: False - -1b) String::Equals(Object). Object is a String. - * The value of Object o2 is 'abcd'. - Is str1 equal to o2?: True - - 2) String::Equals(String) - * The value of String str2 is 'abcd'. - Is str1 equal to str2?: True - - 3) String::Equals(String, String) - Is str1 equal to str2?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp b/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp deleted file mode 100644 index 536db349ec4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// Sample for String.GetTypeCode() -using namespace System; -int main() -{ - String^ str = "abc"; - TypeCode tc = str->GetTypeCode(); - Console::WriteLine( "The type code for '{0}' is {1}, which represents {2}.", str, tc.ToString( "D" ), tc.ToString( "F" ) ); -} - -/* -This example produces the following results: -The type code for 'abc' is 18, which represents String. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp deleted file mode 100644 index 30d08ce5ace..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -// Sample for String::IndexOf(Char, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - Console::WriteLine(); - Console::WriteLine( "All occurrences of 't' from position 0 to {0}.", str->Length - 1 ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "The letter 't' occurs at position(s): " ); - at = 0; - start = 0; - while ( (start < str->Length) && (at > -1) ) - { - at = str->IndexOf( 't', start ); - if ( at == -1 ) - break; - - Console::Write( "{0} ", at ); - start = at + 1; - } - - Console::WriteLine(); -} - -/* -This example produces the following results: - -All occurrences of 't' from position 0 to 66. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The letter 't' occurs at position(s): 7 11 33 41 44 55 64 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp deleted file mode 100644 index f8a1385b749..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -// Sample for String::IndexOf(String, Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int end; - int count; - end = str->Length; - start = end / 2; - Console::WriteLine(); - Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end - 1 ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "The string 'he' occurs at position(s): " ); - count = 0; - at = 0; - while ( (start <= end) && (at > -1) ) - { - - // start+count must be a position within -str-. - count = end - start; - at = str->IndexOf( "he", start, count ); - if ( at == -1 ) - break; - - Console::Write( "{0} ", at ); - start = at + 1; - } - - Console::WriteLine(); -} - -/* -This example produces the following results: - -All occurrences of 'he' from position 33 to 66. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The string 'he' occurs at position(s): 45 56 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp deleted file mode 100644 index 47b0a1db97c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::IndexOfAny(Char[], Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - String^ target = "is"; - array^anyOf = target->ToCharArray(); - start = str->Length / 2; - Console::WriteLine(); - Console::WriteLine( "The first character occurrence from position {0} to {1}.", start, str->Length - 1 ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->IndexOfAny( anyOf, start ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::WriteLine(); -} - -/* - -The first character occurrence from position 33 to 66. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'is' occurs at position: 49 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp deleted file mode 100644 index 4bd03080726..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -// Sample for String::IndexOfAny(Char[], Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - String^ target = "aid"; - array^anyOf = target->ToCharArray(); - start = (str->Length - 1) / 3; - count = (str->Length - 1) / 4; - Console::WriteLine(); - Console::WriteLine( "The first character occurrence from position {0} for {1} characters.", start, count ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->IndexOfAny( anyOf, start, count ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::WriteLine(); -} - -/* - -The first character occurrence from position 22 for 16 characters. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'aid' occurs at position: 27 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp b/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp deleted file mode 100644 index b70c604b0b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -// Sample for String::Intern(String) -using namespace System; -using namespace System::Text; -int main() -{ - String^ s1 = "MyTest"; - String^ s2 = (gcnew StringBuilder)->Append( "My" )->Append( "Test" )->ToString(); - String^ s3 = String::Intern( s2 ); - Console::WriteLine( "s1 == '{0}'", s1 ); - Console::WriteLine( "s2 == '{0}'", s2 ); - Console::WriteLine( "s3 == '{0}'", s3 ); - Console::WriteLine( "Is s2 the same reference as s1?: {0}", s2 == s1 ); - Console::WriteLine( "Is s3 the same reference as s1?: {0}", s3 == s1 ); -} - -/* -This example produces the following results: -s1 == 'MyTest' -s2 == 'MyTest' -s3 == 'MyTest' -Is s2 the same reference as s1?: False -Is s3 the same reference as s1?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp b/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp deleted file mode 100644 index a9a9593c87e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -String^ Test( String^ s ) -{ - if (String::IsNullOrEmpty(s)) - return "is null or empty"; - else - return String::Format( "(\"{0}\") is neither null nor empty", s ); -} - -int main() -{ - String^ s1 = "abcd"; - String^ s2 = ""; - String^ s3 = nullptr; - Console::WriteLine( "String s1 {0}.", Test( s1 ) ); - Console::WriteLine( "String s2 {0}.", Test( s2 ) ); - Console::WriteLine( "String s3 {0}.", Test( s3 ) ); -} -// The example displays the following output: -// String s1 ("abcd") is neither null nor empty. -// String s2 is null or empty. -// String s3 is null or empty. -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp b/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp deleted file mode 100644 index bec722b1e9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// Sample for String::IsInterned(String) -using namespace System; -using namespace System::Text; -using namespace System::Runtime::CompilerServices; - -// In the .NET Framework 2.0 the following attribute declaration allows you to -// avoid the use of the interning when you use NGEN.exe to compile an assembly -// to the native image cache. -[assembly:CompilationRelaxations(CompilationRelaxations::NoStringInterning)]; -void Test( int sequence, String^ str ) -{ - Console::Write( "{0} The string '", sequence ); - String^ strInterned = String::IsInterned( str ); - if ( strInterned == nullptr ) - Console::WriteLine( "{0}' is not interned.", str ); - else - Console::WriteLine( "{0}' is interned.", strInterned ); -} - -int main() -{ - - // String str1 is known at compile time, and is automatically interned. - String^ str1 = "abcd"; - - // Constructed string, str2, is not explicitly or automatically interned. - String^ str2 = (gcnew StringBuilder)->Append( "wx" )->Append( "yz" )->ToString(); - Console::WriteLine(); - Test( 1, str1 ); - Test( 2, str2 ); -} - -//This example produces the following results: - -//1) The string, 'abcd', is interned. -//2) The string, 'wxyz', is not interned. - -//If you use NGEN.exe to compile the assembly to the native image cache, this -//example produces the following results: - -//1) The string, 'abcd', is not interned. -//2) The string, 'wxyz', is not interned. - -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp b/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp deleted file mode 100644 index 07f204ebd9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -// Sample for String::Join(String, String[], int int) -using namespace System; -int main() -{ - array^val = {"apple","orange","grape","pear"}; - String^ sep = ", "; - String^ result; - Console::WriteLine( "sep = '{0}'", sep ); - Console::WriteLine( "val[] = {{'{0}' '{1}' '{2}' '{3}'}}", val[ 0 ], val[ 1 ], val[ 2 ], val[ 3 ] ); - result = String::Join( sep, val, 1, 2 ); - Console::WriteLine( "String::Join(sep, val, 1, 2) = '{0}'", result ); -} - -/* -This example produces the following results: -sep = ', ' -val[] = {'apple' 'orange' 'grape' 'pear'} -String::Join(sep, val, 1, 2) = 'orange, grape' -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp deleted file mode 100644 index 809d2c001d6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -// Sample for String::LastIndexOf(Char, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - start = str->Length - 1; - Console::WriteLine( "All occurrences of 't' from position {0} to 0.", start ); - Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str ); - Console::Write( "The letter 't' occurs at position(s): " ); - at = 0; - while ( (start > -1) && (at > -1) ) - { - at = str->LastIndexOf( 't', start ); - if ( at > -1 ) - { - Console::Write( " {0} ", at ); - start = at - 1; - } - } -} - -/* -This example produces the following results: -All occurrences of 't' from position 66 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The letter 't' occurs at position(s): 64 55 44 41 33 11 7 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp deleted file mode 100644 index 881187073e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Sample for String::LastIndexOf(Char, Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - int end; - start = str->Length - 1; - end = start / 2 - 1; - Console::WriteLine( "All occurrences of 't' from position {0} to {1}.", start, end ); - Console::WriteLine( "\n{0}\n{1}\n{2}", br1, br2, str ); - Console::Write( "The letter 't' occurs at position(s): " ); - count = 0; - at = 0; - while ( (start > -1) && (at > -1) ) - { - count = start - end; //Count must be within the substring. - at = str->LastIndexOf( 't', start, count ); - if ( at > -1 ) - { - Console::Write( " {0} ", at ); - start = at - 1; - } - } -} - -/* -This example produces the following results: -All occurrences of 't' from position 66 to 32. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The letter 't' occurs at position(s): 64 55 44 41 33 - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp b/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp deleted file mode 100644 index e3a6250c8ac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -// Sample for String::Length -using namespace System; -int main() -{ - String^ str = "abcdefg"; - Console::WriteLine( "1) The length of '{0}' is {1}", str, str->Length ); - Console::WriteLine( "2) The length of '{0}' is {1}", "xyz", ((String^)"xyz")->Length ); - int length = str->Length; - Console::WriteLine( "1) The length of '{0}' is {1}", str, length ); -} - -/* -This example displays the following output: - 1) The length of 'abcdefg' is 7 - 2) The length of 'xyz' is 3 - 3) The length of 'abcdefg' is 7 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp b/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp deleted file mode 100644 index 8193a3115e2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp +++ /dev/null @@ -1,117 +0,0 @@ - -// -using namespace System; -using namespace System::Text; - -void Show( String^ title, String^ s ) -{ - Console::Write( "Characters in string {0} = ", title ); - for each (short x in s) { - Console::Write("{0:X4} ", x); - } - Console::WriteLine(); -} - -int main() -{ - - // Character c; combining characters acute and cedilla; character 3/4 - array^temp0 = {L'c',L'\u0301',L'\u0327',L'\u00BE'}; - String^ s1 = gcnew String( temp0 ); - String^ s2 = nullptr; - String^ divider = gcnew String( '-',80 ); - divider = String::Concat( Environment::NewLine, divider, Environment::NewLine ); - - Show( "s1", s1 ); - Console::WriteLine(); - Console::WriteLine( "U+0063 = LATIN SMALL LETTER C" ); - Console::WriteLine( "U+0301 = COMBINING ACUTE ACCENT" ); - Console::WriteLine( "U+0327 = COMBINING CEDILLA" ); - Console::WriteLine( "U+00BE = VULGAR FRACTION THREE QUARTERS" ); - Console::WriteLine( divider ); - Console::WriteLine( "A1) Is s1 normalized to the default form (Form C)?: {0}", s1->IsNormalized() ); - Console::WriteLine( "A2) Is s1 normalized to Form C?: {0}", s1->IsNormalized( NormalizationForm::FormC ) ); - Console::WriteLine( "A3) Is s1 normalized to Form D?: {0}", s1->IsNormalized( NormalizationForm::FormD ) ); - Console::WriteLine( "A4) Is s1 normalized to Form KC?: {0}", s1->IsNormalized( NormalizationForm::FormKC ) ); - Console::WriteLine( "A5) Is s1 normalized to Form KD?: {0}", s1->IsNormalized( NormalizationForm::FormKD ) ); - Console::WriteLine( divider ); - Console::WriteLine( "Set string s2 to each normalized form of string s1." ); - Console::WriteLine(); - Console::WriteLine( "U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE" ); - Console::WriteLine( "U+0033 = DIGIT THREE" ); - Console::WriteLine( "U+2044 = FRACTION SLASH" ); - Console::WriteLine( "U+0034 = DIGIT FOUR" ); - Console::WriteLine( divider ); - s2 = s1->Normalize(); - Console::Write( "B1) Is s2 normalized to the default form (Form C)?: " ); - Console::WriteLine( s2->IsNormalized() ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormC ); - Console::Write( "B2) Is s2 normalized to Form C?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormC ) ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormD ); - Console::Write( "B3) Is s2 normalized to Form D?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormD ) ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormKC ); - Console::Write( "B4) Is s2 normalized to Form KC?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKC ) ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormKD ); - Console::Write( "B5) Is s2 normalized to Form KD?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKD ) ); - Show( "s2", s2 ); - Console::WriteLine(); -} - -/* -This example produces the following results: - -Characters in string s1 = 0063 0301 0327 00BE - -U+0063 = LATIN SMALL LETTER C -U+0301 = COMBINING ACUTE ACCENT -U+0327 = COMBINING CEDILLA -U+00BE = VULGAR FRACTION THREE QUARTERS - --------------------------------------------------------------------------------- - -A1) Is s1 normalized to the default form (Form C)?: False -A2) Is s1 normalized to Form C?: False -A3) Is s1 normalized to Form D?: False -A4) Is s1 normalized to Form KC?: False -A5) Is s1 normalized to Form KD?: False - --------------------------------------------------------------------------------- - -Set string s2 to each normalized form of string s1. - -U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE -U+0033 = DIGIT THREE -U+2044 = FRACTION SLASH -U+0034 = DIGIT FOUR - --------------------------------------------------------------------------------- - -B1) Is s2 normalized to the default form (Form C)?: True -Characters in string s2 = 1E09 00BE - -B2) Is s2 normalized to Form C?: True -Characters in string s2 = 1E09 00BE - -B3) Is s2 normalized to Form D?: True -Characters in string s2 = 0063 0327 0301 00BE - -B4) Is s2 normalized to Form KC?: True -Characters in string s2 = 1E09 0033 2044 0034 - -B5) Is s2 normalized to Form KD?: True -Characters in string s2 = 0063 0327 0301 0033 2044 0034 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp b/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp deleted file mode 100644 index a7be6a4bd78..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -// This example demonstrates the String.Remove() method. -using namespace System; -int main() -{ - String^ s = "abc---def"; - - // - Console::WriteLine( "Index: 012345678" ); - Console::WriteLine( "1) {0}", s ); - Console::WriteLine( "2) {0}", s->Remove( 3 ) ); - Console::WriteLine( "3) {0}", s->Remove( 3, 3 ) ); -} - -/* -This example produces the following results: - -Index: 012345678 -1) abc---def -2) abc -3) abcdef - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp b/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp deleted file mode 100644 index 5bb7e44d58f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "1 2 3 4 5 6 7 8 9"; - Console::WriteLine( "Original string: \"{0}\"", str ); - Console::WriteLine( "CSV string: \"{0}\"", str->Replace( ' ', ',' ) ); -} - -// -// This example produces the following output: -// Original string: "1 2 3 4 5 6 7 8 9" -// CSV string: "1,2,3,4,5,6,7,8,9" -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp b/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp deleted file mode 100644 index c976a43115b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -// This example demonstrates the String.Split(Char[], Boolean) and -// String.Split(Char[], Int32, Boolean) methods -using namespace System; -void Show( array^entries ) -{ - Console::WriteLine( "The return value contains these {0} elements:", entries->Length ); - System::Collections::IEnumerator^ myEnum = entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ entry = safe_cast(myEnum->Current); - Console::Write( "<{0}>", entry ); - } - - Console::Write( "{0}{0}", Environment::NewLine ); -} - -int main() -{ - String^ s = ",one,,,two,,,,,three,,"; - array^sep = gcnew array{ - ',' - }; - array^result; - - // - Console::WriteLine( "The original string is \"{0}\".", s ); - Console::WriteLine( "The separation character is '{0}'.", sep[ 0 ] ); - Console::WriteLine(); - - // - Console::WriteLine( "Split the string and return all elements:" ); - result = s->Split( sep, StringSplitOptions::None ); - Show( result ); - - // - Console::WriteLine( "Split the string and return all non-empty elements:" ); - result = s->Split( sep, StringSplitOptions::RemoveEmptyEntries ); - Show( result ); - - // - Console::WriteLine( "Split the string and return 2 elements:" ); - result = s->Split( sep, 2, StringSplitOptions::None ); - Show( result ); - - // - Console::WriteLine( "Split the string and return 2 non-empty elements:" ); - result = s->Split( sep, 2, StringSplitOptions::RemoveEmptyEntries ); - Show( result ); -} - -/* -This example produces the following results: - -The original string is ",one,,,two,,,,,three,,". -The separation character is ','. - -Split the string and return all elements: -The return value contains these 12 elements: -<><><><><><><><><> - -Split the string and return all non-empty elements: -The return value contains these 3 elements: - - -Split the string and return 2 elements: -The return value contains these 2 elements: -<> - -Split the string and return 2 non-empty elements: -The return value contains these 2 elements: -<,,two,,,,,three,,> - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp b/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp deleted file mode 100644 index bb7a31a327d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// -// Sample for String::ToLower(CultureInfo) -using namespace System; -using namespace System::Globalization; -void CodePoints( String^ title, String^ s ) -{ - Console::Write( "{0}The code points in {1} are: {0}", Environment::NewLine, title ); - System::Collections::IEnumerator^ myEnum = s->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - UInt16 u = safe_cast(myEnum->Current); - Console::Write( "{0:x4} ", u ); - } - - Console::WriteLine(); -} - -int main() -{ - String^ str1 = "INDIGO"; - - // str2 = str1, except each 'I' is '\u0130' (Unicode LATIN CAPITAL I WITH DOT ABOVE). - array^temp = {L'\u0130',L'N',L'D',L'\u0130',L'G',L'O'}; - String^ str2 = gcnew String( temp ); - String^ str3; - String^ str4; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}'", str1 ); - Console::WriteLine(); - Console::WriteLine( "str1 is {0} to str2.", ((0 == String::CompareOrdinal( str1, str2 )) ? (String^)"equal" : "not equal") ); - CodePoints( "str1", str1 ); - CodePoints( "str2", str2 ); - Console::WriteLine(); - - // str3 is a lower case copy of str2, using English-United States culture. - Console::WriteLine( "str3 = Lower case copy of str2 using English-United States culture." ); - str3 = str2->ToLower( gcnew CultureInfo( "en-US",false ) ); - - // str4 is a lower case copy of str2, using Turkish-Turkey culture. - Console::WriteLine( "str4 = Lower case copy of str2 using Turkish-Turkey culture." ); - str4 = str2->ToLower( gcnew CultureInfo( "tr-TR",false ) ); - - // Compare the code points in str3 and str4. - Console::WriteLine(); - Console::WriteLine( "str3 is {0} to str4.", ((0 == String::CompareOrdinal( str3, str4 )) ? (String^)"equal" : "not equal") ); - CodePoints( "str3", str3 ); - CodePoints( "str4", str4 ); -} - -/* -This example produces the following results: - -str1 = 'INDIGO' - -str1 is not equal to str2. - -The code points in str1 are: -0049 004e 0044 0049 0047 004f - -The code points in str2 are: -0130 004e 0044 0130 0047 004f - -str3 = Lower case copy of str2 using English-United States culture. -str4 = Lower case copy of str2 using Turkish-Turkey culture. - -str3 is equal to str4. - -The code points in str3 are: -0069 006e 0064 0069 0067 006f - -The code points in str4 are: -0069 006e 0064 0069 0067 006f -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp b/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp deleted file mode 100644 index 389fdf3e61a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str1 = "123"; - String^ str2 = "abc"; - Console::WriteLine( "Original str1: {0}", str1 ); - Console::WriteLine( "Original str2: {0}", str2 ); - Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) ); - str2 = str1; - Console::WriteLine(); - Console::WriteLine( "New str2: {0}", str2 ); - Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) ); -} - -/* -This code produces the following output: -Original str1: 123 -Original str2: abc -str1 same as str2?: False - -New str2: 123 -str1 same as str2?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp deleted file mode 100644 index 9f50fa95027..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; - -int main() -{ - - // Make an array of strings. Note that we have included spaces. - array^s = { "hello ", "and ", "welcome ", "to ", - "this ", "demo! "}; - - // Put all the strings together. - Console::WriteLine( String::Concat(s) ); - - // Sort the strings, and put them together. - Array::Sort( s ); - Console::WriteLine( String::Concat(s)); -} -// The example displays the following output: -// hello and welcome to this demo! -// and demo! hello this to welcome -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp deleted file mode 100644 index a8d0614ca35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -int main() -{ - - // we want to simply quickly add this person's name together - String^ fName = "Simon"; - String^ mName = "Jake"; - String^ lName = "Harrows"; - - // because we want a name to appear with a space in between each name, - // put a space on the front of the middle, and last name, allowing for - // the fact that a space may already be there - mName = String::Concat( " ", mName->Trim() ); - lName = String::Concat( " ", lName->Trim() ); - - // this line simply concatenates the two strings - Console::WriteLine( "Welcome to this page, '{0}'!", String::Concat( String::Concat( fName, mName ), lName ) ); -} -// The example displays the following output: -// Welcome to this page, 'Simon Jake Harrows'! -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp b/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp deleted file mode 100644 index 683bae6c061..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -int main() -{ - - // Embed an array of characters in a string - String^ strSource = "changed"; - array^destination = {'T','h','e',' ','i','n','i','t','i','a','l',' ','a','r','r','a','y'}; - - // Print the char array - Console::WriteLine( destination ); - - // Embed the source string in the destination string - strSource->CopyTo( 0, destination, 4, strSource->Length ); - - // Print the resulting array - Console::WriteLine( destination ); - strSource = "A different string"; - - // Embed only a section of the source string in the destination - strSource->CopyTo( 2, destination, 3, 9 ); - - // Print the resulting array - Console::WriteLine( destination ); -} -// The example displays the following output: -// The initial array -// The changed array -// Thedifferentarray -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp deleted file mode 100644 index da9802a9dc7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -String^ StripEndTags( String^ item ) -{ - bool found = false; - - // try to find a tag at the end of the line using EndsWith - if ( item->Trim()->EndsWith( ">" ) ) - { - - // now search for the opening tag... - int lastLocation = item->LastIndexOf( "= 0 ) { - item = item->Substring( 0, lastLocation ); - found = true; - } - } - - if (found) item = StripEndTags(item); - - return item; -} - -int main() -{ - - // process an input file that contains html tags. - // this sample checks for multiple tags at the end of the line, rather than simply - // removing the last one. - // note: HTML markup tags always end in a greater than symbol (>). - array^strSource = {"This is bold text","

This is large Text

","This has multiple tags","This has embedded tags.","This line simply ends with a greater than symbol, it should not be modified>"}; - Console::WriteLine( "The following lists the items before the ends have been stripped:" ); - Console::WriteLine( "-----------------------------------------------------------------" ); - - // print out the initial array of strings - IEnumerator^ myEnum1 = strSource->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - String^ s = safe_cast(myEnum1->Current); - Console::WriteLine( s ); - } - - Console::WriteLine(); - Console::WriteLine( "The following lists the items after the ends have been stripped:" ); - Console::WriteLine( "----------------------------------------------------------------" ); - - // Display the array of strings. - IEnumerator^ myEnum2 = strSource->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - String^ s = safe_cast(myEnum2->Current); - Console::WriteLine( StripEndTags( s ) ); - } -} -// The example displays the following output: -// The following lists the items before the ends have been stripped: -// ----------------------------------------------------------------- -// This is bold text -//

This is large Text

-// This has multiple tags -// This has embedded tags. -// This line simply ends with a greater than symbol, it should not be modified> -// -// The following lists the items after the ends have been stripped: -// ---------------------------------------------------------------- -// This is bold text -//

This is large Text -// This has multiple tags -// This has embedded tags. -// This line simply ends with a greater than symbol, it should not be modified> -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp deleted file mode 100644 index 4f76320ec42..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// This is the main project file for VC++ application project -// generated using an Application Wizard. -#define _UNICODE - -#include - -using namespace System; -using namespace System::Text; - -// This is the entry point for this application -int _tmain( void ) -{ - // - // Unicode Mathematical operators - wchar_t charArray1[4] = {L'\x2200',L'\x2202',L'\x200F',L'\x2205'}; - wchar_t * lptstr1 = &charArray1[ 0 ]; - String^ wszMathSymbols = gcnew String( lptstr1 ); - - // Unicode Letterlike Symbols - wchar_t charArray2[4] = {L'\x2111',L'\x2118',L'\x2122',L'\x2126'}; - wchar_t * lptstr2 = &charArray2[ 0 ]; - String^ wszLetterLike = gcnew String( lptstr2 ); - - // Compare Strings - the result is false - Console::WriteLine( String::Concat( L"The Strings are equal? ", (0 == String::Compare( wszLetterLike, wszMathSymbols ) ? (String^)"TRUE" : "FALSE") ) ); - // - - // - // Null terminated ASCII characters in a simple char array - char charArray3[4] = {0x41,0x42,0x43,0x00}; - char * pstr3 = &charArray3[ 0 ]; - String^ szAsciiUpper = gcnew String( pstr3 ); - char charArray4[4] = {0x61,0x62,0x63,0x00}; - char * pstr4 = &charArray4[ 0 ]; - String^ szAsciiLower = gcnew String( pstr4,0,sizeof(charArray4) ); - - // Prints "ABC abc" - Console::WriteLine( String::Concat( szAsciiUpper, " ", szAsciiLower ) ); - - // Compare Strings - the result is true - Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper->ToUpper(), szAsciiLower->ToUpper() ) ? (String^)"TRUE" : "FALSE") ) ); - - // This is the effective equivalent of another Compare method, which ignores case - Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper, szAsciiLower, true ) ? (String^)"TRUE" : "FALSE") ) ); - // - - // - // Create a Unicode String with 5 Greek Alpha characters - String^ szGreekAlpha = gcnew String( L'\x0391',5 ); - - // Create a Unicode String with a Greek Omega character - wchar_t charArray5[3] = {L'\x03A9',L'\x03A9',L'\x03A9'}; - String^ szGreekOmega = gcnew String( charArray5,2,1 ); - String^ szGreekLetters = String::Concat( szGreekOmega, szGreekAlpha, szGreekOmega->Clone() ); - - // Examine the result - Console::WriteLine( szGreekLetters ); - - // The first index of Alpha - int ialpha = szGreekLetters->IndexOf( L'\x0391' ); - - // The last index of Omega - int iomega = szGreekLetters->LastIndexOf( L'\x03A9' ); - Console::WriteLine( String::Concat( "The Greek letter Alpha first appears at index ", Convert::ToString( ialpha ) ) ); - Console::WriteLine( String::Concat( " and Omega last appears at index ", Convert::ToString( iomega ), " in this String." ) ); - // - - // - char asciiChars[6] = {0x51,0x52,0x53,0x54,0x54,0x56}; - char * pstr6 = &asciiChars[ 0 ]; - UTF8Encoding^ encoding = gcnew UTF8Encoding( true,true ); - String^ utfeightstring = gcnew String( pstr6,0,sizeof(asciiChars),encoding ); - - // prints "QRSTTV" - Console::WriteLine( String::Concat( "The UTF8 String is ", utfeightstring ) ); - // - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp b/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp deleted file mode 100644 index 9ca351899a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ strSource = "This is the string which we will perform the search on"; - Console::WriteLine( "The search string is: {0}\"{1}\" {0}", Environment::NewLine, strSource ); - String^ strTarget = ""; - int found = 0; - int totFinds = 0; - do - { - Console::Write( "Please enter a search value to look for in the above string (hit Enter to exit) ==> " ); - strTarget = Console::ReadLine(); - if ( !strTarget->Equals( "" ) ) - { - for ( int i = 0; i < strSource->Length; i++ ) - { - found = strSource->IndexOf( strTarget, i ); - if (found >= 0) - { - totFinds++; - i = found; - } - else - break; - - } - } - else - return 0; - Console::WriteLine( "{0}The search parameter '{1}' was found {2} times. {0}", Environment::NewLine, strTarget, totFinds ); - totFinds = 0; - } - while ( true ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp b/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp deleted file mode 100644 index 1bd127d5ce3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; - -int main() -{ - String^ animal1 = "fox"; - String^ animal2 = "dog"; - String^ strTarget = String::Format( "The {0} jumps over the {1}.", animal1, animal2 ); - Console::WriteLine( "The original string is:{0}{1}{0}", Environment::NewLine, strTarget ); - Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal1 ); - String^ adj1 = Console::ReadLine(); - Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal2 ); - String^ adj2 = Console::ReadLine(); - adj1 = String::Concat( adj1->Trim(), " " ); - adj2 = String::Concat( adj2->Trim(), " " ); - strTarget = strTarget->Insert( strTarget->IndexOf( animal1 ), adj1 ); - strTarget = strTarget->Insert( strTarget->IndexOf( animal2 ), adj2 ); - Console::WriteLine( " {0}The final string is: {0} {1}", Environment::NewLine, strTarget ); -} -// Output from the example might appear as follows: -// The original string is: -// The fox jumps over the dog. -// -// Enter an adjective (or group of adjectives) to describe the fox: ==> bold -// Enter an adjective (or group of adjectives) to describe the dog: ==> lazy -// -// The final string is: -// The bold fox jumps over the lazy dog. -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp b/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp deleted file mode 100644 index 8f6a431148c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -String^ MakeLine( int initVal, int multVal, String^ sep ) -{ - array^sArr = gcnew array(10); - for ( int i = initVal; i < initVal + 10; i++ ) - sArr[ i - initVal ] = String::Format( "{0, -3}", i * multVal ); - return String::Join( sep, sArr ); -} - -int main() -{ - Console::WriteLine( MakeLine( 0, 5, ", " ) ); - Console::WriteLine( MakeLine( 1, 6, " " ) ); - Console::WriteLine( MakeLine( 9, 9, ": " ) ); - Console::WriteLine( MakeLine( 4, 7, "< " ) ); -} -// The example displays the following output: -// 0 , 5 , 10 , 15 , 20 , 25 , 30 , 35 , 40 , 45 -// 6 12 18 24 30 36 42 48 54 60 -// 81 : 90 : 99 : 108: 117: 126: 135: 144: 153: 162 -// 28 < 35 < 42 < 49 < 56 < 63 < 70 < 77 < 84 < 91 -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp b/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp deleted file mode 100644 index 4ea0b86e8aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -int main() -{ - array^info = {"Name","Title","Age","Location","Gender"}; - Console::WriteLine( "The initial values in the array are:" ); - IEnumerator^ myEnum = info->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ s = safe_cast(myEnum->Current); - Console::WriteLine( s ); - } - - Console::WriteLine( " {0}The lowercase of these values is:", Environment::NewLine ); - IEnumerator^ myEnum1 = info->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - String^ s = safe_cast(myEnum1->Current); - Console::WriteLine( s->ToLower() ); - } - - Console::WriteLine( " {0}The uppercase of these values is:", Environment::NewLine ); - IEnumerator^ myEnum2 = info->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - String^ s = safe_cast(myEnum2->Current); - Console::WriteLine( s->ToUpper() ); - } -} -// The example displays the following output: -// The initial values in the array are: -// Name -// Title -// Age -// Location -// Gender -// -// The lowercase of these values is: -// name -// title -// age -// location -// gender -// -// The uppercase of these values is: -// NAME -// TITLE -// AGE -// LOCATION -// GENDER -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp b/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp deleted file mode 100644 index 4960d17021a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ name = "Michelle Violet Banks"; - Console::WriteLine( "The entire name is '{0}'", name ); - - // remove the middle name, identified by finding the spaces in the middle of the name->->. - int foundS1 = name->IndexOf( " " ); - int foundS2 = name->IndexOf( " ", foundS1 + 1 ); - if ( foundS1 != foundS2 && foundS1 >= 0 ) - { - name = name->Remove( foundS1 + 1, foundS2 - foundS1 ); - Console::WriteLine( "After removing the middle name, we are left with '{0}'", name ); - } -} -// The example displays the following output: -// The entire name is 'Michelle Violet Banks' -// After removing the middle name, we are left with 'Michelle Banks' -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp b/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp deleted file mode 100644 index 4d7cac7c4d1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ errString = "This docment uses 3 other docments to docment the docmentation"; - Console::WriteLine( "The original string is:\n'{0}'\n", errString ); - - // Correct the spelling of S"document". - String^ correctString = errString->Replace( "docment", "document" ); - Console::WriteLine( "After correcting the string, the result is:\n'{0}'", correctString ); -} -// -// This code example produces the following output: -// -// The original string is: -// 'This docment uses 3 other docments to docment the docmentation' -// -// After correcting the string, the result is: -// 'This document uses 3 other documents to document the documentation' -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp deleted file mode 100644 index 66a53e4c6dc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -using namespace System; - -String^ StripStartTags( String^ item ) -{ - // Determine whether a tag begins the string. - if (item->Trim()->StartsWith("<")) { - // Find the closing tag. - int lastLocation = item->IndexOf(">"); - - // Remove the tag. - if ( lastLocation >= 0 ) { - item = item->Substring(lastLocation+ 1); - - // Remove any additional starting tags. - item = StripStartTags(item); - } - } - - return item; -} - -int main() -{ - array^ strSource = { "This is bold text", - "

This is large Text

", - "This has multiple tags", - "This has embedded tags.", - "This is bold text
-//

This is large Text

-// This has multiple tags -// This has embedded tags. -// -// This is large Text

-// This has multiple tags -// This has embedded tags.
-// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp deleted file mode 100644 index f2daabba2aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -int main() -{ - try - { - Type^ myType = System::Windows::Forms::Button::typeid; - array^myEvents = myType->GetEvents(); - Console::WriteLine( "The events on the Button class are: " ); - for ( int index = 0; index < myEvents->Length; index++ ) - { - Console::WriteLine( myEvents[ index ] ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp deleted file mode 100644 index 2c09a6f7f39..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -int main() -{ - try - { - - // Create a bitmask based on BindingFlags. - BindingFlags myBindingFlags = static_cast(BindingFlags::Instance | BindingFlags::Public); - Type^ myTypeEvent = System::Windows::Forms::Button::typeid; - array^myEventsBindingFlags = myTypeEvent->GetEvents( myBindingFlags ); - Console::WriteLine( "\nThe events on the Button class with the specified BindingFlags are:" ); - for ( int index = 0; index < myEventsBindingFlags->Length; index++ ) - { - Console::WriteLine( myEventsBindingFlags[ index ] ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// From 7ca1ac5a4c489522e0a483793b801607370a5494 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 2 Jun 2025 11:06:22 -0700 Subject: [PATCH 4/4] fix merge conflict resolution --- xml/System/AttributeTargets.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xml/System/AttributeTargets.xml b/xml/System/AttributeTargets.xml index 2a32da83740..bcf361d6885 100644 --- a/xml/System/AttributeTargets.xml +++ b/xml/System/AttributeTargets.xml @@ -78,8 +78,13 @@ > Visual Basic syntax doesn't support the application of attributes to type parameters. :::code language="csharp" source="~/snippets/csharp/System/AttributeTargets/Overview/attrtargs.cs" id="Snippet1"::: + :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/attrtargs.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AttrTargs/VB/AttrTargs.vb" id="Snippet1"::: - + ]]>
+ + +
+