Category: .NET

  • Tip: ToString() for your custom Class

    While writing code and then debugging with step by step debugger you often just roll over a variable to see what it contain. With custom class it shows the class name/namespace path by default. And it makes debugging harder. A simple solution to this is to add a override to the ToString function in your…

  • Automate Testing: Gitlab, Dotnet

    I always want to test my .NET based application on my personal Gitlab based repo. But since, my old project is too much a mess to do the effort for. So, when we got to rewrite the whole project, I was happy to get my experience on Unit Testing with automation of CI. I still…

  • Extensions Method in .NET

    Recently I use extension method in C# project. I knew those for years, but really never get a chance to use them where they are most effect. I have couple of extension method in my project, such as ToInteger(), for a string to convert a String to Integer, which I used more frequently in my…

  • ASP.NET MVC 5: Session not working

    Just encounter an issue with ASP.NET MVC 5, the sessions are not working. i.e. when I put a value in controller like Session[“mysession”], it do not shows the same value in Views or in fact anywhere else. Search online, some create custom classes to manage them, and some give different patch, finally got the easiest…

  • C#: Code to load Object from Database

    It is often when managing old project that do not use ORM coding, we need to load object from database. In such scenarios it is quite boring to code all 30-40 property to load from DB. So, I wrote this simple code which does it quite well for me, the only catch is you need…

  • Self Hosted Web Service: WebServiceHost

    So today I learn about WebServiceHost. Just a normal class but it does a lot for me today. This host the web service within you Desktop/Windows Service application. i.e. you don’t need to install any Web server or other stuff, just create a Service Contract Class and use WebServiceHost to host it within your application. …

  • WPF ComboBox: DataBinding with DataTable

    Well it seems easy thing, but it took a while for me to get it working. Frankly I still don’t know why it works this way, but at least it works. With WPF I was expecting something as easy as giving DataTable object to ComboBox by it’s property and define the Data Field and Value…