Example #1
0
        public override string ToString()
        {
            string value;

            switch (TypeCode)
            {
            case DataCenterTypeCode.None:
                value = "N/A";
                break;

            case DataCenterTypeCode.Int32:
                value = AsInt32.ToString();
                break;

            case DataCenterTypeCode.Single:
                value = AsSingle.ToString();
                break;

            case DataCenterTypeCode.String:
                value = $"\"{AsString}\"";
                break;

            case DataCenterTypeCode.Boolean:
                value = AsBoolean.ToString();
                break;

            default:
                throw Assert.Unreachable();
            }

            return($"[Name: {Name}, Type: {TypeCode}, Value: {value}]");
        }
        public override int GetHashCode()
        {
            var hash = -1521134295;

            hash = hash * -1521134295 + TypeCode.GetHashCode();

            int vhash;

            switch (TypeCode)
            {
            case DataCenterTypeCode.None:
                vhash = 0;
                break;

            case DataCenterTypeCode.Int32:
                vhash = AsInt32.GetHashCode();
                break;

            case DataCenterTypeCode.Single:
                vhash = AsSingle.GetHashCode();
                break;

            case DataCenterTypeCode.String:
                vhash = AsString.GetHashCode();
                break;

            case DataCenterTypeCode.Boolean:
                vhash = AsBoolean.GetHashCode();
                break;

            default:
                throw Assert.Unreachable();
            }

            hash = hash * -1521134295 + vhash;

            return(hash);
        }
        public override string ToString()
        {
            switch (TypeCode)
            {
            case DataCenterTypeCode.None:
                return("null");

            case DataCenterTypeCode.Int32:
                return(AsInt32.ToString());

            case DataCenterTypeCode.Single:
                return(AsSingle.ToString());

            case DataCenterTypeCode.String:
                return(AsString);

            case DataCenterTypeCode.Boolean:
                return(AsBoolean.ToString());

            default:
                throw Assert.Unreachable();
            }
        }