Closed daniellaillouz closed 5 years ago
in my c# code there is variable type of another class that declared in another file.
I have to generate import statement to those classes also have multiple classes in the same file.
I tried to do this:
string Imports(Class c, File f) { IEnumerable<String> classes = f.Classes.Select(p=> p.name); IEnumerable<Type> types = c.Properties .Select(p => p.Type) .Where(t =>((!t.IsPrimitive || t.IsEnum) && !classes.Contains(t.name))) .Select(t => t.IsGeneric ? t.TypeArguments.First() : t) .Where(t => t.Name != c.Name && t.Name != "DbGeography") .Distinct(); return string.Join(Environment.NewLine, types.Select(t => $"import {{ {t.Name} }} from './misc';").Distinct()); } $Classes(*DTO)[ $Imports export interface $Name { $Properties[ // $LoudName $name: $Type;] }]
but its not working, any idea?
in my c# code there is variable type of another class that declared in another file.
I have to generate import statement to those classes also have multiple classes in the same file.
I tried to do this:
but its not working, any idea?