using custom namespace.

Discussion in 'ASP .Net' started by cykill, Dec 25, 2006.

  1. cykill

    cykill Guest

    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.
     
    cykill, Dec 25, 2006
    #1
    1. Advertising

  2. cykill

    Masudur Guest

    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

    cykill wrote:
    > 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.
     
    Masudur, Dec 25, 2006
    #2
    1. Advertising

  3. cykill

    cykill Guest

    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.




    Sun, 24 Dec 2006 21:58:32 -0800, Masudur wrote:

    > 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
    >
    > cykill wrote:
    >> 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.
     
    cykill, Dec 25, 2006
    #3
  4. cykill

    Mark Rae Guest

    "cykill" <> wrote in message
    news:p...

    > But where do I put the namespace files?


    What do you mean by "the namespace files"? What "files" are you talking
    about here...?
     
    Mark Rae, Dec 25, 2006
    #4
  5. 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




    "cykill" wrote:

    > 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.
    >
    >
    >
    >
    > Sun, 24 Dec 2006 21:58:32 -0800, Masudur wrote:
    >
    > > 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
    > >
    > > cykill wrote:
    > >> 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.

    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Dec 25, 2006
    #5
  6. cykill

    cykill Guest

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




    On Mon, 25 Dec 2006 05:09:00 -0800, Peter Bromberg[ C# MVP] wrote:

    > 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
     
    cykill, Dec 25, 2006
    #6
  7. cykill

    cykill Guest

    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?











    On Mon, 25 Dec 2006 09:12:36 +0000, Mark Rae wrote:

    > "cykill" <> wrote in message
    > news:p...
    >
    >> But where do I put the namespace files?

    >
    > What do you mean by "the namespace files"? What "files" are you talking
    > about here...?
     
    cykill, Dec 25, 2006
    #7
  8. cykill

    Mark Rae Guest

    "cykill" <> wrote in message
    news:p...

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


    Anywhere in your project.
     
    Mark Rae, Dec 25, 2006
    #8
  9. cykill

    Mark Rae Guest

    "cykill" <> wrote in message
    news:p...

    >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.
     
    Mark Rae, Dec 25, 2006
    #9
  10. cykill

    cykill Guest

    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.





    On Mon, 25 Dec 2006 16:53:21 +0000, Mark Rae wrote:

    > "cykill" <> wrote in message
    > news:p...
    >
    >>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.
     
    cykill, Dec 26, 2006
    #10
  11. cykill

    Mark Rae Guest

    "cykill" <> wrote in message
    news:p...

    > 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...
     
    Mark Rae, Dec 26, 2006
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Èý¹â
    Replies:
    1
    Views:
    599
    William F. Robertson, Jr.
    Jul 29, 2003
  2. Jason Heyes
    Replies:
    1
    Views:
    471
    Woebegone
    Nov 19, 2004
  3. Petter Reinholdtsen
    Replies:
    9
    Views:
    4,435
    Howard
    Nov 29, 2004
  4. Andrew Ward
    Replies:
    5
    Views:
    302
    Andrew Ward
    Jul 25, 2005
  5. user
    Replies:
    1
    Views:
    447
    Kevin Spencer
    Jul 19, 2007
Loading...

Share This Page