net framework notes for professionals · pdf file 2018. 6. 7. · .net framework.net...

Click here to load reader

Post on 14-Oct-2020

1 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • .NET Framework Notes for Professionals.NET

    Framework Notes for Professionals

    GoalKicker.com Free Programming Books

    Disclaimer This is an unocial free book created for educational purposes and is

    not aliated with ocial .NET Framework group(s) or company(s). All trademarks and registered trademarks are

    the property of their respective owners

    100+ pages of professional hints and tricks

    https://goalkicker.com https://goalkicker.com

  • Contents About 1 ................................................................................................................................................................................... Chapter 1: Getting started with .NET Framework 2 ........................................................................................

    Section 1.1: Hello World in C# 2 ........................................................................................................................................ Section 1.2: Hello World in F# 3 ....................................................................................................................................... Section 1.3: Hello World in Visual Basic .NET 3 .............................................................................................................. Section 1.4: Hello World in C++/CLI 3 .............................................................................................................................. Section 1.5: Hello World in IL 3 ......................................................................................................................................... Section 1.6: Hello World in PowerShell 4 ......................................................................................................................... Section 1.7: Hello World in Nemerle 4 ............................................................................................................................. Section 1.8: Hello World in Python (IronPython) 4 ......................................................................................................... Section 1.9: Hello World in Oxygene 4 ............................................................................................................................ Section 1.10: Hello World in Boo 4 ...................................................................................................................................

    Chapter 2: Strings 5 ......................................................................................................................................................... Section 2.1: Count characters 5 ....................................................................................................................................... Section 2.2: Count distinct characters 5 ......................................................................................................................... Section 2.3: Convert string to/from another encoding 5 ............................................................................................. Section 2.4: Comparing strings 6 .................................................................................................................................... Section 2.5: Count occurrences of a character 6 .......................................................................................................... Section 2.6: Split string into fixed length blocks 6 ......................................................................................................... Section 2.7: Object.ToString() virtual method 7 ............................................................................................................ Section 2.8: Immutability of strings 8 .............................................................................................................................

    Chapter 3: DateTime parsing 9 ................................................................................................................................. Section 3.1: ParseExact 9 .................................................................................................................................................. Section 3.2: TryParse 10 .................................................................................................................................................. Section 3.3: TryParseExact 12 .........................................................................................................................................

    Chapter 4: Dictionaries 13 ............................................................................................................................................ Section 4.1: Initializing a Dictionary with a Collection Initializer 13 .............................................................................. Section 4.2: Adding to a Dictionary 13 ........................................................................................................................... Section 4.3: Getting a value from a dictionary 13 ......................................................................................................... Section 4.4: Make a Dictionary with Case-Insensivitve keys 14 ................................................................. Section 4.5: IEnumerable to Dictionary (≥ .NET 3.5) 14 ................................................................................................ Section 4.6: Enumerating a Dictionary 14 ...................................................................................................................... Section 4.7: ConcurrentDictionary (from .NET 4.0) 15 ...................................................................... Section 4.8: Dictionary to List 16 ..................................................................................................................................... Section 4.9: Removing from a Dictionary 16 ................................................................................................................. Section 4.10: ContainsKey(TKey) 17 ............................................................................................................................... Section 4.11: ConcurrentDictionary augmented with Lazy'1 reduces duplicated computation 17 ...........................

    Chapter 5: Collections 19 .............................................................................................................................................. Section 5.1: Using collection initializers 19 ...................................................................................................................... Section 5.2: Stack 19 ........................................................................................................................................................ Section 5.3: Creating an initialized List with Custom Types 20 .................................................................................... Section 5.4: Queue 22 .......................................................................................................................................................

    Chapter 6: ReadOnlyCollections 24 ......................................................................................................................... Section 6.1: Creating a ReadOnlyCollection 24 .............................................................................................................. Section 6.2: Updating a ReadOnlyCollection 24 ........................................................................................................... Section 6.3: Warning: Elements in a ReadOnlyCollection are not inherently read-only 24 ......................................

  • Chapter 7: Stack and Heap 26 ................................................................................................................................... Section 7.1: Value types in use 26 ................................................................................................................................... Section 7.2: Reference types in use 26 ...........................................................................................................................

    Chapter 8: LINQ 28 ........................................................................................................................................................... Section 8.1: SelectMany (flat map) 28 ............................................................................................................................ Section 8.2: Where (filter) 29 ........................................................................................................................................... Section 8.3: Any 29 ........................................................................................................................................................... Section 8.4: GroupJoin 30 ................................................................................................................................................ Section 8.5: Except 31 ...................................................................................................................................................... Section 8.6: Zip 31 ............................................................................................................................................................ Section 8.7: Aggregate (fold) 31 ..................................................................................................................................... Section 8.8: ToLookup 32 .........................................................................................