当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET ProviderSettings类代码示例

本文整理汇总了VB.NET中System.Configuration.ProviderSettings的典型用法代码示例。如果您正苦于以下问题:VB.NET ProviderSettings类的具体用法?VB.NET ProviderSettings怎么用?VB.NET ProviderSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ProviderSettings类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: GetProviderSettings

' 导入命名空间
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Text
Imports System.Configuration
Imports System.Security.Permissions


' Shows how to use the ProviderSettings.
Namespace Samples.AspNet


    Public Class UsingProviderSettings


        <PermissionSet( _
           SecurityAction.Demand, Name:="FullTrust")> _
           Private Shared Sub GetProviderSettings()
            ' Get the application configuration file.
            Dim config _
            As System.Configuration.Configuration = _
            ConfigurationManager.OpenExeConfiguration( _
            ConfigurationUserLevel.None)

            Dim pSection As _
            ProtectedConfigurationSection = _
            config.GetSection("configProtectedData")

            Dim providerSettings _
            As ProviderSettingsCollection = _
            pSection.Providers

            Dim pSettings As ProviderSettings
            For Each pSettings In providerSettings

                Console.WriteLine( _
                "Provider settings name: {0}", _
                pSettings.Name)


                Console.WriteLine( _
                "Provider settings type: {0}", _
                pSettings.Type)

                Dim parameters _
                As NameValueCollection = pSettings.Parameters

                Dim pEnum _
                As IEnumerator = parameters.GetEnumerator()

                Dim i As Integer = 0
                While pEnum.MoveNext()
                    Dim pLength As String = _
                    parameters(i).Length.ToString()
                    Console.WriteLine( _
                    "Provider ssettings: {0} has {1} parameters", _
                    pSettings.Name, pLength)
                End While
            Next pSettings

        End Sub


        Public Shared Sub Main(ByVal args() As String)

            GetProviderSettings()
        End Sub
    End Class

End Namespace
开发者ID:VB.NET开发者,项目名称:System.Configuration,代码行数:70,代码来源:ProviderSettings


注:本文中的System.Configuration.ProviderSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。