0% found this document useful (0 votes)
12 views6 pages

Lec 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Lec 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

FUNDAMENTALS OF

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.

Method_Name - It must be a unique name to identify the method in a class.


Parameters - The method parameters are useful to send or receive data from a method, and these
method parameters are enclosed within parentheses and are separated by commas. If no
parameters are required for a method, we need to define a method with empty parentheses
FUNDAMENTALS OF
PROGRAMING
public void GetUsers() {
// Statements to Execute
}
private void InsertUserDetails(string name, int age) {
// Statements to Execute
}
protected string GetUserDetails(int userid)
{
// Statements to Execute
}
FUNDAMENTALS OF
PROGRAMING
Void GetUserDetails()
{
string name, int age
string info = string.Format("Name: {0}, Age: {1}", name, age);
return info;
}
WHAT'S APP NUMBER
WHAT'S APP :92-3193416769
EMAIL:[email protected]

You might also like