<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: GameServiceContainer.&#8203;GetService&lt;T&gt;() please&#8230;</title>
	<atom:link href="http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/feed/" rel="self" type="application/rss+xml" />
	<link>http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/</link>
	<description>Focused on software development.</description>
	<lastBuildDate>Sat, 16 Apr 2011 16:12:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Smoke</title>
		<link>http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/comment-page-1/#comment-179</link>
		<dc:creator>Smoke</dc:creator>
		<pubDate>Wed, 24 Nov 2010 23:34:40 +0000</pubDate>
		<guid isPermaLink="false">http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/#comment-179</guid>
		<description>Nevermind, I WAS awake... The comment board just won&#039;t accept the proper formatting, I guess it thought I was doing something bad.. ?

Anyways, just look up generics, and you&#039;ll be able to figure out what the board ate..</description>
		<content:encoded><![CDATA[<p>Nevermind, I WAS awake&#8230; The comment board just won&#8217;t accept the proper formatting, I guess it thought I was doing something bad.. ?</p>
<p>Anyways, just look up generics, and you&#8217;ll be able to figure out what the board ate..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Smoke</title>
		<link>http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/comment-page-1/#comment-178</link>
		<dc:creator>Smoke</dc:creator>
		<pubDate>Wed, 24 Nov 2010 23:31:06 +0000</pubDate>
		<guid isPermaLink="false">http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/#comment-178</guid>
		<description>Sorry the GetMethod should be this, not quite awake yet..

        public T GetServices()
        {
            return (T)game.Services.GetService(typeof(T));
        }</description>
		<content:encoded><![CDATA[<p>Sorry the GetMethod should be this, not quite awake yet..</p>
<p>        public T GetServices()<br />
        {<br />
            return (T)game.Services.GetService(typeof(T));<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Smoke</title>
		<link>http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/comment-page-1/#comment-177</link>
		<dc:creator>Smoke</dc:creator>
		<pubDate>Wed, 24 Nov 2010 23:29:59 +0000</pubDate>
		<guid isPermaLink="false">http://krisselden.com/2007/05/29/gameservicecontainergetservice-please/#comment-177</guid>
		<description>I realize this posting is old, however, no such thing exist in the current framework(XNA 4.0), you still have to create it yourself..

        public T GetServices()
        {
            return (T)game.Services.GetService(typeof(T));
        }

There it is..

ServiceObject = GetServices(); // Used like this..

I&#039;m sure you already knew this by now, but it will be useful for others who stumble across this post..

You should be able to use this for adding a service, but I&#039;m a bit rusty with my C#\XNA so this might not be quite right.. (It just saves you from having to do &quot;typeof()&quot;...)

        public void AddService(object service)
        {
            game.Services.AddService(typeof(T), service);
        }

AddService(ServiceObject); // Used like this..

Both methods need a game reference, you can either use the constructor to pass it, or use one of the XNA game component classes which already have refs to it..

Peace</description>
		<content:encoded><![CDATA[<p>I realize this posting is old, however, no such thing exist in the current framework(XNA 4.0), you still have to create it yourself..</p>
<p>        public T GetServices()<br />
        {<br />
            return (T)game.Services.GetService(typeof(T));<br />
        }</p>
<p>There it is..</p>
<p>ServiceObject = GetServices(); // Used like this..</p>
<p>I&#8217;m sure you already knew this by now, but it will be useful for others who stumble across this post..</p>
<p>You should be able to use this for adding a service, but I&#8217;m a bit rusty with my C#\XNA so this might not be quite right.. (It just saves you from having to do &#8220;typeof()&#8221;&#8230;)</p>
<p>        public void AddService(object service)<br />
        {<br />
            game.Services.AddService(typeof(T), service);<br />
        }</p>
<p>AddService(ServiceObject); // Used like this..</p>
<p>Both methods need a game reference, you can either use the constructor to pass it, or use one of the XNA game component classes which already have refs to it..</p>
<p>Peace</p>
]]></content:encoded>
	</item>
</channel>
</rss>

