In my previous blog post I have shared an easy tool to convert vb.net project. I have done a successful conversion of my projects data Layer from vb.net to c#, turned out it was awesome and less painful. So far every thing seems okay.
Then I found a small anomaly. In project reference I can see that “Microsoft.VisualBasic” library is referenced. That doesn’t sound right. And I deleted the reference and recompile the project. Some of the class thrown some compile error, and I had to fix them manually.
And today, I want to share those learning with the community. If you “Google” c# to vb.net cheat sheet you would get some very good cheat sheets.
There is my first lesson: When I deleted the “Microsoft.VisualBasic” I found out this little piece of code Information.IsDBNull:
So what's the equivalent c# code? bellow.
Pretty interesting right, why IsDBNull check got into System.Convert namespace. Any way a good lesson learned.
Any guess? yes that’s right “Environment.NewLine”
Yes that’s right DateAndTime.Today = DateTime.Now
I have more to share will share in next post.