VBFixedStringAttribute Classe

Definição

Indica que uma cadeia de caracteres deve ser tratada como se fosse de comprimento fixo.Indicates that a string should be treated as if it were fixed length.

public ref class VBFixedStringAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple=false, Inherited=false)]
public sealed class VBFixedStringAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple=false, Inherited=false)>]
type VBFixedStringAttribute = class
    inherit Attribute
Public NotInheritable Class VBFixedStringAttribute
Inherits Attribute
Herança
VBFixedStringAttribute
Atributos

Exemplos

Structure Person
    Public ID As Integer
    Public MonthlySalary As Decimal
    Public LastReviewDate As Long
    <VBFixedString(15)> Public FirstName As String
    <VBFixedString(15)> Public LastName As String
    <VBFixedString(15)> Public Title As String
    <VBFixedString(150)> Public ReviewComments As String
End Structure

Observação

O VBFixedStringAttribute é informativo e não pode ser usado para converter uma cadeia de caracteres de comprimento variável em uma cadeia de caracteres fixa.The VBFixedStringAttribute is informational and cannot be used to convert a variable length string to a fixed string. A finalidade desse atributo é modificar como as cadeias de caracteres em estruturas e variáveis não locais são usadas por métodos ou chamadas de API que reconhecem o VBFixedStringAttribute .The purpose of this attribute is to modify how strings in structures and non-local variables are used by methods or API calls that recognize the VBFixedStringAttribute. Tenha em mente que esse atributo não altera o comprimento real da própria cadeia de caracteres.Keep in mind that this attribute does not change the actual length of the string itself.

Comentários

As cadeias de caracteres Visual Basic são de comprimento variável por padrão.Visual Basic strings are of variable length by default. Esse atributo é útil ao usar Visual Basic funções de entrada e saída de arquivo, como FileGet e FilePut que exigem cadeias de caracteres de comprimento fixo.This attribute is useful when using Visual Basic file input and output functions such as FileGet and FilePut that require fixed length strings.

Construtores

VBFixedStringAttribute(Int32)

Inicializa o valor do campo SizeConst.Initializes the value of the SizeConst field.

Propriedades

Length

Obtém o comprimento da cadeia de caracteres.Gets the length of the string.

TypeId

Quando implementado em uma classe derivada, obtém um identificador exclusivo para este Attribute.When implemented in a derived class, gets a unique identifier for this Attribute.

(Herdado de Attribute)

Métodos

Equals(Object)

Retorna um valor que indica se essa instância é igual a um objeto especificado.Returns a value that indicates whether this instance is equal to a specified object.

(Herdado de Attribute)
GetHashCode()

Retorna o código hash para a instância.Returns the hash code for this instance.

(Herdado de Attribute)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
IsDefaultAttribute()

Quando substituído em uma classe derivada, indica se o valor dessa instância é o valor padrão para a classe derivada.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Herdado de Attribute)
Match(Object)

Quando substituído em uma classe derivada, retorna um valor que indica se essa instância é igual a um objeto especificado.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Herdado de Attribute)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Implantações explícitas de interface

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de expedição.Maps a set of names to a corresponding set of dispatch identifiers.

(Herdado de Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera as informações de tipo para um objeto, que pode ser usado para obter as informações de tipo para uma interface.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Herdado de Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Retorna o número de interfaces de informações do tipo que um objeto fornece (0 ou 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Herdado de Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornece acesso a propriedades e métodos expostos por um objeto.Provides access to properties and methods exposed by an object.

(Herdado de Attribute)

Aplica-se a

Confira também