public uint SetConfigValue <T>(string config_key, T value) where T : IConvertible { uint requestId = 0; eLeapRS result; Type dataType = value.GetType(); if (dataType == typeof(bool)) { result = LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToBoolean(value), out requestId); } else if (dataType == typeof(Int32)) { result = LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToInt32(value), out requestId); } else if (dataType == typeof(float)) { result = LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToSingle(value), out requestId); } else if (dataType == typeof(string)) { result = LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToString(value), out requestId); } else { throw new ArgumentException("Only boolean, Int32, float, and string types are supported."); } reportAbnormalResults("LeapC SaveConfigValue call was ", result); _configRequests[requestId] = config_key; return(requestId); }