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
- 属性
示例
下面的示例演示如何声明和使用 a 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 中,可以使用固定长度声明 a String 。 在 Visual Basic 中,不再支持固定长度字符串,每次更改长度String时都会分配一个新String字符串。
该 FixedLengthString 类可用于模拟 Visual Basic 6.0 字符串的行为,这使你可以声明长度固定的字符串。 不能将 A 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, String) |
已过时.
初始化类的新实例 FixedLengthString ,指定长度和初始值。 |
| FixedLengthString(Int32) |
已过时.
初始化类的新实例 FixedLengthString ,指定长度。 |
字段
| 名称 | 说明 |
|---|---|
| m_nMaxChars |
已过时.
存储的 FixedLengthString长度 。 |
| m_strValue |
已过时.
存储值 FixedLengthString。 |
属性
| 名称 | 说明 |
|---|---|
| Value |
已过时.
获取或设置一个 FixedLengthString. 的内容。 |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
已过时.
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
已过时.
用作默认哈希函数。 (继承自 Object) |
| GetType() |
已过时.
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
已过时.
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
已过时.
将 FixedLengthString 转换为 String。 |