Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Can i get a list of all properties but only in the direvide class?

$
0
0

Hi

I have

public class MyClassA
{
   public string ThisProperty {get;set;}

   public IList<string> GetAllPropertiesFromDerivedClass()
  {
      //needs to return One,Two and Three
      //This will be different if the derived cass is different
  }

}

public class MyClassB : MyClassA
{
   public string One {get;set;}
   public string Two {get;set;}
   public string Three {get;set;}
}

I know i could create an abstract method or virtual method and override it to hard code it (which is what i am doing at the moment), but can i do it dynamically

Any thoughts would be appriciated


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>