🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Document Details

AltruisticCarnelian4361

Uploaded by AltruisticCarnelian4361

Tags

C# programming object-oriented programming .NET framework software development

Full Transcript

OOPROGR C# Programming LESSON 1 ROMMEL L. DORIN Contents Introduction.Net Framework First C# Program C# Keywords Data Types Operators Introduction C# C#, pronounced “...

OOPROGR C# Programming LESSON 1 ROMMEL L. DORIN Contents Introduction.Net Framework First C# Program C# Keywords Data Types Operators Introduction C# C#, pronounced “C Sharp,” is one of the new languages in the.NET framework being implemented by Microsoft. All.NET languages compile to a common byte code (MSIL) making their integration into programs written in different languages easier. Introduction C# C# is a simple & powerful object-oriented programming language developed by Microsoft. C# can be used to create various types of applications, such as web, windows, console applications, or other types of applications using Visual studio. Introduction C# is object-oriented programming language, developed by Microsoft in 2000 to adopt the best features of Java and C++. It’s used for a wide range of reasons but its popularity lies in its use for the following tasks. Introduction C# Version History C# was first introduced with.NET Framework 1.0 in the year 2002 and evolved much since then. Introduction C# Version History Introduction C# Version History Introduction C# Version History Introduction What is a.Net Framework? The.Net framework is a software development platform developed by Microsoft. The framework was meant to create applications, which would run on the Windows Platform. Introduction What is a.Net Framework? The.Net framework can be used to create both - Form-based and Web-based applications. Web services can also be developed using the.Net framework. The framework also supports various programming languages such as Visual Basic and C#. Introduction The.Net Framework Architecture Diagram Introduction The.Net Components The architecture of the.Net framework is based on the following key components: 1. Common Language Runtime (CLR) -.NET CLR is an execution engine and is the integral part of.NET Framework that is responsible for executing and managing the lifecycle of an executable. CLR stands for Common Language Runtime and also knows as the runtime. CLR’s responsibility is to mange any code written in.NET languages such as C#, VB.NET, or F#. The code that targets CLR is also knows as the “managed code”. Introduction Introduction The.Net Components 2. Class Library - The.NET Framework includes a set of standard class libraries. A class library is a collection of methods and functions that can be used for the core purpose. Most of the methods are split into either the System.* or Microsoft.* namespaces. (The asterisk * just means a reference to all of the methods that fall under the System or Microsoft namespace) A namespace is a logical separation of methods. Introduction The.Net Components 3. Language - The types of applications that can be built in the.Net framework is classified broadly into the following categories. Introduction The.Net Components 3. Language - The types of applications that can be built in the.Net framework is classified broadly into the following categories: a. WinForms – This is used for developing Forms- based applications, which would run on an end user machine. b. ASP.Net – This is used for developing web-based applications, which are made to run on any browser such as Internet Explorer, Chrome or Firefox. Introduction The.Net Components 3. Language - The types of applications that can be built in the.Net framework is classified broadly into the following categories: c. ADO.Net – This technology is used to develop applications to interact with Databases such as Oracle or Microsoft SQL Server. Introduction.Net Design Principles 1. Interoperability - The.Net framework provides a lot of backward support. 2. Portability- Applications built on the.Net framework can be made to work on any Windows platform. 3. Security - The.NET Framework has a good security mechanism. 4. Memory management - The Common Language runtime does all the work or memory management. Introduction What can you do with C#? Introduction What can you do with C#? ❖Full Stack Web Development with ASP.net ❖Real time communications with Signal R ❖Mobile Development with Xamarin ❖Desktop Applications with WPF and UWP ❖Services & Micro-Services with Azure services ❖Game Development with Unity, Cryengine, and more ❖AI and Machine Learning with Azure services ❖Internet of Things with UWP Introduction First C# Program C# can be used in a window-based, web-based, or console application. We will be using the console application Introduction First C# Program Introduction First C# Program Introduction First C# Program Introduction First C# Program Introduction Introduction First C# Program Introduction Comments ❖Single line comments start with two forward slashes // ❖Block comments start with a forward slash and an asterisk and end in the reverse: ❖XML comments start with three forward slashes /// and are very good for documentation purposes. Introduction C# Data Types C# is a strongly-typed language. It means we must declare the type of a variable that indicates the kind of values it is going to store, such as integer, float, decimal, text, etc. C# Data Types C# mainly categorized data types in two types: Value types and Reference types. Value types include simple types (such as int, float, bool, and char), enum types, struct types, and Nullable value types. Reference types include class types, interface types, delegate types, and array types. C# Data Types C# Data Types C# Data Types C# Data Types The value of unsigned integers, long, float, double, and decimal type must be suffix by u,l,f,d, and m, respectively. C# Data Types Conversions The values of certain data types are automatically converted to different data types in C#. This is called an implicit conversion. C# Data Types Conversions C# Data Types Numbers Integer type numbers are whole numbers without decimal points. It can be negative or positive numbers. Floating-point type is numbers with one or more decimal points. It can be negative or positive numbers. C# Data Types Numbers C# Data Types Numbers Integer type numbers are whole numbers without decimal points. It can be negative or positive numbers. Floating-point type is numbers with one or more decimal points. It can be negative or positive numbers. C# Operators Arithmetic Operators C# Operators Relational Operators C# Operators Logical Operators C# Keywords C# contains reserved words that have special meaning for the compiler. These reserved words are called "keywords". Keywords cannot be used as an identifier (name of a variable, class, interface, etc.). Keywords categories: Modifier, Access Modifier, Statement, Method Parameter, Namespace, Operator, Access, Literal, Type, Contextual, Query C# Keywords Modifier Keywords - are specific keywords that indicate who can modify types and type members. Modifiers allow or prevent certain parts of programs from being modified by other parts. C# Keywords Access Modifiers - are applied to the declaration of the class, method, properties, fields, and other members. They define the accessibility of the class and its members. C# Keywords Statement keywords are related to program flow. C# Keywords Method parameters - these keywords are applied to the parameters of a method. C# Keywords Namespace - These keywords are applied with namespace and related operators. C# Keywords Operator keywords perform miscellaneous actions. C# Keywords Access keywords are used to access the containing class or the base class of an object or class. C# Keywords Literal keywords apply to the current instance or value of an object. C# Keywords Type keywords are used for data types. C# Keywords Contextual keywords are considered as keywords, only if used in specific contexts. They are not reserved and so can be used as names or identifiers. C# Keywords Contextual keywords are not converted into blue color (default color for keywords in visual studio) when used as an identifier in Visual Studio. For example, var in the below figure is not in blue, whereas the color of this is the blue color. So var is a contextual keyword. C# Keywords Query keywords are contextual keywords used in LINQ queries. C# Keywords As mentioned above, a keyword cannot be used as an identifier (name of the variable, class, interface, etc.). However, they can be used with the prefix '@'. For example, the class is a reserved keyword, so it cannot be used as an identifier, but @class can be used as shown below. C# Keywords

Use Quizgecko on...
Browser
Browser