filmov
tv
The Difference between Static and Non Static Classes and Methods in C#
Показать описание
If you are creating a .NET or .NET Core application, you are likely to come across classes, constructors, fields, properties or methods in your application.
Using Visual Studio 2019, I've created a Console Application that tests how these work when you use the static modifier and when it is absent.
Using an example static and non-static class, we will see if we can use a mixture of non-static methods in a static class and vice-versa. We will also see how static methods behave when using separate threads.
And what gets ran first? A static constructor, or a non-static constructor?
📖 Learn .NET and C# with our online courses 📖
#csharp #visualstudio
Using Visual Studio 2019, I've created a Console Application that tests how these work when you use the static modifier and when it is absent.
Using an example static and non-static class, we will see if we can use a mixture of non-static methods in a static class and vice-versa. We will also see how static methods behave when using separate threads.
And what gets ran first? A static constructor, or a non-static constructor?
📖 Learn .NET and C# with our online courses 📖
#csharp #visualstudio