<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Auto Access to non-Indexed Collections : Or How I Learned to Stop Worrying and Love the VB Compiler</title><link>http://blogs.msdn.com/b/bethmassi/archive/2009/08/14/auto-access-to-non-indexed-collections-or-how-i-learned-to-stop-worrying-and-love-the-vb-compiler.aspx</link><description>I just finished a couple more How Do I videos on using EF with WPF using VS2008 SP1 (they’ll be published soon) and while I was translating my VB code to C# I stumbled upon an error in C# that does not happen in VB. This of course got me curious and so</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Auto Access to non-Indexed Collections : Or How I Learned to Stop Worrying and Love the VB Compiler</title><link>http://blogs.msdn.com/b/bethmassi/archive/2009/08/14/auto-access-to-non-indexed-collections-or-how-i-learned-to-stop-worrying-and-love-the-vb-compiler.aspx#10407369</link><pubDate>Wed, 03 Apr 2013 20:13:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10407369</guid><dc:creator>Stumbled Upon</dc:creator><description>&lt;p&gt;Thanks so much for posting this! Was wondering the same.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10407369" width="1" height="1"&gt;</description></item><item><title>re: Auto Access to non-Indexed Collections : Or How I Learned to Stop Worrying and Love the VB Compiler</title><link>http://blogs.msdn.com/b/bethmassi/archive/2009/08/14/auto-access-to-non-indexed-collections-or-how-i-learned-to-stop-worrying-and-love-the-vb-compiler.aspx#10000266</link><pubDate>Wed, 21 Apr 2010 20:16:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10000266</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hey Ward, &lt;/p&gt;
&lt;p&gt;I disagree ;-), I like what VB is doing here as the syntax follows suit with how array indexers work. So I could swap data sources easily.&lt;/p&gt;
&lt;p&gt;I was actually doing some processing in a For i = 0 to count type of loop. I wasn't concerned with the order of the items in the collection at all.&lt;/p&gt;
&lt;p&gt;And thanks for (finally) finding some interest in VB ;-)&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10000266" width="1" height="1"&gt;</description></item><item><title>re: Auto Access to non-Indexed Collections : Or How I Learned to Stop Worrying and Love the VB Compiler</title><link>http://blogs.msdn.com/b/bethmassi/archive/2009/08/14/auto-access-to-non-indexed-collections-or-how-i-learned-to-stop-worrying-and-love-the-vb-compiler.aspx#10000258</link><pubDate>Wed, 21 Apr 2010 20:02:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10000258</guid><dc:creator>Ward Bell</dc:creator><description>&lt;p&gt;I think VB is mistaken in this case and the EF team is correct. The collection has no order guarantee and should not implement indexing.&lt;/p&gt;
&lt;p&gt;There is never an entity order guarantee from a query (even OrderBy can take you only so far).&lt;/p&gt;
&lt;p&gt;Indexing is misleading and bug-producing. VB is overreaching in this case and I prefer C# asking you to be explicit in your mistake.&lt;/p&gt;
&lt;p&gt;Of course both languages support &amp;quot;First&amp;quot; ... and no one can say what that will return.&lt;/p&gt;
&lt;p&gt;Btw, why DID you index by 0? Isn't &amp;quot;First&amp;quot; more intentional?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10000258" width="1" height="1"&gt;</description></item><item><title>re: Auto Access to non-Indexed Collections : Or How I Learned to Stop Worrying and Love the VB Compiler</title><link>http://blogs.msdn.com/b/bethmassi/archive/2009/08/14/auto-access-to-non-indexed-collections-or-how-i-learned-to-stop-worrying-and-love-the-vb-compiler.aspx#9870683</link><pubDate>Sat, 15 Aug 2009 03:12:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9870683</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Thanks Peter,&lt;/p&gt;
&lt;p&gt;But the EntityCollection is a Entity Framework type. See my last paragraph on why the EF team chose not to implement the indexer.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9870683" width="1" height="1"&gt;</description></item><item><title>re: Auto Access to non-Indexed Collections : Or How I Learned to Stop Worrying and Love the VB Compiler</title><link>http://blogs.msdn.com/b/bethmassi/archive/2009/08/14/auto-access-to-non-indexed-collections-or-how-i-learned-to-stop-worrying-and-love-the-vb-compiler.aspx#9870677</link><pubDate>Sat, 15 Aug 2009 03:00:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9870677</guid><dc:creator>Peter Gao</dc:creator><description>&lt;p&gt;You are right!&lt;/p&gt;
&lt;p&gt;your OrderDetails class doesn't actually implement an indexer.&lt;/p&gt;
&lt;p&gt;My following code for you information , I implement the indexer:&lt;/p&gt;
&lt;p&gt;public string this[int index]&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		get{&lt;/p&gt;
&lt;p&gt;			if(index&amp;gt;=arrItems.Length)&lt;/p&gt;
&lt;p&gt;				throw new Exception(&amp;quot;The index is over arrItems's length&amp;quot;);&lt;/p&gt;
&lt;p&gt;			else&lt;/p&gt;
&lt;p&gt;				return arrItems[index];&lt;/p&gt;
&lt;p&gt;			}&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;public static void Main()&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		MyIndex myIndex=new MyIndex();&lt;/p&gt;
&lt;p&gt;		Console.WriteLine(myIndex[2]);&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9870677" width="1" height="1"&gt;</description></item></channel></rss>