本文整理匯總了VB.NET中System.Resources.ResXResourceReader.GetEnumerator方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET ResXResourceReader.GetEnumerator方法的具體用法?VB.NET ResXResourceReader.GetEnumerator怎麽用?VB.NET ResXResourceReader.GetEnumerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Resources.ResXResourceReader
的用法示例。
在下文中一共展示了ResXResourceReader.GetEnumerator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
' 導入命名空間
Imports System.Collections
Imports System.Resources
Module Example
Private Const resxFilename As String = ".\CountryHeaders.resx"
Public Sub Main()
' Create a resource file to read.
CreateResourceFile()
' Enumerate the resources in the file.
Dim rr As New ResXResourceReader(resxFilename)
Dim dict As IDictionaryEnumerator = rr.GetEnumerator()
Do While dict.MoveNext()
Console.WriteLine("{0}: {1}", dict.Key, dict.Value)
Loop
End Sub
Private Sub CreateResourceFile()
Dim rw As New ResxResourceWriter(resxFilename)
Dim resNames() As String = {"Country", "Population", "Area",
"Capital", "LCity" }
Dim columnHeaders() As String = { "Country Name", "Population (2010}",
"Area", "Capital", "Largest City" }
Dim comments() As String = { "The localized country name", "",
"The area in square miles", "",
"The largest city based on 2010 data" }
rw.AddResource("Title", "Country Information")
rw.AddResource("nColumns", resNames.Length)
For ctr As Integer = 0 To resNames.Length - 1
Dim node As New ResXDataNode(resNames(ctr), columnHeaders(ctr))
node.Comment = comments(ctr)
rw.AddResource(node)
Next
rw.Generate()
rw.Close()
End Sub
End Module
輸出:
Title: Country Information nColumns: 5 Country: Country Name Population: Population (2010} Area: Area Capital: Capital LCity: Largest City