The VB.NET to C# converter Instant C# makes a static class available to mimic the robustness of the VB cast macro "CInt":
internal static int CInt(object oValue)
{
try
{
if (oValue == null || System.Convert.IsDBNull(oValue))
//default null to 0 (identical to the VB.NET cast):
return 0;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.