126
1
using System;
2
using static System.Console;
3
var m = int.MaxValue;
4
// possible solutions:
5
try
6
{
7
WriteLine("n is an IntPtr");
8
var n = IntPtr.MaxValue;
9
checked
10
{
11
var y = n + 5;
12
WriteLine(y);
13
var x = m + 5;
14
WriteLine(x);
15
throw new Exception("Should not get here.");
16
}
17
}
18
catch (OverflowException) { }
19
20
try
21
{
22
WriteLine("n is a float");
23
var n = float.MaxValue;
24
checked
Cached Result
Environment version: 4.0.30319.42000
Json.NET version: Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
New JSON:
{
"disbursements": [
{
"id": "1f337641",
"contactId": "f5eb2",
"statusCode": 166000005,
"amount": 8,
"category": 166000001
},
{
"id": "027a4762",
"contactId": "f5eb2038",
"statusCode": 166000005,
"amount": 4000,
"category": 166000000
}
]
}
New JSON with complex value replacement:
{
"disbursements": [
{
"id": "1f337641",
"contactId": "f5eb2",
"statusCode": {
"oldValue": 166000005,
"newValue": 166000005
},
"amount": 8,
"category": 166000001
},
{
"id": "027a4762",
"contactId": "f5eb2038",
"statusCode": {
"oldValue": 166000000,
"newValue": 166000005
},
"amount": 4000,
"category": 166000000
}
]
}
Json.NET version: Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
New JSON:
{
"disbursements": [
{
"id": "1f337641",
"contactId": "f5eb2",
"statusCode": 166000005,
"amount": 8,
"category": 166000001
},
{
"id": "027a4762",
"contactId": "f5eb2038",
"statusCode": 166000005,
"amount": 4000,
"category": 166000000
}
]
}
New JSON with complex value replacement:
{
"disbursements": [
{
"id": "1f337641",
"contactId": "f5eb2",
"statusCode": {
"oldValue": 166000005,
"newValue": 166000005
},
"amount": 8,
"category": 166000001
},
{
"id": "027a4762",
"contactId": "f5eb2038",
"statusCode": {
"oldValue": 166000000,
"newValue": 166000005
},
"amount": 4000,
"category": 166000000
}
]
}