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. Global using?

Global using?

Scheduled Pinned Locked Moved C#
csharpc++comtoolsquestion
3 Posts 3 Posters 8 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.
  • J Offline
    J Offline
    jschell
    wrote on last edited by
    #1

    This comes from a comment in a prior post. Global Usings – A Look at New Language Features in C# 10 | The .NET Tools Blog[^] "With C# 10 you can use global using directives that the compiler will consider for the whole project" To me this is just going to lead to similar problems as in C++ where one puts all of their includes in one include file and then uses that single include file everywhere. It is indeed convenient. But that doesn't mean that it should be used. Nor should it even exist. When looking at a single source file one shouldn't need to be concerned about the impact that other files might have.

    Richard DeemingR J 2 Replies Last reply
    0
    • J jschell

      This comes from a comment in a prior post. Global Usings – A Look at New Language Features in C# 10 | The .NET Tools Blog[^] "With C# 10 you can use global using directives that the compiler will consider for the whole project" To me this is just going to lead to similar problems as in C++ where one puts all of their includes in one include file and then uses that single include file everywhere. It is indeed convenient. But that doesn't mean that it should be used. Nor should it even exist. When looking at a single source file one shouldn't need to be concerned about the impact that other files might have.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      jschell wrote:

      When looking at a single source file one shouldn't need to be concerned about the impact that other files might have.

      That's probably an unrealistic ideal. :) For example, the project file controls the C# language level, which can fundamentally change the meaning of the code in your C# files. The project file determines which assemblies/packages you're referencing, which can also change the meaning and/or behaviour of the code. Even going back to VB6, IIRC there was a project level "option base" setting which would change the default lower bound for array declarations which didn't explicitly specify one.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • J jschell

        This comes from a comment in a prior post. Global Usings – A Look at New Language Features in C# 10 | The .NET Tools Blog[^] "With C# 10 you can use global using directives that the compiler will consider for the whole project" To me this is just going to lead to similar problems as in C++ where one puts all of their includes in one include file and then uses that single include file everywhere. It is indeed convenient. But that doesn't mean that it should be used. Nor should it even exist. When looking at a single source file one shouldn't need to be concerned about the impact that other files might have.

        J Offline
        J Offline
        jochance
        wrote on last edited by
        #3

        Yeah I'm not a fan. I'm not even all that wild about the namespace MyNameSpace; vs namespace MyNameSpace { } but mostly just because it breaks the code if someone happens to not be on more recent tooling.

        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