Also should be good to note, this was introduced in .NET 4 and is not available in earlier versions (I know because I've had to use the method in the main article in lieu of this way)
If you do this, you can no longer use Activator.CreateInstance(typeof(Something)), or use Something as a generic type parameter with the "new()" constraint.
Hi Robert, in this scenario you are correct, but sometimes you may still need overloaded constructors and so using defaults like you have may not always work, or you have to duplicate the default value in multiple places which introduces human error if you have to change the default value.
Last Visit: 31-Dec-99 18:00 Last Update: 29-Sep-24 20:31