Uploaded April 2020 | Updated November 2026, 3 hours ago
I have a really, really bad idea. I'd like to create a string that can be appended to or prepended to using custom operators. The goal here is to demonstrate the use of operator overloading, but also offer a bit of caution about creating operators that do not do the expected behavior.
Some examples of what this syntax might look like when using normal strings:
```csharp
"Hello" ) "WorldOfZero" == "HelloWorldOfZero"
"Hello" ( "WorldOfZero" == "WorldOfZeroHello"
```
*Note: I'm using parentheses here instead of angled brackets - angled brackets aren't supported in YouTube descriptions*
More information about using operator overloads is available here, including a list of supported operators: docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/operator-overloading
I've put together a second video on this topic that uses this functionality for a slightly more useful reason. We create an `AppendableList` that enables you to add and remove objects using the `+` and `-` operators. You can watch that here: youtu.be/vavFf1Qiz20
Join the World of Zero Discord Server: discord.gg/hU5Kq2u
I have a really, really bad idea. I'd like to create a string that can be appended to or prepended to using custom operators. The goal here is to demonstrate the use of operator overloading, but also offer a bit of caution about creating operators that do not do the expected behavior.
Some examples of what this syntax might look like when using normal strings:
```csharp
"Hello" ) "WorldOfZero" == "HelloWorldOfZero"
"Hello" ( "WorldOfZero" == "WorldOfZeroHello"
```
*Note: I'm using parentheses here instead of angled brackets - angled brackets aren't supported in YouTube descriptions*
More information about using operator overloads is available here, including a list of supported operators: docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/operator-overloading
I've put together a second video on this topic that uses this functionality for a slightly more useful reason. We create an `AppendableList` that enables you to add and remove objects using the `+` and `-` operators. You can watch that here: youtu.be/vavFf1Qiz20
Join the World of Zero Discord Server: discord.gg/hU5Kq2u
 that give you the ability to declare a using directive over every source file in your project instead of needing to duplicate the declaration inside of each file in your projects! This can help you reduce the duplicated code in your projects and make commonly used libraries and namespaces more readily available across your project!
To use a global using you can add `global` before your using statements like this statement you might use in a data serializing/deserializing library:
```csharp
global using Newtonsoft.Json
```
Including a global using will cause the compiler to include the namespace when resolving types across the entire compilation of your project instead of scoping that reference to the file the using is a part of. What this typically means is that you will want to use this for common namespaces used across your project and continue using file based using statements when referencing more feature specific types.
You can find more information about using Global Usings as part of the using directive documentation here: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-directive#global-modifier
Global Usings are also part of the `ImplicitUsings` feature you might see in your `.csproj` files. To learn more about this feature you can watch this video! https://youtu.be/NlvhBpLl0DY
Join the World of Zero Discord Server: https://discord.gg/hU5Kq2u
This videos thumbnail uses a globe SVG from here: https://commons.wikimedia.org/wiki/File:Emojione_BW_1F30E.svg Lets Explore Global Usings in C# 10](https://i.ytimg.com/vi/z4THCW3b16k/mqdefault.jpg)


