---
title: "Example of namespace"  
description: "Namespace is a container that takes class, interface, enum, structure and delegates. The class name declared in one namespace does not conflict with t"  
author: "Allen Scott"  
published: 2016-07-21  
updated: 2018-03-16  
canonical: https://www.mindstick.com/blog/11189/example-of-namespace  
category: "c#"  
tags: ["c#"]  
reading_time: 3 minutes  

---

# Example of namespace

Namespace is a container that takes class, interface, enum, structure and delegates. The [class name](https://www.mindstick.com/forum/12871/how-to-get-class-name) declared in [one namespace](https://www.mindstick.com/forum/206/can-db2-be-used-in-asp-dot-net-and-which-one-namespace-used-for-db2) does not conflict with the same class names declared in another.

## Example of namespace

Create a class1.cs file and given to namespace name as mindstck

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace mindstick{    public class Class1    {        // fields        protected int _id;        protected string _name;        protected string _phone;        protected double _money;         // properties         public int id        {            get            {                return _id;            }            set            {                _id = value;            }        }        public string name        {            get            {                return _name;            }            set            {                _name = value;            }        }        public string phone        {            get            {                return _phone;            }            set            {                _phone = value;            }        }        public double money        {                                                       get            {                return _money;            }            set            {                _money = value;            }        }     }}
```

**Create a another file class2.cs and import namespace mindstick**

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using mindstick;  namespace OoopsConcepts{   public  class Class2    {        static void Main(string[] args)        {            Class1 c = new Class1();             c.id = 1001;                      c.name = "Ashish";            c.phone = "987456244";            c.money = 4500;            Console.WriteLine("Details of Employee:- " + c.id + " \n" + c.name + " \n" + c.phone + " \n" + c.money + "");                      Console.ReadLine();                   }    }}
```

Output: Details of Employee:-1001

Ashish

987456244

4500

**[Connection](https://www.mindstick.com/articles/13012/what-makes-ethernet-connection-better-than-wifi) Oriented:**

\

In this case we required a connection with the [data source](https://www.mindstick.com/interview/808/what-is-a-data-source) for accessing

\

the data

**Dataset:**

\

It is class present under **“System.Data”** namespace. It is capable for holding

\

more than tables. It works on [disconnected](https://www.mindstick.com/blog/300962/how-modern-life-disconnected-from-nature) [architecture](https://www.mindstick.com/articles/249193/top-5-reasons-to-pursue-architecture) that does not

\

required permanent connection. Dataset provide us index based access

\

data means we can get data from any location.

**Data Adapter:**

\

Data Adapter is used to [transfer data](https://www.mindstick.com/forum/34257/how-can-transfer-data-from-one-activity-to-another-activity-in-android) between dataset into database. It has

\

command like select, insert, [update and delete](https://www.mindstick.com/forum/353/insert-update-and-delete-records-in-php). By default data adapter is

\

not support insert, update, delete.

\

Data adapter is [acts as](https://answers.mindstick.com/qa/51373/what-were-president-johnson-s-first-official-acts-as-president) a mediator between database and dataset object.

\

It will acts as a Bridge between dataset and database

**Data Reader:**

\

Data Reader is used to read the [data from database](https://www.mindstick.com/forum/34370/how-to-populate-google-charts-using-data-from-database-created-via-data-first-asp-dot-net-mvc) and it is read and

\

forward only that connection oriented architecture during fetch the data

\

and It is used to result set that came from server and an it will read one by

\

one because of that memory consumption will be less and it will fetch that

\

data very fast when compared the dataset.

---

Original Source: https://www.mindstick.com/blog/11189/example-of-namespace

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
