tailieunhanh - Lập trình .net 4.0 và visual studio 2010 part 13

Trả về một giá trị Boolean cho thấy cho dù một hoặc nhiều lá cờ được đặt trên một enum. Ví dụ, bạn có thể sử dụng HasFlag () để kiểm tra xem một chiếc xe đặc biệt có các tùy chọn thiết lập: | CHAPTER 4 CLR AND BCL CHANGES var key subkey In 64-bit versions of Windows data is stored separately in the registry for 32- and 64-bit applications. OpenBaseKey and OpenRemoteBaseKey methods now allow you to specify a new enum called RegistryView for specifying the mode that should be used when reading. Note that if you mistakenly use the 64-bit option on a 32-bit version you will get the 32-bit view. allows you to copy the contents of one stream to another avoiding some tedious coding Memorystream destinationstream new MemoryStream using FileStream sourcestream @ c destinationStream and T New TryParse methods have been added to Guid Version and Enum types Guid myGuid not a guid out myGuid Returns a Boolean value indicating whether one or more flags are set on an enum. For example you could use the HasFlag method to test whether a car has particular options set Flags public enum CarOptions AirCon 1 Turbo 2 MP3Player 4 static void Main string args CarOptions myCar Does car have MP3 0 83 CHAPTER 4 CLR AND BCL CHANGES and StringJoinO support IEnumerable T New overloads allow the concatenation and joining of lEnumerable elements without having to convert them to strings first which can make LINQ queries cleaner. Detects if a string is null empty or consists of whitespace characters avoiding a call to Trim This is one of my favorite changes. It is such a common thing to do that it is great to have it baked into the framework. Removes content from the StringBuilder object essentially the same as setting a string builder s .