I had an interesting encounter with a typecast problem today.

I wanted to pass a DirectoryInfo[i].name property in a function.

But it refused to work, so I wrote the function call like

function(string blabla, (string)DirectoryInfo[i].name);

and declared it as a string in the function header... and it worked. But was this the right way to do it?

How should I have written it in the function, cause right now I wrote

static public myFunc(string blabla, string directoryname)
{
tytrur;
}


info, thoughts or comments??? I really don't like to make typecasts like this...

best regards
Henrik