Nested Type

Định nghĩa Nested Type là gì?

Nested TypeLồng Loại. Đây là nghĩa tiếng Việt của thuật ngữ Nested Type - một thuật ngữ thuộc nhóm Technology Terms - Công nghệ thông tin.

Độ phổ biến(Factor rating): 5/10

Loại lồng nhau, trong C #, là một loại tuyên bố trong một lớp học hiện có hoặc struct. Không giống như một loại phi lồng nhau, được công bố trực tiếp trong một đơn vị biên soạn hoặc một không gian tên, loại lồng nhau được xác định trong phạm vi của chứa (hoặc bên ngoài) type.Nested loại được sử dụng duy nhất mà phạm vi, tầm nhìn và tuổi thọ của nó kết thúc trong chứa loại mà không lộ bản thân với các loại khác. Các thành viên điều tra viên trong vòng một loại bộ sưu tập thường được thực hiện như kiểu lồng nhau để lặp qua các bộ sưu tập. Là một iterator, các điều tra viên cho phép sử dụng cùng một logic phía máy khách để lặp bộ sưu tập, bất kể cấu trúc cơ bản thu thập dữ liệu của. Nói chung, loại lồng chỉ được sử dụng trong tình huống mà nó logic thuộc về loại chứa. Nó được thực hiện khi các loại chứa là hoàn toàn phụ thuộc vào loại lồng nhau giúp để đóng gói các chi tiết thực hiện của các loại chứa. Nó thường được dùng trong các tình huống nơi mà các loại có chứa có các loại lồng nhau để thực hiện của nó được sử dụng trực tiếp mà không cần bất kỳ yêu cầu cho instantiating loại lồng nhau của nó.

Xem thêm: Thuật ngữ công nghệ A-Z

Giải thích ý nghĩa

Một loại lồng nhau có thể được truy cập từ bất cứ nơi nào trong chương trình bằng cách tuyên bố nó với một mức độ nào khả năng tiếp cận và sử dụng tên đầy đủ của nó. Ví dụ, AddressInformation có thể là một loại lồng nhau tuyên bố trong vòng loại nhân viên, và có thể được truy cập bằng tên đầy đủ của nó, Employee.AddressInformation.Nested loại có các tính chất chính sau đây:

What is the Nested Type? - Definition

Nested type, in C#, is a type declared within an existing class or struct. Unlike a non-nested type, which is declared directly within a compilation unit or a namespace, nested type is defined within the scope of the containing (or outer) type.Nested type is used only where its scope, visibility and lifetime ends within the containing type without exposing itself to other types. The enumerator member within a collection type is usually implemented as nested type to iterate over the collection. As an iterator, the enumerator enables the use of same client-side logic to iterate the collection, regardless of the data collection's underlying structure. In general, nested type is used only in situations where it logically belongs to the containing type. It is implemented when the containing type is entirely dependent on the nested type that helps to encapsulate the implementation details of the containing type. It is often used in scenarios where the containing type that has the nested type for its implementation is directly used without any requirement for instantiating its nested type.

Understanding the Nested Type

A nested type can be accessed from anywhere within the program by declaring it with a public level of accessibility and using its fully qualified name. For example, AddressInformation can be a nested type declared within Employee type, and can be accessed using its fully qualified name, Employee.AddressInformation.Nested type has the following key properties:

Thuật ngữ liên quan

  • Class
  • Collection
  • Iterator
  • Namespace
  • Accessibility (a11y)
  • Private
  • Public
  • Commit
  • Access Modifiers
  • Acyclic

Source: ? Technology Dictionary - Filegi - Techtopedia - Techterm

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *