VBCodeProvider Construtores
Definição
Inicializa uma nova instância da classe VBCodeProvider.Initializes a new instance of the VBCodeProvider class.
Sobrecargas
| VBCodeProvider() |
Inicializa uma nova instância da classe VBCodeProvider.Initializes a new instance of the VBCodeProvider class. |
| VBCodeProvider(IDictionary<String,String>) |
Inicializa uma nova instância da classe VBCodeProvider usando as opções de provedor especificadas.Initializes a new instance of the VBCodeProvider class by using the specified provider options. |
VBCodeProvider()
Inicializa uma nova instância da classe VBCodeProvider.Initializes a new instance of the VBCodeProvider class.
public:
VBCodeProvider();
public VBCodeProvider ();
Public Sub New ()
Aplica-se a
VBCodeProvider(IDictionary<String,String>)
Inicializa uma nova instância da classe VBCodeProvider usando as opções de provedor especificadas.Initializes a new instance of the VBCodeProvider class by using the specified provider options.
public:
VBCodeProvider(System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ providerOptions);
public VBCodeProvider (System.Collections.Generic.IDictionary<string,string> providerOptions);
new Microsoft.VisualBasic.VBCodeProvider : System.Collections.Generic.IDictionary<string, string> -> Microsoft.VisualBasic.VBCodeProvider
Public Sub New (providerOptions As IDictionary(Of String, String))
Parâmetros
- providerOptions
- IDictionary<String,String>
Um objeto IDictionary<TKey,TValue> que contém as opções de provedor do arquivo de configuração.A IDictionary<TKey,TValue> object that contains the provider options from the configuration file.
Exceções
providerOptions é null.providerOptions is null.
Exemplos
O exemplo de arquivo de configuração a seguir demonstra como especificar que a versão 3,5 do provedor de código de Visual Basic deve ser usada.The following configuration file example demonstrates how to specify that version 3.5 of the Visual Basic code provider should be used.
<configuration>
<system.codedom>
<compilers>
<!-- zero or more compiler elements -->
<compiler
language="vb;VisualBasic"
extension=".vb"
type="Microsoft.VisualBasic.VBCodeProvider, System,
Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
compilerOptions="/optimize"
warningLevel="1" >
<providerOption
name="CompilerVersion"
value="v3.5" />
</compiler>
</compilers>
</system.codedom>
</configuration>
O exemplo a seguir mostra como especificar a versão do compilador ao criar uma nova instância da VBCodeProvider classe.The following example shows how to specify the compiler version when creating a new instance of the VBCodeProvider class.
Imports System.CodeDom.Compiler
Imports Microsoft.CSharp
Imports System.Collections.Generic
Class Program
Shared Sub Main(ByVal args() As String)
DisplayVBCompilerInfo()
Console.WriteLine("Press Enter key to exit.")
Console.ReadLine()
End Sub
Shared Sub DisplayVBCompilerInfo()
Dim provOptions As New Dictionary(Of String, String)
provOptions.Add("CompilerVersion", "v3.5")
' Get the provider for Microsoft.VisualBasic
Dim vbProvider As VBCodeProvider = New VBCodeProvider(provOptions)
' Display the Visual Basic language provider information.
Console.WriteLine("Visual Basic provider is {0}", vbProvider.ToString())
Console.WriteLine(" Provider hash code: {0}", vbProvider.GetHashCode().ToString())
Console.WriteLine(" Default file extension: {0}", vbProvider.FileExtension)
Console.WriteLine()
End Sub
End Class
Comentários
O valor de providerOptions é obtido do elemento < providerOption > no arquivo de configuração.The value for providerOptions is obtained from the <providerOption> element in the configuration file. Você pode identificar a versão do VBCodeProvider que deseja usar especificando o <providerOption> elemento, fornecendo "compilerversion" como o nome da opção e fornecendo o número da versão (por exemplo, "v 3.5") como o valor da opção.You can identify the version of the VBCodeProvider you want to use by specifying the <providerOption> element, supplying "CompilerVersion" as the option name, and supplying the version number (for example, "v3.5") as the option value. Você deve preceder o número de versão com um "v" minúsculo.You must precede the version number with a lower case "v".
Confira também
- CompilerInfo
- CodeDomProvider
- Esquema de arquivos de configuração para o .NET FrameworkConfiguration file schema for the .NET Framework
- <elemento compilers ><compilers> Element
- Especificando nomes de tipo totalmente qualificadosSpecifying Fully Qualified Type Names
- <>elemento provideroption<provideroption> Element