Skip to content

Commit a6a2d4e

Browse files
committed
resolve merge conflicts properly
1 parent 3c7682c commit a6a2d4e

File tree

10 files changed

+123
-156
lines changed

10 files changed

+123
-156
lines changed
Lines changed: 31 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
<<<<<<< HEAD
21
' System.Diagnostics.Stopwatch
32

43
'<Snippet1>
54
Imports System.Diagnostics
65

76
Class OperationsTimer
8-
7+
98
Public Shared Sub Main()
109
DisplayTimerProperties()
11-
10+
1211
Console.WriteLine()
1312
Console.WriteLine("Press the Enter key to begin:")
1413
Console.ReadLine()
1514
Console.WriteLine()
16-
15+
1716
TimeOperations()
1817
End Sub
19-
20-
21-
'<Snippet2>
18+
19+
'<Snippet2>
2220
Public Shared Sub DisplayTimerProperties()
2321

2422
' Display the timer frequency and resolution.
@@ -27,30 +25,30 @@ Class OperationsTimer
2725
Else
2826
Console.WriteLine("Operations timed using the DateTime class.")
2927
End If
30-
28+
3129
Dim frequency As Long = Stopwatch.Frequency
3230
Console.WriteLine(" Timer frequency in ticks per second = {0}", frequency)
3331
Dim nanosecPerTick As Long = 1000000000 / frequency
3432
Console.WriteLine(" Timer is accurate within {0} nanoseconds", nanosecPerTick)
3533

3634
End Sub
37-
38-
'</Snippet2>
39-
'<Snippet3>
35+
'</Snippet2>
36+
37+
'<Snippet3>
4038
Private Shared Sub TimeOperations()
4139

4240
Dim nanosecPerTick As Long = 1000000000 / Stopwatch.Frequency
4341
Const numIterations As Long = 10000
44-
42+
4543
' Define the operation title names.
4644
Dim operationNames As String() = _
4745
{"Operation: Int32.Parse(""0"")", _
4846
"Operation: Int32.TryParse(""0"")", _
4947
"Operation: Int32.Parse(""a"")", _
5048
"Operation: Int32.TryParse(""a"")"}
51-
52-
' Time four different implementations for parsing
53-
' an integer from a string.
49+
50+
' Time four different implementations for parsing
51+
' an integer from a string.
5452

5553
Dim operation As Integer
5654
For operation = 0 To 3
@@ -63,9 +61,9 @@ Class OperationsTimer
6361
Dim indexFastest As Integer = - 1
6462
Dim indexSlowest As Integer = - 1
6563
Dim milliSec As Long = 0
66-
64+
6765
Dim time10kOperations As Stopwatch = Stopwatch.StartNew()
68-
66+
6967
' Run the current operation 10001 times.
7068
' The first execution time will be tossed
7169
' out, since it can skew the average time.
@@ -75,20 +73,20 @@ Class OperationsTimer
7573
Dim ticksThisTime As Long = 0
7674
Dim inputNum As Integer
7775
Dim timePerParse As Stopwatch
78-
76+
7977
Select Case operation
8078
Case 0
8179
' Parse a valid integer using
8280
' a try-catch statement.
8381
' Start a new stopwatch timer.
8482
timePerParse = Stopwatch.StartNew()
85-
83+
8684
Try
8785
inputNum = Int32.Parse("0")
8886
Catch e As FormatException
8987
inputNum = 0
9088
End Try
91-
89+
9290
' Stop the timer, and save the
9391
' elapsed ticks for the operation.
9492
timePerParse.Stop()
@@ -98,11 +96,11 @@ Class OperationsTimer
9896
' the TryParse statement.
9997
' Start a new stopwatch timer.
10098
timePerParse = Stopwatch.StartNew()
101-
99+
102100
If Not Int32.TryParse("0", inputNum) Then
103101
inputNum = 0
104102
End If
105-
103+
106104
' Stop the timer, and save the
107105
' elapsed ticks for the operation.
108106
timePerParse.Stop()
@@ -112,13 +110,13 @@ Class OperationsTimer
112110
' a try-catch statement.
113111
' Start a new stopwatch timer.
114112
timePerParse = Stopwatch.StartNew()
115-
113+
116114
Try
117115
inputNum = Int32.Parse("a")
118116
Catch e As FormatException
119117
inputNum = 0
120118
End Try
121-
119+
122120
' Stop the timer, and save the
123121
' elapsed ticks for the operation.
124122
timePerParse.Stop()
@@ -128,28 +126,28 @@ Class OperationsTimer
128126
' the TryParse statement.
129127
' Start a new stopwatch timer.
130128
timePerParse = Stopwatch.StartNew()
131-
129+
132130
If Not Int32.TryParse("a", inputNum) Then
133131
inputNum = 0
134132
End If
135-
133+
136134
' Stop the timer, and save the
137135
' elapsed ticks for the operation.
138136
timePerParse.Stop()
139137
ticksThisTime = timePerParse.ElapsedTicks
140-
138+
141139
Case Else
142140
End Select
143141
'</Snippet4>
144-
142+
145143
' Skip over the time for the first operation,
146144
' just in case it caused a one-time
147145
' performance hit.
148146
If i = 0 Then
149147
time10kOperations.Reset()
150148
time10kOperations.Start()
151149
Else
152-
150+
153151
' Update operation statistics
154152
' for iterations 1-10001.
155153
If maxTicks < ticksThisTime Then
@@ -167,11 +165,11 @@ Class OperationsTimer
167165
End If
168166
End If
169167
Next i
170-
168+
171169
' Display the statistics for 10000 iterations.
172170
time10kOperations.Stop()
173171
milliSec = time10kOperations.ElapsedMilliseconds
174-
172+
175173
Console.WriteLine()
176174
Console.WriteLine("{0} Summary:", operationNames(operation))
177175
Console.WriteLine(" Slowest time: #{0}/{1} = {2} ticks", _
@@ -186,29 +184,6 @@ Class OperationsTimer
186184
Next operation
187185

188186
End Sub
187+
'</Snippet3>
189188
End Class
190-
'</Snippet3>
191-
=======
192-
'<Snippet1>
193-
Imports System.Diagnostics
194-
Imports System.Threading
195-
196-
197-
Class Program
198-
199-
Shared Sub Main(ByVal args() As String)
200-
Dim stopWatch As New Stopwatch()
201-
stopWatch.Start()
202-
Thread.Sleep(10000)
203-
stopWatch.Stop()
204-
' Get the elapsed time as a TimeSpan value.
205-
Dim ts As TimeSpan = stopWatch.Elapsed
206-
207-
' Format and display the TimeSpan value.
208-
Dim elapsedTime As String = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10)
209-
Console.WriteLine( "RunTime " + elapsedTime)
210-
211-
End Sub
212-
End Class
213-
>>>>>>> 888bb64f55349b13f1342f20d22b825c7eb339d7
214-
'</Snippet1>
189+
'</Snippet1>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'<Snippet1>
2+
Imports System.Diagnostics
3+
Imports System.Threading
4+
5+
Class Program
6+
7+
Shared Sub Main(ByVal args() As String)
8+
Dim stopWatch As New Stopwatch()
9+
stopWatch.Start()
10+
Thread.Sleep(10000)
11+
stopWatch.Stop()
12+
' Get the elapsed time as a TimeSpan value.
13+
Dim ts As TimeSpan = stopWatch.Elapsed
14+
15+
' Format and display the TimeSpan value.
16+
Dim elapsedTime As String = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10)
17+
Console.WriteLine( "RunTime " + elapsedTime)
18+
19+
End Sub
20+
End Class
21+
'</Snippet1>

snippets/visualbasic/System.Reflection/Assembly/Load/Load2.vb renamed to snippets/visualbasic/System.Reflection/Assembly/Load/Load21.vb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Module Example
1616
Next
1717
End Sub
1818
End Module
19+
1920
' The example displays the following output:
2021
' Public types in assembly sysglobl, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a:
2122
' System.Globalization.CultureAndRegionInfoBuilder
Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
<<<<<<< HEAD
21
' <Snippet1>
32
Imports System.Reflection
43

54
Class Class1
65
Public Shared Sub Main()
7-
' You must supply a valid fully qualified assembly name.
6+
' You must supply a valid fully qualified assembly name.
87
Dim SampleAssembly As [Assembly] = _
98
[Assembly].Load("SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3")
109
Dim oType As Type
@@ -15,25 +14,3 @@ Class Class1
1514
End Sub 'LoadSample
1615
End Class
1716
' </Snippet1>
18-
=======
19-
' Visual Basic .NET Document
20-
Option Strict On
21-
22-
' <Snippet1>
23-
Imports System.Reflection
24-
25-
Module Example
26-
Public Sub Main()
27-
Dim longName As String = "system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
28-
Dim assem As Assembly = Assembly.Load(longName)
29-
If assem Is Nothing Then
30-
Console.WriteLine("Unable to load assembly...")
31-
Else
32-
Console.WriteLine(assem.FullName)
33-
End If
34-
End Sub
35-
End Module
36-
' The example displays the following output:
37-
' system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
38-
' </Snippet1>
39-
>>>>>>> 888bb64f55349b13f1342f20d22b825c7eb339d7
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
' Visual Basic .NET Document
2+
Option Strict On
3+
4+
' <Snippet1>
5+
Imports System.Reflection
6+
7+
Module Example
8+
Public Sub Main()
9+
Dim longName As String = "system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
10+
Dim assem As Assembly = Assembly.Load(longName)
11+
If assem Is Nothing Then
12+
Console.WriteLine("Unable to load assembly...")
13+
Else
14+
Console.WriteLine(assem.FullName)
15+
End If
16+
End Sub
17+
End Module
18+
' The example displays the following output:
19+
' system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
20+
' </Snippet1>

snippets/visualbasic/System.Text.RegularExpressions/RegexCompilationInfo/.ctor/makefile

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,18 @@
1-
<<<<<<< HEAD
21
'<snippet1>
32
Class Sample
43
Public Shared Sub Main()
54
Dim val As [String]() = {"apple", "orange", "grape", "pear"}
65
Dim sep As [String] = ", "
76
Dim result As [String]
8-
7+
98
Console.WriteLine("sep = '{0}'", sep)
109
Console.WriteLine("val() = {{'{0}' '{1}' '{2}' '{3}'}}", val(0), val(1), val(2), val(3))
1110
result = [String].Join(sep, val, 1, 2)
1211
Console.WriteLine("String.Join(sep, val, 1, 2) = '{0}'", result)
1312
End Sub
14-
End Class
13+
End Class
1514
'This example displays the following output:
1615
' sep = ', '
1716
' val() = {'apple' 'orange' 'grape' 'pear'}
1817
' String.Join(sep, val, 1, 2) = 'orange, grape'
1918
'</snippet1>
20-
=======
21-
' Visual Basic .NET Document
22-
Option Strict On
23-
24-
' <Snippet2>
25-
Imports System.Collections.Generic
26-
27-
Module Example
28-
Public Sub Main()
29-
Dim maxPrime As Integer = 100
30-
Dim primes As List(Of Integer) = GetPrimes(maxPrime)
31-
Console.WriteLine("Primes less than {0}:", maxPrime)
32-
Console.WriteLine(" {0}", String.Join(" ", primes))
33-
End Sub
34-
35-
Private Function GetPrimes(maxPrime As Integer) As List(Of Integer)
36-
Dim values As Array = Array.CreateInstance(GetType(Integer), _
37-
New Integer() { maxPrime - 1}, New Integer(){ 2 })
38-
' Use Sieve of Eratosthenes to determine prime numbers.
39-
For ctr As Integer = values.GetLowerBound(0) To _
40-
CInt(Math.Ceiling(Math.Sqrt(values.GetUpperBound(0))))
41-
If CInt(values.GetValue(ctr)) = 1 Then Continue For
42-
43-
For multiplier As Integer = ctr To maxPrime \ 2
44-
If ctr * multiplier <= maxPrime Then values.SetValue(1, ctr * multiplier)
45-
Next
46-
Next
47-
48-
Dim primes As New System.Collections.Generic.List(Of Integer)
49-
For ctr As Integer = values.GetLowerBound(0) To values.GetUpperBound(0)
50-
If CInt(values.GetValue(ctr)) = 0 Then primes.Add(ctr)
51-
Next
52-
Return primes
53-
End Function
54-
End Module
55-
' The example displays the following output:
56-
' Primes less than 100:
57-
' 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
58-
' </Snippet2>
59-
>>>>>>> 888bb64f55349b13f1342f20d22b825c7eb339d7

0 commit comments

Comments
 (0)