mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Use 'new' expression in places where the type is evident for the engine (#1415)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
@@ -18,18 +18,18 @@ namespace Robust.Shared.IoC
|
||||
/// <summary>
|
||||
/// Dictionary that maps the types passed to <see cref="Resolve{T}"/> to their implementation.
|
||||
/// </summary>
|
||||
private readonly Dictionary<Type, object> _services = new Dictionary<Type, object>();
|
||||
private readonly Dictionary<Type, object> _services = new();
|
||||
|
||||
/// <summary>
|
||||
/// The types interface types mapping to their registered implementations.
|
||||
/// This is pulled from to make a service if it doesn't exist yet.
|
||||
/// </summary>
|
||||
private readonly Dictionary<Type, Type> _resolveTypes = new Dictionary<Type, Type>();
|
||||
private readonly Dictionary<Type, Type> _resolveTypes = new();
|
||||
|
||||
// To do injection of common types like components, we make DynamicMethods to do the actual injecting.
|
||||
// This is way faster than reflection and should be allocation free outside setup.
|
||||
private readonly Dictionary<Type, (InjectorDelegate? @delegate, object[]? services)> _injectorCache =
|
||||
new Dictionary<Type, (InjectorDelegate? @delegate, object[]? services)>();
|
||||
new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Register<TInterface, TImplementation>(bool overwrite = false)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Robust.Shared.IoC
|
||||
public static class IoCManager
|
||||
{
|
||||
private const string NoContextAssert = "IoC has no context on this thread. Are you calling IoC from the wrong thread or did you forget to initialize it?";
|
||||
private static readonly ThreadLocal<IDependencyCollection> _container = new ThreadLocal<IDependencyCollection>();
|
||||
private static readonly ThreadLocal<IDependencyCollection> _container = new();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the singleton thread-local instance of the IoCManager's dependency collection.
|
||||
|
||||
Reference in New Issue
Block a user