diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp index ecb71d5cb24..8fff71ba264 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp @@ -1,11 +1,9 @@ -// The following code example calls GetMonthsInYear for 5 years in each era. -// using namespace System; using namespace System::Globalization; + int main() { - // Creates and initializes a JapaneseCalendar. JapaneseCalendar^ myCal = gcnew JapaneseCalendar; @@ -28,19 +26,5 @@ int main() for ( int y = 1; y <= 5; y++ ) Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); Console::WriteLine(); - } } - -/* -This code produces the following output. - -YEAR 1 2 3 4 5 -CurrentEra: 12 12 12 12 12 -Era 4: 12 12 12 12 12 -Era 3: 12 12 12 12 12 -Era 2: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp index 4750f392abb..085173db873 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp @@ -1,12 +1,9 @@ -// The following code example calls IsLeapDay for the last day of the second -// month (February) for five years in each of the eras. -// using namespace System; using namespace System::Globalization; + int main() { - // Creates and initializes a JapaneseCalendar. JapaneseCalendar^ myCal = gcnew JapaneseCalendar; @@ -37,22 +34,19 @@ int main() { iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - } Console::WriteLine(); - } } - /* This code produces the following output. YEAR 1 2 3 4 5 -CurrentEra: False False False True False +CurrentEra: False True False False False +Era 5: False True False False False Era 4: False False False True False Era 3: False False True False False Era 2: True False False False True Era 1: True False False False True */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp index 20a782cd3d4..5a922425510 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp @@ -1,11 +1,8 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// using namespace System; using namespace System::Globalization; + int main() -{ - +{ // Creates and initializes a JapaneseCalendar. JapaneseCalendar^ myCal = gcnew JapaneseCalendar; @@ -28,19 +25,17 @@ int main() for ( int y = 1; y <= 5; y++ ) Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); Console::WriteLine(); - } } - /* This code produces the following output. YEAR 1 2 3 4 5 -CurrentEra: False False False True False +CurrentEra: False True False False False +Era 5: False True False False False Era 4: False False False True False Era 3: False False True False False Era 2: True False False False True Era 1: True False False False True */ -// diff --git a/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs b/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs index 1fe631d75a3..07cefeb891c 100644 --- a/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs +++ b/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs @@ -1,4 +1,3 @@ -// using System; using System.Globalization; @@ -26,13 +25,3 @@ public static void Main() } } } -// The example displays the following output: -// Date instantiated without an era: -// 1/1/2 in Japanese Calendar -> 1/1/1990 in Gregorian -// -// Dates instantiated with eras: -// 1/1/2 era 4 in Japanese Calendar -> 1/1/1990 in Gregorian -// 1/1/2 era 3 in Japanese Calendar -> 1/1/1927 in Gregorian -// 1/1/2 era 2 in Japanese Calendar -> 1/1/1913 in Gregorian -// 1/1/2 era 1 in Japanese Calendar -> 1/1/1869 in Gregorian -// diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CS/japanesecalendar_getmonthsinyear.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CS/japanesecalendar_getmonthsinyear.cs index 7dd0c3fce89..5c9fb7ef6b3 100644 --- a/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CS/japanesecalendar_getmonthsinyear.cs +++ b/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CS/japanesecalendar_getmonthsinyear.cs @@ -1,10 +1,6 @@ -// The following code example calls GetMonthsInYear for 5 years in each era. - -// using System; using System.Globalization; - public class SamplesJapaneseCalendar { public static void Main() { @@ -13,38 +9,23 @@ public static void Main() { JapaneseCalendar myCal = new JapaneseCalendar(); // Displays the header. - Console.Write( "YEAR\t" ); - for ( int y = 1; y <= 5; y++ ) - Console.Write( "\t{0}", y ); + Console.Write("YEAR\t"); + for (int y = 1; y <= 5; y++ ) + Console.Write($"\t{y}"); Console.WriteLine(); // Displays the value of the CurrentEra property. - Console.Write( "CurrentEra:" ); - for ( int y = 1; y <= 5; y++ ) - Console.Write( "\t{0}", myCal.GetMonthsInYear( y, JapaneseCalendar.CurrentEra ) ); + Console.Write("CurrentEra:"); + for (int y = 1; y <= 5; y++ ) + Console.Write($"\t{myCal.GetMonthsInYear(y, JapaneseCalendar.CurrentEra)}"); Console.WriteLine(); // Displays the values in the Eras property. - for ( int i = 0; i < myCal.Eras.Length; i++ ) { - Console.Write( "Era {0}:\t", myCal.Eras[i] ); - for ( int y = 1; y <= 5; y++ ) - Console.Write( "\t{0}", myCal.GetMonthsInYear( y, myCal.Eras[i] ) ); + for (int i = 0; i < myCal.Eras.Length; i++ ) { + Console.Write($"Era {myCal.Eras[i]}:\t"); + for (int y = 1; y <= 5; y++ ) + Console.Write("\t{myCal.GetMonthsInYear(y, myCal.Eras[i])}"); Console.WriteLine(); } - } - } - -/* -This code produces the following output. - -YEAR 1 2 3 4 5 -CurrentEra: 12 12 12 12 12 -Era 4: 12 12 12 12 12 -Era 3: 12 12 12 12 12 -Era 2: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CS/japanesecalendar_isleapday.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CS/japanesecalendar_isleapday.cs index 52d4e49794f..f6b4b1205a9 100644 --- a/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CS/japanesecalendar_isleapday.cs +++ b/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CS/japanesecalendar_isleapday.cs @@ -1,14 +1,10 @@ -// The following code example calls IsLeapDay for the last day of the second month (February) for five years in each of the eras. - -// using System; using System.Globalization; - -public class SamplesJapaneseCalendar { - - public static void Main() { - +public class SamplesJapaneseCalendar +{ + public static void Main() + { // Creates and initializes a JapaneseCalendar. JapaneseCalendar myCal = new JapaneseCalendar(); @@ -38,20 +34,17 @@ public static void Main() { } Console.WriteLine(); } - } - } - /* This code produces the following output. YEAR 1 2 3 4 5 -CurrentEra: False False False True False +CurrentEra: False True False False False +Era 5: False True False False False Era 4: False False False True False Era 3: False False True False False Era 2: True False False False True Era 1: True False False False True */ -// diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CS/japanesecalendar_isleapyear.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CS/japanesecalendar_isleapyear.cs index c6260bf6b8e..0b1be7b10f5 100644 --- a/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CS/japanesecalendar_isleapyear.cs +++ b/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CS/japanesecalendar_isleapyear.cs @@ -1,14 +1,10 @@ -// The following code example calls IsLeapYear for five years in each of the eras. - -// using System; using System.Globalization; - -public class SamplesJapaneseCalendar { - - public static void Main() { - +public class SamplesJapaneseCalendar +{ + public static void Main() + { // Creates and initializes a JapaneseCalendar. JapaneseCalendar myCal = new JapaneseCalendar(); @@ -31,20 +27,17 @@ public static void Main() { Console.Write( "\t{0}", myCal.IsLeapYear( y, myCal.Eras[i] ) ); Console.WriteLine(); } - } - } - /* This code produces the following output. YEAR 1 2 3 4 5 -CurrentEra: False False False True False +CurrentEra: False True False False False +Era 5: False True False False False Era 4: False False False True False Era 3: False False True False False Era 2: True False False False True Era 1: True False False False True */ -// diff --git a/snippets/csharp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CS/listener.cs b/snippets/csharp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CS/listener.cs index d90b0fcd657..029fe57def6 100644 --- a/snippets/csharp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CS/listener.cs +++ b/snippets/csharp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CS/listener.cs @@ -26,7 +26,7 @@ // follows: // Open a console window and run the listener from the command line. // In another console window run the sender. In both cases you must specify -// the local IPAddress to use. To obtain this address run the ipconfig comand +// the local IPAddress to use. To obtain this address run the ipconfig command // from the command line. // namespace Mssc.TransportProtocols.Utilities @@ -141,4 +141,4 @@ public static void Main(String[] args) } } } -// \ No newline at end of file +// diff --git a/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsTypes/CS/dynamic2.cs b/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsTypes/CS/dynamic2.cs index d001f96a332..7c44de1c159 100644 --- a/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsTypes/CS/dynamic2.cs +++ b/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsTypes/CS/dynamic2.cs @@ -21,7 +21,7 @@ static void Main(string[] args) // Because dynamic_ec is dynamic, the following call to exampleMethod // with two arguments does not produce an error at compile time. - // However, itdoes cause a run-time error. + // However, it does cause a run-time error. //Console.WriteLine(dynamic_ec.exampleMethod(10, 4)); } } diff --git a/snippets/csharp/VS_Snippets_Wpf/CommandLibrarySnippets/CSharp/Window1.xaml.cs b/snippets/csharp/VS_Snippets_Wpf/CommandLibrarySnippets/CSharp/Window1.xaml.cs index 2bcc936c510..6d57107d9c2 100644 --- a/snippets/csharp/VS_Snippets_Wpf/CommandLibrarySnippets/CSharp/Window1.xaml.cs +++ b/snippets/csharp/VS_Snippets_Wpf/CommandLibrarySnippets/CSharp/Window1.xaml.cs @@ -125,7 +125,7 @@ private void OnLoaded(object sender, RoutedEventArgs e) KeyGesture pasteBind = new KeyGesture(Key.V, ModifierKeys.Alt); ApplicationCommands.Paste.InputGestures.Add(pasteBind); - // + // KeyGesture HelpCmdKeyGesture = new KeyGesture(Key.H, ModifierKeys.Alt); @@ -134,7 +134,7 @@ private void OnLoaded(object sender, RoutedEventArgs e) HelpCmdKeyGesture); this.InputBindings.Add(inputBinding); - // + // // MouseGesture CutCmdMouseGesture = new MouseGesture( @@ -262,4 +262,4 @@ private void cmdButtonClick(object sender, RoutedEventArgs e) } } -} \ No newline at end of file +} diff --git a/snippets/csharp/framework/migration-guide/versions-installed3.cs b/snippets/csharp/framework/migration-guide/versions-installed3.cs index 0506d977052..786ff3506a6 100644 --- a/snippets/csharp/framework/migration-guide/versions-installed3.cs +++ b/snippets/csharp/framework/migration-guide/versions-installed3.cs @@ -5,7 +5,7 @@ public class GetDotNetVersion { public static void Main() { - GetDotNetVersion.Get45PlusFromRegistry(); + Get45PlusFromRegistry(); } private static void Get45PlusFromRegistry() @@ -15,7 +15,7 @@ private static void Get45PlusFromRegistry() using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) { if (ndpKey != null && ndpKey.GetValue("Release") != null) { - Console.WriteLine(".NET Framework Version: " + CheckFor45PlusVersion((int) ndpKey.GetValue("Release"))); + Console.WriteLine($".NET Framework Version: {CheckFor45PlusVersion((int) ndpKey.GetValue("Release"))}"); } else { Console.WriteLine(".NET Framework Version 4.5 or later is not detected."); @@ -25,8 +25,10 @@ private static void Get45PlusFromRegistry() // Checking the version using >= enables forward compatibility. string CheckFor45PlusVersion(int releaseKey) { - if (releaseKey >= 461808) + if (releaseKey > 461814) return "4.7.2 or later"; + if (releaseKey >= 461808) + return "4.7.2"; if (releaseKey >= 461308) return "4.7.1"; if (releaseKey >= 460798) diff --git a/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs b/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs index 0e72ae7d2b9..3a58bec5a75 100644 --- a/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs +++ b/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs @@ -1,7 +1,7 @@ namespace ListExamples { using System; - public class List + public class MyList { // Constant const int defaultCapacity = 4; @@ -11,7 +11,7 @@ public class List int count; // Constructor - public List(int capacity = defaultCapacity) + public MyList(int capacity = defaultCapacity) { items = new T[capacity]; } @@ -60,9 +60,9 @@ protected virtual void OnChanged() => Changed?.Invoke(this, EventArgs.Empty); public override bool Equals(object other) => - Equals(this, other as List); + Equals(this, other as MyList); - static bool Equals(List a, List b) + static bool Equals(MyList a, MyList b) { if (Object.ReferenceEquals(a, null)) return Object.ReferenceEquals(b, null); if (Object.ReferenceEquals(b, null) || a.count != b.count) @@ -81,10 +81,10 @@ static bool Equals(List a, List b) public event EventHandler Changed; // Operators - public static bool operator ==(List a, List b) => + public static bool operator ==(MyList a, MyList b) => Equals(a, b); - public static bool operator !=(List a, List b) => + public static bool operator !=(MyList a, MyList b) => !Equals(a, b); } @@ -92,13 +92,13 @@ public class ExampleCode { public static void ListExampleOne() { - List list1 = new List(); - List list2 = new List(10); + MyList list1 = new MyList(); + MyList list2 = new MyList(10); } public static void ListExampleTwo() { - List names = new List(); + MyList names = new MyList(); names.Capacity = 100; // Invokes set accessor int i = names.Count; // Invokes get accessor int j = names.Capacity; // Invokes get accessor @@ -106,7 +106,7 @@ public static void ListExampleTwo() public static void ListExampleThree() { - List names = new List(); + MyList names = new MyList(); names.Add("Liz"); names.Add("Martha"); names.Add("Beth"); @@ -118,10 +118,10 @@ public static void ListExampleThree() } public static void ListExampleFour() { - List a = new List(); + MyList a = new MyList(); a.Add(1); a.Add(2); - List b = new List(); + MyList b = new MyList(); b.Add(1); b.Add(2); Console.WriteLine(a == b); // Outputs "True" @@ -138,7 +138,7 @@ static void ListChanged(object sender, EventArgs e) } public static void Usage() { - List names = new List(); + MyList names = new MyList(); names.Changed += new EventHandler(ListChanged); names.Add("Liz"); names.Add("Martha"); diff --git a/snippets/standard/datetime/calendars/current-era/cs/Program.cs b/snippets/standard/datetime/calendars/current-era/cs/Program.cs index 7d5ec3325fd..0447ffaa4d8 100644 --- a/snippets/standard/datetime/calendars/current-era/cs/Program.cs +++ b/snippets/standard/datetime/calendars/current-era/cs/Program.cs @@ -15,4 +15,4 @@ public static void Main() } -} \ No newline at end of file +} diff --git a/snippets/standard/datetime/calendars/current-era/vb/Program.vb b/snippets/standard/datetime/calendars/current-era/vb/Program.vb index 0259d82c8d2..04f08b0e905 100644 --- a/snippets/standard/datetime/calendars/current-era/vb/Program.vb +++ b/snippets/standard/datetime/calendars/current-era/vb/Program.vb @@ -10,4 +10,4 @@ Public Module Example Console.WriteLine($"Gregorian calendar dat: {dat:d}") Console.WriteLine($"Japanese calendar dat: {dat.ToString("d", jaJp)}") End Sub -End Module \ No newline at end of file +End Module diff --git a/snippets/visualbasic/VS_Snippets_CLR/EventLogEntry_Source/VB/eventlogentry_source.vb b/snippets/visualbasic/VS_Snippets_CLR/EventLogEntry_Source/VB/eventlogentry_source.vb index 0d33ee59f79..0a726250f0e 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/EventLogEntry_Source/VB/eventlogentry_source.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/EventLogEntry_Source/VB/eventlogentry_source.vb @@ -9,11 +9,9 @@ ' ' -Imports System Imports System.Diagnostics Class MyEventlogClass - Public Shared Sub Main() Dim myEventType As String = Nothing ' Associate the instance of 'EventLog' with local System Log. @@ -37,7 +35,7 @@ Class MyEventlogClass Dim myCount As Integer = myLogEntryCollection.Count ' Iterate through all 'EventLogEntry' instances in 'EventLog'. Dim i As Integer - For i = myCount - 1 To -1 Step -1 + For i = myCount - 1 To 0 Step -1 Dim myLogEntry As EventLogEntry = myLogEntryCollection(i) ' Select the entry having desired EventType. If myLogEntry.EntryType.ToString().Equals(myEventType) Then @@ -46,9 +44,8 @@ Class MyEventlogClass "event of type " & myLogEntry.EntryType.ToString()) Return End If - Next i - - End Sub 'Main -End Class 'MyEventlogClass + Next + End Sub +End Class ' ' \ No newline at end of file diff --git a/snippets/visualbasic/VS_Snippets_CLR/conceptual.calendars/vb/instantiatewithera1.vb b/snippets/visualbasic/VS_Snippets_CLR/conceptual.calendars/vb/instantiatewithera1.vb index 4e4593612ce..dcb627293ea 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/conceptual.calendars/vb/instantiatewithera1.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/conceptual.calendars/vb/instantiatewithera1.vb @@ -1,7 +1,3 @@ -' Visual Basic .NET Document -Option Strict On - -' Imports System.Globalization Module Example @@ -27,13 +23,4 @@ Module Example Next End Sub End Module -' The example displays the following output: -' Date instantiated without an era: -' 1/1/2 in Japanese Calendar -> 1/1/1990 in Gregorian -' -' Dates instantiated with eras: -' 1/1/2 era 4 in Japanese Calendar -> 1/1/1990 in Gregorian -' 1/1/2 era 3 in Japanese Calendar -> 1/1/1927 in Gregorian -' 1/1/2 era 2 in Japanese Calendar -> 1/1/1913 in Gregorian -' 1/1/2 era 1 in Japanese Calendar -> 1/1/1869 in Gregorian -' + diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/VB/japanesecalendar_getmonthsinyear.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/VB/japanesecalendar_getmonthsinyear.vb index d969967aa60..74d8f3f05d5 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/VB/japanesecalendar_getmonthsinyear.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/VB/japanesecalendar_getmonthsinyear.vb @@ -1,54 +1,32 @@ -' The following code example calls GetMonthsInYear for 5 years in each era. - -' -Imports System -Imports System.Globalization -Imports Microsoft.VisualBasic - -Public Class SamplesJapaneseCalendar - - Public Shared Sub Main() - - ' Creates and initializes a JapaneseCalendar. - Dim myCal As New JapaneseCalendar() - - ' Displays the header. - Console.Write("YEAR" + ControlChars.Tab) - Dim y As Integer - For y = 1 To 5 - Console.Write(ControlChars.Tab + "{0}", y) - Next y - Console.WriteLine() - - ' Displays the value of the CurrentEra property. - Console.Write("CurrentEra:") - For y = 1 To 5 - Console.Write(ControlChars.Tab + "{0}", myCal.GetMonthsInYear(y, JapaneseCalendar.CurrentEra)) - Next y - Console.WriteLine() - - ' Displays the values in the Eras property. - Dim i As Integer - For i = 0 To myCal.Eras.Length - 1 - Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i)) - For y = 1 To 5 - Console.Write(ControlChars.Tab + "{0}", myCal.GetMonthsInYear(y, myCal.Eras(i))) - Next y - Console.WriteLine() - Next i - - End Sub 'Main - -End Class 'SamplesJapaneseCalendar - - -'This code produces the following output. - ' - 'YEAR 1 2 3 4 5 - 'CurrentEra: 12 12 12 12 12 - 'Era 4: 12 12 12 12 12 - 'Era 3: 12 12 12 12 12 - 'Era 2: 12 12 12 12 12 - 'Era 1: 12 12 12 12 12 - -' +Imports System.Globalization + +Public Module SamplesJapaneseCalendar + Public Sub Main() + + ' Creates and initializes a JapaneseCalendar. + Dim myCal As New JapaneseCalendar() + + ' Displays the header. + Console.Write("YEAR" + ControlChars.Tab) + For y As Integer = 1 To 5 + Console.Write($"{ControlChars.Tab}{y}") + Next + Console.WriteLine() + + ' Displays the value of the CurrentEra property. + Console.Write("CurrentEra:") + For y As Integer = 1 To 5 + Console.Write($"{ControlChars.Tab}{myCal.GetMonthsInYear(y, JapaneseCalendar.CurrentEra)}") + Next + Console.WriteLine() + + ' Displays the values in the Eras property. + For i As Integer = 0 To myCal.Eras.Length - 1 + Console.Write($"Era {myCal.Eras(i)}:{ControlChars.Tab}") + For y As Integer = 1 To 5 + Console.Write($"{ControlChars.Tab}{myCal.GetMonthsInYear(y, myCal.Eras(i))}") + Next + Console.WriteLine() + Next + End Sub +End Module diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/VB/japanesecalendar_isleapday.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/VB/japanesecalendar_isleapday.vb index 31351653d83..86d2ea8bfda 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/VB/japanesecalendar_isleapday.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/VB/japanesecalendar_isleapday.vb @@ -1,59 +1,47 @@ -' The following code example calls IsLeapDay for the last day of the second month (February) for five years in each of the eras. - -' -Imports System -Imports System.Globalization -Imports Microsoft.VisualBasic - -Public Class SamplesJapaneseCalendar - - Public Shared Sub Main() - - ' Creates and initializes a JapaneseCalendar. - Dim myCal As New JapaneseCalendar() - - ' Creates a holder for the last day of the second month (February). - Dim iLastDay As Integer - - ' Displays the header. - Console.Write("YEAR" + ControlChars.Tab) - Dim y As Integer - For y = 1 To 5 - Console.Write(ControlChars.Tab + "{0}", y) - Next y - Console.WriteLine() - - ' Checks five years in the current era. - Console.Write("CurrentEra:") - For y = 1 To 5 - iLastDay = myCal.GetDaysInMonth(y, 2, JapaneseCalendar.CurrentEra) - Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, JapaneseCalendar.CurrentEra)) - Next y - Console.WriteLine() - - ' Checks five years in each of the eras. - Dim i As Integer - For i = 0 To myCal.Eras.Length - 1 - Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i)) - For y = 1 To 5 - iLastDay = myCal.GetDaysInMonth(y, 2, myCal.Eras(i)) - Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, myCal.Eras(i))) - Next y - Console.WriteLine() - Next i - - End Sub 'Main - -End Class 'SamplesJapaneseCalendar - - -'This code produces the following output. - ' - 'YEAR 1 2 3 4 5 - 'CurrentEra: False False False True False - 'Era 4: False False False True False - 'Era 3: False False True False False - 'Era 2: True False False False True - 'Era 1: True False False False True - -' +Imports System.Globalization + +Public Class SamplesJapaneseCalendar + Public Shared Sub Main() + ' Creates and initializes a JapaneseCalendar. + Dim myCal As New JapaneseCalendar() + + ' Creates a holder for the last day of the second month (February). + Dim iLastDay As Integer + + ' Displays the header. + Console.Write("YEAR" + ControlChars.Tab) + Dim y As Integer + For y = 1 To 5 + Console.Write(ControlChars.Tab + "{0}", y) + Next y + Console.WriteLine() + + ' Checks five years in the current era. + Console.Write("CurrentEra:") + For y = 1 To 5 + iLastDay = myCal.GetDaysInMonth(y, 2, JapaneseCalendar.CurrentEra) + Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, JapaneseCalendar.CurrentEra)) + Next y + Console.WriteLine() + + ' Checks five years in each of the eras. + Dim i As Integer + For i = 0 To myCal.Eras.Length - 1 + Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i)) + For y = 1 To 5 + iLastDay = myCal.GetDaysInMonth(y, 2, myCal.Eras(i)) + Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, myCal.Eras(i))) + Next y + Console.WriteLine() + Next i + End Sub +End Class +'This code produces the following output. +' +' YEAR 1 2 3 4 5 +' CurrentEra: False True False False False +' Era 5: False True False False False +' Era 4: False False False True False +' Era 3: False False True False False +' Era 2: True False False False True +' Era 1: True False False False True diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/VB/japanesecalendar_isleapyear.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/VB/japanesecalendar_isleapyear.vb index 0d4999b88d3..13a3778cf29 100644 --- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/VB/japanesecalendar_isleapyear.vb +++ b/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/VB/japanesecalendar_isleapyear.vb @@ -1,54 +1,41 @@ -' The following code example calls IsLeapYear for five years in each of the eras. - -' -Imports System -Imports System.Globalization -Imports Microsoft.VisualBasic - -Public Class SamplesJapaneseCalendar - - Public Shared Sub Main() - - ' Creates and initializes a JapaneseCalendar. - Dim myCal As New JapaneseCalendar() - - ' Displays the header. - Console.Write("YEAR" + ControlChars.Tab) - Dim y As Integer - For y = 1 To 5 - Console.Write(ControlChars.Tab + "{0}", y) - Next y - Console.WriteLine() - - ' Checks five years in the current era. - Console.Write("CurrentEra:") - For y = 1 To 5 - Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapYear(y, JapaneseCalendar.CurrentEra)) - Next y - Console.WriteLine() - - ' Checks five years in each of the eras. - Dim i As Integer - For i = 0 To myCal.Eras.Length - 1 - Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i)) - For y = 1 To 5 - Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapYear(y, myCal.Eras(i))) - Next y - Console.WriteLine() - Next i - - End Sub 'Main - -End Class 'SamplesJapaneseCalendar - - -'This code produces the following output. - ' - 'YEAR 1 2 3 4 5 - 'CurrentEra: False False False True False - 'Era 4: False False False True False - 'Era 3: False False True False False - 'Era 2: True False False False True - 'Era 1: True False False False True - -' +Imports System.Globalization + +Public Class SamplesJapaneseCalendar + Public Shared Sub Main() + ' Creates and initializes a JapaneseCalendar. + Dim myCal As New JapaneseCalendar() + + ' Displays the header. + Console.Write("YEAR" + ControlChars.Tab) + Dim y As Integer + For y = 1 To 5 + Console.Write(ControlChars.Tab + "{0}", y) + Next + Console.WriteLine() + + ' Checks five years in the current era. + Console.Write("CurrentEra:") + For y = 1 To 5 + Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapYear(y, JapaneseCalendar.CurrentEra)) + Next + Console.WriteLine() + + ' Checks five years in each of the eras. + For i As Integer = 0 To myCal.Eras.Length - 1 + Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i)) + For y = 1 To 5 + Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapYear(y, myCal.Eras(i))) + Next + Console.WriteLine() + Next + End Sub +End Class +'This code produces the following output. +' +' YEAR 1 2 3 4 5 +' CurrentEra: False True False False False +' Era 5: False True False False False +' Era 4: False False False True False +' Era 3: False False True False False +' Era 2: True False False False True +' Era 1: True False False False True diff --git a/snippets/visualbasic/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/VB/listener.vb b/snippets/visualbasic/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/VB/listener.vb index bee8a319ddd..22c1edd8baa 100644 --- a/snippets/visualbasic/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/VB/listener.vb +++ b/snippets/visualbasic/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/VB/listener.vb @@ -18,7 +18,7 @@ ' follows: ' Open a console window and run the listener from the command line. ' In another console window run the sender. In both cases you must specify -' the local IPAddress to use. To obtain this address run the ipconfig comand +' the local IPAddress to use. To obtain this address run the ipconfig command ' from the command line. diff --git a/snippets/visualbasic/VS_Snippets_Wpf/CommandLibrarySnippets/visualbasic/window1.xaml.vb b/snippets/visualbasic/VS_Snippets_Wpf/CommandLibrarySnippets/visualbasic/window1.xaml.vb index 12e7b80e93b..8aa6c194769 100644 --- a/snippets/visualbasic/VS_Snippets_Wpf/CommandLibrarySnippets/visualbasic/window1.xaml.vb +++ b/snippets/visualbasic/VS_Snippets_Wpf/CommandLibrarySnippets/visualbasic/window1.xaml.vb @@ -108,14 +108,14 @@ Namespace SDKSamples Dim pasteBind As New KeyGesture(Key.V, ModifierKeys.Alt) ApplicationCommands.Paste.InputGestures.Add(pasteBind) - ' + ' Dim HelpCmdKeyGesture As New KeyGesture(Key.H, ModifierKeys.Alt) Dim inputBinding As InputBinding inputBinding = New InputBinding(ApplicationCommands.Help, HelpCmdKeyGesture) Me.InputBindings.Add(inputBinding) - ' + ' ' Dim CutCmdMouseGesture As New MouseGesture(MouseAction.MiddleClick) @@ -220,4 +220,4 @@ Namespace SDKSamples End Sub End Class -End Namespace \ No newline at end of file +End Namespace diff --git a/snippets/visualbasic/framework/migration-guide/versions-installed3.vb b/snippets/visualbasic/framework/migration-guide/versions-installed3.vb index 0c41b98d80d..9db1fc8e3e5 100644 --- a/snippets/visualbasic/framework/migration-guide/versions-installed3.vb +++ b/snippets/visualbasic/framework/migration-guide/versions-installed3.vb @@ -10,7 +10,7 @@ Public Module GetDotNetVersion Using ndpKey As RegistryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey) If ndpKey IsNot Nothing AndAlso ndpKey.GetValue("Release") IsNot Nothing - Console.WriteLine(".NET Framework Version: " + CheckFor45PlusVersion(ndpKey.GetValue("Release"))) + Console.WriteLine($".NET Framework Version: {CheckFor45PlusVersion(ndpKey.GetValue("Release"))}") Else Console.WriteLine(".NET Framework Version 4.5 or later is not detected.") End If @@ -19,8 +19,12 @@ Public Module GetDotNetVersion ' Checking the version using >= will enable forward compatibility. Private Function CheckFor45PlusVersion(releaseKey As Integer) As String - If releaseKey >= 461308 Then - Return "4.7.1 or later" + If releaseKey > 461814 Then + Return "4.7.2 or later" + Else If releaseKey >= 461808 Then + Return "4.7.2" + Else If releaseKey >= 461308 Then + Return "4.7.1" Else If releaseKey >= 460798 Then Return "4.7" Else If releaseKey >= 394802 Then