Dot net Windows Application Adding Multiple FontStyle to a single font class object

Hi,

While working with Textbox in a windows application I wanted to show the text of the textbox to be both Bold and Underlined. I had to do this based on certain condition.

I was surprised to see that the bold and underlined properties in the font class are readonly. What this means is that we can only set these properties in the constructor of the class and there is no other way to set the property.

Continued...

Path.combine to combine two paths and backslash in second parameter

Hi,

system.IO.Path comes with many good function to work with the File system. some of them are ChangeExtension, GetDirectoryName, GetExtension, GetFileNameWithoutExtension, IsPathRooted etc.

The system.IO.Path.Combine is also include as a function in system.IO.Path to combine two paths provided to it. A few days back I was working with it to add paths provided by user. But I started getting erros where by sometimes the path would not be combined and only the second provided path was returned. After doing some research on this I got to the root of the cause.

The problem was only occuring when the second path provided in the method was starting with "\".

To make my understanding more accurate I made a small console applictaion to show what would be the result in differenct scenarios. Below are the situation and the output I got for them.

Continued...
 
Copyright © 2006 - 2010 Vikram Lakhotia