Thursday, February 27, 2014

Check for string if it contains positive integer in C#

In order to check if strings is positive integer I used following check in C#

        String maxRecords;

        if (maxRecords == "" || !maxRecords.All(Char.IsDigit))
        {
               // Logic to implement when string contains no valid postive integer.
        }

No comments: