Page 21 : 29
Object-oriented Programming in C#
Reference types, Value types, and Patterns
* Reference Types
Reference Types
Illustration of variables of reference types
Overview of reference types in C#
Comparing and copying objects via references
Equality in C#
* Value Types
Value types
Illustration of variables of value types
Structs in C#
Structs and Initialization
Structs versus classes
Examples of mutable structs in C#
Examples of immutable structs in C#
Boxing and Unboxing
Nullable types
* Organization of C# Programs
Program Organization
Examples of Program Organization
Namespaces and Visibility
Namespaces and Assemblies
* Patterns and Techniques
Design Patterns
Object-oriented Design Patterns
The Singleton pattern
A Singleton Random Class
Factory methods
Examples of Static Factory Methods
Privacy Leaks
Namespaces and Assemblies
Namespaces
The top-level construct in a compilation unit
May contain types (such as classes) and nested namespaces
Identically named members of different namespaces can co-exist
There is no coupling between classes/namespaces and source files/directories
Assemblies
A packaging construct produced by the compiler
Not a syntactic construct in C#
A collection of compiled types - together with resources on which the types depend
Versioning and security settings apply to assemblies
The
file/directory
organization, the
namespace/class
organization and the
assembly
organization are relatively independent of each other