<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.NET Framework </title>
        <link>http://www.karthikg.net/blog/category/5.aspx</link>
        <description>.NET , C#.Net, VB.Net</description>
        <language>en-US</language>
        <copyright>Karthik Gopalakrishnan</copyright>
        <managingEditor>karthik@karthikg.net</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <item>
            <title> Logical Operators Trivia in Vb.Net</title>
            <link>http://karthikg.net/blog/archive/2007/12/16/logical-operators-trivia-in-vb.net.aspx</link>
            <description>&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;Is anybody aware of these two keywords &lt;strong&gt;OrElse&lt;/strong&gt; and &lt;strong&gt;AndAlso&lt;/strong&gt; in Vb.Net. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;These keywords were introduced in &lt;strong&gt;.Net 2.0&lt;/strong&gt; .&lt;/font&gt;  &lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;pre&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;p&gt; &lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; myobj &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Object&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt; &lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Not&lt;/font&gt;&lt;font size="2"&gt; IsNothing(myobj) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;AndAlso&lt;/font&gt;&lt;font size="2"&gt; myobj.y = 200 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt; Console.WriteLine(&lt;/p&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;"Hello World"&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;If the myObj is null or nothing then the If condition  shortcircuits and will not validate the condition myObj.y=200 . &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;I would advise everybody to use the  andAlso and orElse.  I wonder why it was not introduced  a long time back. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Tahoma"&gt;C# by default had this feature  by the use &amp;amp;&amp;amp; and ||.&lt;/font&gt;   &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt; &lt;/pre&gt;&lt;img src="http://karthikg.net/blog/aggbug/5.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Karthik Gopalakrishnan</dc:creator>
            <guid>http://karthikg.net/blog/archive/2007/12/16/logical-operators-trivia-in-vb.net.aspx</guid>
            <pubDate>Sun, 16 Dec 2007 08:22:37 GMT</pubDate>
            <wfw:comment>http://karthikg.net/blog/comments/5.aspx</wfw:comment>
            <comments>http://karthikg.net/blog/archive/2007/12/16/logical-operators-trivia-in-vb.net.aspx#feedback</comments>
            <wfw:commentRss>http://karthikg.net/blog/comments/commentRss/5.aspx</wfw:commentRss>
            <trackback:ping>http://karthikg.net/blog/services/trackbacks/5.aspx</trackback:ping>
        </item>
        <item>
            <title>Serialization Tips</title>
            <link>http://karthikg.net/blog/archive/2007/12/10/serialization-tips.aspx</link>
            <description>&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt" align="justify"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt; &lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt" align="justify"&gt;&lt;font face="Tahoma" size="2"&gt;Serialization is one of the concepts, that is always intriguing to developers. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt" align="justify"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;font face="Tahoma" size="2"&gt;One of my coworker, was trying to move the in process session state management into an out of proc session state service. We were getting some exceptions during the transition, of course when objects need to be persisted in a session, they have to serializable and more than that, if it is an aggregated object (object which may have multiple objects encapsulated in it) then a null check should be performed on each object in the serialization / deserialization method definitions.&lt;/font&gt; &lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt" align="justify"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman" color="#0000ff"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;strong&gt;&lt;u&gt;VB.NET&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font face="Courier New" size="2"&gt;Public Overrides Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)&lt;br /&gt;
 &lt;br /&gt;
  If Not IsNothing(_empobject) Then  &lt;br /&gt;
        info.AddValue("_empobject", _empobject.Serialize(_empobject))  &lt;br /&gt;
 End If  &lt;br /&gt;
  &lt;br /&gt;
End sub&lt;br /&gt;
 &lt;br /&gt;
 Private Sub New(ByVal Info As SerializationInfo, ByVal Context As StreamingContext)&lt;br /&gt;
 &lt;br /&gt;
      If Not String.IsNullOrEmpty(Info.GetString("_empobject")) Then  &lt;br /&gt;
   _empobject = New EmpObject().DeSerialize(Info.GetString("_empobject"))  &lt;br /&gt;
     End If  &lt;br /&gt;
  &lt;br /&gt;
 End Sub&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font face="Times New Roman" color="#0000ff" size="3"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;strong&gt;&lt;u&gt;C#&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span class="keyword"&gt;public&lt;/span&gt; &lt;span class="keyword"&gt;override&lt;/span&gt; &lt;span class="keyword"&gt;void&lt;/span&gt; GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;{     &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;    &lt;span class="keyword"&gt;if&lt;/span&gt; ((_empobject != &lt;span class="keyword"&gt;null&lt;/span&gt;)) { &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;        info.AddValue("_empobject", _empobject.Serialize(_empobject)); &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;    } &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;   } &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span class="keyword"&gt;private&lt;/span&gt; New(SerializationInfo Info, StreamingContext Context) &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;{   &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;    &lt;span class="keyword"&gt;if&lt;/span&gt; (!&lt;span class="keyword"&gt;string&lt;/span&gt;.IsNullOrEmpty(Info.GetString("_empobject"))) { &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;        _empobject = EmpObject().DeSerialize(Info.GetString("_empobject")); &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;    }  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;Finally, how do you serialize a generic list ( of any Type). I was thinking about that, and found this article which explains clearly  how to do it. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Tahoma"&gt;&lt;font face="Arial" size="2"&gt;&lt;a href="http://www.eggheadcafe.com/software/aspnet/30067316/how-can-i-add-generic-lis.aspx"&gt;http://www.eggheadcafe.com/software/aspnet/30067316/how-can-i-add-generic-lis.aspx&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;If you wonder how to xml serialize a generic list, look at the below blog post &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;a href="http://www.hanselman.com/blog/XmlSerializingAGenericListltgt.aspx"&gt;http://www.hanselman.com/blog/XmlSerializingAGenericListltgt.aspx&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;If you want a tool to convert a code from VB to C# , you could use the below link to do that&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;a href="http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx"&gt;http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://karthikg.net/blog/aggbug/4.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Karthik Gopalakrishnan</dc:creator>
            <guid>http://karthikg.net/blog/archive/2007/12/10/serialization-tips.aspx</guid>
            <pubDate>Tue, 11 Dec 2007 06:06:46 GMT</pubDate>
            <wfw:comment>http://karthikg.net/blog/comments/4.aspx</wfw:comment>
            <comments>http://karthikg.net/blog/archive/2007/12/10/serialization-tips.aspx#feedback</comments>
            <wfw:commentRss>http://karthikg.net/blog/comments/commentRss/4.aspx</wfw:commentRss>
            <trackback:ping>http://karthikg.net/blog/services/trackbacks/4.aspx</trackback:ping>
        </item>
    </channel>
</rss>