protected HtmlElement CreateHeaderElement(object obj, string detailsText = null) { if (obj == null) { throw new ArgumentNullException(nameof(obj)); } return(CreateHeaderElement(RepresentedType.Lookup(obj.GetType()), detailsText)); }
public InteractiveEnumerable(int depth, IEnumerable enumerable, InteractiveItemPreparer itemPreparer) : base(depth, itemPreparer) { if (enumerable == null) { throw new ArgumentNullException(nameof(enumerable)); } this.enumerable = enumerable; RepresentedType = RepresentedType.Lookup(enumerable.GetType()); }
public ReflectionInteractiveObject(int depth, object representedObject, InteractiveItemPreparer itemPreparer, RepresentedMemberPredicate memberFilter = null) : base(depth, itemPreparer) { if (representedObject == null) { throw new ArgumentNullException(nameof(representedObject)); } this.representedObject = representedObject; this.memberFilter = memberFilter; RepresentedObjectHandle = ObjectCache.Shared.GetHandle(representedObject); RepresentedType = RepresentedType.Lookup(representedObject.GetType()); }
public EnumValue(Enum value) { var type = value.GetType(); var underlyingType = Enum.GetUnderlyingType(type); representedType = RepresentedType.Lookup(type); this.underlyingType = RepresentedType.Lookup(underlyingType); this.value = Convert.ChangeType(value, underlyingType, CultureInfo.InvariantCulture); names = Enum.GetNames(type); isFlags = type.IsDefined(typeof(FlagsAttribute), false); var values = Enum.GetValues(type); this.values = new object [values.Length]; for (int i = 0; i < values.Length; i++) { this.values [i] = Convert.ChangeType( values.GetValue(i), underlyingType, CultureInfo.InvariantCulture); } }
internal Evaluation( CodeCellId codeCellId, EvaluationStatus status, EvaluationResultHandling resultHandling, object value, TimeSpan evaluationDuration = default, int cultureLCID = 0, int uiCultureLCID = 0, bool initializedIntegration = false, IReadOnlyList <AssemblyDefinition> loadedAssemblies = null) { CodeCellId = codeCellId; Status = status; ResultHandling = resultHandling; switch (value) { case null: ResultRepresentations = Array.Empty <object> (); break; case RepresentedObject representedObject: ResultType = representedObject.RepresentedType; ResultRepresentations = representedObject; break; default: ResultType = RepresentedType.Lookup(value.GetType()); ResultRepresentations = new [] { value }; break; } EvaluationDuration = evaluationDuration; CultureLCID = cultureLCID; UICultureLCID = uiCultureLCID; InitializedIntegration = initializedIntegration; LoadedAssemblies = loadedAssemblies ?? Array.Empty <AssemblyDefinition> (); }
public CodeCellResultEvent( CodeCellId codeCellId, EvaluationResultHandling resultHandling, object value) { CodeCellId = codeCellId; ResultHandling = resultHandling; switch (value) { case null: break; case RepresentedObject representedObject: Type = representedObject.RepresentedType; ValueRepresentations = representedObject; break; default: Type = RepresentedType.Lookup(value.GetType()); ValueRepresentations = new [] { value }; break; } }
protected override IRepresentedType GetValue(string value) => RepresentedType.Lookup(value);