C# Constructor: Usage, Examples, Best Practices, and Pitfalls
We’ve already covered so many C# concepts, and most of them relate to objects. This is hardly surprising, C# being an object-oriented language. What is surprising is that, up until this point, we haven’t covered the “thing” responsible for creating objects!
Today’s post will remedy this problem by covering the C# constructor. The post will roughly follow the same pattern we’ve followed through much of the series. We start by defining the concept, then proceed to show several usage examples. We part ways with general tips on best practices to follow and pitfalls to be aware of. Let’s begin!