public ObjectFormula <T> CreateReferenceEnumerableFormula <T>(object context) where T : IReferenceEnumerable { var typename = typeof(T).Name; if (typename.Contains("`")) { typename = typename.Substring(0, typename.IndexOf('`')); } var f = new ObjectFormula <T>($"{typename}[{string.Join(", ", typeof(T).GetGenericArguments().Select(x => x.Name).ToArray())}]({Value.TrimStart('=')})", context, true); var import = $"from {typeof(T).Namespace} import {typename};"; var imports = new List <string>(); imports.Add(import); foreach (var genparm in typeof(T).GetGenericArguments()) { var typename2 = genparm.Name; if (typename2.Contains("`")) { typename2 = typename.Substring(0, typename2.IndexOf('`')); } imports.Add($"from {genparm.Namespace} import {typename2};"); } var script = new PythonScript("Import", string.Join("\n", imports)); if (f.ExternalScripts == null) { f.ExternalScripts = new PythonScript[] { script } } ; else { f.ExternalScripts = f.ExternalScripts.Append(script).ToArray(); } return(f); }
public int CompareTo(ObjectFormula <T> other) { throw new NotSupportedException(); }
public bool Equals(ObjectFormula <T> other) { return(IsDynamic == other.IsDynamic && Text == other.Text && Context == other.Context); }