C#/.NET Jacob Lewallen. C# vs.NET.NET is a platform. Many languages compile to.NET: –VB.NET –Python.NET –Managed C++ –C#

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Introduction to ASP.NET.
Advertisements

Language Fundamentals in brief C# - Introduction.
C#: Data Types Based on slides by Joe Hummel. 2 UCN Technology: Computer Science Content: “.NET is designed around the CTS, or Common Type System.
The Type System1. 2.NET Type System The type system is the part of the CLR that defines all the types that programmers can use, and allows developers.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Introduction to the C# Programming Language for the VB Programmer.
C#: Project Cool Arthur Ketchel II Keith Francisco Chris McInnis.
Lecture 9 Concepts of Programming Languages
University of Virginia CSharp (© John Knight 2005) 1 What’s New In C#
Abstract Data Types and Encapsulation Concepts
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
From C++ to C#. Web programming The course is on web programming using ASP.Net and C# The course is on web programming using ASP.Net and C# ASP.Net is.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Programming in C# Language Overview
OOP Languages: Java vs C++
11 Values and References Chapter Objectives You will be able to: Describe and compare value types and reference types. Write programs that use variables.
.NET Fundamentals November 20, 2003 Week 3. Class Agenda – November 20, 2003 Questions / Homework? Types (Intrinsic and Reference), Classes, Objects Class.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Michael Olivero Microsoft Student Ambassador for FIU Pick up your free drink below to your left. 1 per person please.
Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization Practical Course SS07 Global Illumination.
FEN 2012 UCN Technology: Computer Science1 C# - Introduction Language Fundamentals in Brief.
Managed C++. Objectives Overview to Visual C++.NET Concepts and architecture Developing with Managed Extensions for C++ Use cases Managed C++, Visual.
Programming Languages and Paradigms Object-Oriented Programming (Part II)
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Introduction to C# C# is - elegant, type-safe, object oriented language enabling to build applications that run on the.NET framework - types of applications.
Week 1: THE C# LANGUAGE Chapter 1: Variables and Expressions ➤ Included in Visual Studio.NET ➤ What the.NET Framework is and what it contains ➤ How.NET.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
C# D1 CSC 298 Elements of C# code (part 2). C# D2 Writing a class (or a struct)  Similarly to Java or C++  Fields: to hold the class data  Methods:
Defining and Converting Data Copyright Kip Irvine, 2003 Last Update: 11/4/2003.
How to be a C# ninja in 10 easy steps Benjamin Day.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system.
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
Bill Campbell, UMB Microsoft's.NET C# and The Common Language Runtime.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
Object-Oriented Programming Chapter Chapter
Managing C++ CHRIS DAHLBERG MID-TIER DEVELOPER SCOTTRADE.
PerlNET: The Camel Talks.NET Jan Dubois The Perl Conference 6 San Diego, July 26 th 2002.
Introduction to Object-Oriented Programming Lesson 2.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Object Oriented Software Development 4. C# data types, objects and references.
Object-Based Programming in VB.NET. Must Understand Following: Encapsulation Information hiding Abstract Data Type Class, Instance, Reference Variable.
Session 1 C# Basics.
Introduction to C# By: Abir Ghattas Michel Barakat.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
Introduction to C# Anders Hejlsberg Distinguished Engineer Developer Division Microsoft Corporation.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
Session 02 Module 3: Statements and Operators Module 4: Programming constructs Module 5: Arrays.
Overview CNS 3260 C#.NET Software Development. 2.NET Framework Began in 2000 Developed in three years (2000 to 2003) Operating System Hardware.NET Framework.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
Value Types. 2 Objectives Discuss concept of value types –efficiency –memory management –value semantics –boxing –unboxing –simple types Introduce struct.
INTRODUCTION BEGINNING C#. C# AND THE.NET RUNTIME AND LIBRARIES The C# compiler compiles and convert C# programs. NET Common Language Runtime (CLR) executes.
Object Lifetime and Pointers
Konstantinos pantos Software solutions architect Techaholics
Creating and Using Objects, Exceptions, Strings
CS360 Windows Programming
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
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.
Java Programming Language
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2006
IS 135 Business Programming
Interfaces, Enumerations, Boxing, and Unboxing
Presentation transcript:

C#/.NET Jacob Lewallen

C# vs.NET.NET is a platform. Many languages compile to.NET: –VB.NET –Python.NET –Managed C++ –C#

.NET Intermediate Language (IL) – “half-way” Interpreted locally using JIT (Just-In-Time) compilers. Has a very nice standard library, comparable to Java’s. Theme: More “open” to it’s hosted system than Java.

C# Basics Garbage Collected Very Java-esque: –Main is static method in some class Designed for.NET, rather than adapted. Simple operator overloading Everything is an Object Java-like inheritance

Safe vs Managed Unmanaged – native code - non-IL code. Unsafe code – code wrapped in C#’s unsafe mechanism: –Relaxed type checking –Pointers –Flagged as unsafe and requires more trust. Unsafe code is still managed code.

Syntax Think Java, if that fails think C++ public class ExampleApp { public static void Main() { string str = “Hello, World”; Console.WriteLine(str); } }

Namespaces More like C++ namespaces, with some Java packages sprinkled in. using System.Collections; Instead of using… System.Collections.Hashtable Assemblies (DLLs) are named for the namespaces they contain, usually.

Declaring a Namespace You can wrap your code in the namespace like so: Namespace UCR.Technical.Seminar { … } Nearly all code I’ve ever seen has been wrapped in a Namespace.

Collections System.Collections.Hashtable System.Collections.ArrayList Type-safe enumerations: foreach (string name in users) { … }.NET will do runtime type checking.

Memory All allocated memory is garbage collected. We use new to create object instances. We can override a finalizer for our classes to handle cleanup.

Value Types Categories: Struct, Enumeration, Numeric Types (integers, floats, bools) Assignments create copies of the assigned value. Value types cannot contain null. int is an alias for System.Int32, all value types have an alias.

Reference Types Also referred to as object ’s. Store references to actual data. Passed by reference, by default.

Boxing Boxing - conversion from a value type to type object. It’s implicit: int x = 23; object o = 23; object r = x; x is an integer on the heap, value is 23. o is an object, referencing a new value on the heap, that’s 23. r is an object, referencing the value x.

Unboxing Explicit conversion from a reference type, an object, to a value type. object o = 23; int x = (int)o; Type checking is done in the conversion. Can throw InvalidCastException ’s.

Properties Replaces getter/setter paradigm. Wraps private member variables around more defined accessors. object.getName() you do object.Name. object.setName(“Jacob”) becomes object.Name = “Jacob”; Standard library uses upper case names for all properties.

Properties Syntax for declaring a Property: String Name { get { return (m_name); } set { m_name = value; } } Where m_name is our member variable. Read-only Properties have no set.

Events/Delegates Calling/invoking methods w/o knowing anything about the method’s object. Defining a Delegate: public delegate void ButtonDelegate(string name); This delegate takes a string and returns nothing.

Defining a Delegate Declare a variable for out delegate: private ButtonDelegate m_presses; We can create an instance of her: m_presses = new ButtonDelegate(SayHello); public bool SayHello(string name) { … } Now, we can invoke/trigger the delegate: m_presses(“Hello, World ”);

Using Delegates Delegates are used exclusively for event handling in.NET GUI’s. Many design patterns (publisher/subscribe)

Microsoft Whining You can download the.NET SDK from Microsoft. You’ll get: –All the necessary command line utilities for developing with C#. –A few graphical tools for inspecting IL. –Help via Visual Studio is NOT required.

Mono Open Source.NET/C# implementation

Assembly Think shared-object - *.dll or *.so.

ADO.NET

System.XML