You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this scenario, an incoming data model may contain a SmartEnum name. Ideally, one could easily validate it against a particular SmartEnum to make sure the value is among the enum's names.
publicsealedclassVehicle:SmartEnum<Vehicle>{publicstaticreadonlyVehicleCar=newVehicle(nameof(Car),1);publicstaticreadonlyVehicleBoat=newVehicle(nameof(Boat),2);publicstaticreadonlyVehiclePlane=newVehicle(nameof(Plane),3);privateVehcileTypeEnum(stringname,intvalue):base(name,value){}}publicclassExampleModel{[Required][SmartEnumName(typeof(Vehicle))]publicstringVehicleName{get;set;}// Can only be "Car", "Boat", or "Plane"}
The text was updated successfully, but these errors were encountered:
In this scenario, an incoming data model may contain a
SmartEnum
name. Ideally, one could easily validate it against a particularSmartEnum
to make sure the value is among the enum's names.The text was updated successfully, but these errors were encountered: