Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
string _shipId = string.Empty;
string[] _ShipIIds;
decimal[] _SelectShipIId;

_ShipIIds = new string[_shipId.Count()];
_SelectShipIId = new decimal[_ShipIIds.Count()];
_ShipIIds = _shipId.Split(',');

for (int i = 0; i < _ShipIIds.Count(); i++)
{
    _SelectShipIId[i] =Convert.ToDecimal(_ShipIIds[i]);
}

what am having the value in _shipIIds the same value am getting the _selectShipIId also but in _ShipIIds is getting count 2 and _SelectShipIid is getting the count 3.

How i can reduce the _SelectShipIID count is 2..

_SelectShipIId=new decimal[_ShipId.count()];
_SelectShipIId=_ShipId.split(',');

from the split function its throw the exception..

cannot implicitly convert type string[] to decimal..

Please help me to solve this..
Posted
Updated 27-Jul-12 19:25pm
v2

1 solution

I think this should be close if not spot on ;)
C#
string _shipId = string.Empty;
 decimal[] _SelectShipIId;
 foreach (ShippingCarrierDTO _ship in _site.ShipVia)
 {
   if (string.IsNullOrEmpty(_shipId))
 {
  _shipId = Convert.ToString(_ship.ShipIId);
 }
 else
 {
   _shipId += "," + Convert.ToString(_ship.ShipIId);
 }
}

 _SelectShipIId =new decimal[_shipId.Length];
 for (int i = 0; i = _shipId.ToString.Split(",").count-1; i++)
 {
  _SelectShipIId[i] = CDec(_shipId.ToString.Split(",")(i);
 }
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900