Lec 3
Lec 3
PROGRAMING
Writeline
Write
Read
Readline
Readkey
Function
String Functions ( substring,len,append,split)
FUNDAMENTALS OF
PROGRAMING
Syntax of C# Methods
As discussed, c# Methods must be declared either in a class or struct by
specifying the required access level, return type, name of the method, and
any method parameters as shown below.
class class_name
{
...
...
<Access_Specifier> <Return_Type> Method_Name()
{
// Statements to Execute
}
...
...
}
FUNDAMENTALS OF
PROGRAMING
If you observe the above syntax, we defined the method in a class with various parameters, which
are
Access_Specifier - It is used to define an access level, either public or private, etc., to allow other
classes to access the method. If we didn’t mention any access modifier, then by default, it is
private.
Return_Type - It is used to specify the type of value the method can return. If the method is not
returning any value, then we need to mention void as the return type.