Overriding the Defaults in a struct (c#)

前端 未结 12 1014
感情败类
感情败类 2021-01-04 00:47

Is it possible to set or override the default state for a structure?

As an example I have an

enum something{a,b,c,d,e};

and a struc

12条回答
  •  天命终不由人
    2021-01-04 01:17

    You can't override the default (parameterless) constructor for a struct. You can only add new constructors, which take parameters.

    http://csharp.2000things.com/2010/10/03/108-defining-a-constructor-for-a-struct/

提交回复
热议问题