From 1176a0c38ee3d8b03ee55f71151fc0f875400656 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Fri, 23 Jul 2021 19:27:37 +0300 Subject: [PATCH 1/4] Batch 0-40 --- .../System.AppContext.Class/cs/Example4.cs | 6 +++--- .../System.AppContext.Class/cs/Example6.cs | 6 +++--- .../System.AppContext.Class/cs/Example8.cs | 6 +++--- .../System.AppContext.Class/cs/GetSwitches3.cs | 12 ++++++------ .../system.Action_PrintExample/cs/action.cs | 4 ++-- .../system.Action~3/cs/Action3.cs | 4 ++-- .../system.Action~3/cs/Anon.cs | 4 ++-- .../system.Action~3/cs/Delegate.cs | 4 ++-- .../system.Action~3/cs/Lambda.cs | 2 +- .../system.Action~4/cs/Action4.cs | 4 ++-- .../system.Action~4/cs/Anon.cs | 4 ++-- .../system.Action~4/cs/Delegate.cs | 4 ++-- .../system.Action~4/cs/Lambda.cs | 4 ++-- .../cs/CreateInstance5.cs | 8 ++++---- .../cs/createinstance2.cs | 2 +- .../cs/createinstanceex1a.cs | 4 ++-- 16 files changed, 39 insertions(+), 39 deletions(-) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs index e16fba3b54a..1a0c7e98816 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs @@ -6,7 +6,7 @@ public static class StringLibrary { - public static int SubstringStartsAt(String fullString, String substr) + public static int SubstringStartsAt(string fullString, string substr) { return fullString.IndexOf(substr, StringComparison.Ordinal); } @@ -22,8 +22,8 @@ public class Example { public static void Main() { - String value = "The archaeologist"; - String substring = "archæ"; + string value = "The archaeologist"; + string substring = "archæ"; int position = StringLibrary.SubstringStartsAt(value, substring); if (position >= 0) Console.WriteLine("'{0}' found in '{1}' starting at position {2}", diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs index f0c64705475..30d9b7624af 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs @@ -6,7 +6,7 @@ public static class StringLibrary { - public static int SubstringStartsAt(String fullString, String substr) + public static int SubstringStartsAt(string fullString, string substr) { return fullString.IndexOf(substr, StringComparison.CurrentCulture); } @@ -22,8 +22,8 @@ public class Example { public static void Main() { - String value = "The archaeologist"; - String substring = "archæ"; + string value = "The archaeologist"; + string substring = "archæ"; int position = StringLibrary.SubstringStartsAt(value, substring); if (position >= 0) Console.WriteLine("'{0}' found in '{1}' starting at position {2}", diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs index ef5baf9cbf8..1f612c52de2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs @@ -6,7 +6,7 @@ public static class StringLibrary { - public static int SubstringStartsAt(String fullString, String substr) + public static int SubstringStartsAt(string fullString, string substr) { bool flag; if (AppContext.TryGetSwitch("StringLibrary.DoNotUseCultureSensitiveComparison", out flag) && flag == true) @@ -26,8 +26,8 @@ public class Example { public static void Main() { - String value = "The archaeologist"; - String substring = "archæ"; + string value = "The archaeologist"; + string substring = "archæ"; int position = StringLibrary.SubstringStartsAt(value, substring); if (position >= 0) Console.WriteLine("'{0}' found in '{1}' starting at position {2}", diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs index d73939bed61..b42666c8b20 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs @@ -6,8 +6,8 @@ public class Example { - private const String SettingName = "AppContextSwitchOverrides"; - private const String SwitchName = "Switch.Application.Utilities.SwitchName"; + private const string SettingName = "AppContextSwitchOverrides"; + private const string SwitchName = "Switch.Application.Utilities.SwitchName"; public static void Main() { @@ -22,8 +22,8 @@ public static void Main() ConfigurationSection sec = config.GetSection("runtime"); if (sec != null) { - String rawXml = sec.SectionInformation.GetRawXml(); - if (String.IsNullOrEmpty(rawXml)) return; + string rawXml = sec.SectionInformation.GetRawXml(); + if (string.IsNullOrEmpty(rawXml)) return; var doc = new XmlDocument(); doc.LoadXml(rawXml); @@ -34,11 +34,11 @@ public static void Main() if (node.Name.Equals(SettingName, StringComparison.Ordinal)) { // Get attribute value XmlAttribute attr = node.Attributes["value"]; - String[] nameValuePair = attr.Value.Split('='); + string[] nameValuePair = attr.Value.Split('='); // Determine whether the switch we want is present. if (SwitchName.Equals(nameValuePair[0], StringComparison.Ordinal)) { bool tempFlag = false; - if (Boolean.TryParse(CultureInfo.InvariantCulture.TextInfo.ToTitleCase(nameValuePair[1]), + if (bool.TryParse(CultureInfo.InvariantCulture.TextInfo.ToTitleCase(nameValuePair[1]), out tempFlag)) AppContext.SetSwitch(nameValuePair[0], tempFlag); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action_PrintExample/cs/action.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action_PrintExample/cs/action.cs index e5faa76fe8d..45191acc3b5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action_PrintExample/cs/action.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action_PrintExample/cs/action.cs @@ -6,7 +6,7 @@ class Program static void Main() { // - List names = new List(); + List names = new List(); names.Add("Bruce"); names.Add("Alfred"); names.Add("Tim"); @@ -17,7 +17,7 @@ static void Main() // The following demonstrates the anonymous method feature of C# // to display the contents of the list to the console. - names.ForEach(delegate(String name) + names.ForEach(delegate(string name) { Console.WriteLine(name); }); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Action3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Action3.cs index 65a408aa40d..72b17d3fbc7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Action3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Action3.cs @@ -10,7 +10,7 @@ public static void Main() Action copyOperation = CopyStrings; copyOperation(ordinals, copiedOrdinals, 3); foreach (string ordinal in copiedOrdinals) - Console.WriteLine(String.IsNullOrEmpty(ordinal) ? "" : ordinal); + Console.WriteLine(string.IsNullOrEmpty(ordinal) ? "" : ordinal); } private static void CopyStrings(string[] source, string[] target, int startPos) @@ -19,7 +19,7 @@ private static void CopyStrings(string[] source, string[] target, int startPos) throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= source.Length - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Anon.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Anon.cs index ddca19e6e7f..8d7e9bc0c65 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Anon.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Anon.cs @@ -13,7 +13,7 @@ public static void Main() { CopyStrings(s1, s2, pos); }; copyOperation(ordinals, copiedOrdinals, 3); foreach (string ordinal in copiedOrdinals) - Console.WriteLine(String.IsNullOrEmpty(ordinal) ? "" : ordinal); + Console.WriteLine(string.IsNullOrEmpty(ordinal) ? "" : ordinal); } private static void CopyStrings(string[] source, string[] target, int startPos) @@ -22,7 +22,7 @@ private static void CopyStrings(string[] source, string[] target, int startPos) throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= source.Length - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Delegate.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Delegate.cs index ac4bca5880d..b8bf832e4da 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Delegate.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Delegate.cs @@ -14,7 +14,7 @@ public static void Main() StringCopy copyOperation = CopyStrings; copyOperation(ordinals, copiedOrdinals, 3); foreach (string ordinal in copiedOrdinals) - Console.WriteLine(String.IsNullOrEmpty(ordinal) ? "" : ordinal); + Console.WriteLine(string.IsNullOrEmpty(ordinal) ? "" : ordinal); } private static void CopyStrings(string[] source, string[] target, int startPos) @@ -23,7 +23,7 @@ private static void CopyStrings(string[] source, string[] target, int startPos) throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= source.Length - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Lambda.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Lambda.cs index 15b18b784ef..91ace56e60d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Lambda.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~3/cs/Lambda.cs @@ -20,7 +20,7 @@ private static void CopyStrings(string[] source, string[] target, int startPos) throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= source.Length - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Action4.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Action4.cs index ae8842fd9cb..c7f0ee0042d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Action4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Action4.cs @@ -11,7 +11,7 @@ public static void Main() Action copyOperation = CopyStrings; copyOperation(ordinals, copiedOrdinals, 3, 5); foreach (string ordinal in copiedOrdinals) - Console.WriteLine(String.IsNullOrEmpty(ordinal) ? "" : ordinal); + Console.WriteLine(string.IsNullOrEmpty(ordinal) ? "" : ordinal); } private static void CopyStrings(string[] source, string[] target, @@ -21,7 +21,7 @@ private static void CopyStrings(string[] source, string[] target, throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= startPos + number - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Anon.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Anon.cs index ceb409cae27..d7fb8722f04 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Anon.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Anon.cs @@ -14,7 +14,7 @@ public static void Main() { CopyStrings(s1, s2, pos, num); }; copyOperation(ordinals, copiedOrdinals, 3, 5); foreach (string ordinal in copiedOrdinals) - Console.WriteLine(String.IsNullOrEmpty(ordinal) ? "" : ordinal); + Console.WriteLine(string.IsNullOrEmpty(ordinal) ? "" : ordinal); } private static void CopyStrings(string[] source, string[] target, @@ -24,7 +24,7 @@ private static void CopyStrings(string[] source, string[] target, throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= startPos + number - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Delegate.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Delegate.cs index 363816a88b3..7fb4bf2804e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Delegate.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Delegate.cs @@ -16,7 +16,7 @@ public static void Main() StringCopy copyOperation = CopyStrings; copyOperation(ordinals, copiedOrdinals, 3, 5); foreach (string ordinal in copiedOrdinals) - Console.WriteLine(String.IsNullOrEmpty(ordinal) ? "" : ordinal); + Console.WriteLine(string.IsNullOrEmpty(ordinal) ? "" : ordinal); } private static void CopyStrings(string[] source, string[] target, @@ -26,7 +26,7 @@ private static void CopyStrings(string[] source, string[] target, throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= startPos + number - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Lambda.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Lambda.cs index 5d6f4acb72c..09877633ebe 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Lambda.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Action~4/cs/Lambda.cs @@ -12,7 +12,7 @@ public static void Main() => CopyStrings(s1, s2, pos, num); copyOperation(ordinals, copiedOrdinals, 3, 5); foreach (string ordinal in copiedOrdinals) - Console.WriteLine(String.IsNullOrEmpty(ordinal) ? "" : ordinal); + Console.WriteLine(string.IsNullOrEmpty(ordinal) ? "" : ordinal); } private static void CopyStrings(string[] source, string[] target, @@ -22,7 +22,7 @@ private static void CopyStrings(string[] source, string[] target, throw new IndexOutOfRangeException("The source and target arrays must have the same number of elements."); for (int ctr = startPos; ctr <= startPos + number - 1; ctr++) - target[ctr] = String.Copy(source[ctr]); + target[ctr] = string.Copy(source[ctr]); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs index 2b55ed2e9f1..f40876fab22 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs @@ -5,13 +5,13 @@ public class Example { public static void Main() { - // Initialize array of characters from a to z. - Char[] chars = new Char[26]; + // Initialize array of characters from a to z. + char[] chars = new char[26]; for (int ctr = 0; ctr < 26; ctr++) chars[ctr] = (char) (ctr + 0x0061); - Object obj = Activator.CreateInstance(typeof(String), - new Object[] { chars, 13, 10 } ); + object obj = Activator.CreateInstance(typeof(string), + new object[] { chars, 13, 10 } ); Console.WriteLine(obj); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstance2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstance2.cs index 58e2224a889..4422ac94f76 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstance2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstance2.cs @@ -12,7 +12,7 @@ public static void Main() for (int ctr = 0; ctr <= arguments.GetUpperBound(0); ctr++) { object[] args = arguments[ctr]; - object result = Activator.CreateInstance(typeof(String), args); + object result = Activator.CreateInstance(typeof(string), args); Console.WriteLine("{0}: {1}", result.GetType().Name, result); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs index 9b874825f85..950d5b8d050 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs @@ -8,14 +8,14 @@ public class Example public static void Main() { ObjectHandle handle = Activator.CreateInstance("PersonInfo", "Person"); - Object p = handle.Unwrap(); + object p = handle.Unwrap(); Type t = p.GetType(); PropertyInfo prop = t.GetProperty("Name"); if (prop != null) prop.SetValue(p, "Samuel"); MethodInfo method = t.GetMethod("ToString"); - Object retVal = method.Invoke(p, null); + object retVal = method.Invoke(p, null); if (retVal != null) Console.WriteLine(retVal); } From 383967e98f6bd126facc459a4dc127756d3b8769 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Fri, 23 Jul 2021 19:32:14 +0300 Subject: [PATCH 2/4] fixes --- .../System.AppContext.Class/cs/Example4.cs | 4 ++-- .../System.AppContext.Class/cs/Example6.cs | 4 ++-- .../System.AppContext.Class/cs/GetSwitches3.cs | 4 ++-- .../system.activator.createinstance/cs/CreateInstance5.cs | 4 ++-- .../system.activator.createinstance/cs/createinstanceex1a.cs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs index 1a0c7e98816..149512806d5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example4.cs @@ -22,8 +22,8 @@ public class Example { public static void Main() { - string value = "The archaeologist"; - string substring = "archæ"; + string value = "The archaeologist"; + string substring = "archæ"; int position = StringLibrary.SubstringStartsAt(value, substring); if (position >= 0) Console.WriteLine("'{0}' found in '{1}' starting at position {2}", diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs index 30d9b7624af..92cf50f4b20 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example6.cs @@ -22,8 +22,8 @@ public class Example { public static void Main() { - string value = "The archaeologist"; - string substring = "archæ"; + string value = "The archaeologist"; + string substring = "archæ"; int position = StringLibrary.SubstringStartsAt(value, substring); if (position >= 0) Console.WriteLine("'{0}' found in '{1}' starting at position {2}", diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs index b42666c8b20..5e327df83a0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/GetSwitches3.cs @@ -22,7 +22,7 @@ public static void Main() ConfigurationSection sec = config.GetSection("runtime"); if (sec != null) { - string rawXml = sec.SectionInformation.GetRawXml(); + string rawXml = sec.SectionInformation.GetRawXml(); if (string.IsNullOrEmpty(rawXml)) return; var doc = new XmlDocument(); @@ -34,7 +34,7 @@ public static void Main() if (node.Name.Equals(SettingName, StringComparison.Ordinal)) { // Get attribute value XmlAttribute attr = node.Attributes["value"]; - string[] nameValuePair = attr.Value.Split('='); + string[] nameValuePair = attr.Value.Split('='); // Determine whether the switch we want is present. if (SwitchName.Equals(nameValuePair[0], StringComparison.Ordinal)) { bool tempFlag = false; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs index f40876fab22..39f2292c3a4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs @@ -6,11 +6,11 @@ public class Example public static void Main() { // Initialize array of characters from a to z. - char[] chars = new char[26]; + char[] chars = new char[26]; for (int ctr = 0; ctr < 26; ctr++) chars[ctr] = (char) (ctr + 0x0061); - object obj = Activator.CreateInstance(typeof(string), + object obj = Activator.CreateInstance(typeof(string), new object[] { chars, 13, 10 } ); Console.WriteLine(obj); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs index 950d5b8d050..a9c88084162 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/createinstanceex1a.cs @@ -8,14 +8,14 @@ public class Example public static void Main() { ObjectHandle handle = Activator.CreateInstance("PersonInfo", "Person"); - object p = handle.Unwrap(); + object p = handle.Unwrap(); Type t = p.GetType(); PropertyInfo prop = t.GetProperty("Name"); if (prop != null) prop.SetValue(p, "Samuel"); MethodInfo method = t.GetMethod("ToString"); - object retVal = method.Invoke(p, null); + object retVal = method.Invoke(p, null); if (retVal != null) Console.WriteLine(retVal); } From 0bd5b9bf042aeccbe9a06cc83fa6d4c534ab8e09 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Fri, 23 Jul 2021 19:33:18 +0300 Subject: [PATCH 3/4] fixes --- .../System.AppContext.Class/cs/Example8.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs index 1f612c52de2..6a0e81c47b7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.AppContext.Class/cs/Example8.cs @@ -26,8 +26,8 @@ public class Example { public static void Main() { - string value = "The archaeologist"; - string substring = "archæ"; + string value = "The archaeologist"; + string substring = "archæ"; int position = StringLibrary.SubstringStartsAt(value, substring); if (position >= 0) Console.WriteLine("'{0}' found in '{1}' starting at position {2}", From 85436b276b3df7788bb55093c7b6114e259ae25f Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Fri, 23 Jul 2021 19:38:39 +0300 Subject: [PATCH 4/4] fixes --- .../system.activator.createinstance/cs/CreateInstance5.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs index 39f2292c3a4..a0550c80b9f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.activator.createinstance/cs/CreateInstance5.cs @@ -5,7 +5,7 @@ public class Example { public static void Main() { - // Initialize array of characters from a to z. + // Initialize array of characters from a to z. char[] chars = new char[26]; for (int ctr = 0; ctr < 26; ctr++) chars[ctr] = (char) (ctr + 0x0061);