ConsoleApplicationBase ConsoleApplicationBase ConsoleApplicationBase ConsoleApplicationBase Class

定義

提供與目前應用程式相關的屬性、方法和事件。Provides properties, methods, and events related to the current application.

public ref class ConsoleApplicationBase : Microsoft::VisualBasic::ApplicationServices::ApplicationBase
public class ConsoleApplicationBase : Microsoft.VisualBasic.ApplicationServices.ApplicationBase
type ConsoleApplicationBase = class
    inherit ApplicationBase
Public Class ConsoleApplicationBase
Inherits ApplicationBase
繼承
ConsoleApplicationBaseConsoleApplicationBaseConsoleApplicationBaseConsoleApplicationBase
衍生

範例

這個範例會使用My.Application.CommandLineArgs屬性可檢查應用程式的命令列引數。This example uses the My.Application.CommandLineArgs property to examine the application's command-line arguments. 如果引數會找到開頭/input=,該引數的其餘部分會顯示。If an argument is found that starts with /input=, the rest of that argument is displayed.

Private Sub ParseCommandLineArgs()
    Dim inputArgument As String = "/input="
    Dim inputName As String = ""

    For Each s As String In My.Application.CommandLineArgs
        If s.ToLower.StartsWith(inputArgument) Then
            inputName = s.Remove(0, inputArgument.Length)
        End If
    Next

    If inputName = "" Then
        MsgBox("No input name")
    Else
        MsgBox("Input name: " & inputName)
    End If
End Sub

備註

所公開的屬性My.Application物件只與目前的應用程式或 DLL 相關聯的傳回資料。The properties exposed by the My.Application object return data that is associated only with the current application or DLL. 使用 My.Application 無法改變任何系統層級資訊。No system-level information can be altered with My.Application.

My.Application 物件包含下列類別:The My.Application object consists of the following classes:

建構函式

ConsoleApplicationBase() ConsoleApplicationBase() ConsoleApplicationBase() ConsoleApplicationBase()

初始化 ConsoleApplicationBase 類別的新執行個體。Initializes a new instance of the ConsoleApplicationBase class.

屬性

CommandLineArgs CommandLineArgs CommandLineArgs CommandLineArgs

取得集合,包含做為目前應用程式之字串 (String) 的命令列引數。Gets a collection containing the command-line arguments as strings for the current application.

Culture Culture Culture Culture

取得目前執行緒用於字串 (String) 操作和字串格式化的文化特性 (Culture)。Gets the culture that the current thread uses for string manipulation and string formatting.

(Inherited from ApplicationBase)
Deployment Deployment Deployment Deployment

取得目前應用程式的 ClickOnce 部署物件,其提供以程式設計方式更新目前部署的支援,以及視需要下載檔案的支援。Gets the current application's ClickOnce deployment object, which provides support for updating the current deployment programmatically and support for the on-demand download of files.

Info Info Info Info

取得物件,提供用於取得應用程式組件之相關資訊 (例如版本號碼、描述等) 的屬性。Gets an object that provides properties for getting information about the application's assembly, such as the version number, description, and so on.

(Inherited from ApplicationBase)
InternalCommandLine InternalCommandLine InternalCommandLine InternalCommandLine

將值設為目前應用程式的命令列引數。Sets the values to use as the current application's command-line arguments.

IsNetworkDeployed IsNetworkDeployed IsNetworkDeployed IsNetworkDeployed

取得 Boolean,表示是否使用 ClickOnce 從網路部署應用程式。Gets a Boolean that represents whether the application was deployed from a network using ClickOnce.

Log Log Log Log

取得物件,提供用於將事件和例外狀況 (Exception) 資訊寫入應用程式記錄檔接聽程式的屬性和方法。Gets an object that provides properties and methods for writing event and exception information to the application's log listeners.

(Inherited from ApplicationBase)
UICulture UICulture UICulture UICulture

取得目前執行緒用來擷取特定文化特性資源的文化特性。Gets the culture that the current thread uses for retrieving culture-specific resources.

(Inherited from ApplicationBase)

方法

ChangeCulture(String) ChangeCulture(String) ChangeCulture(String) ChangeCulture(String)

變更目前執行緒用於字串操作和字串格式化的文化特性。Changes the culture used by the current thread for string manipulation and for string formatting.

(Inherited from ApplicationBase)
ChangeUICulture(String) ChangeUICulture(String) ChangeUICulture(String) ChangeUICulture(String)

變更目前執行緒用來擷取特定文化特性資源的文化特性。Changes the culture that the current thread uses for retrieving culture-specific resources.

(Inherited from ApplicationBase)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnvironmentVariable(String) GetEnvironmentVariable(String) GetEnvironmentVariable(String) GetEnvironmentVariable(String)

傳回指定環境變數的值。Returns the value of the specified environment variable.

(Inherited from ApplicationBase)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱