1. Trang chủ
  2. » Giáo Dục - Đào Tạo

213 chapter 09 tủ tài liệu training

59 77 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 59
Dung lượng 23,16 MB

Nội dung

Advanced C# Part ✓ Unique Operators (Conditional, safe navigation) ✓ LINQ ✓ Synchronous programming ✓ Asynchronous programming ✓ Multithreading ✓ Concurrent collections Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Nullable types Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Conditional operator (Ternary operator) Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Conditional operator exercise (Even or Odd) Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Safe navigation operator Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Introduction to LINQ Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Introduction to LINQ LINQ stands for Language-Integrated Query,  it is a query syntax used to bridges the gap between the world of objects and the world of data LINQ to Objects LINQ to DataSet LINQ to XML LINQ to Entities LINQ to SQL Method Syntax Query Syntax Introduction to LINQ Jack Steven, 5000, 35 Debora Watson, 10000, 45 Claire Adam, 7500, 32 Michael Rob, 3500, 22 Matthew Forest, 4500, 28 Charles Kris, 8000, 27 Robert Wilson, 8000, 28 Emma Brooks, 6000, 23 Jennifer Blake, 3000, 38 Terry Loyd, 9000, 49 Adam Spencer, 7000, 33 Stacy Shelton, 4000, 25 foreach (var employee in employees) { if(employee.Salary>=6000 && employee.Age>=40)         Console.WriteLine(employee.Name); } Introduction to LINQ Familiar language: you don’t have to learn a new query language for each type of data source or data format Less coding: It reduces the amount of code comparing to the normal approach Readable code: LINQ makes the code more readable Standardization: The same LINQ syntax can be used to query multiple data sources Advanced C# Part LINQ - method syntax Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Passing parameters to tasks Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Tasks with return value Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Checking tasks status Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Cancelling tasks Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Cancelling tasks CancellationTokenSource object, which provides a cancellation token through its token property and sends a cancellation message by calling the Cancel method CancellationToken which indicates whether cancellation is requested Advanced C# Part Waiting for tasks Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Task run Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Async and Await Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Advanced C# Part Concurrent collections Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Concurrent collections Provides several thread-safe collection classes that should be used in place of the corresponding types in the System.Collections and System.Collections.Generic namespaces whenever multiple threads are accessing the collection concurrently BlockingCollection ConcurrentBag  ConcurrentDictionary ConcurrentStack  ConcurrentQueue  Advanced C# Part Assignments(19, 20, 21, 22) Ahmad Mohey | Full Stack Developer E-mail : ahmadmohey@gmail.com Twitter : ahmadmohey85 Assignments Assignment No.19: (Search in a list using LINQ) • Display count of search result • Add numbers before each line • Add a parameter in the display method to display the title or not Assignments Assignment No.20: (Say hi in different languages) • Create a list of threads • Create a class called Hi contains or so different SayHi methods in different languages • Each SayHi method has a name and a count to display how many times • English • French • Korean • Russian • Greek • Hindi • Swedish Assignments Assignment No.21: (Fastest task) • Creating two tasks whatever task finishes first cancels the other one and display the maximum value the cancelled one reaches Assignments Assignment No.22: (ConcurrentStack) • Create concurrent stack and fill it with integers using two different threads • Access it using two different threads • Count how many items each thread accessed

Ngày đăng: 16/11/2019, 23:18

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN