All pastes #244794 Raw Edit

Untitled

public text v1 · immutable
#244794 ·published 2006-11-10 05:17 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;

namespace FlatRedBall
{
    class FlatRedBallServices
    {

        private static Dictionary<Type, object> mPool;

        static FlatRedBallServices()
        {
            mPool = new Dictionary();
        }

        public static void RegisterService(object service)
        {
            Type t = service.GetType();
            if (!mPool.ContainsKey(t))
            {
                mPool.Add(t, service);
            }
        }

        public static T GetService()
        {
            return (T)mPool[typeof(T)];
        }
    }
}