Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 82529e6

Browse files
committed
Overload so the compiler can validate the passed type
1 parent ecab1bb commit 82529e6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/GitHub.Exports/Services/IUIProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public interface IUIProvider : IServiceProvider
1818
T TryGetService<T>() where T : class;
1919

2020
void AddService(Type t, object instance);
21+
void AddService<T>(T instance);
2122
void RemoveService(Type t);
2223

2324
IObservable<UserControl> SetupUI(UIControllerFlow controllerFlow, IConnection connection);

src/GitHub.VisualStudio/Services/UIProvider.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ public Ret GetService<T, Ret>() where Ret : class
144144
return GetService<T>() as Ret;
145145
}
146146

147+
public void AddService<T>(T instance)
148+
{
149+
AddService(typeof(T), instance);
150+
}
151+
147152
public void AddService(Type t, object instance)
148153
{
149154
if (!Initialized)

0 commit comments

Comments
 (0)