{"id":70979,"date":"2022-06-04T08:13:38","date_gmt":"2022-06-04T06:13:38","guid":{"rendered":"https:\/\/drafts.code-maze.com\/?p=70979"},"modified":"2022-06-09T08:29:46","modified_gmt":"2022-06-09T06:29:46","slug":"csharp-global-using-directives","status":"publish","type":"post","link":"https:\/\/code-maze.com\/csharp-global-using-directives\/","title":{"rendered":"Global Using Directives in C#"},"content":{"rendered":"<p>In this article, we are going to learn about Global Using Directives in C#.<\/p>\n<p>When we create a console application using .NET 6, the <code>Program.cs<\/code> class contains a single line of code (not counting the comment):<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">\/\/ See https:\/\/aka.ms\/new-console-template for more information\r\nConsole.WriteLine(\"Hello, World!\");<\/pre>\n<p>This application is very minimal compared to previous .NET versions. Global Using Directive powers this clean code, and in this article, we will learn more about it.<\/p>\n<div style=\"padding: 20px; border-left: 5px #dc2323 solid; display: block; margin-bottom: 20px; box-shadow: 1px 1px 5px 0px lightgrey;\">To download the source code for this article, you can visit our <a href=\"https:\/\/github.com\/CodeMazeBlog\/CodeMazeGuides\/tree\/main\/csharp-basic-topics\/GlobalUsingDirectiveInCSharp\" target=\"_blank\" rel=\"nofollow noopener\">GitHub repository<\/a>.<\/div>\n<p>Let&#8217;s dive in.<\/p>\n<h2>How Do We Use Global Using Directives?<\/h2>\n<p>Before C# 10, we had to import <code>namespaces<\/code> as we needed them. So if our entire application needs a given namespace, we have to import it into every file. <strong>With global using directives, we can declare namespaces once and they become available to all files in the application.\u00a0<\/strong><\/p>\n<h2>Declaring Global Using Directives<\/h2>\n<p>We declare global usings by using two ways. In a first way, we define the global using directive in any file within our project. Another way is declaring our global usings in the main <code>Project file(.csproj)<\/code>. We will discuss this later when we talk about <code>implicit global using directives<\/code>. Let&#8217;s inspect the first way.<\/p>\n<p>Back to our console application, let&#8217;s add a <code>Store<\/code> class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">namespace GlobalUsingDirectiveInCSharp.Model\r\n{\r\n    public class Store\r\n    {\r\n        public string? Name { get; set; }\r\n\r\n        public string? Owner { get; set; }\r\n    }\r\n}<\/pre>\n<p>Furthermore, let&#8217;s make use of the <code>Store<\/code> class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">using GlobalUsingDirectiveInCSharp.Model;\r\n\r\nvar store = new Store { Name = \"Fred and Sons Bakery\", Owner = \"Fred\" };\r\n\r\nConsole.WriteLine($\"{store.Name} is owned by {store.Owner}\");<\/pre>\n<p>For every file that we use <code>Store,<\/code> we have to declare its namespace &#8211; <code>using GlobalUsingDirectiveInCSharp.Model<\/code>.\u00a0<\/p>\n<p>On the other hand, to make <code>Store<\/code> accessible globally, we add the <code>global<\/code> keyword before the using statement:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">global using GlobalUsingDirectiveInCSharp.Model;<\/code><\/p>\n<p>With <code>global<\/code> keyword added we can access <code>Store<\/code> from any file within our console application. Also, when we declare a <code>global using directive<\/code> and a <code>non-global using directive<\/code> in the same file, <strong>the global using directive must be declared first before the non-global directive<\/strong>.<\/p>\n<p>We would get the error if we don&#8217;t follow the rule:<\/p>\n<p><a href=\"https:\/\/code-maze.com\/wp-content\/uploads\/2022\/06\/globalusingdirectives.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-70982\" src=\"https:\/\/code-maze.com\/wp-content\/uploads\/2022\/06\/globalusingdirectives.png\" alt=\"A global using directive must precede all non-global using directive\" width=\"540\" height=\"99\" srcset=\"https:\/\/code-maze.com\/wp-content\/uploads\/2022\/06\/globalusingdirectives.png 540w, https:\/\/code-maze.com\/wp-content\/uploads\/2022\/06\/globalusingdirectives-300x55.png 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<p>We can define <code>global using directives<\/code> in any file. However, it is recommended to place all <code>global usings<\/code> in a single file. This makes it easier for us to maintain them in larger applications.\u00a0<\/p>\n<h2>Implicit Global Using Directives<\/h2>\n<p>Another feature used in making our console application minimal is the <code>Implicit Global Using Directives<\/code>. The .NET SDK automatically generates <code>global using directives<\/code> called implicit global using directives. This is a new feature in .NET 6:\u00a0<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\r\n\r\n  &lt;PropertyGroup&gt;\r\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\r\n    &lt;TargetFramework&gt;net6.0&lt;\/TargetFramework&gt;\r\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;\r\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;\r\n  &lt;\/PropertyGroup&gt;\r\n\r\n&lt;\/Project&gt;\r\n<\/pre>\n<p>This is the <code>.csproj<\/code> file of our console application. To use implicit global using directives, the setting <code>&lt;ImplicitUsings&gt;<\/code> is set to <code>enable<\/code>.\u00a0<code>&lt;implicitUsings&gt;<\/code> are enabled by default when creating new applications. <\/p>\n<p><span style=\"font-weight: 400;\">Now, let\u2019s see where we can find the implicit global using directives that are defined in our application:<\/span><\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">obj\\Debug\\net6.0\\GlobalUsingDirectiveInCSharp.GlobalUsings.g.cs<\/code><\/p>\n<p><span style=\"font-weight: 400;\">Implicit global usings differ between projects. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let\u2019s inspect the global usings file for the Console application:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">\/\/ &lt;auto-generated\/&gt;\r\nglobal using global::System;\r\nglobal using global::System.Collections.Generic;\r\nglobal using global::System.IO;\r\nglobal using global::System.Linq;\r\nglobal using global::System.Net.Http;\r\nglobal using global::System.Threading;\r\nglobal using global::System.Threading.Tasks;<\/pre>\n<p><span style=\"font-weight: 400;\">\u00a0Additionally, let\u2019s inspect the same for a Web API project:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">\/\/ &lt;auto-generated\/&gt;\r\nglobal using global::Microsoft.AspNetCore.Builder;\r\nglobal using global::Microsoft.AspNetCore.Hosting;\r\nglobal using global::Microsoft.AspNetCore.Http;\r\nglobal using global::Microsoft.AspNetCore.Routing;\r\nglobal using global::Microsoft.Extensions.Configuration;\r\nglobal using global::Microsoft.Extensions.DependencyInjection;\r\nglobal using global::Microsoft.Extensions.Hosting;\r\nglobal using global::Microsoft.Extensions.Logging;\r\nglobal using global::System;\r\nglobal using global::System.Collections.Generic;\r\nglobal using global::System.IO;\r\nglobal using global::System.Linq;\r\nglobal using global::System.Net.Http;\r\nglobal using global::System.Net.Http.Json;\r\nglobal using global::System.Threading;\r\nglobal using global::System.Threading.Tasks;<\/pre>\n<p>We can also remove any <code>implicit global using directive<\/code> we don&#8217;t need it.<\/p>\n<p>Let&#8217;s see how:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">&lt;ItemGroup&gt;\r\n    &lt;Using Remove=\"System.Collections.Generic\"&gt;&lt;\/Using&gt;\r\n&lt;\/ItemGroup&gt;<\/pre>\n<p>When we add this tag in <code>.csproj<\/code>, we remove the implicit global using directive of <code>System.Collections.Generic<\/code>. On running our application, the namespace is removed from the <code>GlobalUsings.g.cs<\/code> file.<\/p>\n<p>To enable a directive, we use <code>Include<\/code> tag within <code>&lt;Using&gt;<\/code> settings:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-highlight=\"3\">&lt;ItemGroup&gt;\r\n  &lt;Using Remove=\"System.Collections.Generic\"&gt;&lt;\/Using&gt;\r\n  &lt;Using Include=\"GlobalUsingDirectiveInCSharp.Model\"&gt;&lt;\/Using&gt;\r\n&lt;\/ItemGroup&gt;<\/pre>\n<p>With this in place, we can remove the global using directive we define for the <code>Store<\/code> class in any file and the application will still run.<\/p>\n<h2>Disabling Implicit Global Using Directives<\/h2>\n<p>We can disable <code>Implicit Global Using Directives<\/code> by setting <code>&lt;implictUsings&gt;<\/code> in our <code>.cproj<\/code> file to <code>disable<\/code>:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\" data-enlighter-highlight=\"6\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\r\n\r\n  &lt;PropertyGroup&gt;\r\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\r\n    &lt;TargetFramework&gt;net6.0&lt;\/TargetFramework&gt;\r\n    &lt;ImplicitUsings&gt;disable&lt;\/ImplicitUsings&gt;\r\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;\r\n  &lt;\/PropertyGroup&gt;\r\n\r\n  &lt;ItemGroup&gt;\r\n    &lt;Using Remove=\"System.Collections.Generic\"&gt;&lt;\/Using&gt;\r\n    &lt;Using Include=\"GlobalUsingDirectiveInCSharp.Model\"&gt;&lt;\/Using&gt;\r\n  &lt;\/ItemGroup&gt;\r\n\r\n&lt;\/Project&gt;\r\n<\/pre>\n<p>Just a single note here. Even though we disable implicit using directives inside the <code>PropertyGroup<\/code>, we will still be able to access those namespaces included inside the <code>ItemGroup<\/code> part. This setup will override the <code>&lt;ImplicitUsings&gt;<\/code> one. So basically, if we want we can disable all the global usings, and then enable just the required ones.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, we have learned about <code>Global Using Directives<\/code> and how to declare one. We also covered <code>Implicit Global Using Directives<\/code>. Both features make for a cleaner code in the latest C# 10 and .NET 6.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we are going to learn about Global Using Directives in C#. When we create a console application using .NET 6, the Program.cs class contains a single line of code (not counting the comment): \/\/ See https:\/\/aka.ms\/new-console-template for more information Console.WriteLine(&#8220;Hello, World!&#8221;); This application is very minimal compared to previous .NET versions. Global [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":62189,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[12],"tags":[1285,1283,1284],"class_list":["post-70979","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-csharp","tag-declaring-global-using-directives","tag-global-using-directives","tag-implicit-usling-directives","et-has-post-format-content","et_post_format-et-post-format-standard"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Global Using Directives in C# - Code Maze<\/title>\n<meta name=\"description\" content=\"In this article, we are going to learn about Global Using Directives in C#. We&#039;ll also talk about implicit global using directives.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/code-maze.com\/csharp-global-using-directives\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Global Using Directives in C# - Code Maze\" \/>\n<meta property=\"og:description\" content=\"In this article, we are going to learn about Global Using Directives in C#. We&#039;ll also talk about implicit global using directives.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/csharp-global-using-directives\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-04T06:13:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-09T06:29:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"620\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Code Maze\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/CodeMazeBlog\" \/>\n<meta name=\"twitter:site\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Code Maze\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/\"},\"author\":{\"name\":\"Code Maze\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04\"},\"headline\":\"Global Using Directives in C#\",\"datePublished\":\"2022-06-04T06:13:38+00:00\",\"dateModified\":\"2022-06-09T06:29:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/\"},\"wordCount\":588,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"keywords\":[\"Declaring global using directives\",\"Global using directives\",\"implicit usling directives\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/csharp-global-using-directives\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/\",\"url\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/\",\"name\":\"Global Using Directives in C# - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"datePublished\":\"2022-06-04T06:13:38+00:00\",\"dateModified\":\"2022-06-09T06:29:46+00:00\",\"description\":\"In this article, we are going to learn about Global Using Directives in C#. We'll also talk about implicit global using directives.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/csharp-global-using-directives\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"width\":1100,\"height\":620,\"caption\":\"C# Development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/code-maze.com\/csharp-global-using-directives\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Global Using Directives in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/code-maze.com\/#website\",\"url\":\"https:\/\/code-maze.com\/\",\"name\":\"Code Maze\",\"description\":\"Learn. Code. Succeed.\",\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/code-maze.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/code-maze.com\/#organization\",\"name\":\"Code Maze\",\"url\":\"https:\/\/code-maze.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"width\":3511,\"height\":3510,\"caption\":\"Code Maze\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/CodeMazeBlog\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04\",\"name\":\"Code Maze\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png\",\"caption\":\"Code Maze\"},\"description\":\"This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/codemaze\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog\"],\"url\":\"https:\/\/code-maze.com\/author\/codemazecontributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Global Using Directives in C# - Code Maze","description":"In this article, we are going to learn about Global Using Directives in C#. We'll also talk about implicit global using directives.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/code-maze.com\/csharp-global-using-directives\/","og_locale":"en_US","og_type":"article","og_title":"Global Using Directives in C# - Code Maze","og_description":"In this article, we are going to learn about Global Using Directives in C#. We'll also talk about implicit global using directives.","og_url":"https:\/\/code-maze.com\/csharp-global-using-directives\/","og_site_name":"Code Maze","article_published_time":"2022-06-04T06:13:38+00:00","article_modified_time":"2022-06-09T06:29:46+00:00","og_image":[{"width":1100,"height":620,"url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","type":"image\/png"}],"author":"Code Maze","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Code Maze","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/"},"author":{"name":"Code Maze","@id":"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04"},"headline":"Global Using Directives in C#","datePublished":"2022-06-04T06:13:38+00:00","dateModified":"2022-06-09T06:29:46+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/"},"wordCount":588,"commentCount":0,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","keywords":["Declaring global using directives","Global using directives","implicit usling directives"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/csharp-global-using-directives\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/","url":"https:\/\/code-maze.com\/csharp-global-using-directives\/","name":"Global Using Directives in C# - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","datePublished":"2022-06-04T06:13:38+00:00","dateModified":"2022-06-09T06:29:46+00:00","description":"In this article, we are going to learn about Global Using Directives in C#. We'll also talk about implicit global using directives.","breadcrumb":{"@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/csharp-global-using-directives\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/#primaryimage","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","width":1100,"height":620,"caption":"C# Development"},{"@type":"BreadcrumbList","@id":"https:\/\/code-maze.com\/csharp-global-using-directives\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"Global Using Directives in C#"}]},{"@type":"WebSite","@id":"https:\/\/code-maze.com\/#website","url":"https:\/\/code-maze.com\/","name":"Code Maze","description":"Learn. Code. Succeed.","publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/code-maze.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/code-maze.com\/#organization","name":"Code Maze","url":"https:\/\/code-maze.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","width":3511,"height":3510,"caption":"Code Maze"},"image":{"@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/CodeMazeBlog"]},{"@type":"Person","@id":"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04","name":"Code Maze","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png","caption":"Code Maze"},"description":"This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.","sameAs":["https:\/\/www.linkedin.com\/company\/codemaze\/","https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog"],"url":"https:\/\/code-maze.com\/author\/codemazecontributor\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/70979","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=70979"}],"version-history":[{"count":6,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/70979\/revisions"}],"predecessor-version":[{"id":71262,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/70979\/revisions\/71262"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media\/62189"}],"wp:attachment":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media?parent=70979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=70979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=70979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}