When i decided to take the long and winding road to MCTS glory i read a couple of reviews on the Textbooks available to help me. As they're weren't many books at the time i went for:

Microsoft .NET Framework 2.0 Application Development Foundation - Self-Paced Training Kit.

In the main its a good book, with both C# and VB code examples, however the reviews on amazon said there were a few errors in it... and well i've found the first!

Page 78 says:

How to change a file extension:

string ourPath = @"c:\boot.ini";
Console.WriteLine("Ext : {0}", Path
.GetExtension(ourPath));
Console.WriteLine("Change Path: {0} ", Path.ChangeExtension(ourPath, "bak"));

From that you might assume that  Path.ChangeExtension() would change the path, but infact all it does it return a string of the new filename. To actually change the extension you need to do the following:

File

.Move(ourPath, Path.ChangeExtension(ourPath, "bak"));

string


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
posted @ Tuesday, May 22, 2007 3:58 PM | in C#

Comments

No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  


Please add 5 and 4 and type the answer here: