namespace in c#

21
pplication: Introducing Namespaces 1. Start Microsoft Visual Studio 2. To create a new project, on the main menu, click File -> New Project 3. In the left l ist, click Windows 4. In the right list, click Empty Project 5. Change the name to DepartmentStore4  6. Click OK 7. To create a new file, on the main menu, click Project -> Add New Item... 8. In the left list, click Code 9. In the right list, click Code File 10. Change the Name to DepartmentStore and press Add 11. In the empty document, type the following: 12. public class DepartmentStore 13. { 14. static int Main() 15. { 16. return 0; 17. } } Manually Creating a Namespace To create a namespace: y Type code that starts with the namespace keyword followed by the name of the section y R ight-click the section where you want to create the namespace and double-click Insert Snippet... Double-click Visual C#. In the list, double-click namespace Like a class, the section that is part of a namespace starts with an opening curly bracket "{" and ends with a closing curly bracket "}". Here is an example: namespace Business { } Between the curly brackets, you can type anything that is part of the namespace. For example, you can create a class inside of a namespace. Here is an example: namespace Business { class House { } }  Application: Creating a Namespace y To create a namespace, change the document as follows: y public class DepartmentStore y { y static int Main() y {

Upload: pankaj-bhargav

Post on 09-Apr-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 1/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 2/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 3/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 4/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 5/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 6/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 7/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 8/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 9/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 10/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 11/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 12/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 13/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 14/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 15/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 16/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 17/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 18/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 19/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 20/21

8/8/2019 Namespace in C#

http://slidepdf.com/reader/full/namespace-in-c 21/21