jeudi 21 mai 2015

Reflection - GetProperties of a class that are Interfaces [duplicate]

This question already has an answer here:

I'm using refelection to iterate through the Public properties of a class.

foreach (PropertyInfo prop in instance.GetType().GetProperties())
{
  ...do work 

This gets me all public properties. However I only want to get Public Properties that are interfaces. For example below i want to get 'session' (which is an Interface) but not Help.

public ISession Session { get; set; } //My Interface - i want this

public string Help { get; set; } //I dont want this





Aucun commentaire:

Enregistrer un commentaire