Introduction to.NET Florin Olariu “Alexandru Ioan Cuza”, University of Iai Department of Computer Science.

Slides:



Advertisements
Similar presentations
LINQ and Collections An introduction to LINQ and Collections.
Advertisements

.NET 3.5 – Mysteries. NetFx Evolution NetFx 1.0 C# 1.0, VB 7.0, VS.NET NetFx 1.1 C# 1.1, VB 7.1, VS 2003 NetFx 2.0 C# 2.0, VB 8.0, VS 2005 NetFx 3.0 C#
What’s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
Aptech Borivali(West) Hefin Dsouza. Agenda  What is.NET and What is Visual Studio? .NET Framework 3.5 Overview.  Visual Studio 2008 Enhancements. 
Introduction to PL/SQL Chapter 9. Objectives Explain the need for PL/SQL Explain the benefits of PL/SQL Identify the different types of PL/SQL blocks.
XML files (with LINQ). Introduction to LINQ ( Language Integrated Query ) C#’s new LINQ capabilities allow you to write query expressions that retrieve.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Eric Vogel Software Developer A.J. Boggs & Company.
Introduction to LINQ Lecture # 19 August Introduction How do you interrogate/manipulate data? What if you could do the work in a type-safe," string-free.
Session 08 Module 14: Generics and Iterator Module 15: Anonymous & partial class & Nullable type.
Introduction to LINQ Chapter 11. Introduction Large amounts of data are often stored in a database—an organized collection of data. A database management.
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections UTPA – Fall 2011.
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
Session 07 Module 13 - Collections. Collections / Session 7 / 2 of 32 Review  A delegate in C# is used to refer to a method in a safe manner.  To invoke.
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
1 A Very Brief Introduction to Relational Databases.
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd
LINQ and Lambda Expressions Telerik Software Academy LINQ Overview.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
What is a database? (a supplement, not a substitute for Chapter 1…) some slides copied/modified from text Collection of Data? Data vs. information Example:
Understanding Data Types and Collections Lesson 2.
Building Web Applications with Microsoft ASP
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Introduction to .NET Florin Olariu
DotNetSpider Editor Hefin Dsouza
Introduction to .NET Florin Olariu
Introduction to .NET Florin Olariu
Introduction to Entity Framework
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2016
LINQ for SQL SQL Saturday May 2009 David Fekke.
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2013
CSC 221: Computer Programming I Spring 2010
Lambda Expressions By Val Feldsher.
CSC 221: Computer Programming I Fall 2005
LiNQ SQL Saturday David Fekke.
Upgrading Your C# Programming Skills to Be a More Effective Developer
Data Virtualization Tutorial: JSON_TABLE Queries
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
CO6025 Advanced Programming
XAML User Interface Creation in C#
Tutorial 8 Objectives Continue presenting methods to import data into Access, export data from Access, link applications with data stored in Access, and.
Databases and Information Management
MIS Professor Sandvig MIS 324 Professor Sandvig
Chapter 15 QUERY EXECUTION.
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
An Introduction to Entity Framework
Introduction to LINQ Chapter 11 10/28/2015 Lect 4 CT1411.
CSSSPEC6 SOFTWARE DEVELOPMENT WITH QUALITY ASSURANCE
Introduction to LINQ Chapter 11.
Object Oriented Practices
Lesson 7. Events, Delegates, Generics.
Databases and Information Management
What’s new in ASP.NET Core and Entity Framework 2.2 (Preview 3)
Knowledge Byte In this section, you will learn about:
MIS Professor Sandvig MIS 324 Professor Sandvig
Introduction to .NET Florin Olariu
Introduction to .NET Florin Olariu
5. 3 Coding with Denotations
ADO.NET Entity Framework
Functions By Anand George.
Abstract Data Types Abstraction is to distill a system to its most fundamental parts. Applying the abstraction paradigm to the design of data structures.
Visual Studio 2008.
Entity Framework & LINQ (Language Integrated Query)
Fast-Track UiPath Developer Module 4: Retrieving and Working With Data
CS4540 Special Topics in Web Development LINQ to Objects
Presentation transcript:

Introduction to.NET Florin Olariu “Alexandru Ioan Cuza”, University of Iai Department of Computer Science

Agenda  Generic dictionaries  Demo  LINQ  Demo  Interview questions

What’s next …  Entity Framework Core

Generic dictionaries

 What is a dictionary?  How can we manipulate a dictionary?

Generic dictionaries  What is a dictionary? It is a data structure that enables us to access an element based on a specified key.

Generic dictionaries  What is a dictionary? It is a data structure that enables us to access an element based on a specified key. It is a strongly typed collection of keys and values.

Generic dictionaries  What is a dictionary? It is a data structure that enables us to access an element based on a specified key. It is a strongly typed collection of keys and values.  Key

Generic dictionaries  What is a dictionary? It is a data structure that enables us to access an element based on a specified key. It is a strongly typed collection of keys and values.  Key  Must be unique

Generic dictionaries  What is a dictionary? It is a data structure that enables us to access an element based on a specified key. It is a strongly typed collection of keys and values.  Key  Must be unique  Must not be changed

Generic dictionaries  What is a dictionary? It is a data structure that enables us to access an element based on a specified key. It is a strongly typed collection of keys and values.  Key  Must be unique  Must not be changed  Cannot be null

Generic dictionaries  Declaration

Generic dictionaries  Declaration Dictionary

Generic dictionaries  Declaration Dictionary  Samples Dictionary

Generic dictionaries  Initialization Dictionary states; states = new Dictionary (); Dictionary states = new Dictionary (); var states = new Dictionary ();

Generic dictionaries  Manipulating a dictionary states.Add("NY", "New York"); var states = new Dictionary { {"NY", "New York"}, { "CA", "California"} }; states.Remove("CA");

Generic dictionaries  Demo

Generic dictionaries  Performance

Generic dictionaries  Performance  Many collection classes offer the same functionality as others; for example, SortedList offers nearly the same features as SortedDictionary.

Generic dictionaries  Performance  Many collection classes offer the same functionality as others; for example, SortedList offers nearly the same features as SortedDictionary.  However, often there’s a big difference in performance. Whereas one collection consumes less memory, the other collection class is faster with retrieval of elements.

Generic dictionaries  Details about big O algorithm complexity in attached pdf for the course.

LINQ

 Intro  Building a LINQ query using Query syntax - Demo  Building a LINQ query using Method syntax - Demo  Lambda expression in action - Demo  Using LINQ with collections

LINQ  Stands from Language INtegrated Query

LINQ  Stands from Language INtegrated Query  Definition

LINQ  Stands from Language INtegrated Query  Definition  A way to execute queries against a data source directly from.NET

LINQ  Stands from Language INtegrated Query  Definition  A way to execute queries against a data source directly from.NET  Data sources :  LINQ to objects => should implement an IEnumerable interface  LINQ to SQL => works with SQL databases  LINQ with Entities => works with Entity Framework  LINQ to XML => works with any XML Document  …

LINQ  There are 2 ways to express queries in LINQ:

LINQ  There are 2 ways to express queries in LINQ:  Query syntax:

LINQ  There are 2 ways to express queries in LINQ:  Query syntax: var product = from p in products where p.Name == productName select p;  Method syntax

LINQ  There are 2 ways to express queries in LINQ:  Query syntax: var product = from p in products where p.Name == productName select p;  Method syntax var product = products.Where(p => p.Name == productName).FirstOrDefault(); or

LINQ  There are 2 ways to express queries in LINQ:  Query syntax: var product = from p in products where p.Name == productName select p;  Method syntax var product = products.Where(p => p.Name == productName).FirstOrDefault(); or var product = products.FirstOrDefault(p => p.Name == productName);

LINQ  Delegate

LINQ  Delegate  Is a type that represents a reference to a method with a specific parameter list and a return type.

LINQ  Delegate  Is a type that represents a reference to a method with a specific parameter list and a return type.

LINQ  Delegate  Is a type that represents a reference to a method with a specific parameter list and a return type.

LINQ  Lambda expression

LINQ  Lambda expression  Is a method that can be passed as an argument to a method when that argument is expecting a delegate type.

LINQ  Demo – Query syntax vs Method syntax and Lambda expressions

LINQ  LINQ with collections DOAVOID Use LINQ!Iterating the collections multiple times Consider using method syntax over query syntax Use FirstOrDefault and LastOrDefault instead of First and Last Wait to cast a result after all queries are defined

Interview questions

One more thing…  “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live” ― John WoodsJohn Woods

Questions  Do you have any other questions?

Thanks! See you next time!