本文整理汇总了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