Valimai
asked on
enable "option explicit" c#
Hi there,
I have a new computer and started coding a new project, C#.
I noticed i did not apply ToString() to a int variable when combining it with string.
E.g.
int maxLength = 50;
throw new Exception.EntityException_ FieldLengt h("Last Name is limited to " + maxLength + " characters");
This compiles! How do i fix it so the compiler tells me to fix the code? For the life of me i cannot see the option in the editor.
I would expect to have to write
throw new Exception.EntityException_ FieldLengt h("Last Name is limited to " + maxLength-->.ToString()<-- + " characters");
thanks!
I have a new computer and started coding a new project, C#.
I noticed i did not apply ToString() to a int variable when combining it with string.
E.g.
int maxLength = 50;
throw new Exception.EntityException_
This compiles! How do i fix it so the compiler tells me to fix the code? For the life of me i cannot see the option in the editor.
I would expect to have to write
throw new Exception.EntityException_
thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just can't believe that I could always do this with c#:
int myNumber = 5;
Response.Write("The number is " + myNumber);
No need to respond to this one. I will keep the question open for another day to see if anyone else has a view. Otherwise i will accept your answer.