what possible in a static class and not in non-static class or vice versa in C#, for example
static class
MyProgram.CallFunction();
non-static class
MyProgram obj =new MyProgram();
obj.CallFunction();
in the above example without creating the instance we can able to call static class members so this is basic.
I'm looking for a difference which is possible and not possible in static and non-static
Asad AliPosted Dec 9, 2019, 2:58 AM
If you are using IOC than its better to not to use static classes and let dependency injection hangle it (but that absolutely depends on your situation)
also If you are using TDD then it's easy to create fakes for classes that are non-static
Ashutosh GuptaPosted Dec 8, 2019, 10:34 AM
Puneet KankarPosted Dec 8, 2019, 9:45 AM
Dinesh GabhanePosted Dec 8, 2019, 8:42 AM