/// <summary> /// Builds the data table with statistics /// </summary> /// <param name="tableName">Name of the table.</param> /// <returns></returns> public DataTable buildDataTable(string tableName) { TEnum keyOfTheFirst = (TEnum)this.Keys.imbGetItemAt(0, false); settingsMemberInfoEntry key_mie = new settingsMemberInfoEntry(typeof(TEnum)); settingsMemberInfoEntry value_mie = new settingsMemberInfoEntry(typeof(T)); instanceCountPipeLine <T> ot = this[keyOfTheFirst]; if (ot == null) { } var o = ot.self; foreach (KeyValuePair <TEnum, instanceCountPipeLine <T> > oti in this) { ot = oti.Value; ot.self.reCalculate(instanceCountCollection <T> .preCalculateTasks.all); } DataTable output = this.BuildDataTableHorDictionary("self", key_mie.displayName, PropertyEntryColumn.property_description | PropertyEntryColumn.role_letter | PropertyEntryColumn.role_symbol, new string[] { nameof(o.Count), nameof(o.avgFreq), nameof(o.minFreq), nameof(o.maxFreq), nameof(o.medianFreq), nameof(o.varianceFreq), nameof(o.entropyFreq) }); /* * buildDataTable(tableName, * imbDataTableExtensions.buildDataTableOptions.doInsertAutocountColumn|imbDataTableExtensions.buildDataTableOptions.doOnlyWithDisplayName|imbDataTableExtensions.buildDataTableOptions.doInsertItemTitleColumn, globalMeasureUnitDictionary.stats); */ output.Title(tableName); return(output); }
/// <summary> /// Gets the description for dictionary, property table etc /// </summary> /// <param name="k">The k.</param> /// <returns></returns> public static String getDescriptionForDictionary(this Object k) { settingsMemberInfoEntry tmp = null; Type kt = k.GetType(); MemberInfo memberInfo = kt; String desc = ""; if (k is PropertyEntryColumn) { desc = PropertyEntryColumnExtensions.getDescriptionForKey((PropertyEntryColumn)k); } else if (k is Enum) { memberInfo = kt.GetMember(k.ToString()).First(); tmp = new settingsMemberInfoEntry(memberInfo); desc = tmp.description; if (tmp.description.isNullOrEmptyString()) { desc = tmp.displayName; } } else { tmp = new settingsMemberInfoEntry(kt); desc = tmp.description; } return(desc); }
public static Dictionary <Object, settingsMemberInfoEntry> getMemberInfoDictionaryForKeys(this IEnumerable <Object> keys) { Dictionary <Object, settingsMemberInfoEntry> output = new Dictionary <object, settingsMemberInfoEntry>(); foreach (Object k in keys) { settingsMemberInfoEntry tmp = null; Type kt = k.GetType(); MemberInfo memberInfo = kt; if (k is Enum) { memberInfo = kt.GetMember(k.ToString()).First(); tmp = new settingsMemberInfoEntry(memberInfo); } else if (k is String) { tmp = new settingsMemberInfoEntry(k); } if (kt.IsValueType) { tmp = new settingsMemberInfoEntry(k); } else { tmp = new settingsMemberInfoEntry(kt); } output.Add(k, tmp); } return(output); }
/// <summary> /// Adds column using object <c>source</c> reflection information /// </summary> /// <param name="dt">The dt.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="source">The source.</param> /// <param name="seo">The seo.</param> /// <returns></returns> public static DataColumn AddToShema(this DataTable dt, string propertyName, object source = null, settingsEntriesForObject seo = null) { if (source == null) { source = dt.ExtendedProperties[templateFieldDataTable.shema_sourceinstance] as IDataRowSetter; } var dc = dt.Columns.Add(propertyName, typeof(string)); if (seo == null) { seo = new settingsEntriesForObject(source); } if (!seo.spes.ContainsKey(propertyName)) { dc.Caption = propertyName; } else { settingsMemberInfoEntry smi = seo.spes[propertyName]; dc.Caption = smi.displayName; // smi.exportPropertyCollection(dc.ExtendedProperties); } return(dc); }
//protected modelRecordBase() //{ // _modelRecordCommonSetup(); //} private void _modelRecordCommonSetup() { _modelRecordGlobalCount.Add(true); id_global = modelRecordGlobalCount + 1; timeStart = DateTime.Now; timeFinish = DateTime.Now; iTI = new settingsMemberInfoEntry(this); }
public static Label GetLetterLabel(this settingsMemberInfoEntry memberEntry) { Label output = new Label(); output.Text = memberEntry.letter; return(output); }
/// <summary> /// Learns the about related instance/key object /// </summary> /// <param name="instanceOrKey">The instance or key.</param> internal void learnAboutInstance(object instanceOrKey) { instanceTypeInfo = new settingsMemberInfoEntry(instanceOrKey); PropertyEntry pe = new PropertyEntry(instanceTypeInfo.displayName, instanceOrKey); instanceOrKeyData = new PropertyCollectionExtended(); instanceOrKeyData.AppendVertically(pe); }
public static DataTable SetSME(this DataTable table, settingsMemberInfoEntry sme) { table.SetClassType(sme.memberInfo as Type); table.SetClassName(sme.name); table.SetDescription(sme.description); table.SetExtraDesc(sme.additionalInfo); return(table); }
public static settingsMemberInfoEntry GetSME(this DataTable table) { settingsMemberInfoEntry sme = new settingsMemberInfoEntry(); sme.name = table.GetClassName(); sme.memberInfo = table.GetClassType(); sme.additionalInfo = table.GetExtraDesc(); sme.description = table.GetDescription(); return(sme); // sme.categoryName = table.GetC }
/// <summary> /// Takes Attribute values to set name and description for the collection /// </summary> /// <param name="item">The item.</param> /// <param name="instanceID">The instance identifier.</param> /// <returns></returns> public String Add(PropertyCollectionExtended item, Enum instanceID) { settingsMemberInfoEntry mie = new settingsMemberInfoEntry(instanceID); if (!imbSciStringExtensions.isNullOrEmptyString(mie.displayName)) { item.name = mie.displayName; } if (!imbSciStringExtensions.isNullOrEmptyString(mie.description)) { item.description = mie.displayName; } return(Add(item, item.name, true)); }
/// <summary> /// Initializes a new instance of the <see cref="aceOperationArgs"/> class. /// </summary> /// <param name="__executor">The executor.</param> /// <param name="__menu">The menu.</param> /// <param name="__item">The item.</param> /// <param name="__method">The method.</param> /// <param name="__component">The component.</param> public aceOperationArgs(aceOperationSetExecutorBase __executor, aceMenuItemCollection __menu, aceMenuItem __item, MethodInfo __method, IAceComponent __component = null) { _executor = __executor; _menu = __menu; _item = __item; _method = __method; _component = __component; _itemMetaData = new aceMenuItemMeta(_method); _methodInfo = new settingsMemberInfoEntry(_method); _item.deployMeta(_itemMetaData, this); _paramSet = itemMetaData.cmdParams; }
internal static void setByMemberInfo(this commandTreeDescription item, MemberInfo __m) { settingsMemberInfoEntry mi = new settingsMemberInfoEntry(__m); aceMenuItemMeta mm = new aceMenuItemMeta(__m); commandTreeDescription desc = item; desc.memberMeta = mi; desc.menuMeta = mm; desc.name = mm.getEntrySafe(aceMenuItemAttributeRole.DisplayName, mi.name); desc.category = mm.getEntrySafe(aceMenuItemAttributeRole.Category).or(mi.categoryName, "Main"); desc.nodeLevel = commandTreeNodeLevel.group; }
public helpBuilderContext(helpBuilderConfiguration _configuration, Object _scope, string _filename = "") { configuration = _configuration; scope = _scope; scopeType = scope.GetType(); scopeEntry = new settingsMemberInfoEntry(scopeType); if (_filename.isNullOrEmpty()) { _filename = "help"; } filename = _filename; folder = new folderNode(configuration.outputPath, "Help", "Generated help content"); folder = folder.Add(scopeType.Name, scopeType.Name, "Help output for [" + scopeType.Name + "]"); resourcesFolder = new folderNode(configuration.resourcesPath, "Help resources", "Content resources for help generation"); // }
/// <summary> /// Deploys <c>cmdParams</c> and other information from member information. /// </summary> /// <param name="mi">The mi.</param> protected void deployFromMemberInfo(MemberInfo mi) { this.autoDefaultValues("", true); settingsMemberInfoEntry mie = new settingsMemberInfoEntry(mi); String methodName = mi.Name.removeStartsWith(METHOD_PREFIX); String displayName = methodName; this[aceMenuItemAttributeRole.Category] = mie.categoryName; if (!mie.categoryName.isNullOrEmpty()) { displayName = methodName.removeStartsWith(mie.categoryName); } this[aceMenuItemAttributeRole.Description] = mie.description; this[aceMenuItemAttributeRole.Category] = mie.categoryName; this[aceMenuItemAttributeRole.DisplayName] = displayName; this[aceMenuItemAttributeRole.Key] = mie.letter; if (!mie.prompt.isNullOrEmpty()) { this[aceMenuItemAttributeRole.ConfirmMessage] = mie.prompt; } var ma = mi.GetCustomAttributes(typeof(aceMenuItemAttribute), false); foreach (aceMenuItemAttribute amia in ma) { this[amia.role] = amia.setting; } if (!String.IsNullOrEmpty(this[aceMenuItemAttributeRole.aliasNames])) { var als = this[aceMenuItemAttributeRole.aliasNames].Split(';'); aliasList.AddRange(als); } //aliasList.AddUnique(displayName); aliasList.AddUnique(methodName); if (!String.IsNullOrEmpty(this[aceMenuItemAttributeRole.CmdParamList])) { var tmp = this[aceMenuItemAttributeRole.CmdParamList]; _cmdParams = new typedParamCollection(tmp); } else { if (mi is MethodInfo) { MethodInfo mInfo = mi as MethodInfo; var parms = mInfo.GetParameters(); if (parms.count() > 0) { if (parms[0].ParameterType != typeof(aceOperationArgs)) { isMethodWithParameters = true; _cmdParams = new typedParamCollection(mi as MethodInfo); } } } // <-------------- direct method support>>> methods with normal arguments, not aceOperationArgs >>> } if (_cmdParams == null) { _cmdParams = new typedParamCollection(); } if (String.IsNullOrEmpty(this[aceMenuItemAttributeRole.DisplayName])) { this[aceMenuItemAttributeRole.DisplayName] = mi.Name; } //t.GetCustomAttributes(false); }
/// <summary> /// Builds the type of the tree node for. /// </summary> /// <param name="type">The type.</param> /// <param name="source">The source.</param> /// <param name="host">The host.</param> /// <returns></returns> internal static commandTreeDescription BuildTreeNodeForType(Type type, IAceOperationSetExecutor source, commandTreeDescription parent, String nameOverride = "", commandTreeNodeLevel level = commandTreeNodeLevel.type) { settingsMemberInfoEntry typeInfo = new settingsMemberInfoEntry(type); commandTreeDescription output = parent.Add(nameOverride.or(typeInfo.name, typeInfo.displayName, type.Name)); commandTree host = parent.root as commandTree; output.description = typeInfo.description; output.nodeLevel = level; output.helpLines.Add(typeInfo.info_helpTitle); output.helpLines.Add(typeInfo.info_helpTips); output.helpLines.AddRange(typeInfo.additionalInfo); var methods = type.GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly); aceDictionarySet <String, commandTreeDescription> groups = new aceDictionarySet <string, commandTreeDescription>(); aceDictionarySet <String, commandTreeDescription> group_nodes = new aceDictionarySet <string, commandTreeDescription>(); foreach (MemberInfo __m in methods) { if (__m.Name.StartsWith(aceMenuItemMeta.METHOD_PREFIX)) { commandTreeDescription desc = new commandTreeDescription(); desc.setByMemberInfo(__m); desc.nodeLevel = commandTreeNodeLevel.group; groups.Add(desc.category, desc); } } foreach (String group in groups.Keys.OrderBy(x => x)) { var ordered = groups[group].OrderBy(x => x.name); commandTreeDescription gdesc = parent.Add(group); gdesc.nodeLevel = commandTreeNodeLevel.group; foreach (var cdesc in ordered) { cdesc.nodeLevel = commandTreeNodeLevel.command; gdesc.Add(cdesc, cdesc.name); host.flatAccess.Add(cdesc.path, cdesc); } } var properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); foreach (PropertyInfo pi in properties) { if (pi.DeclaringType.Name == "aceCommandConsole") { continue; } if (pi.DeclaringType.Name == "aceAdvancedConsole") { continue; } if (pi.PropertyType.GetInterfaces().Contains(typeof(IAceOperationSetExecutor))) { var plugin_instance = source.imbGetPropertySafe(pi) as IAceOperationSetExecutor; var plugin_node = BuildTreeNodeForType(pi.PropertyType, source, parent, pi.Name, commandTreeNodeLevel.plugin); plugin_node.setByMemberInfo(pi); host.plugins.Add(plugin_node.path, plugin_instance); } else if (pi.PropertyType.IsValueType || pi.PropertyType.isTextOrNumber() || pi.GetCustomAttributes(false).Any()) { if (pi.CanWrite) { var prop = parent.Add(pi.Name); prop.setByMemberInfo(pi); prop.nodeLevel = commandTreeNodeLevel.parameter; host.properties.Add(prop.path, pi); } } else if (pi.PropertyType.IsClass || pi.GetCustomAttributes(false).Any()) { if (!pi.PropertyType.IsGenericType) { var prop = parent.Add(pi.Name); prop.setByMemberInfo(pi); prop.nodeLevel = commandTreeNodeLevel.module; host.modules.Add(prop.path, pi); } } } return(output); }
/// <summary> /// Deploys the descriptor base. /// </summary> /// <param name="memberInfo">The member information.</param> /// <param name="attribute">The attribute.</param> /// <param name="instance">The instance.</param> protected void deployDescriptorBase(MemberInfo memberInfo, fileDataBaseAttribute attribute, Object instance = null) { filenameMode = attribute.filenameMode; nameOrPropertyPath = attribute.nameOrPropertyPath; options = attribute.options; memberMetaInfo = new settingsMemberInfoEntry(memberInfo); name = memberMetaInfo.displayName.or(memberInfo.Name); description = memberMetaInfo.description; formatMode = attribute.formatMode; if (memberInfo is PropertyInfo) { PropertyInfo pi = memberInfo as PropertyInfo; type = pi.PropertyType; if (type.GetInterface(nameof(ISupportLoadSave)) != null) { options |= fileDataPropertyOptions.SupportLoadSave; if (formatMode == fileDataPropertyMode.autoTextOrXml) { formatMode = fileDataPropertyMode.XML; } } if (formatMode == fileDataPropertyMode.autoTextOrXml) { if (type == typeof(String)) { formatMode = fileDataPropertyMode.text; } else if (type == typeof(List <String>)) { if (options.HasFlag(fileDataPropertyOptions.itemAsFile)) { formatMode = fileDataPropertyMode.text; } else { formatMode = fileDataPropertyMode.XML; } } else { formatMode = fileDataPropertyMode.XML; } } } else if (memberInfo is Type) { type = memberInfo as Type; if (formatMode == fileDataPropertyMode.autoTextOrXml) { formatMode = fileDataPropertyMode.XML; } } switch (filenameMode) { case fileDataFilenameMode.customName: filename = attribute.nameOrPropertyPath; break; case fileDataFilenameMode.memberInfoName: filename = memberInfo.Name.getCleanFilepath(""); break; case fileDataFilenameMode.propertyValue: if (instance != null) { PropertyExpression pexp = new PropertyExpression(instance, attribute.nameOrPropertyPath); filename = pexp.getValue().toStringSafe(memberInfo.Name).getCleanFilepath(""); } else { filename = attribute.nameOrPropertyPath.getCleanFilepath(""); } break; } }
/// <summary> /// Constructs meta content /// </summary> /// <param name="output">The output.</param> /// <param name="meta">The meta.</param> /// <param name="helpContext">The help context.</param> /// <param name="item">The item.</param> public void GenerateMetaContent(ITextRender output, imbMetaAttributeEnum meta, settingsMemberInfoEntry item) { String metaSectionTitle = ""; folderNode resfolder = resourcesFolder; //= helpContext.resourcesFolder.Add(item.relevantTypeName, item.relevantTypeName, "Resources for class [" + item.relevantTypeName + "]"); if (!item.metaAttributeSet[meta].Any()) { return; } switch (meta) { case imbMetaAttributeEnum.AttachContent: case imbMetaAttributeEnum.AttachExample: resfolder = resourcesFolder.Add(item.relevantTypeName, item.relevantTypeName, "Resources for class [" + item.relevantTypeName + "]"); break; } switch (meta) { case imbMetaAttributeEnum.AddContextProperty: break; case imbMetaAttributeEnum.AddExampleInLine: foreach (imbMetaAttribute att in item.metaAttributeSet[meta]) { output.open("div", att.caption, att.description); output.AppendCode(att.path); output.close(); } break; case imbMetaAttributeEnum.AttachExample: foreach (imbMetaAttribute att in item.metaAttributeSet[meta]) { String p = resfolder.findFile(att.path, SearchOption.AllDirectories); output.open("div", att.caption, att.description); if (File.Exists(p)) { String src = File.ReadAllText(p); output.AppendCode(src); } output.close(); } break; case imbMetaAttributeEnum.AddProjectProperty: break; case imbMetaAttributeEnum.AddSearchLink: foreach (imbMetaAttribute att in item.metaAttributeSet[meta]) { if (att.path.Contains("{0}")) { att.path = String.Format(att.path, item.name); } if (att.description.Contains("{0}")) { att.description = String.Format(att.description, item.name); } output.AppendLink(att.path, att.description, att.caption); } break; case imbMetaAttributeEnum.AttachContent: //var folder = helpContext.resourcesFolder.Add(item.relevantTypeName, item.relevantTypeName, "Resources for class [" + item.relevantTypeName + "]"); foreach (imbMetaAttribute att in item.metaAttributeSet[meta]) { String p = resfolder.findFile(att.path, SearchOption.AllDirectories); if (File.Exists(p)) { String src = File.ReadAllText(p); output.AppendDirect(src); } } break; case imbMetaAttributeEnum.AttachLink: //output.open("div", "Related content", ""); foreach (imbMetaAttribute att in item.metaAttributeSet[meta]) { output.AppendLink(att.path, att.description, att.caption); } //output.close(); break; } output.AppendHorizontalLine(); }
/// <summary> /// 2017:: Builds horizontal data table with columns mapping properties of the type. /// </summary> /// <remarks> /// <para>If fieldsCategoriesToShow[] parameters array is empty - filters are not applied</para> /// </remarks> /// <param name="firstItem">Type or Instance to be used for column estraction.</param> /// <param name="__dataTable">Name of data table. If empty or null = type name is used.</param> /// <param name="doInsertItem">If TRUE and first parametar was Instance - it will be transfered as the first row in the DataTable</param> /// <param name="doOnlyWithDisplayName">Only properties with DisplayName attribute. Value of attribute will be mapped to Caption of column</param> /// <param name="doInherited">Should inherited properties be included? FALSE to get only properties declared at class of the object</param> /// <param name="fieldsOrCategoriesToShow">Category or property name to include in DataTable. If its empty it will ignore this criteria. Entries ending with _ are prefix definisions</param> /// <returns>DataTable object with proper DataColumn shema made from Primitive, Enum and ToStrings</returns> public static DataTable buildDataTable(this object firstItem, string __dataTable, buildDataTableOptions options, PropertyCollectionExtended dictionary, string[] fieldsOrCategoriesToShow = null, ILogBuilder logger = null) { bool doInsertItem = options.HasFlag(buildDataTableOptions.doInsertItem); bool doOnlyWithDisplayName = options.HasFlag(buildDataTableOptions.doOnlyWithDisplayName); bool doInherited = options.HasFlag(buildDataTableOptions.doInherited); bool doInsertAutocountColumn = options.HasFlag(buildDataTableOptions.doInsertAutocountColumn); DataTable output = new DataTable(__dataTable); if (firstItem == null) { throw new dataException("firstItem is null -- can't buildDataTable!"); return(output); } if (dictionary != null) { dictionary = globalMeasureUnitDictionary.units; } BindingFlags flags = BindingFlags.Instance; string prefix = ""; List <string> filters = fieldsOrCategoriesToShow.getFlatList <string>(); if (filters.Any(x => x.EndsWith("_"))) { prefix = filters.First(x => x.EndsWith("_")); filters.Remove(prefix); } if (!doInherited) { flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance; } else { flags = BindingFlags.Public | BindingFlags.Instance; } Type itemType = firstItem as Type; if (itemType == null) { itemType = firstItem.GetType(); } if (imbSciStringExtensions.isNullOrEmptyString(__dataTable)) { __dataTable = itemType.Name; } output.TableName = __dataTable; List <DataColumn> columnList = new List <DataColumn>(); if (options.HasFlag(buildDataTableOptions.doInsertAutocountColumn)) { DataColumn dc = new DataColumn("#", typeof(int)); dc.AutoIncrement = true; dc.AutoIncrementSeed = 1; columnList.Add(dc); } if (options.HasFlag(buildDataTableOptions.doInsertItemTitleColumn)) { DataColumn dc = new DataColumn(globalMeasureUnitDictionary.globalMeasureEnum.itemTitle.ToString(), typeof(string)); columnList.Add(dc); } PropertyInfo[] propList = itemType.GetProperties(flags); foreach (PropertyInfo pi in propList) { PropertyCollection extraData = new PropertyCollection(); imbAttributeCollection imb = imbAttributeTools.getImbAttributeDictionary(pi); object[] atts = pi.GetCustomAttributes(true); List <string> tokenList = new List <string>(); tokenList.Add(pi.Name); tokenList.Add(pi.Name.ToLower()); bool pass = false; settingsMemberInfoEntry me = new settingsMemberInfoEntry(pi, dictionary); tokenList.AddSeveral(me.displayName, me.categoryName); if (doOnlyWithDisplayName) { pass = (tokenList.Count() > 2); } else { pass = true; } if (pass) { if (filters.Any()) { pass = filters.Any(x => tokenList.Contains(x, StringComparer.CurrentCultureIgnoreCase)); } } if (pass) { if (pi.PropertyType.isSimpleInputEnough() || pi.PropertyType.isEnum()) { } else { //Type IInterface = pi.PropertyType.GetInterface(nameof(IGetToSetFromString)); //if (IInterface == null) //{ // pass = false; //} //else //{ // pass = true; //} } } if (pass) { string fieldName = prefix.add(pi.Name, "_"); string format = imb.getMessage(imbAttributeName.reporting_valueformat, ""); DataColumn dc = new DataColumn(fieldName, pi.PropertyType, "", MappingType.Attribute); if (tokenList.Count > 2) { dc.Caption = tokenList[2]; } else { dc.Caption = pi.Name.imbTitleCamelOperation(true); } dc.DataType = pi.PropertyType; // extraData[name_tokens] = tokenList; // extraData[templateFieldInfo] = firstItem; extraData[imbAttributeName.reporting_valueformat] = format; //* extraData[imbAttributeName.measure_displayGroup] = imb.getProperString(me.categoryName, imbAttributeName.measure_displayGroup, imbAttributeName.menuGroupPath); //* extraData[imbAttributeName.measure_important] = imb.getMessage(imbAttributeName.measure_important, dataPointImportance.normal); //* extraData[templateFieldDataTable.col_type] = pi.PropertyType; extraData[templateFieldDataTable.col_directAppend] = imb.ContainsKey(imbAttributeName.reporting_escapeoff); extraData[templateFieldDataTable.col_attributes] = imb; extraData[templateFieldDataTable.col_propertyInfo] = pi; extraData[templateFieldDataTable.col_desc] = imb.getStringLine(Environment.NewLine, imbAttributeName.menuHelp, imbAttributeName.help, imbAttributeName.helpDescription, imbAttributeName.helpPurpose); extraData[templateFieldDataTable.col_format] = format; //* dc.ExtendedProperties.copyInto(extraData); if (me.pe != null) { dc.ExtendedProperties.copyInto(me.pe); dc.ExtendedProperties[templateFieldDataTable.col_pe] = me.pe; dc.ColumnName = me.pe[PropertyEntryColumn.entry_key].toStringSafe(); } if (output.Columns.Contains(dc.ColumnName)) { if (logger != null) { logger.log("ColumnName [" + dc.ColumnName + "] already defined in table [" + output.TableName + "]"); } } else { output.Columns.Add(dc); } } } // if (doInsertItem) { if (firstItem is Type) { // -- it was type } else { output.AddObject(firstItem); } } output.ExtendedProperties[templateFieldDataTable.shema_sourcename] = ""; output.ExtendedProperties[templateFieldDataTable.shema_sourceinstance] = "runtime type"; output.ExtendedProperties[templateFieldDataTable.shema_classname] = firstItem.GetType().Name; return(output); }