Interview Questions C
Interview Questions C
Single line
Example:
Example:
Eg:
/// summary;
/// Set error message for multilingual language.
/// summary
Q) what is C# Exception?
When executing C# code, different errors can occur: coding errors made by
the programmer, errors due to wrong input, or other unforeseeable things.
When an error occurs, C# will normally stop and generate an error message.
The technical term for this is: C# will throw an exception (throw an error).
The try statement allows you to define a block of code to be tested for errors
while it is being executed.
B)
try
catch (Exception e)
Q) What is finally?
The finally statement lets you execute code, after try...catch, regardless
of the result:
try
Console.WriteLine(myNumbers[10]);
}
catch (Exception e)
finally
No, Multiple catch blocks of similar type can't be executed. Once the proper
catch code executed, the control is transferred to the finally block, and then the
code that follows the finally block gets executed.
Void is a type modifier that states that the method or variable does not return
any value.
Q) What is an object?
Console.WriteLine(myObj.color);
Fields and methods inside classes are often referred to as "Class Members":
Create a Car class with three class members: two fields and one method.
// The class
class MyClass
// Class members
}
https://www.guru99.com/c-sharp-interview-questions.html