How to match data types without a switch construct?

Posts   
 
    
Rushmore
User
Posts: 125
Joined: 27-Jan-2005
# Posted on: 15-Dec-2006 14:26:23   

the SD.LLBLGen.Pro.TypeConverters assembly contains only BooleanNumericConverter.

I want to read a delimited text file, and assign the values to the fields of an entity object. Something like:

Id|SureName|LastName 1|Bill|Gates 2|Visual|Studio

entity.Id (Integer) entity.SureName (String) entity.LastName (String)


string[] values = rows[index].Split('|');

for (int field = 0; field < values.Length; field++)
{
  entity.Fields[field].CurrentValue = Converter(values[field], entity.Fields[field].DataType)
}

Is there something like Converter(values[field], entity.Fields[field].DataType) available?

Regards, Carlo

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 16-Dec-2006 12:38:57   

No that's not supported: the typeconverters are for one field only.

Frans Bouma | Lead developer LLBLGen Pro