dimanche 19 mars 2017

which is the best performance way to achieve XML column info to set object's field

I have field object array (field containing fieldname/fieldvalue fields) which I need to set into Info class for related columns match to fieldname (as defined below XML).

public class Info
{
  public string col1 {get; set;}
  public string col2 {get; set;}
  public datetime col3 {get; set;}
  public datetime col4 {get; set;}
  public datetime col5 {get; set;}

}

XML is as follow:

 <columninfo>
    <column name="col1,col2" fieldname="c1" type="string" />
    <column name="col3" fieldname="c3" type="date" format="ddMMMyyy"/>
    <column name="col4,col5" fieldname="c4" type="string" format="ddMMMyyy"/>
 </columninfo>

Example: fieldname="c1" then, need to set two columns -col1,col2 of info class., if fieldname="c3" then, need to set "col3" of info class with particular dateformat as defined format attribute.

How to achieve this where it can be fastest way by performance. two things - one is to read XML to some object or directly parse XML to find matching for fieldname's related column. second thing, to set column of Info class based on fieldname/value.

Thanks





Aucun commentaire:

Enregistrer un commentaire