The answer of Heslacher answer of Heslacher covers the most important part. This answer is intended as a reply to the comments, regarding the use of a namespace
. Here's the definition of the namespace keyword (from MSDN):
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
A simple example:
System.Console.Write("Hello world!");
In above code:
System
is the namespaceConsole
is a classWrite
is a method
There are many classes in the System
namespace. Namespaces can also be nested, for example the System.Data
namespace, it contains several classes for the ADO.NET architecture in .NET.
Deeply nested namespaces will result in longer code. For example:
namespace Services
{
namespace Management
{
namespace Data
{
class MyClass
{
}
}
}
}
Everytime you want to instantiate a class in the Data
namespace you'd have to write:
Services.Management.Data.MyClass myClass = new Services.Management.Data.MyClass();
You have two options:
use the
using
statement:using Services.Management.Data; MyClass myClass = new MyClass();
use an alias:
using data = Services.Management.Data; data.MyClass = new data.MyClass();
More reading on namespaces:
Now you know what you can do with namespaces, you can apply it to your code:
namespace ObjectModel
{
public class Category { }
}
namespace BusinessEntities
{
public class Category { }
}
var omCat = new ObjectModel.Category();
var beCat = new BusinessEntities.Category();
As I said, your main question is resolved by the answer of Heslacher but I hope this answer is of any help.
The answer of Heslacher covers the most important part. This answer is intended as a reply to the comments, regarding the use of a namespace
. Here's the definition of the namespace keyword (from MSDN):
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
A simple example:
System.Console.Write("Hello world!");
In above code:
System
is the namespaceConsole
is a classWrite
is a method
There are many classes in the System
namespace. Namespaces can also be nested, for example the System.Data
namespace, it contains several classes for the ADO.NET architecture in .NET.
Deeply nested namespaces will result in longer code. For example:
namespace Services
{
namespace Management
{
namespace Data
{
class MyClass
{
}
}
}
}
Everytime you want to instantiate a class in the Data
namespace you'd have to write:
Services.Management.Data.MyClass myClass = new Services.Management.Data.MyClass();
You have two options:
use the
using
statement:using Services.Management.Data; MyClass myClass = new MyClass();
use an alias:
using data = Services.Management.Data; data.MyClass = new data.MyClass();
More reading on namespaces:
Now you know what you can do with namespaces, you can apply it to your code:
namespace ObjectModel
{
public class Category { }
}
namespace BusinessEntities
{
public class Category { }
}
var omCat = new ObjectModel.Category();
var beCat = new BusinessEntities.Category();
As I said, your main question is resolved by the answer of Heslacher but I hope this answer is of any help.
The answer of Heslacher covers the most important part. This answer is intended as a reply to the comments, regarding the use of a namespace
. Here's the definition of the namespace keyword (from MSDN):
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
A simple example:
System.Console.Write("Hello world!");
In above code:
System
is the namespaceConsole
is a classWrite
is a method
There are many classes in the System
namespace. Namespaces can also be nested, for example the System.Data
namespace, it contains several classes for the ADO.NET architecture in .NET.
Deeply nested namespaces will result in longer code. For example:
namespace Services
{
namespace Management
{
namespace Data
{
class MyClass
{
}
}
}
}
Everytime you want to instantiate a class in the Data
namespace you'd have to write:
Services.Management.Data.MyClass myClass = new Services.Management.Data.MyClass();
You have two options:
use the
using
statement:using Services.Management.Data; MyClass myClass = new MyClass();
use an alias:
using data = Services.Management.Data; data.MyClass = new data.MyClass();
More reading on namespaces:
Now you know what you can do with namespaces, you can apply it to your code:
namespace ObjectModel
{
public class Category { }
}
namespace BusinessEntities
{
public class Category { }
}
var omCat = new ObjectModel.Category();
var beCat = new BusinessEntities.Category();
As I said, your main question is resolved by the answer of Heslacher but I hope this answer is of any help.
The answer of Heslacher covers the most important part. This answer is intended as a reply to the comments, regarding the use of a namespace
. Here's the definition of the namespace keyword (from MSDN):
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
A simple example:
System.Console.Write("Hello world!");
In above code:
System
is the namespaceConsole
is a classWrite
is a method
There are many classes in the System
namespace. Namespaces can also be nested, for example the System.Data
namespace, it contains several classes for the ADO.NET architecture in .NET.
Deeply nested namespaces will result in longer code. For example:
namespace Services
{
namespace Management
{
namespace Data
{
class MyClass
{
}
}
}
}
Everytime you want to instantiate a class in the Data
namespace you'd have to write:
Services.Management.Data.MyClass myClass = new Services.Management.Data.MyClass();
You have two options:
use the
using
statement:using Services.Management.Data; MyClass myClass = new MyClass();
use an alias:
using data = Services.Management.Data; data.MyClass = new data.MyClass();
More reading on namespaces:
Now you know what you can do with namespaces, you can apply it to your code:
namespace ObjectModel
{
public class Category { }
}
namespace BusinessEntities
{
public class Category { }
}
var omCat = new ObjectModel.Category();
var beCat = new BusinessEntities.Category();
As I said, your main question is resolved by the answer of Heslacher but I hope this answer is of any help.
The answer of Heslacher covers the most important part. This answer is intended as a reply to the comments, regarding the use of a namespace
. Here's the definition of the namespace keyword (from MSDN):
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
A simple example:
System.Console.Write("Hello world!");
In above code:
System
is the namespaceConsole
is a classWrite
is a method
There are many classes in the System
namespace. Namespaces can also be nested, for example the System.Data
namespace, it contains several classes for the ADO.NET architecture in .NET.
Deeply nested namespaces will result in longer code. For example:
namespace Services
{
namespace Management
{
namespace Data
{
class MyClass
{
}
}
}
}
Everytime you want to instantiate a class in the Data
namespace you'd have to write:
Services.Management.Data.MyClass myClass = new Services.Management.Data.MyClass();
You have two options:
use the
using
statement:using Services.Management.Data; MyClass myClass = new MyClass();
use an alias:
using data = Services.Management.Data; data.MyClass = new data.MyClass();
Now you know what you can do with namespaces, you can apply it to your code:
namespace ObjectModel
{
public class Category { }
}
namespace BusinessEntities
{
public class Category { }
}
var omCat = new ObjectModel.Category();
var beCat = new BusinessEntities.Category();
As I said, your main question is resolved by the answer of Heslacher but I hope this answer is of any help.
The answer of Heslacher covers the most important part. This answer is intended as a reply to the comments, regarding the use of a namespace
. Here's the definition of the namespace keyword (from MSDN):
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
A simple example:
System.Console.Write("Hello world!");
In above code:
System
is the namespaceConsole
is a classWrite
is a method
There are many classes in the System
namespace. Namespaces can also be nested, for example the System.Data
namespace, it contains several classes for the ADO.NET architecture in .NET.
Deeply nested namespaces will result in longer code. For example:
namespace Services
{
namespace Management
{
namespace Data
{
class MyClass
{
}
}
}
}
Everytime you want to instantiate a class in the Data
namespace you'd have to write:
Services.Management.Data.MyClass myClass = new Services.Management.Data.MyClass();
You have two options:
use the
using
statement:using Services.Management.Data; MyClass myClass = new MyClass();
use an alias:
using data = Services.Management.Data; data.MyClass = new data.MyClass();
More reading on namespaces:
Now you know what you can do with namespaces, you can apply it to your code:
namespace ObjectModel
{
public class Category { }
}
namespace BusinessEntities
{
public class Category { }
}
var omCat = new ObjectModel.Category();
var beCat = new BusinessEntities.Category();
As I said, your main question is resolved by the answer of Heslacher but I hope this answer is of any help.
The answer of Heslacher covers the most important part. This answer is intended as a reply to the comments, regarding the use of a namespace
. Here's the definition of the namespace keyword (from MSDN):
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
A simple example:
System.Console.Write("Hello world!");
In above code:
System
is the namespaceConsole
is a classWrite
is a method
There are many classes in the System
namespace. Namespaces can also be nested, for example the System.Data
namespace, it contains several classes for the ADO.NET architecture in .NET.
Deeply nested namespaces will result in longer code. For example:
namespace Services
{
namespace Management
{
namespace Data
{
class MyClass
{
}
}
}
}
Everytime you want to instantiate a class in the Data
namespace you'd have to write:
Services.Management.Data.MyClass myClass = new Services.Management.Data.MyClass();
You have two options:
use the
using
statement:using Services.Management.Data; MyClass myClass = new MyClass();
use an alias:
using data = Services.Management.Data; data.MyClass = new data.MyClass();
Now you know what you can do with namespaces, you can apply it to your code:
namespace ObjectModel
{
public class Category { }
}
namespace BusinessEntities
{
public class Category { }
}
var omCat = new ObjectModel.Category();
var beCat = new BusinessEntities.Category();
As I said, your main question is resolved by the answer of Heslacher but I hope this answer is of any help.