33
. NET C#.NET BY:- UJJAWAL KULSHRESTHA

DOT NET

Embed Size (px)

Citation preview

Page 1: DOT NET

.NETC#.NET

BY:-

UJJAWAL KULSHRESTHA

Page 2: DOT NET

2

.NET

.NET:- .NET is a platform or framework or technology.

Framework:- Framework is a group of some tools.

.NET

(Programming language) (Base Library) (Common language runtime)(CLR)

.net mainly work in three concepts

Page 3: DOT NET

3

.NET

Point to be noted about .NET:-

1.Microsoft .NET provide us a worst library to perform task in the program.

2.In Microsoft in .NET library is found in the form of Name space.

CLR(Common Language Runtime):- It is combination of software & hardware which is provided by Microsoft .NET framework to create an environment in which we can execute any .NET application.

Page 4: DOT NET

4

.NET

Focus in four main function in .NET.1.Name space

2.Class

3.Method

4.Properties.

.NET supports many types of language

Ex:- C#, VB, ASP, APL etc.

Page 5: DOT NET

5

C#.NET

C# is a Famous Programming Language Development team led by “Anders Hejlsberg” provided by DOT NET frame which officially proposed in Year 2000 Now days C# is one of the popular language in Computer Technology.

Page 6: DOT NET

6

C#.NET Features

1.Platform independent- C# is platform independent language because it follows the concept of WORA(Write ones run anywhere) it can run of any kind of operating system.

2.Portable- It is easy to carry application from one environment to another environment.

3.Multithreaded- It is one of the imp feature in C#.NET in which a single program divides in small slices & then thus all slices execute simultaneously for more & more utilization of C.P.U(Central Processing Unit).

Ex: Microsoft office.

Page 7: DOT NET

7

C#.NET Features

4.Web enabled- It is easy to inbuilt C# program in web application Ex: ASP.NET

5.Based on OOPS- It is most important role in popularity of C#.

Page 8: DOT NET

8

Object Oriented Programming System(OOPS)

Object Oriented Programming System- It is a programming approach or we can say methodology which determine how to develop program. In efficient program by which we can use it again & again as per requirement. It is combination of some rules & regulation for using keywords provided by the language develop program.

Point to be noted in OOPS:-

1.In OOPS each & everything is a available in the form of “CLASS” & “OBJECT”.

2.OOPS relate the C#.NET with real world.

3.It is bottom up approach.

Page 9: DOT NET

9

OOPS Features

1.Encapsulation-The process of wrapping up or we can say hiding of data in a single unit. This process in known as encapsulation.

2.Abstraction- Extraction of data from the class according to user requirement without showing their background detail.

Note:-Encapsulation or Data Abstraction are opposite to each other

3.Polymorphism- Existence two or more things it same name but have different functionality & play diff-2 role in diff-2 situation this concept is known as polymorphism.

Page 10: DOT NET

10

OOPS Features

4.Inheritance-Using of properties of one class into another class this concept is known as “Inheritance”. It play most important role in reusability of data.

Ex; Super/parent/base class

Sub/child/derived class

CLASS A

CLASS B

Page 11: DOT NET

11

Class & Object

Class-Collection of data members ,data methods & variable according to user requirement in a single unit. that single unit is called class.

Syntax define in class

Class Classname

{ _____________ - - ___member____

}

Page 12: DOT NET

12

Class & Object

Object- Definition or we can say instance of the class known as object.

Syntax to define object

Classname object = new classname( );

Operation, which allocate memory.

Page 13: DOT NET

13

Class & Object

Point to be noted about class & object-

1.A class mainly contains two type of members. a)Static b)Non static.

a)Static-Those types of member which define in class using static keyword are known as static member. It is common for all object of the class.

Ex; Static int a; . Static void sum( );

b)Non static- those types of members which get define in class without static keyword are known as non static member. All object of the class have own information about these member.

Ex; int 0; . Void sum( );

Page 14: DOT NET

14

Class & Object

2.If we want to access any member of the class then first of all we have access there member.

3.We can access class in two ways.

a)By defining object of class to access their non static member.

Classname object=new classname( );

object .member

b)By defining using classname to access their static member.

Classname.member;

It means there is no need to define object of the class to access their static member.

(.=member access operator) object . member

it determine that this is belong to this

Page 15: DOT NET

15

Structure of C# programming

Using Namespace;

Class Classname

{

public static void main( )

{

---------------------------------

---------------------------------

}

Page 16: DOT NET

16

Structure of C# programming

Using-It predefine keyword in C# which used to accessing namespace. In the program by which we can use these namespace for further operation.

Namespace-It is treated like a container which contains two or more classes & these classes contains method for specific purpose in short in C# library is found of in the form of namespace.

There are two types of Namespace-

1)Predefine namespace-those types of namespaces which are provided by microsoft .net are known as predefine. eg: system.io, system.

2)User define namespace- those types of namespaces which get developed by users for the specific purpose are known as user define namespace.

Page 17: DOT NET

17

Structure of C# programming

Public – It is one of the types of access specifier which determine that public member can access anywhere.

Static- It keyword play diff-2 role in diff-2 situation here static keyword determine that there is no need to define object for executing for main method.

Void-It is return type which determine that main method unable to return any kind of value.

Main- Each & every language have own predefine method from which program get initialize & get ready to execute.

Command line argument(string)- Those types of values program get receive at the time of initialization.

Page 18: DOT NET

18

In program, method perform task

Namespace

Using

Object

or classname

Class

Method

-----------------------------------------

--------------------Instruction to perform task

Namespace

Class

Method

Page 19: DOT NET

19

Method

It is such smallest unit of program which contains some instruction to achieve specific task in the program.

1)Return type 2)method name 3)argument

with return

Void datatype-two types of datatypes.a)primitive b)non primitive

a)Primitive-Char, int, float, double, long, byte, Boolean.

b)Non primitive-Class, string.

Page 20: DOT NET

20

1)Return type- Determine that what kind of the value method provide us at the time of calling.

3)Argument- Argument determine that what kind of value provided to the method by us at the time of call.

Method types-1)No argument no return value

Void method name( ) if method is non static if method is static

Classobject.method( ); Classname.method( );

Method

Page 21: DOT NET

21

Method

2)With argument no return value Void.method(argument) if method is non static if method is static

classobject.method(argument); classname.method(argument);

3)With argument with return value Datatype.method(argument) if method is non static

datatype variable or object=classobject.method(argument);

Page 22: DOT NET

22

If method is static

datatype variable =classname.method(argument);

4)No argument with return value

datatype.method( ); if method is non static if method is static

datatype variable or object=classobject.method( ); datatype variable=classname.method( );

Method

Page 23: DOT NET

23

Console

Console- It is a predefine class of system namespace which contain static method for working with standard input & standard output device.

Static method of console class-1)Void WriteLine(int value)-It use to print integer value on standard output device.

2)Void WriteLine(float value)-It use to point float value on standard output device.

3)Void WriteLine(char value)-It use to point char value on standard output device.

4)Void WriteLine(double value)-It use to point double value on standard output device.

5)Void WriteLine(long value)-It use to point long value on standard output device.

Page 24: DOT NET

24

Console

Void WriteLine(string object)

Note- All above methods always print data at cursor position & moved the cursor in next line if we does not want to move the cursor in next line after printing data. then we have used “Write( ) method” in place of “WriteLine( )”

String ReadLine( )It use to read data or we can say input data from standard input device it read a complete line in the form of string.

Console.read( )-to show data after processing output in output screen

Page 25: DOT NET

25

Console

Information to call method-1)Class name

2)Check weather method is static or non static.

3)Type of method on the basic of working.

4)Follow the syntax.

Note-1)Console class does not have any method to input other type of data such as integer, float, double etc. 2)If we want to input other type of data then we have to use parsing method.

Page 26: DOT NET

26

GUI(Graphical user interface)

Window- Graphical representation of software & items.

Window contains diff-2 kind of tools which perform operation in the window to perform a task. These tools are known as window components. eg:- Button, ratio button, check box, keyword etc.

Windows- “Operating system”

Operating system-the internal working of computers is managed by different sets of programs known as the operating system. An operating system is responsible for integrating, controlling and managing different resources of a computer by providing basic functionality such as process management, memory management, file management, etc., to the computer.

Three things remind in GUI (when, what, how)

Page 27: DOT NET

27

GUI(Graphical user interface)

1.Properties 2.Method 3.Event

1.Properties- Extra characteristics of the component or we can say tools are known as properties. There are two types of properties.

a) Read only property

b) Read/write property.

a)Read only property- those steps of property we can retrieve their value but unable to change them these property are known as read only property.

Page 28: DOT NET

28

GUI(Graphical user interface)

b)Read/Write only- These types of properties which allow to change their value & we can also retrieve their value these type of properties are known as read/write properties.

2. Method- Method are such smallest unit of program which contain some instruction to perform specific task in the program.

3. Events- it is such special types of methods which execute itself when any happening occurs related to that.

Page 29: DOT NET

29

GUI(Graphical user interface)

Difference b/w Method & Events- 1. Method are completely predefined & user defined. It means if

method is predefine which have predefine name with predefine functionality. If method is user define which have user define but in case of event method name is predefine with user define functionality.

2. We have to call method as per requirement but there is no need to event.

change = componentname.properties=retrieve

componentname.method

Page 30: DOT NET

30

GUI(Graphical user interface)

Note- Each & every property of an component must have return type.

return type/data type property name

It determine what type of data property accept on give us.

Location- point (return type)

This.Location=newpoint(40,60); color.backcolor=color.red;

controlbox- boolean type maximize=windowstate this.windowstate=formwindowstate.maximize;

Page 31: DOT NET

31

GUI(Graphical user interface)

Common properties of all component-1.Color backcolor- It get or set background color of component.

2.Color forecolor- It get or set the font color of the component.

3.Int width- It get or set width of the component.

4.Int height- It get or set height of the component.

5.Int left- It get or set distance b/w left corner of the component & its container area.

6.Int top-It get or set distance b/w top corner of the component & its container area.

7.Boolean enable- It used to get or set a value which check with their component is enable or disable and also use to enable or disable of the component by using this property component is always visible

Page 32: DOT NET

32

GUI(Graphical user interface)

8.Boolean visible- It used to hide or visible of the component.

ex:- private void button1_Click(object sender, EventArgs e)

{

if (textBox1.Visible == false)

{

textBox1.Visible = true;

button1.Text = "Hide";

}

else

{

textBox1.Visible = false;

button1.Text = "show";

}}

Page 33: DOT NET

33

GUI(Graphical user interface)

Events of form-

form rea1.Public void form activated( ) -It occurs when form get active

2.Public void form deactivated( )- It occurs when form get deactivated.

3.Public void form load( )- It occurs when form load first time.

4.Public void enter( )-It occurs when focus in commit on form.

5.Public void leave( )- It occurs when form in leave focus.

6.Public void form closing( )- It occurs when ready to close.

7.Public void key down( )-It occurs when any key printable or non printable key will press on the form.

8.Public void key pressed( )- It occurs when any printable key it listen only printable key.

9.Public void key up( )- It occurs when key will release after rest it listen both printable as well as non printable key.