Skip to content

Commit

Permalink
Fix typos in property names and comments (#9441)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanGil authored Nov 17, 2023
1 parent efedcfd commit 13edf8e
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>(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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
9 changes: 9 additions & 0 deletions snippets/csharp/System/Type/GetProperty/Project.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

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

</PropertyGroup>

</Project>
13 changes: 7 additions & 6 deletions snippets/csharp/System/Type/GetProperty/type_getproperty1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System;
using System.Reflection;

class MyClass
class MyClass1
{
private int myProperty;
// Declare MyProperty.
Expand All @@ -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);
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions snippets/csharp/System/Type/GetProperty/type_getproperty2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

using System;
using System.Reflection;
class MyClass

class MyClass2
{
private int myProperty;
// Declare MyProperty.
Expand All @@ -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);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions snippets/csharp/System/Type/GetProperty/type_getproperty21.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// <Snippet1>
using System;
using System.Reflection;

public class MyPropertyClass
{
private int [,] myPropertyArray = new int[10,10];
Expand All @@ -17,6 +18,7 @@ public class MyPropertyClass
}
}
}

public class MyTypeClass
{
public static void Main()
Expand Down
10 changes: 6 additions & 4 deletions snippets/csharp/System/Type/GetProperty/type_getproperty3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

using System;
using System.Reflection;
class MyClass1

class MyClass3
{
private int [,] myArray = {{1,2},{3,4}};
// Declare an indexer.
Expand All @@ -18,22 +19,23 @@ 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);
myTypeArr.SetValue(typeof(int),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.ToString());
Console.WriteLine("The {0} property exists in MyClass3.", myPropInfo.ToString());
}
catch(NullReferenceException e)
{
Expand Down
24 changes: 12 additions & 12 deletions snippets/csharp/System/Type/GetProperty/type_getproperty_types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,39 +14,39 @@ 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)
{
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.
//The name of the first property of MyPropertyTypeClass is MyProperty1.
//The type of the first property of MyPropertyTypeClass is System.String.
}
}
// </Snippet1>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ try
let myType = typeof<MyClass>
// 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}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

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

</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 13edf8e

Please sign in to comment.