TAILIEUCHUNG - Apress - Accelerated C#_1

Accelerated C # 2010 là con đường nhanh nhất để làm chủ C #. Tất cả C # lập trình viên cần phải biết và hiểu như thế nào C # thực sự làm việc nhưng rất ít sách địa chỉ này. Không bao gồm nó ở độ sâu rằng điều này không. Nó dạy cho cả hai khái niệm ngôn ngữ cốt lõi C # và làm thế nào để sử dụng chúng trong mã hiệu suất cao. | CHAPTER 4 CLASSES STRUCTS AND OBJECTS You do not know the compiler-generated name of the type therefore you are forced to declare the variable instance as an implicitly typed local variable using the var keyword as I did in the code. Also notice that the compiler-generated type is a generic type that takes two type parameters. It would be inefficient for the compiler to generate a new type for every anonymous type that contains two types with the same field names. The output above indicates that the actual type of employeeinfo looks similar to the type name below fAnonymousType0 And because the anonymous type for customerinfo contains the same number of fields with the same names the generated generic type is reused and the type of customerinfo looks similar to the type below fAnonymousType0 Had the anonymous type for customerinfo contained different field names than those for employeeinfo then another generic anonymous type would have been declared. Now that you know the basics about anonymous types I want to show you an abbreviated syntax for declaring them. Pay attention to the bold statements in the following example using System public class ConventionalEmployeeinfo ._ public ConventionalEmployeeinfo string Name int Id Name Id public string Name get return name set name value public int Id get return id set id value private string name private int id public class EntryPoint 89 CHAPTER 4 CLASSES STRUCTS AND OBJECTS static void Main ConventionalEmployeeInfo oldEmployee new ConventionalEmployeeInfo Joe 42 var employeeinfo new string Name Jane int id 1234 var customerinfo new Name Id employeeInfo Name 0 Id 1 customerInfo Name 0 Id 1 Anonymous Type is actually 0 For illustration purposes I have declared a type named

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.