FixedLengthString 类

定义

注意

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 可以使用固定长度声明 。 在 Visual Basic 中,不再支持固定长度的字符串,每次更改 长度String时都会分配一个新String字符串。

FixedLengthString 可用于模拟 Visual Basic 6.0 字符串的行为,这使你能够声明具有固定长度的字符串。 FixedLengthString不能转换为 ;String必须引用 Value 属性或调用 ToString 方法来转换类型。

注意

Microsoft.VisualBasic.Compatibility.VB6 命名空间中的函数和对象用于工具从 Visual Basic 6.0 升级到 Visual Basic 2008。 多数情况下,这些函数和对象可再现 .NET Framework 中其他命名空间的功能。 只有当 Visual Basic 6.0 代码模型与 .NET Framework 实现有显著区别时,才必须使用这些函数和对象。

构造函数

FixedLengthString(Int32)
已过时.

通过指定长度来初始化 FixedLengthString 类的新实例。

FixedLengthString(Int32, String)
已过时.

通过指定长度和初始值来初始化 FixedLengthString 类的新实例。

字段

m_nMaxChars
已过时.

存储 FixedLengthString 的长度。

m_strValue
已过时.

存储 FixedLengthString 的值。

属性

Value
已过时.

获取或设置 FixedLengthString 的内容。

方法

Equals(Object)
已过时.

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()
已过时.

作为默认哈希函数。

(继承自 Object)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()
已过时.

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()
已过时.

FixedLengthString 转换为 String

适用于