C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO). Now AI Change the world no need to learn any langue just download gemini app (https://geminiaiapk.com/) and after that you are developer
2. Methods
A method is a code block that contains a series of statements.
A program causes the statements to be executed by calling the method and
specifying any required method arguments.
In C#, every executed instruction is performed in the context of a method.
The Main method is the entry point for every C# application and it is called by
the common language runtime (CLR) when the program is started.
3. Main()
● The Main method is the entry point of a C# console application or
windows application. (Libraries and services do not require a Main
method as an entry point.).
● When the application is started, the Main method is the first method that
is invoked.
4. Main
● The Main method is the entry point of an .exe program; it is where the
program control starts and ends.
● Main is declared inside a class or struct. Main must be static and it should
not be public. (In the earlier example, it receives the default access of
private.) The enclosing class or struct is not required to be static.
● Main can either have a void or int return type.
● The Main method can be declared with or without a string[] parameter
that contains command-line arguments.
5. Namespace
● Namespaces are heavily used in C# programming in two ways.
● First, the .NET Framework uses namespaces to organize its many classes,
as follows:
System.Console.WriteLine("Hello World!");
System is a namespace and Console is a class in that namespace.
6. The using keyword can be used so that the complete name is not required, as
in the following example:
using System;
Console.WriteLine("Hello");
Console.WriteLine("World!");
7. Second, declaring your own namespaces can help you control the scope of
class and method names in larger programming projects.
8. namespace SampleNamespace {
class SampleClass {
public void SampleMethod()
{ System.Console.WriteLine ("SampleMethod inside SampleNamespace");
}}}
Read more ...
17. Console.ReadLine Method
● Reads the next line of characters from the standard input stream, or null
if no more lines are available.
● If the standard input device is the keyboard, the ReadLine method blocks
until the user presses the Enter key.
● Return Value type is System.String
20. Identifiers ...
● In C#, an identifier is a name assigned to a method, a variable, or any
other user defined item.
● Identifier can be one or more characters long.
● Identifier may start with any letter of the alphabet or an underscore.
Line_count, Test, x, y2, MaxLoad, _top, my_var, sample23
● However, identifiers containing two consecutive underscores, such as
max_ _value, are reserved for use by the compiler.
● Uppercase and lowercase are different; that is, to c#, myvar and MyVar
are separate names.
● 12x is invalid identifier.
21. Identifiers ...
● Good programming practice dictates that you choose identifiers that
reflect the meaning or usage of the items being named.
● You can use any of the reserved C# keywords as identifiers, C# does allow
you to precede a keyword with an @, allowing it to be a legal identifier.
22. Exercise
● Write a program to display
multiplication table of a given
number using for loop.