Nullable Int32 Parse


is possible parse string nullable integer? if string can parsed parse method return integer, if not return null.

here how expect work:
string s = "5";
int32? i;
i = {something}.parse(s);

i have seen question asked many times, not find answer guessing cannot done in v2.

you can write own {something}, need contain method:


public static int? parse(string s) {
    int i;
    if (int.tryparse(s, out i)) return i;
    else return null;
}

 



Archived Forums V  >  Visual C# Language



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'