public static RecordValue RecordFromProperties(object obj, Type type) { RecordValue r = RecordFromFields( from prop in type.GetProperties(BindingFlags.Public | BindingFlags.Instance) let fieldValue = prop.GetValue(obj) select new NamedValue(prop.Name, New(fieldValue, prop.PropertyType))); return(r); }
private static RecordValue GuaranteeRecord(FormulaValue rawVal) { if (rawVal is RecordValue record) { return(record); } // Handle the single-column-table case. var defaultField = new NamedValue("Value", rawVal); RecordValue val = RecordFromFields(defaultField); return(val); }