MongoDB.Bson.Serialization.Conventions.EnumRepresentationConvention.EnumRepresentationConvention C# (CSharp) Method

EnumRepresentationConvention() public method

Initializes a new instance of the EnumRepresentationConvention class.
public EnumRepresentationConvention ( BsonType representation ) : System
representation BsonType The serialization representation. 0 is used to detect representation /// from the enum itself.
return System
        public EnumRepresentationConvention(BsonType representation)
        {
            if (!((representation == 0) ||
                (representation == BsonType.String) ||
                (representation == BsonType.Int32) ||
                (representation == BsonType.Int64)))
            {
                throw new ArgumentException("Enums can only be represented as String, Int32, Int64 or the type of the enum");
            }
            _representation = representation;
        }
EnumRepresentationConvention