mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Register<T> extension for IDependencyCollection.
This commit is contained in:
@@ -47,6 +47,7 @@ Template for new versions:
|
||||
* `IClyde.TextInputStart()`, `IClyde.TextInputStop()`, `IClyde.TextInputSetRect()` APIs to control text input behavior.
|
||||
* `TextEditing` events for reporting in-progress IME compositions.
|
||||
* `LineEdit` and `TextEdit` have functional IME support when the game is running on SDL2. If you provide a font file with the relevant glyphs, CJK text input should now be usable.
|
||||
* `Register<T>` (single type parameter) extension method for `IDependencyCollection`.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
|
||||
20
Robust.Shared/IoC/DependencyCollectionExt.cs
Normal file
20
Robust.Shared/IoC/DependencyCollectionExt.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Robust.Shared.IoC;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="IDependencyCollection"/>.
|
||||
/// </summary>
|
||||
public static class DependencyCollectionExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Register a type as both implementation and interface.
|
||||
/// This is equivalent to calling <see cref="IDependencyCollection.Register{TInterface, TImplementation}(bool)"/> with both type args set to <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <param name="deps">The dependency collection to register into.</param>
|
||||
public static void Register<[MeansImplicitUse] T>(this IDependencyCollection deps)
|
||||
where T : class
|
||||
{
|
||||
deps.Register<T, T>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user