Estruturas (Visual Basic)
A structure is a generalization of the user-defined type (UDT) supported by previous versions of Visual Basic. In addition to fields, structures can expose properties, methods, and events. A structure can implement one or more interfaces, and you can declare individual access levels for each field.
You can combine data items of different types to create a structure. A structure associates one or more elements with each other and with the structure itself. When you declare a structure, it becomes a composite data type, and you can declare variables of that type.
Structures are useful when you want a single variable to hold several related pieces of information. For example, you might want to keep an employee's name, telephone extension, and salary together. You could use several variables for this information, or you could define a structure and use it for a single employee variable. The advantage of the structure becomes apparent when you have many employees and therefore many instances of the variable.
Nesta seção
Como: Declarar uma estrutura (Visual Basic)
Shows how to declare a structure and its elements.Variáveis de estrutura (Visual Basic)
Covers assigning a structure to a variable and accessing its elements.Estruturas e outros elementos de programação (Visual Basic)
Summarizes how structures interact with arrays, objects, procedures, and each other.Estruturas e Classes (Visual Basic)
Describes the similarities and differences between structures and classes.
Seções relacionadas
Tipos de dados no Visual Basic
Introduces the Visual Basic data types and describes how to use them.Resumo de tipo de dados (Visual Basic)
Lists the elementary data types supplied by Visual Basic.