FixedLengthString.ToString 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將 FixedLengthString 轉換成 String。
public:
override System::String ^ ToString();
public override string ToString();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
傳回
String A 包含 的FixedLengthString值。
範例
以下範例示範如何宣告並使用 。FixedLengthString
Private Sub DemoFixedLengthString()
' Declare a string that has a length of 7 characters and assign the
' initial string. The additional 5 positions will be padded with
' spaces.
Dim fixedString As New FixedLengthString(7, "He")
' Display the string in a message box.
MsgBox(fixedString.ToString)
' Assign a new value to the string.
fixedString.Value = "Hello World"
' Display again. Note that only the first 7 characters are shown.
MsgBox(fixedString.ToString)
End Sub
備註
這個 FixedLengthString 類別可以用來模擬 Visual Basic 6.0 字串的行為,讓你能宣告一個固定長度的字串。 FixedLengthString A 無法轉換成 aString;你必須要麼參考該Value屬性,要麼呼叫該ToString方法來轉換該型別。
備註
命名空間中的 Microsoft.VisualBasic.Compatibility.VB6 函式與物件提供給從 Visual Basic 6.0 升級到 Visual Basic 2008 的工具使用。 在大多數情況下,這些函式和物件會重複你在 .NET Framework 其他命名空間中能找到的功能。 只有當 Visual Basic 6.0 的程式碼模型與 .NET Framework 實作有顯著差異時,才需要使用。