-1

I have a very simple object like:

public class ChargeTemplate
{
    public string ChargeTemplateType;
    public string TemplateCode;
    public string ChargeDescription;
    public string Active;

    public Calculation ChargeTemplateCalculation;
    public TApplication ChargeTemplateApplication;
    public Taxation ChargeTemplateTaxation;
}

I'm filling out some of the fields and then passing it to this method:

public void FillChargeTemplateFields(object items)
{

 foreach (var prop in items.GetType().GetFields())
 {
   ...
 }

}

Inside I'm grabbing the name and the value.

When I get down to Calculation, I want to know that it's a new class with fields so that I can throw it back up into the method to get it's field names and values. But I can't seem to figure out how to determine that it's a class as well. How do I do this?

Jason
  • 41
  • 8

1 Answers1

0

Looking for namespace name in FieldType allowed me to determine it was one of my classes, at which point I just passed back the value.

Jason
  • 41
  • 8