FixedLengthString 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862
模擬 Visual Basic 6.0 固定長度字串的行為。
public ref class FixedLengthString
public class FixedLengthString
[System.Obsolete("Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862")]
public class FixedLengthString
type FixedLengthString = class
[<System.Obsolete("Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862")>]
type FixedLengthString = class
Public Class FixedLengthString
- 繼承
-
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
備註
在 Visual Basic 6.0 中, String a 可以宣告固定長度。 在 Visual Basic 中,固定長度字串不再支援,且每次String長度變更時都會重新分配一個新String字串。
這個 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 實作有顯著差異時,才需要使用。
建構函式
| 名稱 | Description |
|---|---|
| FixedLengthString(Int32, String) |
已淘汰.
初始化該類別的新實例 FixedLengthString ,指定長度與初始值。 |
| FixedLengthString(Int32) |
已淘汰.
初始化類別的新實例 FixedLengthString ,指定長度。 |
欄位
| 名稱 | Description |
|---|---|
| m_nMaxChars |
已淘汰.
儲存長度為 FixedLengthString。 |
| m_strValue |
已淘汰.
儲存 的值 FixedLengthString。 |
屬性
| 名稱 | Description |
|---|---|
| Value |
已淘汰.
取得或設定 的 FixedLengthString內容。 |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
已淘汰.
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
已淘汰.
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
已淘汰.
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
已淘汰.
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
已淘汰.
將 FixedLengthString 轉換成 String。 |