Alternative for Microsoft.VisualBasic.Information.IsNumeric in C# -
attrval[5] = wrmservice.windowsagent.agentversion;   from above if attrval[5] null or not getting value or strings other numeric values want assign attrval[5] value '0.0.0.0' otherwise display numeric value coming.what coding have implement here
as per information while doing googling did
attrval[5] = (wrmservice.windowsagent.agentversion == null || microsoft.visualbasic.information.isnumeric(wrmservice.windowsagent.agentversion)) ?  "0.0.0.0" : wrmservice.windowsagent.agentversion;    but microsoft.visualbasic.information.isnumeric making problems. there similar 1 in c#?
only 2 outputs required 1 numeric , 1 other, can string or null whatever have set in 0.0.0.0
try
if(!int.tryparse(wrmservice.windowsagent.agentversion, out attrval[5])) attrval[5] = 0;   in case, if agentversion numeric, place parsed value attrval[5], otherwise set 0.
edit
ah guess looking for:
attrval[5] = string.isnullorempty(wrmservice.windowsagent.agentversion) ? "0.0.0.0" : wrmservice.windowsagent.agentversion;      
Comments
Post a Comment