Santhosh Subramaniam

Santhosh Subramaniam

  • NA
  • 226
  • 103.5k

How to convert array values to class objects in c#?

Feb 7 2020 5:12 AM
Hi,
I have a string value with comma separator,
string currency = "EUR:100;INR:500;CZK:500";
var _currency= currency.split(':');
now i get value in array like
EUR:100
INR:500
CZK:500 in _currency variable.
now how to push this array values to my class
class CurrencyValue
{
public string Currency {get;set;}
public int Amount{get;set;}
}
that is EUR to Currency and 100 to Amount?

Answers (4)