<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1521708873202627715</id><updated>2011-04-21T17:49:36.126-07:00</updated><category term='visual studio'/><category term='C#'/><category term='Singularity'/><category term='set'/><category term='Dictionaries'/><category term='Research'/><category term='Microsoft'/><category term='Properties'/><category term='get'/><category term='code examples'/><category term='C# 4.0'/><title type='text'>C# in a coders' life.</title><subtitle type='html'>My experiences in programming using C#. Various code snippets and other ideas for better programming in C#.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-7750588457988222267</id><published>2008-08-08T11:59:00.000-07:00</published><updated>2008-08-08T12:10:06.251-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dictionaries'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Better Coded example for Dictionaries in C#</title><content type='html'>Here is the post on Channel8.msdn blog about how to handle deletion from dictionaries in C#. &lt;a href="http://channel8.msdn.com/Posts/Working-with-Dictionaries-in-C-the-Good--Bad-of-it/"&gt;Click here to follow the link..&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-7750588457988222267?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/7750588457988222267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=7750588457988222267' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/7750588457988222267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/7750588457988222267'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/08/better-coded-example-for-dictionaries.html' title='Better Coded example for Dictionaries in C#'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-1350496786366071516</id><published>2008-08-01T13:30:00.000-07:00</published><updated>2008-09-06T05:04:34.181-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# 4.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Research'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Peek into the (notsofar) Future - C# 4.0</title><content type='html'>C# has evolved into a highly functional language, with even Operating Systems being written in it,  the C# design team at Microsoft Research has been working hard to press the new level programming ideology into the C# mould.&lt;br /&gt;&lt;br /&gt;I saw the C# developers interview on the channel9 and the goals that they are targeting are&lt;br /&gt;&lt;ul&gt;&lt;li&gt;More declarative programming&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Making the Language more dynamic (heard something like Global Functions)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Concurrency  management (watch the video for a great discussion on this one&lt;/li&gt;&lt;/ul&gt;They are basically looking forward to the multi-core future which could be certainly asymmetric. &lt;a href="http://channel9.msdn.com/posts/Charles/C-40-Meet-the-Design-Team/"&gt;Catch the video for this one..&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-1350496786366071516?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/1350496786366071516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=1350496786366071516' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/1350496786366071516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/1350496786366071516'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/08/peek-into-notsofar-future-c-40.html' title='Peek into the (notsofar) Future - C# 4.0'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-2195895642593560195</id><published>2008-07-08T13:44:00.000-07:00</published><updated>2008-08-08T13:47:29.262-07:00</updated><title type='text'>Some Funny C#??</title><content type='html'>&lt;span style="font-family:'Courier New';"&gt;args of string many are they) Main is what they seek yet return they do not.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Brace you must&lt;br /&gt;&lt;br /&gt;    Written it is, the Console. “Hello World”&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/mattwar/archive/2005/10/09/479008.aspx"&gt;Check out this hilarious post..&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-2195895642593560195?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/2195895642593560195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=2195895642593560195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/2195895642593560195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/2195895642593560195'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/07/some-funny-c.html' title='Some Funny C#??'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-8062832877449209877</id><published>2008-04-20T15:45:00.000-07:00</published><updated>2008-08-08T12:55:26.204-07:00</updated><title type='text'>Handling File Size when transferring over the network..</title><content type='html'>In my recent project, I used sockets in C# to transfer a file from one host to another over a LAN environment. The socket creation exercise was pretty easy, but how to manage the file transfer??&lt;br /&gt;&lt;br /&gt;My problem was that I decided to use an Asynchronous model for my Server, in that, the Server would be able to connect to many hosts at the same time. This gave rise to the need to handle multiple "buffers" at the same time and independent of each other. But C#(or rather .Net) to the rescue, all the async code is smoothly handled, but the logic behind keeping tab of the file name and file size needed some thought..&lt;br /&gt;&lt;br /&gt;1. How to transfer the file name over the network?&lt;br /&gt;&lt;br /&gt;- When sending the file over the network, we might face (more often that not) a situation where we are supposed to assume that the file name at the target system will be same as the file name on the native host. To take care that the file name is preserved, I made use of the "pre-data" buffer in the send file method, highlighted in red below.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 204, 255); font-style: italic; font-weight: bold;"&gt;public void SendFile(string fileName, &lt;span style="color: rgb(255, 0, 0);font-size:130%;" &gt;byte[] preBuffer&lt;/span&gt;, byte[] postBuffer, TransmitFileOptions flags);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial; color: rgb(51, 204, 255); font-style: italic;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-style: italic;"&gt;We can use this field to transmit the file name across the network along with the first data packet.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial; color: rgb(51, 204, 255); font-style: italic; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-8062832877449209877?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/8062832877449209877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=8062832877449209877' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/8062832877449209877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/8062832877449209877'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/04/handling-file-size-when-transferring.html' title='Handling File Size when transferring over the network..'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-8361135334426669088</id><published>2008-04-16T13:25:00.000-07:00</published><updated>2008-04-16T13:32:10.401-07:00</updated><title type='text'>Creating sockets in C#</title><content type='html'>Creating sockets in c# is a simple affair, but managing the async calls can be a big pain..&lt;br /&gt;my idea was to connect two boxes through sockets and do some simple file transfer.&lt;br /&gt;&lt;br /&gt;The first thing is the code for creating the sockets:&lt;br /&gt;&lt;br /&gt;//create the server socket..&lt;br /&gt;&lt;pre class="smallestblack"&gt;&lt;span&gt;&lt;span class="smallblack"&gt;Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);&lt;br /&gt;&lt;br /&gt;Now the address family here is the type of addressing scheme that you are going to use..&lt;br /&gt;SocketType.Stream specifies that the data will be sent as a stream of bytes and the ProtocolType is TCP here.&lt;br /&gt;You can even use UDP and many others..&lt;br /&gt;&lt;br /&gt;By default the socket receive and send buffer size is 8bytes.. havent tested this on many systems but this was the case on my personal and work pc both.&lt;br /&gt;This is very helpful while stripping off data in chunks that has been sent as a blocks of data packed in a single buffer.&lt;br /&gt;&lt;br /&gt;I'll talk more about the buffers soon.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-8361135334426669088?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/8361135334426669088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=8361135334426669088' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/8361135334426669088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/8361135334426669088'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/04/creating-sockets-in-c.html' title='Creating sockets in C#'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-1311258425702022972</id><published>2008-03-27T19:41:00.000-07:00</published><updated>2008-09-06T05:03:58.278-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Research'/><category scheme='http://www.blogger.com/atom/ns#' term='Singularity'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Q. What do you use C# for? Ans. Writing OSes</title><content type='html'>"&lt;em&gt;...it is impossible to predict how a singularity will affect objects in its causal future.&lt;/em&gt;" - NCSA Cyberia Glossary&lt;br /&gt;&lt;br /&gt;Yes, the Singularity Project at Microsoft Research has proved radical in more than one ways, the most significant digression from OS coding tradition being the fact that the OS platform has been coded in a Very High Level Language - C#!!&lt;br /&gt;&lt;br /&gt;Actually, its written in Sing#, an extension of C# that first-class support for OS communication primitives as well as strong support for systems programming. The first question in anyones mind would be performance on C# which is a JIT compiled language requiring a significant overhead in comparison to the likes of C and C++, but according to Microsoft Research, use of safe programming languages eliminates many preventable defects, such as buffer overruns.&lt;br /&gt;&lt;br /&gt;Second, the use of sound program verification tools further guarantees that entire classes of&lt;br /&gt;programmer errors are removed from the system early in the development cycle.&lt;br /&gt;&lt;br /&gt;Third, an improved system architecture stops the propagation of runtime errors at well-defined boundaries, making it easier to achieve robust and correct system behavior.&lt;br /&gt;&lt;br /&gt;In their laboratory trial builds, the research team juggled between using Safe and Unsafe code for critical elements like Garbage Collector. It would be very interesting to see how it affects the performance and especially what security loop-holes may be induced with unsafe code...&lt;br /&gt;&lt;br /&gt;On an ending note, when I was reading about Singularity, the research team has clearly conveyed that their target is simplicity of design rather than performance. Quite a paradigm shift I would say.&lt;br /&gt;&lt;br /&gt;Read the whole Singularity series, starting here..&lt;br /&gt;&lt;a href="http://thenewtech.blogspot.com/2008/03/microsoft-singularity-series-i.html#links"&gt;DIGITAL AND TECH: Microsoft Singularity - Series I&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-1311258425702022972?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/1311258425702022972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=1311258425702022972' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/1311258425702022972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/1311258425702022972'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/08/digital-and-tech-microsoft-singularity.html' title='Q. What do you use C# for? Ans. Writing OSes'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-5179915541383126083</id><published>2008-01-29T11:05:00.000-08:00</published><updated>2008-01-29T11:22:26.502-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual studio'/><category scheme='http://www.blogger.com/atom/ns#' term='Properties'/><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='code examples'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Using Set &amp; Get properties in C#</title><content type='html'>Using Set and Get properties in C# is really cool. You can basically do two things to data while using properties:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Make data Read-only, Write-Only or Read-Write both.&lt;/li&gt;&lt;li&gt;Make the data Source - Transparent to the user of the application.&lt;/li&gt;&lt;/ul&gt;In this post, I will show how to make the Read-Only using  "&lt;span style="font-weight: bold;"&gt;get" &lt;/span&gt;property!&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;We start with an example:&lt;/span&gt;&lt;br /&gt;Consider the following array -&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(102, 255, 255); font-weight: bold;font-family:times new roman;" &gt;        private List&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(102, 255, 255); font-weight: bold;font-family:times new roman;" &gt; m_OxyEntities = new List&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(102, 255, 255); font-weight: bold;font-family:times new roman;" &gt;( );&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 255); font-weight: bold;font-family:times new roman;" &gt;        //This line of code creates a new list, which is the actual store of the data.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(102, 255, 255); font-weight: bold;font-family:times new roman;" &gt;&lt;/span&gt;&lt;/span&gt;&lt;entity&gt;&lt;entity&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(102, 255, 255); font-weight: bold;font-family:times new roman;" &gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;&lt;span style="color: rgb(102, 255, 255);"&gt;        public List&lt;/span&gt;&lt;/span&gt;&lt;entity&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;&lt;span style="color: rgb(102, 255, 255);"&gt; OxyEntities&lt;br /&gt;{&lt;br /&gt;    get&lt;br /&gt;        {&lt;br /&gt;            return m_OxyEntities;&lt;br /&gt;         }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 255);"&gt;        //This line of code creates another list, but when accessing any element of the list, there is automatic mapping to the corresponding element of the actual list create above using the "&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 255, 255);font-size:100%;" &gt;Get - Return&lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;&lt;span style="color: rgb(102, 255, 255);"&gt;" combination.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Basically, since we allow only "get" and expose only the list OxyEntities (&lt;span style="font-style: italic;"&gt;remember its public, while actual data list is private&lt;/span&gt;), we make it a read only list when being accessed out of the scope.&lt;br /&gt;&lt;br /&gt;I will talk about making it Write only in the next post.&lt;br /&gt;   &lt;br /&gt;&lt;/entity&gt;&lt;/entity&gt;&lt;/entity&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-5179915541383126083?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/5179915541383126083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=5179915541383126083' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/5179915541383126083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/5179915541383126083'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/01/using-set-get-properties-in-c.html' title='Using Set &amp; Get properties in C#'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-3921969396133614330</id><published>2008-01-19T10:48:00.001-08:00</published><updated>2008-01-19T10:48:13.755-08:00</updated><title type='text'>Working With Dictionaries in C#</title><content type='html'>I am working on a game using XNA 1.0 refresh edition and decided to use dictionary to organize my &amp;quot;missiles&amp;quot;. The dictionaries are quite a queer thing to use. I researched a bit and found that they are really efficient when the key is already known and since that is the case here,i decided to use em. But the major problem arose when i wanted to delete some components of the dictionary during the &amp;quot;foreach&amp;quot; loop for dictionary access. Then I realized that I can&amp;#39;t remove data from dictionary during the for-each loop, and then settled for deleting the elements after the end of the loop, as a separate for loop.  &lt;br&gt;Just collected the keys of the entries to be deleted from the dictionary and then in the for loop deleted each one.&lt;br&gt;&lt;div style="text-align: center;"&gt;Here goes the code:&lt;br&gt;&lt;/div&gt;&amp;nbsp;&lt;i&gt;&lt;b&gt;for(int i=0;i&amp;lt;MissileUnloadKey_Index;i++) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; miss.Remove(MissilesToUnload_Keys[i]);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; EnemyUnloadKey_Index; i++)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dushman.Remove (EnemysToUnload_Keys[i]);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/b&gt;&lt;/i&gt;&lt;br&gt;Problem solved! &lt;br&gt;So if you are stuck in the same mess, you know what to do... If you have a better idea then leave&amp;nbsp; a comment here.&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-3921969396133614330?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/3921969396133614330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=3921969396133614330' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/3921969396133614330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/3921969396133614330'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/01/working-with-dictionaries-in-c.html' title='Working With Dictionaries in C#'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1521708873202627715.post-3456102248420218346</id><published>2008-01-11T00:48:00.000-08:00</published><updated>2008-01-11T00:52:56.558-08:00</updated><title type='text'>String hello = new String("Hello World");</title><content type='html'>Hello world!&lt;br /&gt;Am starting off with my blog about experiences while trying to code my way through using C#.&lt;br /&gt;Hope we have a great journey ahead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1521708873202627715-3456102248420218346?l=csharpinmylife.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://csharpinmylife.blogspot.com/feeds/3456102248420218346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1521708873202627715&amp;postID=3456102248420218346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/3456102248420218346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1521708873202627715/posts/default/3456102248420218346'/><link rel='alternate' type='text/html' href='http://csharpinmylife.blogspot.com/2008/01/string-hello-new-stringhello-world.html' title='String hello = new String(&quot;Hello World&quot;);'/><author><name>URJIT</name><uri>http://www.blogger.com/profile/16003894652966991061</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_sL0_8zcJLwg/SM0smwS_StI/AAAAAAAAADU/GsXNP2bvx9w/S220/DSC00373.JPG'/></author><thr:total>0</thr:total></entry></feed>
