Skip to content

Commit a5ad126

Browse files
authored
Replace vbNewLine with Environment.NewLine (#4680)
* Replace vbNewLine with Environment.NewLine * Update source2.vb * Update source2.vb * Update source2.vb * Update Module1.vb * Update useresxdatanodes.vb * Update source.vb * Update source.vb * Update source.vb * Update source.vb * Update encryptor.vb * Update program.vb * Update isletterordigit.vb * Update module1.vb * Update source.vb * Update source.vb * Update source.vb * Update Class1.vb * Update Module1.vb
1 parent aee70ed commit a5ad126

File tree

19 files changed

+62
-62
lines changed
  • samples/snippets/visualbasic

19 files changed

+62
-62
lines changed

samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/VB/Module1.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ Module Module1
574574
For Each product In query
575575
Console.WriteLine("Name: " & product.Name)
576576
Console.WriteLine("Product number: " & product.ProductNumber)
577-
Console.WriteLine("List price: $ " & product.ListPrice & vbNewLine)
577+
Console.WriteLine("List price: $ " & product.ListPrice & Environment.NewLine)
578578
Next
579579
' </SnippetWhere3>
580580
End Sub
@@ -637,7 +637,7 @@ Module Module1
637637
For Each product In query
638638
Console.WriteLine("Name: " & product.Name)
639639
Console.WriteLine("Product number: " & product.ProductNumber)
640-
Console.WriteLine("List price: $" & product.ListPrice & vbNewLine)
640+
Console.WriteLine("List price: $" & product.ListPrice & Environment.NewLine)
641641
Next
642642
' </SnippetWhereIsNull>
643643
End Sub

samples/snippets/visualbasic/VS_Snippets_CLR/ActivatorX/VB/source2.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Class DynamicInstanceList
1414
item = Activator.CreateInstance(Type.GetType(instances(i)))
1515
instlist.SetValue(item, i)
1616
Next i
17-
Console.WriteLine(vbNewLine + "Objects and their default values:" + vbNewLine)
17+
Console.WriteLine(Environment.NewLine + "Objects and their default values:" + Environment.NewLine)
1818
For Each o As Object In instlist
19-
Console.WriteLine("Type: {0}" + vbNewLine + "Value: {1}" + _
20-
vbNewLine + "HashCode: {2}" + vbNewLine, _
19+
Console.WriteLine("Type: {0}" + Environment.NewLine + "Value: {1}" + _
20+
Environment.NewLine + "HashCode: {2}" + Environment.NewLine, _
2121
o.GetType().FullName, o.ToString(), o.GetHashCode())
2222
Next o
2323
End Sub

samples/snippets/visualbasic/VS_Snippets_CLR/Array_FindEtAl/vb/source.vb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@ Public Class DinoDiscoverySet
4040
dinoType = AddressOf EndsWithSaurus
4141
End Select
4242

43-
Console.WriteLine(vbNewLine + _
43+
Console.WriteLine(Environment.NewLine + _
4444
"Array.Exists(dinosaurs, ""{0}""): {1}", _
4545
Ending, _
4646
Array.Exists(dinosaurs, dinoType))
4747

48-
Console.WriteLine(vbNewLine + _
48+
Console.WriteLine(Environment.NewLine + _
4949
"Array.TrueForAll(dinosaurs, ""{0}""): {1}", _
5050
Ending, _
5151
Array.TrueForAll(dinosaurs, dinoType))
5252

53-
Console.WriteLine(vbNewLine + _
53+
Console.WriteLine(Environment.NewLine + _
5454
"Array.Find(dinosaurs, ""{0}""): {1}", _
5555
Ending, _
5656
Array.Find(dinosaurs, dinoType))
5757

58-
Console.WriteLine(vbNewLine + _
58+
Console.WriteLine(Environment.NewLine + _
5959
"Array.FindLast(dinosaurs, ""{0}""): {1}", _
6060
Ending, _
6161
Array.FindLast(dinosaurs, dinoType))
6262

63-
Console.WriteLine(vbNewLine + _
63+
Console.WriteLine(Environment.NewLine + _
6464
"Array.FindAll(dinosaurs, ""{0}""):", Ending)
6565

6666
Dim subArray() As String = _

samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.monitors/vb/source.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Public Module App
4545
Next
4646
' Wait until this WaitHandle is signaled.
4747
opsAreDone.WaitOne()
48-
Console.WriteLine(vbTab + vbNewLine + "All synchronized operations have completed.")
48+
Console.WriteLine(vbTab + Environment.NewLine + "All synchronized operations have completed.")
4949
Console.WriteLine()
5050

5151
numOps = 5
@@ -56,7 +56,7 @@ Public Module App
5656

5757
' Wait until this WaitHandle is signaled.
5858
opsAreDone.WaitOne()
59-
Console.WriteLine(vbTab + vbNewLine + "All unsynchronized thread operations have completed.")
59+
Console.WriteLine(vbTab + Environment.NewLine + "All unsynchronized thread operations have completed.")
6060
End Sub
6161

6262
Sub SyncUpdateResource()

samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/VB/source.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ Namespace Ambiguity
3434
Dim Mymethodinfo As MethodInfo = Mytype.GetMethod("Mymethod")
3535
' end of try block
3636
Catch ex As AmbiguousMatchException
37-
Console.WriteLine(vbNewLine + "{0}" + vbNewLine + "{1}", ex.GetType().FullName, ex.Message)
37+
Console.WriteLine(Environment.NewLine + "{0}" + Environment.NewLine + "{1}", ex.GetType().FullName, ex.Message)
3838
Catch
39-
Console.WriteLine(vbNewLine + "Some other exception.")
39+
Console.WriteLine(Environment.NewLine + "Some other exception.")
4040
End Try
4141
Return
4242
End Sub
@@ -51,4 +51,4 @@ End Namespace
5151
'
5252
' System.Reflection.AmbiguousMatchException
5353
' Ambiguous match found.
54-
' </Snippet1>
54+
' </Snippet1>

samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/VB/source.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Public Class TestMethodInfo
2626
Dim magicMethod As MethodInfo = magicType.GetMethod("ItsMagic")
2727
Dim magicValue As Object = magicMethod.Invoke(magicClassObject, New Object(){100})
2828

29-
Console.WriteLine("MethodInfo.Invoke() Example" + vbNewLine)
29+
Console.WriteLine("MethodInfo.Invoke() Example" + Environment.NewLine)
3030
Console.WriteLine("MagicClass.ItsMagic() returned: {0}", magicValue)
3131
End Sub
3232
End Class

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/VB/isletterordigit.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Module IsLetterOrDigitSample
44
Sub Main()
55

66
Dim str As String
7-
str = "newline:" + vbNewLine
7+
str = "newline:" + Environment.NewLine
88

99
Console.WriteLine(Char.IsLetterOrDigit("8"c)) ' Output: "True"
1010
Console.WriteLine(Char.IsLetterOrDigit(str, 8)) ' Output: "False", because it's a NewLine

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/VB/source2.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ Public Class ScrambleList
1212
integerList.Add(i)
1313
Next i
1414

15-
Console.WriteLine("Ordered:" + vbNewLine)
15+
Console.WriteLine("Ordered:" + Environment.NewLine)
1616
For Each value As Integer In integerList
1717
Console.Write("{0}, ", value)
1818
Next value
19-
Console.WriteLine("<end>" + vbNewLine + vbNewLine + "Scrambled:" + vbNewLine)
19+
Console.WriteLine("<end>" + Environment.NewLine + Environment.NewLine + "Scrambled:" + Environment.NewLine)
2020

2121
' Scramble the order of the items in the list.
2222
integerList.Scramble()
2323

2424
For Each value As Integer In integerList
2525
Console.Write("{0}, ", value)
2626
Next value
27-
Console.WriteLine("<end>" + vbNewLine)
27+
Console.WriteLine("<end>" + Environment.NewLine)
2828
End Sub
2929

3030
Public Sub Scramble()

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/vb/source2.vb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Class Program
1313
' Add in the vehicles contained in the someVehicles list.
1414
allVehicles.UnionWith(someVehicles)
1515

16-
Console.WriteLine("The current HashSet contains:" + vbNewLine)
16+
Console.WriteLine("The current HashSet contains:" + Environment.NewLine)
1717
For Each vehicle As String In allVehicles
1818
Console.WriteLine(vehicle)
1919
Next vehicle
@@ -24,34 +24,34 @@ Class Program
2424
allVehicles.Add("Helicopters")
2525
allVehicles.Add("Submarines")
2626

27-
Console.WriteLine(vbNewLine + "The updated HashSet contains:" + vbNewLine)
27+
Console.WriteLine(Environment.NewLine + "The updated HashSet contains:" + Environment.NewLine)
2828
For Each vehicle As String In allVehicles
2929
Console.WriteLine(vehicle)
3030
Next vehicle
3131

3232
' Verify that the 'All Vehicles' set contains at least the vehicles in
3333
' the 'Some Vehicles' list.
3434
If allVehicles.IsSupersetOf(someVehicles) Then
35-
Console.Write(vbNewLine + "The 'All' vehicles set contains everything in ")
35+
Console.Write(Environment.NewLine + "The 'All' vehicles set contains everything in ")
3636
Console.WriteLine("'Some' vechicles list.")
3737
End If
3838

3939
' Check for Rockets. Here the OrdinalIgnoreCase comparer will compare
4040
' True for the mixed-case vehicle type.
4141
If allVehicles.Contains("roCKeTs") Then
42-
Console.WriteLine(vbNewLine + "The 'All' vehicles set contains 'roCKeTs'")
42+
Console.WriteLine(Environment.NewLine + "The 'All' vehicles set contains 'roCKeTs'")
4343
End If
4444

4545
allVehicles.ExceptWith(someVehicles)
46-
Console.WriteLine(vbNewLine + "The excepted HashSet contains:" + vbNewLine)
46+
Console.WriteLine(Environment.NewLine + "The excepted HashSet contains:" + Environment.NewLine)
4747
For Each vehicle As String In allVehicles
4848
Console.WriteLine(vehicle)
4949
Next vehicle
5050

5151
' Remove all the vehicles that are not 'super cool'.
5252
allVehicles.RemoveWhere(AddressOf isNotSuperCool)
5353

54-
Console.WriteLine(vbNewLine + "The super cool vehicles are:" + vbNewLine)
54+
Console.WriteLine(Environment.NewLine + "The super cool vehicles are:" + Environment.NewLine)
5555
For Each vehicle As String In allVehicles
5656
Console.WriteLine(vehicle)
5757
Next vehicle

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/VB/source2.vb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Public Class BinReadWrite
1313
Dim bw As New BinaryWriter(fs, utf8)
1414
Dim bstring As String
1515

16-
bstring = "This is line #1 of text written as a binary stream." + vbNewLine
17-
bstring = bstring + "This is line #2 of text written as a binary stream." + vbNewLine
18-
bstring = bstring + "This is line #3 of text written as a binary stream." + vbNewLine
16+
bstring = "This is line #1 of text written as a binary stream." + Environment.NewLine
17+
bstring = bstring + "This is line #2 of text written as a binary stream." + Environment.NewLine
18+
bstring = bstring + "This is line #3 of text written as a binary stream." + Environment.NewLine
1919
bw.Write(bstring)
2020

2121
' reset the stream position for reading
@@ -31,7 +31,7 @@ Public Class BinReadWrite
3131
fs.Read(rawbytes, 0, len)
3232

3333
' display the string
34-
Console.WriteLine("Read from FileStream: " + vbNewLine + utf8.GetString(rawbytes))
34+
Console.WriteLine("Read from FileStream: " + Environment.NewLine + utf8.GetString(rawbytes))
3535
Console.WriteLine()
3636

3737
' Now, read the string using BinaryReader
@@ -42,7 +42,7 @@ Public Class BinReadWrite
4242
Dim br As New BinaryReader(fs, utf8)
4343
' ReadString will read the length prefix and return the string.
4444
bstring = br.ReadString()
45-
Console.WriteLine("Read from BinaryReader: "+ vbNewLine + bstring)
45+
Console.WriteLine("Read from BinaryReader: "+ Environment.NewLine + bstring)
4646
fs.Close()
4747
End Sub
4848
End Class

0 commit comments

Comments
 (0)