Browse Source

Merge pull request #32 from SSStormy/dev

Expose services in ServiceManager
tags/docs-0.9
RogueException 9 years ago
parent
commit
defd376dc8
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/Discord.Net/ServiceManager.cs

+ 6
- 1
src/Discord.Net/ServiceManager.cs View File

@@ -1,9 +1,10 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;


namespace Discord namespace Discord
{ {
public class ServiceManager
public class ServiceManager : IEnumerable<IService>
{ {
private readonly Dictionary<Type, IService> _services; private readonly Dictionary<Type, IService> _services;


@@ -36,5 +37,9 @@ namespace Discord
throw new InvalidOperationException($"This operation requires {typeof(T).Name} to be added to {nameof(DiscordClient)}."); throw new InvalidOperationException($"This operation requires {typeof(T).Name} to be added to {nameof(DiscordClient)}.");
return singletonT; return singletonT;
} }

IEnumerator<IService> IEnumerable<IService>.GetEnumerator() => _services.Values.GetEnumerator();

public IEnumerator GetEnumerator() => _services.Values.GetEnumerator();
} }
} }

Loading…
Cancel
Save