Results 1 to 7 of 7

Thread: it is a namespace but is used like a type

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Unhappy it is a namespace but is used like a type

    I have two projects and refering one to another. To say project DEntity is refering in Project DService. and among the namespaces am using iam refering this particular project too.
    When i trying to call the DEntityproject's one of the file's class, its nt happening.


    Code:
    DEntity.Helper.Opensession() is a namespace but is used like a type
    the line of code is this

    Code:
    DEntity.Helper.Opensession();
    Thanks in advance

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: it is a namespace but is used like a type

    Hey,

    Is Opensession defined as a method on the Helper Class which lives within the DEntity namespace?

    If so, is this method a static method? Do you first have to create an instance of the Helper class before you can access the methods of the class?

    Gary

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: it is a namespace but is used like a type

    Opensession defind as a method which lives in helper class.
    it is a static method.

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: it is a namespace but is used like a type

    Is it possible for you to post the class that you are using?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: it is a namespace but is used like a type

    This is the class am creating
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data.SqlClient;
    using System.Configuration;
    using DzineRepository;
    using DRepository;
    using DEntity;

    namespace UserMaintenanceServices
    {
    public class UserMaintenanceServices
    {
    Helper.OpenSession();
    }
    }

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: it is a namespace but is used like a type

    It's not a namespace and it's not used like a type. DEntity is the namespace, Helper is the type, OpenSession is a method and it's used like a method. That's just like using System.Windows.Forms.MessageBox.Show(). System.Windows.Forms is the namespace, MessageBox is the type and Show is the method.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Re: it is a namespace but is used like a type

    so, can we call this method by a single line if the method is defined as public?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width