(1) C# default access modifier
namespace : public
enum : public
interface : public
class : private
struct : private
delegate : private
constructor : private (note if no constructor is explicitly defined,
a public default constructor will be automatically defined)
method : private
field :
private
enum member : public
cinterface member: public
For example
namespace AccessDemo
{
class OuterClass
{
void MethodA() {}
class InnerClass {}
}
}
is equivalent to
namespace AccessDemo
{
internal class OuterClass
{
private void MethodA() {}
private class InnerClass {}
}
}
(2)In Console Application, how to get input from the user ?
Console.Write("Enter a string - ");
Console.Write("Enter input : ");
string userinput = Console.ReadLine();
Console.WriteLine("You entered '{0}'", userinput
);
output :
Enter input : test input
You entered 'test input'
'
No comments:
Post a Comment