Auto-Implemented properties comes to Visual Basic 2010

(Note: This blog post was originally published under my old domain(codesmiles.com), here. Web Archive link. (This post is part of my Visual Studio 2010 series) In C# we can create properties for classes in simple way by just specifying the below code, this option is called auto-implemented property, as the implementation is taken care by the compiler.[more] public int Price { get; set; }   In Visual Basic we don’t have such simple option to create properties, hence to create a simple class we have to write the below code.. Class Client Private _Code As String Public Property Code() As String Get Return _Code End Get Set(ByVal value As String) _Code = value End Set End Property Private _Name As String Public Property Name() As String Get Return _Name End Get Set(ByVal value As String) _Name = value End Set End Property Private _CreditLimit As Single = 2000 Public Property CreditLimit() As Single Get Return _CreditLimit End Get Set(ByVal value As Single) _CreditLimit = value End Set End Property End Class   But in Visual Basic 2010(in Visual Studio 2010) we can write the below code instead of the above.. Class Client Public Property Code As String Public Property Name

New Stream.CopyTo() in .Net framework 4

(Note: This blog post was originally published under my old domain(codesmiles.com), here. Web Archive link. (This post is part of my Visual Studio 2010 series) Stream.CopyTo() is a new method added to System.IO.Stream in .Net framework 4, which allows you to copy bytes from one stream to another easily and makes your code simple.[more]   FileStream sourceStream = new FileStream(@”G:\test\art.bmp”, FileMode.Open); FileStream targetStream = new FileStream(@”G:\test\art-copy.bmp”, FileMode.CreateNew); sourceStream.CopyTo(targetStream); targetStream.Close(); sourceStream.Close();   This method is also available in MemoryStream(any subclass of System.IO.Stream). This is a notable method if you especially do more file IO in your application, you may also look at your old code for chances to refactor it with this method(if you have time 🙂    Subscribe to the feed! (?) and receive any such future posts on your favorite feed reader Any comments? write here..  

More secure gmail?

(Note: This blog post was originally published under my old domain(codesmiles.com), here. Web Archive link. Just a quick tip.. if your gmail url is http://mail.google.com/mail/?shva=1# you might be wondering whether it is secure(as it is not https), it isn’t so secure, but recently Gmail changed its default mode to https, most people get the url as https when they login currently. [more]But if you still see only http, then to make gmail more secure, go to your gmail Settings and enable “Always use https” “..If you sign in to Gmail via a non-secure Internet connection, like a public wireless or non-encrypted network, your Google account may be more vulnerable to hijacking. Non-secure networks make it easier for someone to impersonate you and gain full access to your Google account, including any sensitive data it may contain like bank statements or online log-in credentials…”   More here..