[ Pobierz całość w formacie PDF ]
.reflection Provides classes that can be used to read metadata or dynamically invoke behavior froma type.reflection-only context When loading an assembly using reflection, this is the context that containsthe assemblies loaded with the ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods.statement lambda A lambda expression with more than one statement in the body of the expression.target The class, property, or method that contain metadata defined by an attribute.type Any class, interface, array, value type, enumeration, parameter, generic type definition, andopen or closed constructed generic type. 360 CHAPTER 8 REFLECTION, CUSTOM ATTRIBUTES, THE CODEDOM, AND LAMBDA EXPRESSIONSX'EXAM TIPS AND TRICKSThe Review of Key Terms and the Cheat Sheet for this chapter can be printedoff to help you study.You can find these files in the ZIP file for this chapter atwww.wrox.com/remtitle.cgi?isbn=1118612094 on the Download Code tab. 9Working with DataWHAT YOU WILL LEARN IN THIS CHAPTER¤'¤'Working with data collections¤'¤'Consuming data¤'¤'Performing I/O operations¤'¤'Understanding serializationWROX.COM CODE DOWNLOADS FOR THIS CHAPTERYou can find the code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=1118612094 on the Download Code tab.The code is in the chapter09download and individually named according to the names throughout the chapter.Managing data is an essential part of most applications, and understanding all the optionsavailable to you is critical when studying for the test, but also for advancing your career as adeveloper.The first section in this chapter will explain the concept of arrays and collections.These are two options you have for managing sets of data in C#.The second section, on consuming data, discusses accessing databases using ADO.NET, theADO.NET Entity Framework, and WCF Data Services.ADO.NET is a set of classes in the.NET Framework that enables you to connect to a database, retrieve data, execute stored pro-cedures, add, update, and delete records.The ADO.NET Entity Framework is an object rela-tional mapping tool that provides a graphical user interface that generates the code for you toperform the operations against a database using ADO.NET.WCF Data Services is a feature in.NET that exposes an ADO.NET Entity Framework model so that it can be accessed over theweb or an intranet.The third section reviews I/O operations and the many choices available for reading and writ-ing files.It also demonstrates how to read and write files asynchronously to create responsiveapplications during long running processes. 362 CHAPTER 9 WORKING WITH DATAX'The final section discusses serialization and how to convert an object into binary format, XML, orJSON.This allows you to easily transform a record, or records, in a database to a format that couldbe used by another system or persisted to disk as a file.Table 9-1 introduces you to the exam objectives covered in this chapter.TABLE 9-1: 70-483 Exam Objectives Covered in This ChapterOBJECTIVE CONTENT COVEREDPerform I/O operations This includes reading-and-writing files and streams either syn-chronously or asynchronously.Consume data This includes retrieving, adding, updating, and deleting datafrom a database.This also includes using the ADO.NET EntityFramework and WCF Data Services to expose a database toother systems.Serialize and deserialize data This includes how to serialize and deserialize data using binary,custom, XML, JSON, and Data Contract serialization.Store data in and retrieve data This includes data using arrays and collectionsfrom collectionsWORKING WITH DATA COLLECTIONSUnderstanding how to manipulate a series of data is critical for all types of developers.For example,drop-down lists require a set of data, reading records from a database requires a set of data, andreading a file requires storing a set of data in memory.There are many different terms peoples use todescribe a series of data such as arrays, sets, collections, lists, dictionaries, or queues.They all areused to store a series of data in memory, and each offers functionality for appending, searching, andsorting the data.This section explains arrays and collections and the differences between the two.Arrays are the most primitive type in C#, with limited functionality, while collections is a generalterm that encompasses lists, dictionaries, queues, and other objects.ArraysAn array is the most basic type used to store a set of data.An array contains elements, and they arereferenced by their index using square brackets, [].The following example creates a single dimen-sional array of integers:int[] mySet = new int[5];mySet[0] = 1;mySet[1] = 2;mySet[2] = 3;mySet[3] = 4;mySet[4] = 5; Working with Data Collections 363X'When you create an array, you must specify the number of elements the array can contain.In theprevious example the number of elements is 5 [ Pobierz caÅ‚ość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • necian.htw.pl