Tech Off Post

Single Post Permalink

View Thread: C# Sting converstion
  • User profile image

    W3bbo said:

    An "int" date?


    If you've got a DateTime instance, just call myDate.ToString(); you can optionally specify a format-string or predefined culture settings to get the right format (e.g. myDate.ToString("yyyy-MM-dd"); or myDate.ToString(CultureInfo.CurrentCulture); )


    In .NET, every class inherits Object's .ToString() method, by default this method simply returns some basic information gained from Reflection, but some types (such as DateTime) override the behaviour. There is also the System.Convert class, but I find myself rarely using it (since it's nothing you can't do with the existing .TryParse / .Parse / .ToString methods.

    I got it you need () at the end of tostring !


    C# is new to me. Why does it not do the () in the dot completion system ?


    I got another question... In VB I use On Error Resume Next for errors, I need to write files and at times a file does not exist so i use the Error Handling to keep the code running. But I don't know how to do this in C# ???


    Thanks for help.