Skip to main content
added 67 characters in body
Source Link
Soner Gönül
  • 99.1k
  • 103
  • 224
  • 375

You didn't mentioned to use what is exactly collection["id"] but..

From Int32.TryParse Method (String, Int32)

When this method returns, contains the 32-bit signed integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed.

Looks like your conversation fails because of your collection["id"] is bigger than Int32.MaxValue but since you didn't tell us more information, it is almost not possible to give exact answer..

Int64 also has a TryParse method that I think it can hold your value like;

int resultid;
bool success = Int64.TryParse(collection["id"], out resultid);

You didn't mentioned to use what is exactly collection["id"] but..

From Int32.TryParse Method (String, Int32)

When this method returns, contains the 32-bit signed integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed.

Looks like your conversation fails but since you didn't tell us more information, it is almost not possible to give exact answer..

Int64 also has a TryParse method that I think it can hold your value like;

int resultid;
bool success = Int64.TryParse(collection["id"], out resultid);

You didn't mentioned to use what is exactly collection["id"] but..

From Int32.TryParse Method (String, Int32)

When this method returns, contains the 32-bit signed integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed.

Looks like your conversation fails because of your collection["id"] is bigger than Int32.MaxValue but since you didn't tell us more information, it is almost not possible to give exact answer..

Int64 also has a TryParse method that I think it can hold your value like;

int resultid;
bool success = Int64.TryParse(collection["id"], out resultid);
Source Link
Soner Gönül
  • 99.1k
  • 103
  • 224
  • 375

You didn't mentioned to use what is exactly collection["id"] but..

From Int32.TryParse Method (String, Int32)

When this method returns, contains the 32-bit signed integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed.

Looks like your conversation fails but since you didn't tell us more information, it is almost not possible to give exact answer..

Int64 also has a TryParse method that I think it can hold your value like;

int resultid;
bool success = Int64.TryParse(collection["id"], out resultid);