本文整理汇总了VB.NET中System.Resources.NeutralResourcesLanguageAttribute类的典型用法代码示例。如果您正苦于以下问题:VB.NET NeutralResourcesLanguageAttribute类的具体用法?VB.NET NeutralResourcesLanguageAttribute怎么用?VB.NET NeutralResourcesLanguageAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NeutralResourcesLanguageAttribute类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Main
' 导入命名空间
Imports System.Globalization
Imports System.Reflection
Imports System.Resources
Imports System.Threading
<Assembly:NeutralResourcesLanguageAttribute("en")>
Module Example
Public Sub Main()
' Select the current culture randomly to test resource fallback.
Dim cultures() As String = { "de-DE", "en-us", "fr-FR" }
Dim rnd As New Random()
Dim index As Integer = rnd.Next(0, cultures.Length)
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(cultures(index))
Console.WriteLine("The current culture is {0}",
CultureInfo.CurrentUICulture.Name)
' Retrieve the resource.
Dim rm As New ResourceManager("ExampleResources" , GetType(Example).Assembly)
Dim greeting As String = rm.GetString("Greeting")
Console.Write("Enter your name: ")
Dim name As String = Console.ReadLine()
Console.WriteLine("{0} {1}", greeting, name)
End Sub
End Module
示例2:
' 导入命名空间
Imports System.Resources
<Assembly:NeutralResourcesLanguage("en-US")>
示例3:
' 导入命名空间
Imports System.Resources
<Assembly:NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>