|
-
Oct 31st, 2002, 04:09 AM
#1
Thread Starter
Frenzied Member
Typecast or not to typecast...
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
-
Oct 31st, 2002, 11:09 AM
#2
Frenzied Member
Yes it can be done that way, but you can also do this
Code:
function(string blabla, DirectoryInfo[i].name.ToString());
Dont gain the world and lose your soul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|