private object Create() { if (_creator == null) { _creator = CreatorProvider.GetCreator <T>(); } return(_creator.Invoke()); }
private object Create() { if (_creator == null) { _creator = _creatorType switch { CreatorType.SpecifiedType => CreatorProvider.GetCreator <T>(), CreatorType.SpecifiedTypeDictionary => CreatorProvider.GetCreator(typeof(Dictionary <,>).MakeGenericType(_dictionaryKeyType, _dictionaryValueType)), CreatorType.ObjectDictionary => () => new Dictionary <string, object>(), _ => throw new InvalidOperationException(), }; } return(_creator.Invoke()); }
private object Create() { if (_creator == null) { _creator = _creatorType switch { CreatorType.SpecifiedType => CreatorProvider.GetCreator <T>(), CreatorType.SpecifiedTypeList => CreatorProvider.GetCreator(typeof(List <>).MakeGenericType(_listValueType)), CreatorType.ObjectList => () => new List <object>(), _ => throw new InvalidOperationException(), }; } return(_creator.Invoke()); }