locked
VB to C# Conversion Please RRS feed

  • Question

  • User-990300661 posted

    All,

    I've tried to convert this code to C# using the online tools, but it's not doing it correctly.  This code just grabs the last write time from the page associated page:

    +++++++++++++++++++

    Dim File As New System.IO.FileInfo(Request.PhysicalPath.ToString)
    lblfileinfo.Text = "This page was last updated on " & File.LastWriteTime.ToString("m")
    lblfileinfo.Text &= ", " & File.LastWriteTime.ToString("yyyy") & " at <spanlowercase"">"
    lblfileinfo.Text &= File.LastWriteTime.ToString("t") & "</span>."
    lblfileinfo.CssClass = "hideonprint"

    ++++++++++++++++++

    Can somone convert this to C# for me please?  The online conversions choke on the first line.

    Thanks

    Friday, July 16, 2010 11:00 AM

Answers

  • User-990300661 posted

    Figured it out:

    FileInfo File = new FileInfo(Request.PhysicalPath.ToString());
    lblfileinfo.Text = "This page was last updated on " + File.LastWriteTime.ToString("m");
    lblfileinfo.Text += ", " + File.LastWriteTime.ToString("yyyy") + " at <span class=\"lowercase\">";
    lblfileinfo.Text += File.LastWriteTime.ToString("t") + "</span>.";
    lblfileinfo.CssClass = "hideonprint";

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 16, 2010 2:42 PM