Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Diference between Using Namespace and Namespace.Class.Method in the code....

Diference between Using Namespace and Namespace.Class.Method in the code....

Scheduled Pinned Locked Moved C#
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BhuvaneswarKumar
    wrote on last edited by
    #1

    I had a dll referenced in my project having namespace Utilities. I can access the methods in the namespace by writing Using Utilities at the top of my project and directly I can use Utilities.Class.Method..... Plz let me know what the exact difference between these two ways. Thanks, Bhuvan....

    P 1 Reply Last reply
    0
    • B BhuvaneswarKumar

      I had a dll referenced in my project having namespace Utilities. I can access the methods in the namespace by writing Using Utilities at the top of my project and directly I can use Utilities.Class.Method..... Plz let me know what the exact difference between these two ways. Thanks, Bhuvan....

      P Offline
      P Offline
      Pedram Behroozi
      wrote on last edited by
      #2

      No difference at all. Except without using Using you have to write Namespace.Class.Method everywhere you want to use that method. Hope can help :) [Edit] Also it's worthy to search Using in MSDN.

      I died as a mineral and became a plant, I died as plant and rose to animal, I died as animal and I was Man. Why should I fear? When was I less by dying? -- Rumi[^] My blog

      modified on Thursday, December 4, 2008 2:43 AM

      B L 2 Replies Last reply
      0
      • P Pedram Behroozi

        No difference at all. Except without using Using you have to write Namespace.Class.Method everywhere you want to use that method. Hope can help :) [Edit] Also it's worthy to search Using in MSDN.

        I died as a mineral and became a plant, I died as plant and rose to animal, I died as animal and I was Man. Why should I fear? When was I less by dying? -- Rumi[^] My blog

        modified on Thursday, December 4, 2008 2:43 AM

        B Offline
        B Offline
        BhuvaneswarKumar
        wrote on last edited by
        #3

        Yep....Thanks.... :)

        1 Reply Last reply
        0
        • P Pedram Behroozi

          No difference at all. Except without using Using you have to write Namespace.Class.Method everywhere you want to use that method. Hope can help :) [Edit] Also it's worthy to search Using in MSDN.

          I died as a mineral and became a plant, I died as plant and rose to animal, I died as animal and I was Man. Why should I fear? When was I less by dying? -- Rumi[^] My blog

          modified on Thursday, December 4, 2008 2:43 AM

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Pedram Behroozi wrote:

          No difference at all.

          Not quite. By prefixing the class with the namespace you can avoid name clashes. If two (or more) usings have the same class, then you will get a compiler error if you don't specify the namespace. Likewise, if you forget to include your namespace via using and there's another namespace using your class name, then you might accidentally use this class. Sure, the signatures won't match, but it can give you some headache because you might not know what the compiler is complaining about. regards

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups