<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo" -->

---
title: C# tip: define Using Aliases to avoid ambiguity | daily.dev
description: When two referenced namespaces or packages expose classes with the same name (like a Match type from two different football-stats libraries), C# namespace...
canonical: https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: C# tip: define Using Aliases to avoid ambiguity | daily.dev
og:description: When two referenced namespaces or packages expose classes with the same name (like a Match type from two different football-stats libraries), C# namespace...
og:url: https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo
og:image: https://api.daily.dev/og/posts/Cxwr3VyVO.png
og:image:alt: C# tip: define Using Aliases to avoid ambiguity
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# C# tip: define Using Aliases to avoid ambiguity

**[Code4IT](https://daily.dev/sources/code4it)** · 4 min read · 0 upvotes · 0 comments

## Summary

When two referenced namespaces or packages expose classes with the same name (like a Match type from two different football-stats libraries), C# namespace aliases let you avoid ambiguity without writing fully qualified names everywhere. The using statement can alias an entire namespace or a specific class, and even generics with a specified inner type, cleaning up code readability. Limitations include needing to specify the full generic inner type and not being able to nest an aliased class inside another alias's generic parameter.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.code4it.dev/csharptips/using-alias>

## Questions this post answers

### How do I use two classes with the same name from different namespaces in C#?

Use a using alias to rename the imported namespace or the specific class so the compiler and your code can distinguish them. For example, 'using Shiny = ShinyData.Football.Statistics;' lets you write 'new Shiny.Match()', or alias the class directly with 'using ShinyMatch = ShinyData.Football.Statistics.Match;' and then instantiate 'new ShinyMatch()'.

_daily.dev surfaces practical C# tips like this for developers untangling namespace collisions._

### Can you create a using alias for a generic type in C#?

Yes, but the generic's inner type must be specified concretely, such as 'using ShinyDictionary = ShinyData.Football.Statistics.CustomDictionary<int>;' rather than leaving a type parameter open like CustomDictionary<T>. Additionally, an aliased class cannot be used as the inner type of another generic alias; the fully qualified name must be used instead in that case.

_developers wrestling with generics and aliasing edge cases can find more C# patterns via daily.dev._

## Similar posts on daily.dev

- [Working union types into C\#](https://daily.dev/posts/working-union-types-into-c--n1rhxnbqf) · Atomic Spin · 0 upvotes · 0 comments
- [The best new features of C\# 14](https://daily.dev/posts/the-best-new-features-of-c-14-6gsbbjwv4) · InfoWorld · 46 upvotes · 4 comments
- [Explore union types in C\# 15](https://daily.dev/posts/explore-union-types-in-c-15-oygraauhf) · DevBlogs · 64 upvotes · 3 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"C# tip: define Using Aliases to avoid ambiguity","url":"https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo"},"datePublished":"2026-10-04T13:07:18.105Z","dateModified":"2026-10-04T13:19:20.659Z","description":"When two referenced namespaces or packages expose classes with the same name (like a Match type from two different football-stats libraries), C# namespace...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/adcaf6bde6b6122cd72c5adcc6ed8181?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/adcaf6bde6b6122cd72c5adcc6ed8181?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Code4IT","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Code4IT","logo":"https://media.daily.dev/image/upload/s--OaaG4G10--/f_auto,q_auto/v1791119049/logos/code4it?_a=BAMAMicg0","url":"https://daily.dev/sources/code4it"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,c#","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Code4IT","item":"https://daily.dev/sources/code4it"},{"@type":"ListItem","position":3,"name":"C# tip: define Using Aliases to avoid ambiguity"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/c-tip-define-using-aliases-to-avoid-ambiguity-cxwr3vyvo#faq","mainEntity":[{"@type":"Question","name":"How do I use two classes with the same name from different namespaces in C#?","acceptedAnswer":{"@type":"Answer","text":"Use a using alias to rename the imported namespace or the specific class so the compiler and your code can distinguish them. For example, 'using Shiny = ShinyData.Football.Statistics;' lets you write 'new Shiny.Match()', or alias the class directly with 'using ShinyMatch = ShinyData.Football.Statistics.Match;' and then instantiate 'new ShinyMatch()'. daily.dev surfaces practical C# tips like this for developers untangling namespace collisions."}},{"@type":"Question","name":"Can you create a using alias for a generic type in C#?","acceptedAnswer":{"@type":"Answer","text":"Yes, but the generic's inner type must be specified concretely, such as 'using ShinyDictionary = ShinyData.Football.Statistics.CustomDictionary<int>;' rather than leaving a type parameter open like CustomDictionary<T>. Additionally, an aliased class cannot be used as the inner type of another generic alias; the fully qualified name must be used instead in that case. developers wrestling with generics and aliasing edge cases can find more C# patterns via daily.dev."}}]}
```

