In C#, when I enclose an int value in brackets and type the dot, I get a list of functions that can be performed on that int value
string a = (12).ToString();
My question is, how can we define a custom function like that? For example I want to define a function toDateTime which can work like this
DateTime dt = ("12/12/12").toDateTime();
I fully understand that this can be done by the normal way also
DateTime dt = toDateTime("12/12/12");
I am just curious about how it is done by the other way.
()- the reason you need to use braces aroundintconstants to get intellisence is VS treats "12." as beginning of float number, unlike in all other types (i.e. string :"aaa".shows intelisence forstring).