C# Language & .NET Platform 9th Lecture

Slides:



Advertisements
Similar presentations
Based on Java Software Development, 5th Ed. By Lewis &Loftus
Advertisements

CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 12 th -13 th Lecture Pavel Ježek.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 6 th Lecture Pavel Ježek
Introduction to Programming Lecture 39. Copy Constructor.
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 2 nd Lecture Pavel Ježek
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 4 th Lecture Pavel Ježek
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Lecture 16 CIS 208 Friday March 18 th, Last bit on structs, I swear Structs in Debugger It’s your friend.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 7 th & 8 th Lecture Pavel Ježek.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 11 th Lecture Pavel Ježek
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 11 th Lecture Pavel Ježek
CS 376b Introduction to Computer Vision 01 / 23 / 2008 Instructor: Michael Eckmann.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
1 9/6/05CS360 Windows Programming CS360 Windows Programming.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 10 th Lecture Pavel Ježek
Managing C++ CHRIS DAHLBERG MID-TIER DEVELOPER SCOTTRADE.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 6 th Lecture Pavel Ježek
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 8 th Lecture Pavel Ježek
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 11 th Lecture Pavel Ježek
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 9 th Lecture Pavel Ježek
Object Oriented Software Development 4. C# data types, objects and references.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 2 nd Lecture Pavel Ježek
Introduction to C# By: Abir Ghattas Michel Barakat.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 4 th Lecture Pavel Ježek
- This slide is intentionally left blank - Some of the slides are based on University of Linz.NET presentations. © University of Linz, Institute for System.
CSC 142 F 1 CSC 142 References and Primitives. CSC 142 F 2 Review: references and primitives  Reference: the name of an object. The type of the object.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 7 th Lecture Pavel Ježek
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming II 5 th Lecture Pavel Ježek
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming II 3 rd Lecture Pavel Ježek
Value Types. 2 Objectives Discuss concept of value types –efficiency –memory management –value semantics –boxing –unboxing –simple types Introduce struct.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming II 2 nd Lecture Pavel Ježek
Advanced .NET Programming I 11th Lecture
Advanced .NET Programming I 3nd Lecture
Advanced .NET Programming II 6th Lecture
Advanced .NET Programming II 4th Lecture
Module 5: Common Type System
Advanced .NET Programming I 4th Lecture
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
Advanced .NET Programming I 6th Lecture
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Pointers and References
CSC 253 Lecture 8.
CSC 253 Lecture 8.
Conditional Statements
Pointers C#, pointers can only be declared to hold the memory addresses of value types int i = 5; int *p; p = &i; *p = 10; // changes the value of i to.
Parameter Passing in Java
Java Programming Language
A simple function.
Programming Languages and Paradigms
Pointers and References
Advanced .NET Programming I 13th Lecture
Advanced .NET Programming I 5th Lecture
C# Language & .NET Platform 10th Lecture
Advanced .NET Programming I 7th Lecture
- This slide is intentionally left blank -
Advanced .NET Programming I 3rd Lecture
Advanced .NET Programming I 4th Lecture
CS Problem Solving and Object Oriented Programming Spring 2019
C# Language & .NET Platform 11th Lecture
Advanced .NET Programming I 6th Lecture
C# Language & .NET Platform 3rd Lecture
C# Language & .NET Platform 4th Lecture
Anatomy of a class Part I
C# Language & .NET Platform 8th Lecture
C# Language & .NET Platform 12th Lecture
Lecture 7: Types (Revised based on the Tucker’s slides) 10/4/2019
Presentation transcript:

C# Language & .NET Platform 9th Lecture Pavel Ježek pavel.jezek@d3s.mff.cuni.cz Some of the slides are based on University of Linz .NET presentations. © University of Linz, Institute for System Software, 2004 published under the Microsoft Curriculum License (http://www.msdnaa.net/curriculum/license_curriculum.aspx)

CLI Type System All types Value types Reference types Pointers (allocated in-place [with exceptions]) Reference types (allocated on managed heap) Pointers Structures Enumerations Classes (e.g. strings) Interfaces Arrays Delegates Simple types (Int32, Int64, Double, Boolean, Char, …) Nullables User defined structures

Visibility class private struct private Visibility modifiers: public Access is not restricted. protected Access is limited to the containing class or types derived from the containing class. internal Access is limited to the current assembly. protected internal Access is limited to the current assembly or types derived from the containing class. private Access is limited to the containing type. Default visibility in: enum public class private interface public struct private

CLI Type System All types Value types Reference types Pointers (allocated in-place [with exceptions]) Reference types (allocated on managed heap) Pointers Structures Enumerations Classes (e.g. strings) Interfaces Arrays Delegates Simple types (Int32, Int64, Double, Boolean, Char, …) Nullables User defined structures

Parameters - "call by value" value parameters (input parameters) void Inc(int x) {x = x + 1;} void f() { int val = 3; Inc(val); // val == 3 } - "call by value" - formal parameter is a copy of the actual parameter - actual parameter is an expression

Parameters - "call by value" value parameters (input parameters) void Inc(int x) {x = x + 1;} void f() { int val = 3; Inc(val); // val == 3 } - "call by value" - formal parameter is a copy of the actual parameter - actual parameter is an expression - "call by reference" - formal parameter is an alias for the actual parameter (address of actual parameter is passed) - actual parameter must be a variable ref parameters (transient parameters) void Inc(ref int x) { x = x + 1; } void f() { int val = 3; Inc(ref val); // val == 4 }