using custom namespace.

C

cykill

Hi. I'm new to asp.net and I've been searching on the net and in book on
how to use custom namespace. I've created my own custom namespace and I
just need a straight answer on where to put the namespace file so I can
import them in the webpage. Can someone clarify? Thanks.
 
M

Masudur

Hi,

If (you create a custom namespace in a different project)
{
... add the project reference...
And just import the namespace top of the class....
}
else if (you created custom namespace in same project)
{
start using it,... with full qualified
name or import.... in top of the class...
}


Thanks
Masudur
 
C

cykill

But where do I put the namespace files? I'm using notepad as my editor.
I'm creating each individual asp page and put them all in a folder. do i
put it in the wwwroot folder? Thanks.
 
G

Guest

cykill,
There is no such animal. namespace is a way of categorizing classes and
other objects (Enums, structs, etc) so that you can disambiguate between
classes of the same name. For example:

namespace MyCustomNamespace.Data
{

public class SqlClient
{
.....
}

}

There is a SqlClient class in the .NET Framework already. By specifying your
custom namespace, you can still have such a class of your own invention, and
disambiguate with "MyCustomNamespace.SqlClient"

Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
 
C

cykill

ok. if you were to create your example of classes, where do you put it so
other asp.net code can use it?
 
C

cykill

I guess I just want to know where to put all my class files so that I can
use them with other code. I take it that I can't put them in any
directory like c:\temp? Sorry if this has been confusing. I don't quite
know how to explain it. I'm new to .net stuff. I usually do java stuff.
Java has a directory called "classes" to put all your custom classes. And
if I want to create directories under the directory "classes", like
"classes/mycustomproject/dbqueries", I can just put them in there an
import them in my code like mycustomproject.dbqueries.*. Sense? What's
the asp.net equivalent?
 
M

Mark Rae

I guess I just want to know where to put all my class files so that I can
use them with other code.

Ah - OK.
I take it that I can't put them in any directory like c:\temp?

No - they need to be within your project's folder structure.
Java has a directory called "classes" to put all your custom classes. And
if I want to create directories under the directory "classes", like
"classes/mycustomproject/dbqueries", I can just put them in there an
import them in my code like mycustomproject.dbqueries.*. Sense? What's
the asp.net equivalent?

You can create a folder called 'classes' if you like, but it has to be
within your project's folder structure.

You say you're using Notepad to do this - is there any *specific* reason for
this?

If not, I strongly suggest you do yourself a *huge* favour and download
this: http://msdn.microsoft.com/vstudio/express/vwd/ - it's completely free,
and will make your life so much easier...

If you need database support, download this:
http://msdn.microsoft.com/vstudio/express/sql/default.aspx - again, it's
completely free.
 
C

cykill

No specific reason of using notepad. I'll look into visual studio
express. Didn't know there was a free version of VS out there. Can I put
the class files in c:\inetpub\wwwroot as those files will be used in my
web application? Thanks.
 
M

Mark Rae

No specific reason of using notepad. I'll look into visual studio
express. Didn't know there was a free version of VS out there.
OK.

Can I put the class files in c:\inetpub\wwwroot as those files will be
used
in my web application?

No - see my previous answers...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top