<?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: C# 3.0 Tutorials: Implicitly typed local variables</title>
	<atom:link href="http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/feed" rel="self" type="application/rss+xml" />
	<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables</link>
	<description>Sharing our knowledge</description>
	<lastBuildDate>Thu, 19 Jan 2012 06:22:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: santosh kumar</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-221739</link>
		<dc:creator>santosh kumar</dc:creator>
		<pubDate>Wed, 31 Mar 2010 06:08:18 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-221739</guid>
		<description>This id gr8 !

Thank you</description>
		<content:encoded><![CDATA[<p>This id gr8 !</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Var and try catch</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-211017</link>
		<dc:creator>Var and try catch</dc:creator>
		<pubDate>Tue, 02 Feb 2010 14:20:19 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-211017</guid>
		<description>.. still wrong I can see. The serverside code does not treat the xml I insert as regular text. So I replace the greater than/lower than with a -

-basicModule-
		-userNumber-0045613239-/userNumber-
		
-/basicModule-</description>
		<content:encoded><![CDATA[<p>.. still wrong I can see. The serverside code does not treat the xml I insert as regular text. So I replace the greater than/lower than with a -</p>
<p>-basicModule-<br />
		-userNumber-0045613239-/userNumber-</p>
<p>-/basicModule-</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Var and try catch</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-211016</link>
		<dc:creator>Var and try catch</dc:creator>
		<pubDate>Tue, 02 Feb 2010 14:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-211016</guid>
		<description>Dont know what has happend with the xml file, so I try to past it again:

&quot;+4545678998&quot;</description>
		<content:encoded><![CDATA[<p>Dont know what has happend with the xml file, so I try to past it again:</p>
<p>&#8220;+4545678998&#8243;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Var and try catch</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-210898</link>
		<dc:creator>Var and try catch</dc:creator>
		<pubDate>Mon, 01 Feb 2010 13:09:11 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-210898</guid>
		<description>Hi again,

Im am trying to use linq to select data from an xml document.
The document looks like:

	12345678


		
The userNumber is declared in the line:
res = from userNumber in xdoc.Descendants(“basicModule”) select userNumber.Element(“userNumber”).Value;

Actually I am not quite sure what type is returned from the xml document, but it does not help setting the var to a string</description>
		<content:encoded><![CDATA[<p>Hi again,</p>
<p>Im am trying to use linq to select data from an xml document.<br />
The document looks like:</p>
<p>	12345678</p>
<p>The userNumber is declared in the line:<br />
res = from userNumber in xdoc.Descendants(“basicModule”) select userNumber.Element(“userNumber”).Value;</p>
<p>Actually I am not quite sure what type is returned from the xml document, but it does not help setting the var to a string</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sync</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-210884</link>
		<dc:creator>Michael Sync</dc:creator>
		<pubDate>Mon, 01 Feb 2010 09:25:07 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-210884</guid>
		<description>Hi Pigbear,

What will be the type of this &quot;from userNumber in xdoc.Descendants(“basicModule”) select userNumber.Element(“userNumber”).Value&quot;?

If it&#039;s string then you need to initialize that variable.

var res = strine.Empty;

Hope it helps</description>
		<content:encoded><![CDATA[<p>Hi Pigbear,</p>
<p>What will be the type of this &#8220;from userNumber in xdoc.Descendants(“basicModule”) select userNumber.Element(“userNumber”).Value&#8221;?</p>
<p>If it&#8217;s string then you need to initialize that variable.</p>
<p>var res = strine.Empty;</p>
<p>Hope it helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Var and try catch</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-210883</link>
		<dc:creator>Var and try catch</dc:creator>
		<pubDate>Mon, 01 Feb 2010 09:18:07 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-210883</guid>
		<description>How do I initialize my &quot;var&quot; variable if I am going to use it outside the try statement like this:

  XDocument xdoc = XDocument.Load(@&quot;C:\VisualStudio\myxmlfile.xml&quot;);
            var res = ; //GIVES ERROR HERE
            try
            {
                res = from userNumber in xdoc.Descendants(&quot;basicModule&quot;) select userNumber.Element(&quot;userNumber&quot;).Value;
            }
            catch (Exception)
            {
                
            }
           
If I declare it inside the try-catch the initialization would be okay, but the it would not been known outside the try statement

Best Regards
Pigbear</description>
		<content:encoded><![CDATA[<p>How do I initialize my &#8220;var&#8221; variable if I am going to use it outside the try statement like this:</p>
<p>  XDocument xdoc = XDocument.Load(@&#8221;C:\VisualStudio\myxmlfile.xml&#8221;);<br />
            var res = ; //GIVES ERROR HERE<br />
            try<br />
            {<br />
                res = from userNumber in xdoc.Descendants(&#8220;basicModule&#8221;) select userNumber.Element(&#8220;userNumber&#8221;).Value;<br />
            }<br />
            catch (Exception)<br />
            {</p>
<p>            }</p>
<p>If I declare it inside the try-catch the initialization would be okay, but the it would not been known outside the try statement</p>
<p>Best Regards<br />
Pigbear</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liam</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-199662</link>
		<dc:creator>Liam</dc:creator>
		<pubDate>Thu, 08 Oct 2009 09:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-199662</guid>
		<description>&quot;You shouldn’t use implicitly-typed local variable if you know the type.&quot;

When would you not know the type?</description>
		<content:encoded><![CDATA[<p>&#8220;You shouldn’t use implicitly-typed local variable if you know the type.&#8221;</p>
<p>When would you not know the type?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik Radford</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-72471</link>
		<dc:creator>Nik Radford</dc:creator>
		<pubDate>Tue, 17 Jun 2008 12:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-72471</guid>
		<description>Here&#039;s a question, unfortunately I don&#039;t have VS2008 at hand to test it with.

Now this is not great code but I just thought about

Lets say, for the sake of hypothesising 

I have an interface called IMyInterface, I have an object called MyObject that implement IMyInterface.

I have a function that has a return type IMyInterface, but actually returns an instantiated MyObject.

I initialize my var with the return of this function.

for brevity and in pseudo I do this.

var myVar = MyFunction();

does myVar become of type IMyInterface or of type MyObject when I&#039;m dealing with it?

I&#039;m pretty sure visual studio will treat it as IMyInterface, because it&#039;ll look up the return type of the function called in order to provide intellisense. But as to the compiler? hmm... I&#039;ll have to test that. My Expectation would be IMyInterface, and if it wasn&#039;t it&#039;d be bad not to treats as IMyInterface, but it certainly provides food for thought.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a question, unfortunately I don&#8217;t have VS2008 at hand to test it with.</p>
<p>Now this is not great code but I just thought about</p>
<p>Lets say, for the sake of hypothesising </p>
<p>I have an interface called IMyInterface, I have an object called MyObject that implement IMyInterface.</p>
<p>I have a function that has a return type IMyInterface, but actually returns an instantiated MyObject.</p>
<p>I initialize my var with the return of this function.</p>
<p>for brevity and in pseudo I do this.</p>
<p>var myVar = MyFunction();</p>
<p>does myVar become of type IMyInterface or of type MyObject when I&#8217;m dealing with it?</p>
<p>I&#8217;m pretty sure visual studio will treat it as IMyInterface, because it&#8217;ll look up the return type of the function called in order to provide intellisense. But as to the compiler? hmm&#8230; I&#8217;ll have to test that. My Expectation would be IMyInterface, and if it wasn&#8217;t it&#8217;d be bad not to treats as IMyInterface, but it certainly provides food for thought.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sync</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-64700</link>
		<dc:creator>Michael Sync</dc:creator>
		<pubDate>Thu, 22 May 2008 08:08:06 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-64700</guid>
		<description>Can you show me your LINQ code? Normally, you can check the count of var..  
e.g. 

Option #1.
selectedProduct.resultView.Count 

OR

Option #2.

bool isFound = false;

var selPdt = LINQ;

foreach(var i in selPdt){
  isFound = true;
}

if(isFound){
  //DoSomething
}</description>
		<content:encoded><![CDATA[<p>Can you show me your LINQ code? Normally, you can check the count of var..<br />
e.g. </p>
<p>Option #1.<br />
selectedProduct.resultView.Count </p>
<p>OR</p>
<p>Option #2.</p>
<p>bool isFound = false;</p>
<p>var selPdt = LINQ;</p>
<p>foreach(var i in selPdt){<br />
  isFound = true;<br />
}</p>
<p>if(isFound){<br />
  //DoSomething<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ahtesham</title>
		<link>http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables/comment-page-1#comment-64664</link>
		<dc:creator>ahtesham</dc:creator>
		<pubDate>Thu, 22 May 2008 05:14:58 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/2008/03/01/c-30-tutorials-implicitly-typed-local-variables#comment-64664</guid>
		<description>lets say i have store the values from linq store procedure into var 
var selectedProduct= storeProcedure of linq
now i want to see if selectedProduct is null or empty 
i tried with
selectedProduct==null 
selectedProduct.returnValue=null 
selectedProduct.returnValue.tostring()==string.empty
but none worked 
so any suggestion that tell me that that var is empty or null or do not have any value
thanks in advance</description>
		<content:encoded><![CDATA[<p>lets say i have store the values from linq store procedure into var<br />
var selectedProduct= storeProcedure of linq<br />
now i want to see if selectedProduct is null or empty<br />
i tried with<br />
selectedProduct==null<br />
selectedProduct.returnValue=null<br />
selectedProduct.returnValue.tostring()==string.empty<br />
but none worked<br />
so any suggestion that tell me that that var is empty or null or do not have any value<br />
thanks in advance</p>
]]></content:encoded>
	</item>
</channel>
</rss>

