TAILIEUCHUNG - Tìm hiểu về các loại tham khảo và các loại giá trị

Sâu trong quá trình mã hóa, bạn thường đắm mình trong logic, giải quyết vấn đề ở bàn tay. Hành động đơn giản, chẳng hạn như chuyển nhượng và instantiation, là những công việc bạn thực hiện thường xuyên, mà không cần suy nghĩ nhiều. Tuy nhiên, khi viết chương trình C #, hoặc sử dụng bất kỳ ngôn ngữ mục tiêu của Common Language Runtime (CLR), bạn có thể muốn có một cái nhìn thứ hai. Điều gì xuất hiện để được đơn giản đôi khi có thể dẫn đến khó khăn để tìm thấy lỗi. Chương này đi vào. | This page intentionally left blank CHAPTER 4 Understanding Reference Types and Value Types Deep in the course of coding you re often immersed in logic solving the problem at hand. Simple actions such as assignment and instantiation are tasks you perform regularly without much thought. However when writing C programs or using any language that targets the Common Language Runtime CLR you might want to take a second look. What appears to be simple can sometimes result in hard-to-find bugs. This chapter goes into greater depth on CLR types and shows you a few things about coding in C that often catch developers off guard. More specifically you learn about the differences between reference types and value types. The .NET type system which C is built upon is divided into reference types and value types. You ll work with each of these types all the time and it s important to know the differences between them. This chapter shows you the differences via memory allocation and assignment behaviors. This understanding should translate into helping you make smart design decisions that improve application performance and reduce errors. IN THIS CHAPTER A Quick Introduction to Reference Types and Value Types The Unified Type System Reference Type and Value Type Memory Allocation Reference Type and Value Type Assignment More Differences Between Reference Types and Value Types C and .NET Framework Types Nullable Types A Quick Introduction to Reference Types and Value Types There is much to be said about reference types and value types but this section gives a quick introduction to the essentials. You learn a little about their behaviors and what they look like in code. 80 CHAPTER 4 Understanding Reference Types and Value Types As its name suggests a reference type has a value that is a reference to an object in memory. However a value type has a value that contains the object itself. Up until now you ve been creating custom reference types which is defined with the class keyword .

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.