From 13edf8e99aadb4aaa012c35ffd6c538965c47874 Mon Sep 17 00:00:00 2001 From: Joan Gil Date: Fri, 17 Nov 2023 19:41:59 +0100 Subject: [PATCH] Fix typos in property names and comments (#9441) --- .../CPP/type_getproperty2.cpp | 2 +- .../Parameter/Window1.xaml.cs | 8 +++---- .../Dispatcher/Invoke/Window1.xaml.cs | 8 +++---- .../System/Type/GetProperty/Project.csproj | 9 +++++++ .../Type/GetProperty/type_getproperty1.cs | 13 +++++----- .../Type/GetProperty/type_getproperty2.cs | 16 +++++++------ .../Type/GetProperty/type_getproperty21.cs | 2 ++ .../Type/GetProperty/type_getproperty3.cs | 10 ++++---- .../GetProperty/type_getproperty_types.cs | 24 +++++++++---------- .../Type/GetProperty/type_getproperty2.fs | 2 +- .../Type_GetProperty1/VB/Project.vbproj | 9 +++++++ .../Type_GetProperty1/VB/type_getproperty1.vb | 2 +- .../visualbasic/window1.xaml.vb | 8 +++---- .../visualbasic/window1.xaml.vb | 8 +++---- 14 files changed, 73 insertions(+), 48 deletions(-) create mode 100644 snippets/csharp/System/Type/GetProperty/Project.csproj create mode 100644 snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/Project.vbproj 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 index ee34ae2857b..9301970d3b4 100644 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp @@ -34,7 +34,7 @@ int main() // 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 propety to console. + // Display Name property to console. Console::WriteLine( "{0} is a property of MyClass.", myPropInfo->Name ); } catch ( NullReferenceException^ e ) diff --git a/snippets/csharp/System.Windows.Input/CanExecuteRoutedEventArgs/Parameter/Window1.xaml.cs b/snippets/csharp/System.Windows.Input/CanExecuteRoutedEventArgs/Parameter/Window1.xaml.cs index 01c35832e42..caf203f4629 100644 --- a/snippets/csharp/System.Windows.Input/CanExecuteRoutedEventArgs/Parameter/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Input/CanExecuteRoutedEventArgs/Parameter/Window1.xaml.cs @@ -101,14 +101,14 @@ private void OnSliderMouseWheel(object sender, MouseWheelEventArgs e) if (e.Delta > 0) { //execute the Slider DecreaseSmall RoutedCommand - //the slider.value propety is passed as the command parameter + //the slider.value property is passed as the command parameter ((RoutedCommand)Slider.DecreaseSmall).Execute( source.Value,source); } else { //execute the Slider IncreaseSmall RoutedCommand - //the slider.value propety is passed as the command parameter + //the slider.value property is passed as the command parameter ((RoutedCommand)Slider.IncreaseSmall).Execute( source.Value,source); } @@ -127,14 +127,14 @@ private void OnSliderMouseUp(object sender, MouseButtonEventArgs e) if (e.ChangedButton == MouseButton.XButton1) { // Execute the Slider DecreaseSmall RoutedCommand - // The slider.value propety is passed as the command parameter + // The slider.value property is passed as the command parameter ((RoutedCommand)Slider.DecreaseSmall).Execute( source.Value, source); } if (e.ChangedButton == MouseButton.XButton2) { // Execute the Slider IncreaseSmall RoutedCommand - // The slider.value propety is passed as the command parameter + // The slider.value property is passed as the command parameter ((RoutedCommand)Slider.IncreaseSmall).Execute( source.Value, source); } diff --git a/snippets/csharp/System.Windows.Threading/Dispatcher/Invoke/Window1.xaml.cs b/snippets/csharp/System.Windows.Threading/Dispatcher/Invoke/Window1.xaml.cs index 4a01a236fb6..7f9e0fc0db7 100644 --- a/snippets/csharp/System.Windows.Threading/Dispatcher/Invoke/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Threading/Dispatcher/Invoke/Window1.xaml.cs @@ -103,14 +103,14 @@ private void OnSliderMouseWheel(object sender, MouseWheelEventArgs e) if (e.Delta > 0) { // Execute the Slider DecreaseSmall RoutedCommand. - // The slider.value propety is passed as the command parameter. + // The slider.value property is passed as the command parameter. ((RoutedCommand)Slider.DecreaseSmall).Execute( source.Value, source); } else { // Execute the Slider IncreaseSmall RoutedCommand. - // The slider.value propety is passed as the command parameter. + // The slider.value property is passed as the command parameter. ((RoutedCommand)Slider.IncreaseSmall).Execute( source.Value, source); } @@ -127,14 +127,14 @@ private void OnSliderMouseUp(object sender, MouseButtonEventArgs e) if (e.ChangedButton == MouseButton.XButton1) { // Execute the Slider DecreaseSmall RoutedCommand. - // The slider.value propety is passed as the command parameter. + // The slider.value property is passed as the command parameter. ((RoutedCommand)Slider.DecreaseSmall).Execute( source.Value, source); } if (e.ChangedButton == MouseButton.XButton2) { // Execute the Slider IncreaseSmall RoutedCommand. - // The slider.value propety is passed as the command parameter. + // The slider.value property is passed as the command parameter. ((RoutedCommand)Slider.IncreaseSmall).Execute( source.Value, source); } diff --git a/snippets/csharp/System/Type/GetProperty/Project.csproj b/snippets/csharp/System/Type/GetProperty/Project.csproj new file mode 100644 index 00000000000..29255f5f4b1 --- /dev/null +++ b/snippets/csharp/System/Type/GetProperty/Project.csproj @@ -0,0 +1,9 @@ + + + + Library + net6.0 + + + + \ No newline at end of file diff --git a/snippets/csharp/System/Type/GetProperty/type_getproperty1.cs b/snippets/csharp/System/Type/GetProperty/type_getproperty1.cs index 9e59484eca7..ded0be8510f 100644 --- a/snippets/csharp/System/Type/GetProperty/type_getproperty1.cs +++ b/snippets/csharp/System/Type/GetProperty/type_getproperty1.cs @@ -3,7 +3,7 @@ using System; using System.Reflection; -class MyClass +class MyClass1 { private int myProperty; // Declare MyProperty. @@ -19,22 +19,23 @@ public int MyProperty } } } -public class MyTypeClass + +public class MyTypeClass2 { public static void Main(string[] args) { try { - // Get the Type object corresponding to MyClass. - Type myType=typeof(MyClass); + // Get the Type object corresponding to MyClass1. + Type myType=typeof(MyClass1); // 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); + Console.WriteLine("The {0} property exists in MyClass1.", myPropInfo.Name); } catch(NullReferenceException e) { - Console.WriteLine("The property does not exist in MyClass." + e.Message); + Console.WriteLine("The property does not exist in MyClass1." + e.Message); } } } diff --git a/snippets/csharp/System/Type/GetProperty/type_getproperty2.cs b/snippets/csharp/System/Type/GetProperty/type_getproperty2.cs index 14c3eb3feb1..9e1bb07a3d5 100644 --- a/snippets/csharp/System/Type/GetProperty/type_getproperty2.cs +++ b/snippets/csharp/System/Type/GetProperty/type_getproperty2.cs @@ -2,7 +2,8 @@ using System; using System.Reflection; -class MyClass + +class MyClass2 { private int myProperty; // Declare MyProperty. @@ -18,22 +19,23 @@ public int MyProperty } } } -public class MyTypeClass + +public class MyTypeClass2 { public static void Main(string[] args) { try { - // Get Type object of MyClass. - Type myType=typeof(MyClass); + // Get Type object of MyClass2. + Type myType=typeof(MyClass2); // Get the PropertyInfo by passing the property name and specifying the BindingFlags. PropertyInfo myPropInfo = myType.GetProperty("MyProperty", BindingFlags.Public | BindingFlags.Instance); - // Display Name propety to console. - Console.WriteLine("{0} is a property of MyClass.", myPropInfo.Name); + // Display Name property to console. + Console.WriteLine("{0} is a property of MyClass2.", myPropInfo.Name); } catch(NullReferenceException e) { - Console.WriteLine("MyProperty does not exist in MyClass." +e.Message); + Console.WriteLine("MyProperty does not exist in MyClass2." +e.Message); } } } diff --git a/snippets/csharp/System/Type/GetProperty/type_getproperty21.cs b/snippets/csharp/System/Type/GetProperty/type_getproperty21.cs index 7d976dceb21..62c5887e96c 100644 --- a/snippets/csharp/System/Type/GetProperty/type_getproperty21.cs +++ b/snippets/csharp/System/Type/GetProperty/type_getproperty21.cs @@ -1,6 +1,7 @@ // using System; using System.Reflection; + public class MyPropertyClass { private int [,] myPropertyArray = new int[10,10]; @@ -17,6 +18,7 @@ public class MyPropertyClass } } } + public class MyTypeClass { public static void Main() diff --git a/snippets/csharp/System/Type/GetProperty/type_getproperty3.cs b/snippets/csharp/System/Type/GetProperty/type_getproperty3.cs index 3fb20bd805b..e96e5370669 100644 --- a/snippets/csharp/System/Type/GetProperty/type_getproperty3.cs +++ b/snippets/csharp/System/Type/GetProperty/type_getproperty3.cs @@ -2,7 +2,8 @@ using System; using System.Reflection; -class MyClass1 + +class MyClass3 { private int [,] myArray = {{1,2},{3,4}}; // Declare an indexer. @@ -18,14 +19,15 @@ class MyClass1 } } } -public class MyTypeClass + +public class MyTypeClass3 { public static void Main(string[] args) { try { // Get the Type object. - Type myType=typeof(MyClass1); + Type myType=typeof(MyClass3); Type[] myTypeArr = new Type[2]; // Create an instance of a Type array. myTypeArr.SetValue(typeof(int),0); @@ -33,7 +35,7 @@ public static void Main(string[] args) // 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.ToString()); + Console.WriteLine("The {0} property exists in MyClass3.", myPropInfo.ToString()); } catch(NullReferenceException e) { diff --git a/snippets/csharp/System/Type/GetProperty/type_getproperty_types.cs b/snippets/csharp/System/Type/GetProperty/type_getproperty_types.cs index a1294edfc95..43c9ea42150 100644 --- a/snippets/csharp/System/Type/GetProperty/type_getproperty_types.cs +++ b/snippets/csharp/System/Type/GetProperty/type_getproperty_types.cs @@ -3,9 +3,9 @@ using System; using System.Reflection; -class MyClass1 +class MyPropertyTypeClass { - String myMessage="Hello World."; + String myMessage = "Hello World."; public string MyProperty1 { get @@ -14,30 +14,30 @@ public string MyProperty1 } set { - myMessage =value; + myMessage = value; } } } + class TestClass { static void Main() { try { - Type myType = typeof(MyClass1); + Type myType = typeof(MyPropertyTypeClass); // Get the PropertyInfo object representing MyProperty1. - PropertyInfo myStringProperties1 = myType.GetProperty("MyProperty1", - typeof(string)); - 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); + PropertyInfo myStringProperties1 = myType.GetProperty("MyProperty1", typeof(string)); + Console.WriteLine("The name of the first property of MyPropertyTypeClass is {0}.", myStringProperties1.Name); + Console.WriteLine("The type of the first property of MyPropertyTypeClass is {0}.", myStringProperties1.PropertyType); } catch(ArgumentNullException e) { - Console.WriteLine("ArgumentNullException :"+e.Message); + Console.WriteLine("ArgumentNullException :" + e.Message); } catch(AmbiguousMatchException e) { - Console.WriteLine("AmbiguousMatchException :"+e.Message); + Console.WriteLine("AmbiguousMatchException :" + e.Message); } catch(NullReferenceException e) { @@ -45,8 +45,8 @@ static void Main() 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. + //The name of the first property of MyPropertyTypeClass is MyProperty1. + //The type of the first property of MyPropertyTypeClass is System.String. } } // diff --git a/snippets/fsharp/System/Type/GetProperty/type_getproperty2.fs b/snippets/fsharp/System/Type/GetProperty/type_getproperty2.fs index 808322c70be..fe0018e0dc5 100644 --- a/snippets/fsharp/System/Type/GetProperty/type_getproperty2.fs +++ b/snippets/fsharp/System/Type/GetProperty/type_getproperty2.fs @@ -18,7 +18,7 @@ try let myType = typeof // Get the PropertyInfo by passing the property name and specifying the BindingFlags. let myPropInfo = myType.GetProperty("MyProperty", BindingFlags.Public ||| BindingFlags.Instance) - // Display Name propety to console. + // Display Name property to console. printfn $"{myPropInfo.Name} is a property of MyClass." with :? NullReferenceException as e -> printfn $"MyProperty does not exist in MyClass.{e.Message}" diff --git a/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/Project.vbproj new file mode 100644 index 00000000000..29255f5f4b1 --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/Project.vbproj @@ -0,0 +1,9 @@ + + + + Library + net6.0 + + + + \ No newline at end of file diff --git a/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/type_getproperty1.vb b/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/type_getproperty1.vb index fdf6d2d35a0..78e58d5097d 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/type_getproperty1.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/type_getproperty1.vb @@ -21,7 +21,7 @@ Public Class MyTypeClass Dim myType As Type = GetType(MyClass1) ' Get PropertyInfo object by passing property name. Dim myPropInfo As PropertyInfo = myType.GetProperty("MyProperty") - ' Display Name propety to console. + ' Display Name property to console. Console.WriteLine("The {0} property exists in MyClass.", myPropInfo.Name) Catch e As NullReferenceException Console.WriteLine("The property does not exist in MyClass.", e.Message.ToString()) diff --git a/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithDispatcherTimer/visualbasic/window1.xaml.vb b/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithDispatcherTimer/visualbasic/window1.xaml.vb index 308cf91fe01..5b4a9b5cd99 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithDispatcherTimer/visualbasic/window1.xaml.vb +++ b/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithDispatcherTimer/visualbasic/window1.xaml.vb @@ -79,12 +79,12 @@ Namespace SDKSamples If e.Delta > 0 Then 'execute the Slider DecreaseSmall RoutedCommand - 'the slider.value propety is passed as the command parameter + 'the slider.value property is passed as the command parameter CType(Slider.DecreaseSmall, RoutedCommand).Execute(source.Value,source) Else 'execute the Slider IncreaseSmall RoutedCommand - 'the slider.value propety is passed as the command parameter + 'the slider.value property is passed as the command parameter CType(Slider.IncreaseSmall, RoutedCommand).Execute(source.Value,source) End If End If @@ -99,12 +99,12 @@ Namespace SDKSamples If source IsNot Nothing Then If e.ChangedButton = MouseButton.XButton1 Then ' Execute the Slider DecreaseSmall RoutedCommand - ' The slider.value propety is passed as the command parameter + ' The slider.value property is passed as the command parameter CType(Slider.DecreaseSmall, RoutedCommand).Execute(source.Value, source) End If If e.ChangedButton = MouseButton.XButton2 Then ' Execute the Slider IncreaseSmall RoutedCommand - ' The slider.value propety is passed as the command parameter + ' The slider.value property is passed as the command parameter CType(Slider.IncreaseSmall, RoutedCommand).Execute(source.Value, source) End If End If diff --git a/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithSystemTimer/visualbasic/window1.xaml.vb b/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithSystemTimer/visualbasic/window1.xaml.vb index a9627a02b92..22dc68d6525 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithSystemTimer/visualbasic/window1.xaml.vb +++ b/snippets/visualbasic/VS_Snippets_Wpf/InvalidateRequeryWithSystemTimer/visualbasic/window1.xaml.vb @@ -78,12 +78,12 @@ Namespace SDKSamples If source IsNot Nothing Then If e.Delta > 0 Then ' Execute the Slider DecreaseSmall RoutedCommand. - ' The slider.value propety is passed as the command parameter. + ' The slider.value property is passed as the command parameter. CType(Slider.DecreaseSmall, RoutedCommand).Execute(source.Value, source) Else ' Execute the Slider IncreaseSmall RoutedCommand. - ' The slider.value propety is passed as the command parameter. + ' The slider.value property is passed as the command parameter. CType(Slider.IncreaseSmall, RoutedCommand).Execute(source.Value, source) End If End If @@ -96,12 +96,12 @@ Namespace SDKSamples If source IsNot Nothing Then If e.ChangedButton = MouseButton.XButton1 Then ' Execute the Slider DecreaseSmall RoutedCommand. - ' The slider.value propety is passed as the command parameter. + ' The slider.value property is passed as the command parameter. CType(Slider.DecreaseSmall, RoutedCommand).Execute(source.Value, source) End If If e.ChangedButton = MouseButton.XButton2 Then ' Execute the Slider IncreaseSmall RoutedCommand. - ' The slider.value propety is passed as the command parameter. + ' The slider.value property is passed as the command parameter. CType(Slider.IncreaseSmall, RoutedCommand).Execute(source.Value, source) End If End If