Frenchi In LA
Frenchi In LA

Reputation: 3169

Get the information from Dictionary with reflection

Let's say I have a class with the following schema.

public MyClass {
    public Dictionary<String, Class1> Dict1 { get; set; }

    public Myclass() {
       // Add and work with dic1
    }
}

I'd like to use reflection to get all class1 of the dict1. I hope this is clear, otherwise let me know and I will put additional information. Thanks, and any help would be greatly appreciated.

Upvotes: 0

Views: 659

Answers (1)

Hawxby
Hawxby

Reputation: 2804

This should do it

dic1.Values.OfType<Class1>()

Upvotes: 1

Related Questions