public WrappedVariable(string variableName, object value, Type type, bool generateMetadata) : base(variableName, type, generateMetadata) { this.value = value; bool isArray = type.IsArray; bool isGenericList = TypeUtility.IsGenericList(type); // Root data type or element type of collection is unknown if (this.dataType == DataType.Unknown) { if (isArray || isGenericList) { IList list = (IList)value; int count = list.Count; List <string> unknownList = new List <string>(count); for (int i = 0; i < count; i++) { unknownList.Add(type.Name); } this.value = unknownList; } else { // Let's just use the type of the value to help us debug this.value = type.Name; } } else if (this.dataType == DataType.Enum) { Type enumElementType = TypeUtility.GetElementType(this.value.GetType()); // Convert enums to underlying type if (enumElementType.IsEnum) { Type underlyingType = Enum.GetUnderlyingType(enumElementType); this.value = TypeUtility.ChangeElementType(this.value, underlyingType); } } CacheDisplayNames(); }