Include this file in your project and get rid of long conversions coding.
In large projects, you want to keep coding smaller and try to use shortcuts while coding. At least I do . This is a very small class that will make your life easier. I tried to write code for converting data type easily.
Using the Code
Instead of using lengthy type conversion, e.g.,
Int.Parse, I wrote extension methods for these functions which I would use so many times.
Here is the code for class:
public static class MyExtensions
public static int ToInt32(this object obj)
public static decimal ToDecimal(this object obj)
public static Double ToDouble(this object obj)
public static DateTime ToDate(this object obj)
Here is how we use it:
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
object EmploeeId = 9;
int a = Convert.ToInt32(EmploeeId);
EmploeeId Empo = Employee.GetEmployee(Convert.ToInt32(EmploeeId.ToInt32()));
int b = EmploeeId.ToInt32();
Employee Emp = Employee.GetEmployee(EmploeeId.ToInt32());
Points of Interest
This is a very small tool, but it made my coding very fast and easy. You can also use your own types and then create overloads of these extension methods. I hope it helps you in coding as well.