Skip to content

Commit ce1e118

Browse files
Copilotgewarren
andcommitted
Move DirectoryInfo.Root and List.IndexOf VB snippets to new organization
Co-authored-by: gewarren <[email protected]>
1 parent 1ad43ec commit ce1e118

File tree

6 files changed

+99
-2
lines changed

6 files changed

+99
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
' <Snippet1>
2+
Imports System.Collections.Generic
3+
4+
Public Class Example
5+
6+
Public Shared Sub Main()
7+
8+
Dim dinosaurs As New List(Of String)
9+
10+
dinosaurs.Add("Tyrannosaurus")
11+
dinosaurs.Add("Amargasaurus")
12+
dinosaurs.Add("Mamenchisaurus")
13+
dinosaurs.Add("Brachiosaurus")
14+
dinosaurs.Add("Deinonychus")
15+
dinosaurs.Add("Tyrannosaurus")
16+
dinosaurs.Add("Compsognathus")
17+
18+
Console.WriteLine()
19+
For Each dinosaur As String In dinosaurs
20+
Console.WriteLine(dinosaur)
21+
Next
22+
23+
Console.WriteLine(vbLf & _
24+
"IndexOf(""Tyrannosaurus""): {0}", _
25+
dinosaurs.IndexOf("Tyrannosaurus"))
26+
27+
Console.WriteLine(vbLf & _
28+
"IndexOf(""Tyrannosaurus"", 3): {0}", _
29+
dinosaurs.IndexOf("Tyrannosaurus", 3))
30+
31+
Console.WriteLine(vbLf & _
32+
"IndexOf(""Tyrannosaurus"", 2, 2): {0}", _
33+
dinosaurs.IndexOf("Tyrannosaurus", 2, 2))
34+
35+
End Sub
36+
End Class
37+
38+
' This code example produces the following output:
39+
'
40+
'Tyrannosaurus
41+
'Amargasaurus
42+
'Mamenchisaurus
43+
'Brachiosaurus
44+
'Deinonychus
45+
'Tyrannosaurus
46+
'Compsognathus
47+
'
48+
'IndexOf("Tyrannosaurus"): 0
49+
'
50+
'IndexOf("Tyrannosaurus", 3): 5
51+
'
52+
'IndexOf("Tyrannosaurus", 2, 2): -1
53+
' </Snippet1>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
' <snippet2>
2+
Imports System.IO
3+
4+
Module Module1
5+
6+
Sub Main()
7+
Dim di1 As DirectoryInfo = New DirectoryInfo("\\tempshare\tempdir")
8+
Dim di2 As DirectoryInfo = New DirectoryInfo("tempdir")
9+
Dim di3 As DirectoryInfo = New DirectoryInfo("x:\tempdir")
10+
Dim di4 As DirectoryInfo = New DirectoryInfo("c:\")
11+
12+
Console.WriteLine("The root path of '{0}' is '{1}'", di1.FullName, di1.Root)
13+
Console.WriteLine("The root path of '{0}' is '{1}'", di2.FullName, di2.Root)
14+
Console.WriteLine("The root path of '{0}' is '{1}'", di3.FullName, di3.Root)
15+
Console.WriteLine("The root path of '{0}' is '{1}'", di4.FullName, di4.Root)
16+
End Sub
17+
18+
End Module
19+
20+
' This code produces output similar to the following:
21+
22+
' The root path of '\\tempshare\tempdir' is '\\tempshare\tempdir'
23+
' The root path of 'c:\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\tempdir' is 'c:\'
24+
' The root path of 'x:\tempdir' is 'x:\'
25+
' The root path of 'c:\' is 'c:\'
26+
' Press any key to continue . . .
27+
28+
' </snippet2>

xml/System.Collections.Generic/List`1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2622,7 +2622,7 @@ Public Function StartsWith(e As Employee) As Boolean
26222622
The following example demonstrates all three overloads of the <xref:System.Collections.Generic.List%601.IndexOf%2A> method. A <xref:System.Collections.Generic.List%601> of strings is created, with one entry that appears twice, at index location 0 and index location 5. The <xref:System.Collections.Generic.List%601.IndexOf%28%600%29> method overload searches the list from the beginning, and finds the first occurrence of the string. The <xref:System.Collections.Generic.List%601.IndexOf%28%600%2CSystem.Int32%29> method overload is used to search the list beginning with index location 3 and continuing to the end of the list, and finds the second occurrence of the string. Finally, the <xref:System.Collections.Generic.List%601.IndexOf%28%600%2CSystem.Int32%2CSystem.Int32%29> method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range.
26232623
26242624
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/IndexOf/source.cs" interactive="try-dotnet" id="Snippet1":::
2625-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_IndexOf/vb/source.vb" id="Snippet1":::
2625+
:::code language="vb" source="~/snippets/visualbasic/System.Collections.Generic/ListT/IndexOf/source.vb" id="Snippet1":::
26262626
26272627
]]></format>
26282628
</remarks>

xml/System.IO/DirectoryInfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3752,7 +3752,7 @@ The following example refers to the parent directory of a specified directory.
37523752
37533753
:::code language="csharp" source="~/snippets/csharp/System.IO/DirectoryInfo/Root/directoryinforoot2.cs" id="Snippet2":::
37543754
:::code language="fsharp" source="~/snippets/fsharp/System.IO/DirectoryInfo/Root/directoryinforoot2.fs" id="Snippet2":::
3755-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/directoryinforoot/VB/directoryinforoot2.vb" id="Snippet2":::
3755+
:::code language="vb" source="~/snippets/visualbasic/System.IO/DirectoryInfo/Root/directoryinforoot2.vb" id="Snippet2":::
37563756
37573757
]]></format>
37583758
</remarks>

0 commit comments

Comments
 (0)