How to handle negative TimeSpan value in C#?

I had problems with casting TimeSpan object to DateTime. Error occured: FormatException (“the input string was not in proper format”).Code I tried:DateTime.Parse(record.Field(“Hours”)); // raised errorHere record is a DataRow object and I’m using Linq to Objects to parse the Date.//Field actual value :”{-06:25:00}”How did I overcome?I used .Duration() method of TimeSpan object.DateTime.Parse(record.Field(“Hours”).Duration());¬†HTH ūüôā

Template Tag in HTML5

W3C has introduced a new “template”¬†tag that provides a mechanism to define HTML markup fragments as prototypes. In practice, a template can be used to insert fragments of HTML code into your page, for example: <template¬†id=”rowTemplate”> <tr> <td¬†class=”record”></td> <td></td> <td></td> </tr> </template> FeaturesThe following are the features of the template tag: The template code can … Read more

What is API and How to use it?

what is an api

Have you ever used a library in C#? Yes, that’s an API. An Application Programming Interface is something that let’s you interact with something or with an interface. They are just a set of functions you can call. They have their documentation on¬†what they do,¬†how they behave, what input(s) they need to perform as intended. … Read more

Server Application Unavailable in IIS 5.1

server-application-unavailable

I encountered this error while deploying an ASP.NET website to IIS 5.1 on Windows XP SP2. It’s really been a head hitting issue to track it down until I got something interesting after a lot of Googling exercise that I would love to share with you. But before that please allow me to explain what … Read more

What is toString(“X2”)?

“X2” here denotes the hexadecimal format specifier.¬†Standard numeric format strings are used to format common numeric types. A standard format string takes the form¬†Axx¬†where¬†A¬†is a single alphabetic character called the format specifier, and¬†xx¬†is an optional integer called the precision specifier. The format specifier must be one of the built-in format characters. The precision specifier ranges … Read more