The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Framework BCL Richness

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Tim Sneath

Posts: 395
Nickname: timsneath
Registered: Aug, 2003

Tim Sneath is a .NET developer for Microsoft in the UK.
Framework BCL Richness Posted: Sep 12, 2003 11:29 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Tim Sneath.
Original Post: Framework BCL Richness
Feed Title: Tim Sneath's Blog
Feed URL: /msdnerror.htm?aspxerrorpath=/tims/Rss.aspx
Feed Description: Random mumblings on Microsoft, .NET, and other topics.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Tim Sneath
Latest Posts From Tim Sneath's Blog

Advertisement

There are times when I take the .NET Framework base class libraries for granted. But it saves so much time on a daily basis. Today I needed to update a file timestamp and realised that I didn't have a touch utility on my machine. the FileInfo class made it quicker to write one from scratch than find and download one!

Here's what I wrote, pared down to the bared bones:

   class Touch {
      static void Main(string[] args) {
         System.IO.FileInfo f = new System.IO.FileInfo(args[0]);	
         if (f.Exists)
            f.LastWriteTime = System.DateTime.Now;
      }
   }    

This version is of course missing support for wildcards and error handling - I leave that as an exercise for the reader! Incidentally, the FileInfo class also includes properties for CreationTime and LastAccessTime.

Read: Framework BCL Richness

Topic: Scott Hanselman's Ultimate Developer and Power Users Tools List v1 Previous Topic   Next Topic Topic: Web Data Admin Tool

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use