lundi 3 août 2015

Referring to class members as enumerations in C#

Is there a way to pass class 'members' as first-class values?

public class Bike {
    public Color BikeColour { get; set; }
    public bool  IsGirlsBike { get; set; }
}

I would like to then refer to the field names, without any notion of an object.

I guess what I want is something like an enum:

public enum BikeFields {BikeColour, IsGirlsBike};

but without defining it explicitly.

Is there a way to do this in C#?





Aucun commentaire:

Enregistrer un commentaire