This is a brief introduction of the computer language of C#
Size: 1.01 MB
Language: en
Added: Aug 12, 2024
Slides: 31 pages
Slide Content
CC103 – Computer Programming II Instr. John Oliver N. Lacap January 20, 2024
Who am I? John Oliver N. Lacap (Sir Oliver/Lacap) Colegio de San de Letran – 2016 Worked for Letran , Yondu and PSBank Attained Microsoft Certifications and DevOps Currently working as third-party developer for UST-AC and full-time Full-stack Developer at EMAPTA
Who are you? Name Preferred name Hobbies/Interest Why take information technology program?
Course Description Data types, control structures, functions, syntax, and semantics of the language, classes, class relationships, and exception handling. This course is an introduction to computer programming for Windows. Emphasis will be on the fundamentals of structured design, development, testing, implementation, and documentation, including language syntax, data and file structures, input/output devices, files, and databases. The following C# topics will be covered: C# syntax, basics of C# classes, interfaces, exception handling, assemblies, .NET collections, and relational database programming. The Microsoft Visual Studio .NET IDE will be used for program development.
Course Objectives At the end of the class you will be able to: Recognize, diagram, and implement introductory programming concepts using C# Determine locgical alternatives with C# decision structures utilizing iteration, class methods, fields, and properties. Assemble forms, classes, and controls into C# solutions utilizing arrays and file/database access methods
Course Outline Midterm Finals Introduction to C# Object Oriented Programming (SOLID) Reading and Writing User Input Data Manipulation (SQL) Operators Classes Decision Making Encapsulation Loops Inheritance Methods Abstraction Arrays Polymorphism
Lectures We meet at 1PM-6PM Saturday Check the schedule in your student portal Readings and labs will be posted in MS Teams Attendance is a MUST
Introduction to Programming in C#
C# A modern, general-purpose, object oriented programming language develop by Microsoft and approved by European Computer Manufacturers Association and International Standards Organization
Developed by Anders Hejlsberg and his team during the development of .NET Framework
C# Designed for Common Language Runtime Infrastructure (CLI), which consist of the executable code and runtime environment that allows use of high-level languages on different computer platforms
Features Boolean Conditions Automatic Garbage Collection Standard Library Properties and Events Easy-to-use Generics Conditional Compilation LINQ and Lambda Expressions Integration with Windows
Environment .NET Framework – a revolutionary platform that helps you to write the following types of applications Windows applications Web applications Web services .NET Framework – consists of an enormous library of codes used by the client languages such as C# .NET Framework Class Library Windows Forms ASP.NET Windows Presentation Foundation Windows Communication Foundation LINQ
.NET Architecture C# programs run on .NET, a virtual execution system called the common language runtime (CLR) CLR – the implementation by Microsoft of the common language infrastructure (CLI), an international standard.
Integrated Development Environment for C# An integrated development environment (IDE) is a software application that helps programmers develop software code efficiently. It increases developer productivity by combining capabilities such as software editing, building, testing, and packaging in an easy-to-use application. Just as writers use text editors and accountants use spreadsheets, software developers use IDEs to make their job easier.
Program Structure A C# program consists of the following parts Namespace declaration A class Class methods Class attributes A Main method Statements and Expressions Comments
Rules C# is case sensitive All statements and expression must end with semicolon The program execution starts at the Main method
Basic Syntax using – used for including the namespaces in the program. A program can include multiple using statements class – used for declaring a class variables – attributes or data members of a class, used for storing data. functions – set of statements that perform a specific task. identifiers – a name used to identify a class, variable, function or any user-defined item.
Identifier A variable name. A sequence of Unicode characters without any whitespace. An identifier may be a C# reserve word, if it’s prefixed by @
Rules for naming variables/classes A name must begin with a letter that could be followed by a sequence of letters, digits or underscore First character in an identifiers cannot be a digit Must not contain embedded space or symbols (-, +, !) Underscore can be used It should not be a C# keyword
C# Keywords abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in in (generic modifier) int interface internal is lock long namespace new null object operator out out (generic modifier) override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual void volatile while
Data Types Value Types and Reference Types
Value Types Directly contain their data Variables have their own copy of the data , and it isn’t possible for operations on one to affect the other. Some examples are int, char and float (stores numbers)
Common Value Types Type Represents bool Boolean value char 16-bit Unicode character decimal 128-bit precise decimal values with 28-29 significant digits double 64-bit double-precision floating point type float 32-bit single-precision floating point type int 32-bit signed integer type
Reference Types Does not contain the actual data stored in a variable, but they contain a reference to the variables If the data in the memory location is changed by on of the variables, the other variable automatically reflects this change in value.
Console.WriteLine (); Writes the specified string value, followed by the current line terminator, to the standard output stream.
Declaring Variables Syntax datatype identifier datatype identifier = value datatype identifier1, identifier2 datatype identifier1 = value, identifier2 = value
Console.Write (); Writes the specified string value to the standard output stream.