×
You can use excuses to convince others, but how will you convince yourself?
--Your friends at LectureNotes
Close

Note for Dot Net Framework for Application Development - DFAD By Adarsh lakshetty

  • Dot Net Framework for Application Development - DFAD
  • Note
  • Visveswaraya Technological University - Vtu
  • Computer Science Engineering
  • 5 Topics
  • 16876 Views
  • 303 Offline Downloads
  • Uploaded 1 year ago
Adarsh Lakshetty
Adarsh Lakshetty
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-2

Dot Net Framework for Application Development CBCS V Semester Subject code :15CS564 C# Features C# is object oriented programming language. It provides a lot of features that are given below. Simple ,Modern programming language, Object oriented, Type safe, Interoperability, Scalable and Updateable, Component oriented, Structured programming language, Rich Library & Fast speed. 1) Simple C# is a simple language in the sense that it provides structured approach (to break the problem into parts), rich set of library functions, data types etc. 2) Modern Programming Language C# programming is based upon the current trend and it is very powerful and simple for building scalable, interoperable and robust applications. 3) Object Oriented C# is object oriented programming language. OOPs makes development and maintenance easier where as in Procedure-oriented programming language it is not easy to manage if code Prof Adarsh L , Dept of CSE BKEC, Basavakalyan Page 2

Text from page-3

Dot Net Framework for Application Development CBCS V Semester Subject code :15CS564 grows as project size grow. 4) Type Safe C# type safe code can only access the memory location that it has permission to execute. Therefore it improves a security of the program. 5) Interoperability Interoperability process enables the C# programs to do almost anything that a native C++ application can do. 6) Scalable and Updateable C# is automatic scalable and updateable programming language. For updating our application we delete the old files and update them with new ones. 7) Component Oriented C# is component oriented programming language. It is the predominant software development methodology used to develop more robust and highly scalable applications. 8) Structured Programming Language C# is a structured programming language in the sense that we can break the program into parts using functions. So, it is easy to understand and modify. 9) Rich Library C# provides a lot of inbuilt functions that makes the development fast. 10) Fast Speed The compilation and execution time of C# language is fast. C# Example: Welcome program In C# programming language, a simple " Welcome program " program can be written by multiple ways. Let's see the top 4 ways to create a simple C# example: Simple Example Using System Using public modifier Using namespace Prof Adarsh L , Dept of CSE BKEC, Basavakalyan Page 3

Text from page-4

Dot Net Framework for Application Development CBCS V Semester Subject code :15CS564 C# Simple Example include all 4 ways using System; namespace CSE { public class Program { public static void Main(string[] args) { .Net framework Namespace Methods Data type Class name Console.WriteLine("Welcome to CSE "); } Methods to display value on Console } } Output: Welcome to CSE department Description class: is a keyword which is used to define class. Program: is the class name. A class is a blueprint or template from which objects are created. It can have data members and methods. Here, it has only Main method. static: is a keyword which means object is not required to access static members. So it saves memory. void: is the return type of the method. It does't return any value. In such case, return statement is not required. Main: is the method name. It is the entry point for any C# program. Whenever we run the C# program, Main() method is invoked first before any other method. It represents start up of the program. string[] args: is used for command line arguments in C#. While running the C# program, we can pass values. These values are known as arguments which we can use in the program. System.Console.WriteLine("Welcome to CSE department "): Here, System is the namespace. Console is the class defined in System namespace. The WriteLine() is the static method of Console class which is used to write the text on the console. Example: Simple Console Project with C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CSharp Prof Adarsh L , Dept of CSE BKEC, Basavakalyan Page 4

Text from page-5

Dot Net Framework for Application Development CBCS V Semester Subject code :15CS564 { class Program { static void Main(string[] args) { string message = "Hello World!!"; Console.WriteLine(message); } } } C# Variable The variable in C# is nothing but a name given to a data value. In the above example, message is the name of the variable that stores the string data value "Hello World!!". As the name suggests, the contents of a variable can vary, i.e., you can change the value of a variable at any time. In C#, a variable is always defined with a data type. The following is the syntax variable declaration and initialization. Syntax: <data type> <variable name>; <datatype> <variable name> = <value>; A variable can be declared and initialized later or it can be declared and initialized at the same time. In the following example, the first statement declares a variable called "message" without assigning any value to it. In the second statement, a value is assigned to the "message" variable. Example: Variable declaration string message; // value can be assigned after it declared message = "Hello World!!"; Multiple variable declaration int i, j, k, l = 0; int amount, num; Variable assignment int i = 100; int j = i; // value of j will be 100 Invalid Variable Assignment Prof Adarsh L , Dept of CSE BKEC, Basavakalyan Page 5

Lecture Notes