.NET January 18, 2026
2 min read

.NET 10 and C# 14 — Unbound generic types and nameof

C# 14 introduces a new feature, which allows the argument to nameof to be an unbound generic type, removing the need to provide “dummy” types when you only care about the name of the generic definition itself. In this article, I present how this feature works.

Previous C# versions

Before C# 14, if you wanted to get the name of a generic class, like Logger<T>, you could use the nameof operator, but you could not just refer to the class itself, instead, the compiler required you to provide a “dummy” type argument, such as int, string, or a domain entity like User, etc. For example:

Console.WriteLine(nameof(Logger<string>));
Console.WriteLine(nameof(Logger<User>));

// Output:
Logger
Logger

Unbound generic types and nameof

With C# 14, you can now use the unbound syntax. For that, you simply use empty brackets <> for a single parameter, or commas <,> for multiple parameters. This allows you to refer to the generic definition rather than a specific construction, for example:

// Use the unbound syntax <> for one parameter.
Console.WriteLine(nameof(Logger<>));

// Use the comma <,> for two parameters
Console.WriteLine(nameof(DataMapper<,>));

// Output:
Logger
DataMapper

Conclusion

This new feature is a nice improvement for C#, which removes the need for dummy type arguments and makes the code cleaner and makes the language feel more polished.

This is the link for the project in GitHub: https://github.com/henriquesd/DotNet10.CSharp14.Demo

If you like this demo, I kindly ask you to give a ⭐️ in the repository.

Thanks for reading!


References

What’s new in C# 14