c# - The best overloaded method match for 'double.TryParse(string, out double)' has some invalid arguments -
i did search , didn't find answer question. if it's been asked, i'd appreciate finding it.
i'm bit new coding , i'm trying convert program vb c#.
here original vb code:
for each grpkey in groups.keys.toarray dim grp = groups(grpkey) if grp.smartkitparameters.count > 0 dim partnameparam = getparametervalue(grp.smartkitparameters, "%smartkitname%", "") dim maintcodeparam = getparametervalue(grp.smartkitparameters, "%maintcode%", "p") dim divisioncodeparam = getparametervalue(grp.smartkitparameters, "%divisioncode%", "w") dim quantityparam double double.tryparse(getparametervalue(grp.smartkitparameters, "%quantity%", "0"), quantityparam) dim smkt new part { .partid = allparts.values.max(function(p) p.partid) + 1, .dpltype = grp.parts.values.first.dpltype, .plane = grp.parts.values.first.plane, .quantity = quantityparam, .maintcode = maintcodeparam, .partnumber = partnameparam, .plant = divisioncodeparam, } dim parentgrp = getgroup(groups, smkt.dpltype, smkt.plane, "(default group)") parentgrp.parts.add(smkt.partid, smkt) allparts.add(smkt.partid, smkt) groups.remove(grpkey) end if using specdimscmd new oledbcommand("select * dplspecialdimensions;", conn) using rdr = specdimscmd.executereader while rdr.read dim partid = rdr.getinteger("partid", 0) if allparts.containskey(partid) allparts(partid).specialdimensions.add(new specialdimension { .partid = partid, .specdimid = rdr.getinteger("specdimid", 0), .maintcode = rdr.getstring("maintcode", ""), .specialtype = rdr.getstring("specialtype", ""), .specialdim = rdr.getsingle("specialdim", 0.0) }) end if end while end using end using next
here i've done convert c# code:
1 foreach (string grpkey_loopvariable in groups.keys.toarray) 2 { 3 if (grp.smartkitparameters.count > 0) 4 { 5 string partnameparam = getparametervalue(grp.smartkitparameters, "%smartkitname%", ""); 6 string maintcodeparam = getparametervalue(grp.smartkitparameters, "%maintcode%", "p"); 7 string divisioncodeparam = getparametervalue(grp.smartkitparameters, "%divisioncode%", "w"); 8 double quantityparam = 0; 9 string quantityparamstring = getparametervalue(grp.smartkitparameters, "%quantity%", "0.0"); 10 double.tryparse(quantityparamstring, quantityparam); 11 12 part smkt = new part 13 { 14 partid = allparts.values.max(p => p.partid) + 1, 15 dpltype = grp.parts.values.first().dpltype, 16 plane = grp.parts.values.first().plane, 17 quantity = quantityparam, 18 maintcode = maintcodeparam, 19 partnumber = partnameparam, 20 plant = divisioncodeparam, 21 }; 22 23 dynamic parentgrp = getgroup(groups, smkt.dpltype, smkt.plane, "(default group)"); 24 parentgrp.parts.add(smkt.partid, smkt); 25 26 allparts.add(smkt.partid, smkt); 27 28 groups.remove(grpkey); 29 } 30 31 using (oledbcommand specdimscmd = new oledbcommand("select * dplspecialdimensions;", conn)) 32 { 33 using (oledbdatareader rdr = specdimscmd.executereader()) 34 { 35 while (rdr.read()) 36 { 37 dynamic partid = getinteger(rdr idatareader, "partid", 0); 38 if (allparts.containskey(partid)) 39 { 40 allparts[partid].specialdimensions.add(new specialdimension 41 { 42 partid = partid, 43 specdimid = getinteger(rdr idatareader, "specdimid", 0), 44 maintcode = getstring(rdr idatareader, "maintcode", ""), 45 specialtype = getstring(rdr idatareader, "specialtype", ""), 46 specialdim = getsingle(rdr idatareader, "specialdim", 0) 47 }); 48 } 49 } 50 } 51 } 52}
at line 10 in c# code, getting error:
the best overloaded method match 'double.tryparse(string, out double)' has invalid arguments
this doesn't make sense me since arguments correct type (string , double). invalid arguments in other way?
doubleparam
out
parameter, should explictly tell so:
double.tryparse(quantityparamstring, out quantityparam);
Comments
Post a Comment