Пример #1
0
 /// <summary>
 /// Gets the terminal resource for a given type or null if there is no such resource
 /// </summary>
 public ITerminalResource <T> SafeGetTerminalResource <T>() where T : Terminal => ResourceByType.SafeGet(typeof(T)) as ITerminalResource <T>;
Пример #2
0
 /// <summary>
 /// Gets the terminal resource for a given type, and throws an UnknownResource exception
 /// if there is no such resource
 /// </summary>
 public ITerminalResource <T> GetTerminalResource <T>() where T : Terminal => ResourceByType.SafeGet(typeof(T)) as ITerminalResource <T>
 ?? throw new UnknownResource(typeof(T).GetRESTableTypeName());
Пример #3
0
 /// <summary>
 /// Gets the terminal resource for a given type or null if there is no such resource
 /// </summary>
 public IResource <T> SafeGetResource <T>() where T : class => ResourceByType.SafeGet(typeof(T)) as IResource <T>;
Пример #4
0
 /// <summary>
 /// Gets the terminal resource for a given type, and throws an UnknownResource exception
 /// if there is no such resource
 /// </summary>
 public IResource <T> GetResource <T>() where T : class => ResourceByType.SafeGet(typeof(T)) as IResource <T>
 ?? throw new UnknownResource(typeof(T).GetRESTableTypeName());
Пример #5
0
 /// <summary>
 /// Gets the resource for a given type or returns null if there is no such resource
 /// </summary>
 public IResource SafeGetResource(Type type) => ResourceByType.SafeGet(type);
Пример #6
0
 /// Gets the resource for a given type, or throws an UnknownResource exception if there is no such resource
 /// </summary>
 public IResource GetResource(Type type) => ResourceByType.SafeGet(type) ?? throw new UnknownResource(type.GetRESTableTypeName());