Download presentation
Presentation is loading. Please wait.
1
Programming in C# CHAPTER - 9
2
What is a Namespace? Namespaces are used to organize the source code into more logical and manageable way Namespaces can contain Definitions of classes, structures, interfaces and other types and other namespaces Namespaces can contain other namespaces For example: System namespace contains Data namespace The name of the nested namespace is System.Data
3
Full Class Names A full name of a class is the name of the class preceded by the name of its namespace Example: Array class, defined in the System namespace The full name of the class is System.Array <namespace_name>.<class_name>
4
Including Namespaces The using directive in C#:
Allows using types in a namespace, without specifying their full name Example: instead of using <namespace_name> using System; DateTime date; System.DateTime date;
5
Namespace Members Namespace are at the top of the C# language element hierarchy. Namespace may contain other namespaces, nothing else can encapsulate a namespace. Members of namespace Classes, Delegates, enums, interfaces, structs, namespaces, using directives, and alias directives
6
Scope and Visibility Scope of the variable and the data is where you define them If you define in a method block { } then the scope of that variable is within that block If you define in a class then its scope is throughout the class i.e., till the class terminates.
7
Scope and Visibility Visibility of the variable and the data is where you define them If you define the variable within a method block { } then that variable will be visible throughout the block and its subordinate blocks If you define the variable globally then that variable will be visible throughout the class and in its members method and their subordinate methods.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.