Same Class Name

Hi Experts,

I have the WebSite, which contains the following class in the App_Code folder.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Mail;

/// <summary>
/// Summary description for Web
/// </summary>
public class Attachment
    public Attachment()
		// TODO: Add constructor logic here

        // The implementation is omitted


Open in new window

I need to employ methods in the System.Web.Mail.Attachment class in order to send mail.
Now I recognize that my Attachment class name conflict with System.Web.Mail.Attachment class.
If I create a Attachment class (used for my Database Model / Entity), is there any conflict / issues?
If yes, what is the common prefix for the Entity?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add Namespace to resolve issues if any
kaufmed 👽Commented:
Read my comment in another question as to why we use namespaces.
Navneet.Net Full Stack DeveloperCommented:

Yes, Namespace is like a Unique Path  to Your Class.
Hence if you have two then there is Conflict, but natural.

So it has to be unique

C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

bbkevinAuthor Commented:
ASP.NET Web Site, not a Web Application
It is possible to add namespace?
Navneet.Net Full Stack DeveloperCommented:

1) Namespace is common to .Net, Irrespective of  Project Type.
2) As I Say Namespace is unique
Hence  System.Web.Mail.Attachment here Attachment Class comes from System.Web.Mail Namespace
For you Just have Unique Namespace
MyApplication.Attachment .Mail

3) Common prefix for Entity is Model


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bbkevinAuthor Commented:
Thanks for help!
I used namespace to make my class unique.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.