using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SmartCoalApplication.Base { public sealed class BoxedConstants { private static object[] boxedInt32 = new object[1024]; private static object boxedTrue = (object)true; private static object boxedFalse = (object)false; public static object GetInt32(int value) { if (value >= boxedInt32.Length || value < 0) { return (object)value; } if (boxedInt32[value] == null) { boxedInt32[value] = (object)value; } return boxedInt32[value]; } public static object GetBoolean(bool value) { return value ? boxedTrue : boxedFalse; } static BoxedConstants() { } private BoxedConstants() { } } }