© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
6 replies
SWEETPONY

❔ ✅ How to get true properties from object?

I have following object:
public class AccessGroupRulesDto
{
    [JsonProperty( PropertyName = "allow_access_when_blocked" )]
    public bool AllowAccessWhenBlocked { get; set; }

    [JsonProperty( PropertyName = "allow_access_on_antipassback" )]
    public bool AllowAccessOnAntipassback { get; set; }

    [JsonProperty( PropertyName = "allow_exit_out_of_schedule_access" )]
    public bool AllowExitOutOfScheduleAccess { get; set; }

    [JsonProperty( PropertyName = "allow_entry_out_of_schedule_access" )]
    public bool AllowEntryOutOfScheduleAccess { get; set; }

    [JsonProperty( PropertyName = "allow_access_by_one_factor" )]
    public bool AllowAccessByOneFactor { get; set; }

    [JsonProperty( PropertyName = "allow_turning_off_sound_open_door" )]
    public bool AllowTurningOffSoundOpenDoor { get; set; }

    [JsonProperty( PropertyName = "guest_access" )]
    public bool GuestAccess { get; set; }

    [JsonProperty( PropertyName = "guard_control" )]
    public bool GuardControl { get; set; }

    [JsonProperty( PropertyName = "alarm_remove" )]
    public bool AlarmRemove { get; set; }

    [JsonProperty( PropertyName = "group_access_mode" )]
    public GroupAccessMode GroupAccessMode { get; set; }
}
public class AccessGroupRulesDto
{
    [JsonProperty( PropertyName = "allow_access_when_blocked" )]
    public bool AllowAccessWhenBlocked { get; set; }

    [JsonProperty( PropertyName = "allow_access_on_antipassback" )]
    public bool AllowAccessOnAntipassback { get; set; }

    [JsonProperty( PropertyName = "allow_exit_out_of_schedule_access" )]
    public bool AllowExitOutOfScheduleAccess { get; set; }

    [JsonProperty( PropertyName = "allow_entry_out_of_schedule_access" )]
    public bool AllowEntryOutOfScheduleAccess { get; set; }

    [JsonProperty( PropertyName = "allow_access_by_one_factor" )]
    public bool AllowAccessByOneFactor { get; set; }

    [JsonProperty( PropertyName = "allow_turning_off_sound_open_door" )]
    public bool AllowTurningOffSoundOpenDoor { get; set; }

    [JsonProperty( PropertyName = "guest_access" )]
    public bool GuestAccess { get; set; }

    [JsonProperty( PropertyName = "guard_control" )]
    public bool GuardControl { get; set; }

    [JsonProperty( PropertyName = "alarm_remove" )]
    public bool AlarmRemove { get; set; }

    [JsonProperty( PropertyName = "group_access_mode" )]
    public GroupAccessMode GroupAccessMode { get; set; }
}


I'd like to return all properties where bool is not false
how can I do it?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ How to get value from json object by path?
C#CC# / help
3y ago
✅ How to fill the object without populating properties?
C#CC# / help
2y ago
❔ getproperties reset object properties to 0
C#CC# / help
3y ago