Category Archives: C#

Check if the string end or start with any of the element in an array in C#

We may have used normal EndsWith() extension for the string to check if the string ends with a specific string or character. But, did you ever encountered a situation where you have to check if the string ends with or starts with any of the given strings, may be an array ?. Well I have, and so I wrote an extension for checking if a string ends or starts with any of the element in an array in C#. Once you have this in a static class, say StringExtensions, you can use it in your application if you have access to that class.

Well, I did not use much comments since as you can see its almost self explanatory. Quite simple to do, right ?. Happy coding guys.

Minify Css using C#

Here I am sharing a simple code to minify css to optimize the size and make the page load faster. Long css files are always a headache when comes to the page load speed. This will fix that issue for an extent

Happy Coding

Calculate age of a person from his date of birth

When I was working with a project, I wanted to calculate age using date of birth provided. So I implemented a method and made it an extension to datetime object. I am sharing this code with you guys

Happy Coding

Create a month dropdown list easily

Here I am introducing a useful extension method for Dropdownlist in and C#. Creating Month list in a dropdown list.

Simple, easy and clean. Happy Coding

How to clear cache of web browser control in C#

Its been a long time since I wrote anything here. So I decided to come with something very interesting. It is often a headache when we work with web browser control in C#. Clearing cache in web browser control will be a requirement in some cases. I had the same issue once, and I asked to my friend “google”, as always he gave me a solution. I got a code from internet. It was a bit messy and buggy. I modified it in my way, simplified it. Now I have a perfect code to clear cache in web browser control. I am sharing it with you guys..

This was a great addition to my code vault. I hope it will be helpful for you. Cheers