Programming C# 4.0 Pdf

Download free Android Programming eBooks in pdf format or read Android app development books online. Android Notes for Professionals. The Android Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative. C# 4.0 is a version of the C# programming language that was released on April 11, 2010. Microsoft released the 4.0 runtime and development environment Visual Studio 2010. The major focus of C# 4.0 is interoperability with partially or fully dynamically typed languages and frameworks, such as the Dynamic Language Runtime and COM.

  1. C# Programming Language Pdf Download
  2. C# Programming Guide Pdf
  3. Programming C# 4.0 O'reilly Pdf
  4. Programming C# 4.0 Pdf
  5. Programming C# 4.0 Pdf Download
  6. Programming C# 4.0 Pdf Software
  7. C# Programming Pdf Book

C# Notes for Professionals book

If you found this free C# programming book useful,
then please share it ❤😊

Chapters

  1. Getting started with C# Language
  2. Literals
  3. Operators
  4. Conditional Statements
  5. Equality Operator
  6. Equals and GetHashCode
  7. Null-Coalescing Operator
  8. Null-conditional Operators
  9. nameof Operator
  10. Verbatim Strings
  11. Common String Operations
  12. String.Format
  13. String Concatenate
  14. String Manipulation
  15. String Interpolation
  16. String Escape Sequences
  17. StringBuilder
  18. Regex Parsing
  19. DateTime Methods
  20. Arrays
  21. O(n) Algorithm for circular rotation of an array
  22. Enum
  23. Tuples
  24. Guid
  25. BigInteger
  26. Collection Initializers
  27. An overview of C# collections
  28. Looping
  29. Iterators
  30. IEnumerable
  31. Value type vs Reference type
  32. Built-in Types
  33. Aliases of built-in types
  34. Anonymous types
  35. Dynamic type
  36. Type Conversion
  37. Casting
  38. Nullable types
  39. Constructors and Finalizers
  40. Access Modifiers
  41. Interfaces
  42. Static Classes
  43. Singleton Implementation
  44. Dependency Injection
  45. Partial class and methods
  46. Object initializers
  47. Methods
  48. Extension Methods
  49. Named Arguments
  50. Named and Optional Arguments
  51. Data Annotation
  52. Keywords
  53. Object Oriented Programming In C#
  54. Recursion
  55. Naming Conventions
  56. XML Documentation Comments
  57. Comments and regions
  58. Inheritance
  59. Generics
  60. Using Statement
  61. Using Directive
  62. IDisposable interface
  63. Reflection
  64. IQueryable interface
  65. Linq to Objects
  66. LINQ Queries
  67. LINQ to XML
  68. Parallel LINQ (PLINQ)
  69. XmlDocument and the System.Xml namespace
  70. XDocument and the System.Xml.Linq namespace
  71. C# 7.0 Features
  72. C# 6.0 Features
  73. C# 5.0 Features
  74. C# 4.0 Features
  75. C# 3.0 Features
  76. Exception Handling
  77. NullReferenceException
  78. Handling FormatException when converting string to other types
  79. Read & Understand Stacktraces
  80. Diagnostics
  81. Overflow
  82. Getting Started: Json with C#
  83. Using json.net
  84. Lambda expressions
  85. Generic Lambda Query Builder
  86. Properties
  87. Initializing Properties
  88. INotifyPropertyChanged interface
  89. Events
  90. Expression Trees
  91. Overload Resolution
  92. BindingList<T>
  93. Preprocessor directives
  94. Structs
  95. Attributes
  96. Delegates
  97. File and Stream I/O
  98. Networking
  99. Performing HTTP requests
  100. Reading and writing .zip files
  101. FileSystemWatcher
  102. Access network shared folder with username and password
  103. Asynchronous Socket
  104. Action Filters
  105. Polymorphism
  106. Immutability
  107. Indexer
  108. Checked and Unchecked
  109. Stream
  110. Timers
  111. Stopwatches
  112. Threading
  113. Async/await, Backgroundworker, Task and Thread Examples
  114. Async-Await
  115. Synchronization Context in Async-Await
  116. BackgroundWorker
  117. Task Parallel Library
  118. Making a variable thread safe
  119. Lock Statement
  120. Yield Keyword
  121. Task Parallel Library (TPL) Dataflow Constructs
  122. Functional Programming
  123. Func delegates
  124. Function with multiple return values
  125. Binary Serialization
  126. ICloneable
  127. IComparable
  128. Accessing Databases
  129. Using SQLite in C#
  130. Caching
  131. Code Contracts
  132. Code Contracts and Assertions
  133. Structural Design Patterns
  134. Creational Design Patterns
  135. Implementing Decorator Design Pattern
  136. Implementing Flyweight Design Pattern
  137. System.Management.Automation
  138. System.DirectoryServices.Protocols.LdapConnection
  139. C# Authentication handler
  140. Pointers
  141. Pointers & Unsafe Code
  142. How to use C# Structs to create a Union type (Similar to C Unions)
  143. Reactive Extensions (Rx)
  144. AssemblyInfo.cs Examples
  145. Creating a Console Application using a Plain-Text Editor and the C# Compiler (csc.exe)
  146. CLSCompliantAttribute
  147. ObservableCollection<T>
  148. Hash Functions
  149. Generating Random Numbers in C#
  150. Cryptography (System.Security.Cryptography)
  151. ASP.NET Identity
  152. Unsafe Code in .NET
  153. C# Script
  154. Runtime Compile
  155. Interoperability
  156. .NET Compiler Platform (Roslyn)
  157. ILGenerator
  158. T4 Code Generation
  159. Creating Own MessageBox in Windows Form Application
  160. Including Font Resources
  161. Import Google Contacts
  162. Garbage Collector in .Net
  163. Microsoft.Exchange.WebServices
  164. Windows Communication Foundation

What people are saying about Notes for Professionals books

Wow! Awesome resource. Thanks a lot!

Really nice and condensed collection, thanks to all co-authors

Good Technical stuff for beginners and intermediates who is looking to learn any technology.

This is perfect for me who's learning to code!

From time to time, one comes across a bundle that is worth exploring. Today, a series of books called Programming Notes for Professionals over at http://books.goalkicker.com/ Have fun exploring #freeBooks #technology #bundle

A lot of effort went into this, I also took a look at the languages I'm familiar with. They even have screenshots of the results and provide an excellent way of showing exactly what you would input and see. I really appreciate the fact that they are pdf that you can save and don't have to rely on an internet connection.

The C# Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified

Book created for educational purposes and is not affiliated with C# group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners

808 pages, published on May 2019

More Programming Books

C# Programming Language Pdf Download

View More Free Programming Books

To support continued development and improvements to this book, please consider a small bitcoin donation: 1H63m55bw6KDYUaKU1mYLGrzDf4wcrVzhX

  • C# Basic Tutorial
  • C# Advanced Tutorial
  • C# Useful Resources
  • Selected Reading

A thread is defined as the execution path of a program. Each thread defines a unique flow of control. If your application involves complicated and time consuming operations, then it is often helpful to set different execution paths or threads, with each thread performing a particular job.

Threads are lightweight processes. One common example of use of thread is implementation of concurrent programming by modern operating systems. Use of threads saves wastage of CPU cycle and increase efficiency of an application.

So far we wrote the programs where a single thread runs as a single process which is the running instance of the application. However, this way the application can perform one job at a time. To make it execute more than one task at a time, it could be divided into smaller threads.

Thread Life Cycle

The life cycle of a thread starts when an object of the System.Threading.Thread class is created and ends when the thread is terminated or completes execution.

Following are the various states in the life cycle of a thread −

  • The Unstarted State − It is the situation when the instance of the thread is created but the Start method is not called.

  • The Ready State − It is the situation when the thread is ready to run and waiting CPU cycle.

  • The Not Runnable State − A thread is not executable, when

    • Sleep method has been called
    • Wait method has been called
    • Blocked by I/O operations
  • The Dead State − It is the situation when the thread completes execution or is aborted.

The Main Thread

In C#, the System.Threading.Thread class is used for working with threads. It allows creating and accessing individual threads in a multithreaded application. The first thread to be executed in a process is called the main thread.

When a C# program starts execution, the main thread is automatically created. The threads created using the Thread class are called the child threads of the main thread. You can access a thread using the CurrentThread property of the Thread class.

The following program demonstrates main thread execution −

When the above code is compiled and executed, it produces the following result −

Properties and Methods of the Thread Class

The following table shows some most commonly used properties of the Thread class −

Sr.No.Property & Description
1

CurrentContext

Gets the current context in which the thread is executing.

2

CurrentCulture

Gets or sets the culture for the current thread.

3

CurrentPrinciple

Gets or sets the thread's current principal (for role-based security).

4

CurrentThread

Gets the currently running thread.

5

CurrentUICulture

Gets or sets the current culture used by the Resource Manager to look up culture-specific resources at run-time.

6

ExecutionContext

Gets an ExecutionContext object that contains information about the various contexts of the current thread.

7

IsAlive

Gets a value indicating the execution status of the current thread.

8

IsBackground

Gets or sets a value indicating whether or not a thread is a background thread.

9

IsThreadPoolThread

Gets a value indicating whether or not a thread belongs to the managed thread pool.

10

ManagedThreadId

Gets a unique identifier for the current managed thread.

11

Name

Gets or sets the name of the thread.

12

Priority

Gets or sets a value indicating the scheduling priority of a thread.

13

ThreadState

Gets a value containing the states of the current thread.

The following table shows some of the most commonly used methods of the Thread class −

Sr.No.Method & Description
1

public void Abort()

Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread.

2

public static LocalDataStoreSlot AllocateDataSlot()

Allocates an unnamed data slot on all the threads. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.

3

public static LocalDataStoreSlot AllocateNamedDataSlot(string name)

Allocates a named data slot on all threads. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.

4

public static void BeginCriticalRegion()

Notifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception might jeopardize other tasks in the application domain.

5

public static void BeginThreadAffinity()

Notifies a host that managed code is about to execute instructions that depend on the identity of the current physical operating system thread.

6

public static void EndCriticalRegion()

Notifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception are limited to the current task.

7

public static void EndThreadAffinity()

Notifies a host that managed code has finished executing instructions that depend on the identity of the current physical operating system thread.

8

public static void FreeNamedDataSlot(string name)

Eliminates the association between a name and a slot, for all threads in the process. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.

9

public static Object GetData(LocalDataStoreSlot slot)

Retrieves the value from the specified slot on the current thread, within the current thread's current domain. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.

10

public static AppDomain GetDomain()

Returns the current domain in which the current thread is running.

11

public static AppDomain GetDomainID()

Returns a unique application domain identifier

12

public static LocalDataStoreSlot GetNamedDataSlot(string name)

Looks up a named data slot. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.

13

public void Interrupt()Free download tweaking windows repair all in one.

Interrupts a thread that is in the WaitSleepJoin thread state.

14

public void Join()

Blocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping. This method has different overloaded forms.

15

public static void MemoryBarrier()

Synchronizes memory access as follows: The processor executing the current thread cannot reorder instructions in such a way that memory accesses prior to the call to MemoryBarrier execute after memory accesses that follow the call to MemoryBarrier.

16

public static void ResetAbort()

Cancels an Abort requested for the current thread.

17

public static void SetData(LocalDataStoreSlot slot, Object data)

Sets the data in the specified slot on the currently running thread, for that thread's current domain. For better performance, use fields marked with the ThreadStaticAttribute attribute instead.

18

public void Start()

Starts a thread.

19

public static void Sleep(int millisecondsTimeout)

Makes the thread pause for a period of time.

20

public static void SpinWait(int iterations)

Causes a thread to wait the number of times defined by the iterations parameter

21

public static byte VolatileRead(ref byte address)

public static double VolatileRead(ref double address)

public static int VolatileRead(ref int address)

public static Object VolatileRead(ref Object address)

Reads the value of a field. The value is the latest written by any processor in a computer, regardless of the number of processors or the state of processor cache. This method has different overloaded forms. Only some are given above.

22

public static void VolatileWrite(ref byte address,byte value)

public static void VolatileWrite(ref double address, double value)

public static void VolatileWrite(ref int address, int value)

public static void VolatileWrite(ref Object address, Object value)

Writes a value to a field immediately, so that the value is visible to all processors in the computer. This method has different overloaded forms. Only some are given above.

23

public static bool Yield()

Causes the calling thread to yield execution to another thread that is ready to run on the current processor. The operating system selects the thread to yield to.

Creating Threads

Threads are created by extending the Thread class. The extended Thread class then calls the Start() method to begin the child thread execution.

The following program demonstrates the concept −

When the above code is compiled and executed, it produces the following result −

Managing Threads

C# Programming Guide Pdf

The Thread class provides various methods for managing threads.

The following example demonstrates the use of the sleep() method for making a thread pause for a specific period of time.

Programming C# 4.0 O'reilly Pdf

4.0

When the above code is compiled and executed, it produces the following result −

Programming C# 4.0 Pdf

Destroying Threads

Programming C# 4.0 Pdf Download

The Abort() method is used for destroying threads.

Programming C# 4.0 Pdf Software

The runtime aborts the thread by throwing a ThreadAbortException. This exception cannot be caught, the control is sent to the finally block, if any.

The following program illustrates this −

C# Programming Pdf Book

When the above code is compiled and executed, it produces the following result −