Skip to content

Commit

Permalink
added GetAll(Type) method
Browse files Browse the repository at this point in the history
  • Loading branch information
kennelken committed Nov 27, 2023
1 parent 0115406 commit 33f73cc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/server/generators/generator_csharp_runner.dart
Expand Up @@ -1038,6 +1038,17 @@ using Rectangle = System.Drawing.RectangleF;
return items as List<T>;
}
public IList GetAll(Type type)
{
if (!AllItemsByType.TryGetValue(type, out var items))
{
items = _emptyCollectionFactory.List(type);
AllItemsByType[type] = items;
}
return items as IList;
}
/// <summary>
/// Supposed to be called only once when the model is parsed
/// </summary>
Expand Down Expand Up @@ -1127,6 +1138,18 @@ using Rectangle = System.Drawing.RectangleF;
return list as List<T>;
}
public IList List(Type type)
{
if (!_lists.TryGetValue(type, out var list))
{
var genericListType = typeof(List<>);
var concreteListType = genericListType.MakeGenericType(type);
list = Activator.CreateInstance(concreteListType, Array.Empty<object>());
_lists[type] = list;
}
return list as IList;
}
private Dictionary<Type, object> _hashsets = new Dictionary<Type, object>();
public HashSet<T> HashSet<T>()
Expand Down

0 comments on commit 33f73cc

Please sign in to comment.