<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FData_Structure%2FDictionary</id>
		<title>VB.Net/Data Structure/Dictionary - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FData_Structure%2FDictionary"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Data_Structure/Dictionary&amp;action=history"/>
		<updated>2026-04-05T15:52:19Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Data_Structure/Dictionary&amp;diff=1022&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Data_Structure/Dictionary&amp;diff=1022&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Data_Structure/Dictionary&amp;diff=1023&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Data_Structure/Dictionary&amp;diff=1023&amp;oldid=prev"/>
				<updated>2010-05-26T12:45:46Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Check if a directory does not exist, create a directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Try&lt;br /&gt;
            If (Directory.Exists(&amp;quot;D:\test01&amp;quot;)) Then&lt;br /&gt;
                Console.WriteLine(&amp;quot;D:\test01 already exists&amp;quot;)&lt;br /&gt;
            Else&lt;br /&gt;
                Directory.CreateDirectory(&amp;quot;C:\test01&amp;quot;)&lt;br /&gt;
            End If&lt;br /&gt;
            Console.WriteLine(&amp;quot;Directories created&amp;quot;)&lt;br /&gt;
        Catch E As Exception&lt;br /&gt;
            Console.WriteLine(&amp;quot;Error creating directory&amp;quot;)&lt;br /&gt;
            Console.WriteLine(&amp;quot;Error: {0}&amp;quot;, E.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Create directory with drive letter and without drive letter==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Console.WriteLine(&amp;quot;Creating directories...&amp;quot;)&lt;br /&gt;
        Directory.CreateDirectory(&amp;quot;D:\test01&amp;quot;)&lt;br /&gt;
        Directory.CreateDirectory(&amp;quot;D:\Temp\Sample02&amp;quot;)&lt;br /&gt;
        Directory.CreateDirectory(&amp;quot;Sample03&amp;quot;)&lt;br /&gt;
        Console.WriteLine(&amp;quot;Directories created&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Delete a Directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Try&lt;br /&gt;
            Directory.Delete(&amp;quot;C:\Sample01&amp;quot;, True)&lt;br /&gt;
        Catch E As Exception&lt;br /&gt;
            Console.WriteLine(&amp;quot;Error deleting directory C:\Sample01&amp;quot;)&lt;br /&gt;
            Console.WriteLine(&amp;quot;Error {0}&amp;quot;, E.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Get and set current working directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Console.WriteLine(&amp;quot;Current directory is {0}&amp;quot;, Directory.GetCurrentDirectory())&lt;br /&gt;
        Directory.SetCurrentDirectory(&amp;quot;C:\&amp;quot;)&lt;br /&gt;
        Console.WriteLine(&amp;quot;Current directory is {0}&amp;quot;, Directory.GetCurrentDirectory())&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Get parent directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Dim Current As String&lt;br /&gt;
        Dim Parent As DirectoryInfo&lt;br /&gt;
        Try&lt;br /&gt;
            Current = Directory.GetCurrentDirectory()&lt;br /&gt;
            Parent = Directory.GetParent(Current)&lt;br /&gt;
            Console.WriteLine(&amp;quot;Current directory {0}&amp;quot;, Current)&lt;br /&gt;
            Console.WriteLine(&amp;quot;Parent directory {0}&amp;quot;, Parent.FullName)&lt;br /&gt;
        Catch E As Exception&lt;br /&gt;
            Console.WriteLine(&amp;quot;Error determining parent directory&amp;quot;)&lt;br /&gt;
            Console.WriteLine(E.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==List all Directories under a directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Dim Root As New DirectoryInfo(&amp;quot;C:\&amp;quot;)&lt;br /&gt;
        Dim Files As FileInfo() = Root.GetFiles(&amp;quot;*.*&amp;quot;)&lt;br /&gt;
        Dim Dirs As DirectoryInfo() = Root.GetDirectories(&amp;quot;*.*&amp;quot;)&lt;br /&gt;
        Console.WriteLine(&amp;quot;Root Directories&amp;quot;)&lt;br /&gt;
        Dim DirectoryName As DirectoryInfo&lt;br /&gt;
        For Each DirectoryName In Dirs&lt;br /&gt;
            Try&lt;br /&gt;
                Console.Write(DirectoryName.FullName)&lt;br /&gt;
                Console.Write(&amp;quot; contains {0} files &amp;quot;, DirectoryName.GetFiles().Length)&lt;br /&gt;
                Console.WriteLine(&amp;quot; and {0} subdirectories &amp;quot;, DirectoryName.GetDirectories().Length)&lt;br /&gt;
            Catch E As Exception&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error accessing&amp;quot;)&lt;br /&gt;
            End Try&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==List all files under a directory==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Module Module1&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Dim Root As New DirectoryInfo(&amp;quot;C:\&amp;quot;)&lt;br /&gt;
        Dim Files As FileInfo() = Root.GetFiles(&amp;quot;*.*&amp;quot;)&lt;br /&gt;
        Dim Dirs As DirectoryInfo() = Root.GetDirectories(&amp;quot;*.*&amp;quot;)&lt;br /&gt;
        Console.WriteLine(&amp;quot;Root Files&amp;quot;)&lt;br /&gt;
        Dim Filename As FileInfo&lt;br /&gt;
        For Each Filename In Files&lt;br /&gt;
            Try&lt;br /&gt;
                Console.Write(Filename.FullName)&lt;br /&gt;
                Console.Write(&amp;quot; Size: {0} bytes&amp;quot;, Filename.Length)&lt;br /&gt;
                Console.WriteLine(&amp;quot; Last use: {0}&amp;quot;, Filename.LastAccessTime)&lt;br /&gt;
            Catch E As Exception&lt;br /&gt;
                Console.WriteLine(&amp;quot;Error accessing File&amp;quot;)&lt;br /&gt;
            End Try&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Make Dictionary based on your own Object==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.Collections.Generic&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    &lt;br /&gt;
    Shared Sub Main(ByVal args As String())&lt;br /&gt;
        Dim dict As New StudentDictionary&lt;br /&gt;
        dict.Add(&amp;quot;113-11-1111&amp;quot;, New Student(&amp;quot;A&amp;quot;, &amp;quot;a&amp;quot;))&lt;br /&gt;
        dict.Add(&amp;quot;222-22-2222&amp;quot;, New Student(&amp;quot;B&amp;quot;, &amp;quot;b&amp;quot;))&lt;br /&gt;
        dict.Add(&amp;quot;333-33-3333&amp;quot;, New Student(&amp;quot;C&amp;quot;, &amp;quot;c&amp;quot;))&lt;br /&gt;
        dict.Add(&amp;quot;444-44-4444&amp;quot;, New Student(&amp;quot;D&amp;quot;, &amp;quot;d&amp;quot;))&lt;br /&gt;
        Dim student As Student = dict.Item(&amp;quot;365-76-5476&amp;quot;)&lt;br /&gt;
        Console.WriteLine(student.ToString)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
  &lt;br /&gt;
Public Class Student&lt;br /&gt;
    Private m_FirstName As String&lt;br /&gt;
    Private m_LastName As String&lt;br /&gt;
    Public Sub New(ByVal first_name As String, ByVal last_name As String)&lt;br /&gt;
        m_FirstName = first_name&lt;br /&gt;
        m_LastName = last_name&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Overrides Function ToString() As String&lt;br /&gt;
        Return m_FirstName &amp;amp; &amp;quot; &amp;quot; &amp;amp; m_LastName&lt;br /&gt;
    End Function&lt;br /&gt;
End Class&lt;br /&gt;
Public Class StudentDictionary&lt;br /&gt;
    Inherits System.Collections.DictionaryBase&lt;br /&gt;
    &amp;quot; Add a Dictionary entry.&lt;br /&gt;
    Public Sub Add(ByVal new_key As String, ByVal new_student As Student)&lt;br /&gt;
        Dictionary.Add(new_key, new_student)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot; Return an object with the given key.&lt;br /&gt;
    Default Public Property Item(ByVal key As String) As Student&lt;br /&gt;
        Get&lt;br /&gt;
            Return DirectCast(Dictionary.Item(key), Student)&lt;br /&gt;
        End Get&lt;br /&gt;
        Set(ByVal Value As Student)&lt;br /&gt;
            Dictionary.Item(key) = Value&lt;br /&gt;
        End Set&lt;br /&gt;
    End Property&lt;br /&gt;
    &amp;quot; Return a collection containing the Dictionary&amp;quot;s keys.&lt;br /&gt;
    Public ReadOnly Property Keys() As ICollection&lt;br /&gt;
        Get&lt;br /&gt;
            Return Dictionary.Keys&lt;br /&gt;
        End Get&lt;br /&gt;
    End Property&lt;br /&gt;
    &amp;quot; Return a collection containing the Dictionary&amp;quot;s values.&lt;br /&gt;
    Public ReadOnly Property Values() As ICollection&lt;br /&gt;
        Get&lt;br /&gt;
            Return Dictionary.Values&lt;br /&gt;
        End Get&lt;br /&gt;
    End Property&lt;br /&gt;
    &amp;quot; Return True if the Dictionary contains this Student.&lt;br /&gt;
    Public Function Contains(ByVal key As String) As Boolean&lt;br /&gt;
        Return Dictionary.Contains(key)&lt;br /&gt;
    End Function&lt;br /&gt;
    &amp;quot; Remove this entry.&lt;br /&gt;
    Public Sub Remove(ByVal key As String)&lt;br /&gt;
        Dictionary.Remove(key)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Your own Generic List Dictionary  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.Collections.Generic&lt;br /&gt;
Imports System.Collections.Specialized&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    &lt;br /&gt;
    Shared Sub Main(ByVal args As String())&lt;br /&gt;
        Dim dict As New StudentListDictionary&lt;br /&gt;
        dict.Add(&amp;quot;111-11-1111&amp;quot;, New Student(&amp;quot;A&amp;quot;, &amp;quot;A&amp;quot;))&lt;br /&gt;
        dict.Add(&amp;quot;333-22-3333&amp;quot;, New Student(&amp;quot;B&amp;quot;, &amp;quot;B&amp;quot;))&lt;br /&gt;
        dict.Add(&amp;quot;444-44-4444&amp;quot;, New Student(&amp;quot;C&amp;quot;, &amp;quot;C&amp;quot;))&lt;br /&gt;
        dict.Add(&amp;quot;555-55-5555&amp;quot;, New Student(&amp;quot;D&amp;quot;, &amp;quot;D&amp;quot;))&lt;br /&gt;
        Dim student As Student = dict.Item(&amp;quot;111-11-1111&amp;quot;)&lt;br /&gt;
        Console.WriteLine(student.ToString)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
  &lt;br /&gt;
Public Class Student&lt;br /&gt;
    Private m_FirstName As String&lt;br /&gt;
    Private m_LastName As String&lt;br /&gt;
    Public Sub New(ByVal first_name As String, ByVal last_name As String)&lt;br /&gt;
        m_FirstName = first_name&lt;br /&gt;
        m_LastName = last_name&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Overrides Function ToString() As String&lt;br /&gt;
        Return m_FirstName &amp;amp; &amp;quot; &amp;quot; &amp;amp; m_LastName&lt;br /&gt;
    End Function&lt;br /&gt;
End Class&lt;br /&gt;
Public Class StudentListDictionary&lt;br /&gt;
    Inherits ListDictionary&lt;br /&gt;
    &amp;quot; Add a Dictionary entry.&lt;br /&gt;
    Public Shadows Sub Add(ByVal new_key As String, ByVal new_student As Student)&lt;br /&gt;
        MyBase.Add(new_key, new_student)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot; Return an object with the given key.&lt;br /&gt;
    Default Public Shadows Property Item(ByVal key As String) As Student&lt;br /&gt;
        Get&lt;br /&gt;
            Return DirectCast(MyBase.Item(key), Student)&lt;br /&gt;
        End Get&lt;br /&gt;
        Set(ByVal Value As Student)&lt;br /&gt;
            MyBase.Item(key) = Value&lt;br /&gt;
        End Set&lt;br /&gt;
    End Property&lt;br /&gt;
    &amp;quot; Return True if the Dictionary contains this Student.&lt;br /&gt;
    Public Shadows Function Contains(ByVal key As String) As Boolean&lt;br /&gt;
        Return MyBase.Contains(key)&lt;br /&gt;
    End Function&lt;br /&gt;
    &amp;quot; Remove this entry.&lt;br /&gt;
    Public Shadows Sub Remove(ByVal key As String)&lt;br /&gt;
        MyBase.Remove(key)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>