background preloader

.NET

Facebook Twitter

Threading in C# - Free E-book. Threading in C# Joseph Albahari Last updated: 2011-4-27 Translations: Chinese | Czech | Persian | Russian | Japanese Download PDF Part 1: Getting Started C# supports parallel execution of code through multithreading.

Threading in C# - Free E-book

A C# client program (Console, WPF, or Windows Forms) starts in a single thread created automatically by the CLR and operating system (the “main” thread), and is made multithreaded by creating additional threads. All examples assume the following namespaces are imported: using System; using System.Threading; class ThreadTest{ static void Main() { Thread t = new Thread (WriteY); t.Start(); for (int i = 0; i < 1000; i++) Console.Write ("x"); } static void WriteY() { for (int i = 0; i < 1000; i++) Console.Write ("y"); }} The main thread creates a new thread t on which it runs a method that repeatedly prints the character “y”. Once started, a thread’s IsAlive property returns true, until the point where the thread ends.

Done static void Go(){ if (! Done Done (usually!) Join and Sleep. Lucene.Net ultra fast search for MVC or WebForms site => made easy! This article covers Lucene.Net 3.0.3 (official site[^]) Introduction Have you ever heard of Lucene.Net?

Lucene.Net ultra fast search for MVC or WebForms site => made easy!

If not, let me introduce it briefly. Lucene.Net is a line-by-line port of popular Apache Lucene , which is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search. So, while technically possibly, though somewhat challenging, you can integrate original Apache Lucene into your .NET application, and it will give you insanely fast search. Main purpose of Lucene.Net is to be easy to integrate into any .NET application and provide most of the speed and flexibility of the original Java-based library.

You might ask: "why bother with Lucene.Net? First of all, I discovered that Lucene is still faster than SQL query. Good news are that Lucene.Net solves most of those problems for you! Small disclaimer, sort of)): Article Contents Scenario Installation.

Know How

ASP.NET Application and Page Life Cycle - CodeProject - Мозила фајерфокс. Download source code - 4.03 KB Table of Contents Introduction In this article, we will try to understand what the different events are which take place right from the time the user sends a request, until the time the request is rendered on the browser.

ASP.NET Application and Page Life Cycle - CodeProject - Мозила фајерфокс

So we will first try to understand the two broader steps of an ASP.NET request and then we will move into different events emitted from ‘HttpHandler’, ‘HttpModule’ and ASP.NET page object. As we move in this event journey, we will try to understand what kind of logic should go in each and every one of these events. This is a small Ebook for all my .NET friends which covers topics like WCF, WPF, WWF, Ajax, Core .NET, SQL, etc. The Two Step Process From 30,000 feet level, ASP.NET request processing is a 2 step process as shown below. Pinvoke.net: the interop wiki! - Мозила фајерфокс.

.NET Column: Safe Thread Synchronization. Safe Thread Synchronization Jeffrey Richter By far, the most common use of thread synchronization is to ensure mutually exclusive access to a shared resource by multiple threads.

.NET Column: Safe Thread Synchronization

In the Win32® API, the CRITICAL_SECTION structure and associated functions offers the fastest and most efficient way to synchronize threads for mutually exclusive access when the threads are all running in a single process. The Microsoft® .NET Framework doesn't expose a CRITICAL_SECTION structure, but it does offer a similar mechanism allowing mutually exclusive access among a set of threads running in the same process. This mechanism is made possible by way of SyncBlocks and the System.Threading.Monitor class. In this column, I'm going to explain how this common use of thread synchronization is exposed via the .NET Framework. The Great Idea The .NET Framework employs an object-oriented programming structure.

In Win32, an unmanaged C++ class with this design would look like the one in Figure 1.

WCF