MoaidHathot / Dumpify

Adding `.Dump()` extension methods to Console Applications, similar to LinqPad's.
MIT License
959 stars 40 forks source link

Added member filter support #28

Closed hermanussen closed 5 months ago

hermanussen commented 5 months ago

Allows providing a custom function that determines if a member should be included or not.

As mentioned in the readme:

You can provide a custom filter to determine if members should be included or not

public class Person
{
    public string Name { get; set; }

    [JsonIgnore]
    public string SensitiveData { get; set; }
}

new Person()
{
    Name = "Moaid",
    SensitiveData = "We don't want this to show up"
}.Dump(members: new MembersConfig { MemberFilter = member => !member.Info.CustomAttributes.Any(a => a.AttributeType == typeof(JsonIgnoreAttribute)) });