Interview question: What are the 5 classes you use most often?
-
Interesting that System.Convert is in there. I think I've only ever used it about twice (well directly, anyway).
Regards, Rob Philpott.
-
During an Interview I get this interesting question: What are the 5 classes you use most often? What is the best answer to this question? Keeping in mind that this is an interview question what will be your answer?
And what did you answer?
-
I also responded Object first because of the word "used" then I answered things like String, List, Int and Debug. This seems to me so basic than I hesitated to answer that. Happy to see I'm not alone.
In answer to your email (the question appears to have vanished):
Int
is a synonym forInt32
, andInt16
,Int32
, andInt64
are allstruct
Have a look here: Using struct and class - what's that all about?[^] - it tries to explain the difference.You looking for sympathy? You'll find it in the dictionary, between sympathomimetic and sympatric (Page 1788, if it helps)
-
And what did you answer?
I responded Object first then String, List, maybe Int even it's a struct and Debug, Console, something like that.
-
Interesting that System.Convert is in there. I think I've only ever used it about twice (well directly, anyway).
Regards, Rob Philpott.
Rob Philpott wrote:
Interesting that System.Convert is in there
Most people don't "like" the class. It's not interesting which is better, what is interesting is whether the *interviewer* would ask why I choose the class. Chances are, the question never comes.
static void Main(string[] args)
{
string s = null;Console.WriteLine((string)s); // default Console.WriteLine("" + s); // only if you'd rather go back to VB6 Console.WriteLine(Convert.ToString(s)); // obvious //Console.WriteLine(s.ToString()); // would explode Console.ReadLine();
}
Now, an object that can contain null would not be casted to an Int - most people would parse it (and ignore any conversion errors). If prefer to convert it all if there's a lot of different types after another that need to be assigned. Otherwise, I go for casting.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
During an Interview I get this interesting question: What are the 5 classes you use most often? What is the best answer to this question? Keeping in mind that this is an interview question what will be your answer?
This is where you wished you'd remember something absurdly obscure like AsyncStateMachineAttribute.
-
-
During an Interview I get this interesting question: What are the 5 classes you use most often? What is the best answer to this question? Keeping in mind that this is an interview question what will be your answer?
B413 wrote:
What is the best answer to this question?
If an interviewer thinks there is a best answer to that question then you can be sure that the interviewer doesn't know what they are doing. At best they don't understand the interview process and at worst they are arrogant. There are of course bad answers to that question - like "what is a class?"
-
jschell wrote:
You use Object itself more than say String?
Dunno, I did not measure them - just the first five non-structs that popped into my head. A string is still a pointer to an array of bytes to me. Nothing fancy, just an address. Outside of that, it's a shame Interfaces were not included, it would have made the answer much more interesting. Given inheritance, I'd say I use a LOT of Object :)
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
During an Interview I get this interesting question: What are the 5 classes you use most often? What is the best answer to this question? Keeping in mind that this is an interview question what will be your answer?
system.web.ui system.io system.data system.configuration system.data.sql :)
-
During an Interview I get this interesting question: What are the 5 classes you use most often? What is the best answer to this question? Keeping in mind that this is an interview question what will be your answer?
System.web.ui system.io system.data system.data.sqlclient system.configuration :)