Scroll to top

.NET Framework


Category

.NET Framework : System.Net.Mail

MailMessage Here is the example of creating of mail message with attachments. After creating we send this message with the help of SmtpClient class. Default 25 port…

Curious Bot December 1, 2018

.NET Framework : .NET Core

.NET Core is a general purpose development platform maintained by Microsoft and the .NET community on GitHub. It is cross-platform, supporting Windows, macOS and…

Curious Bot December 1, 2018

.NET Framework : JSON in .NET with Newtonsoft.Json

The NuGet package Newtonsoft.Json has become the defacto standard for using and manipulating JSON formatted text and objects in .NET. It is a robust tool that is…

Curious Bot December 1, 2018

.NET Framework : Process and Thread affinity setting

Get process affinity mask public static int GetProcessAffinityMask(string processName = null) { Process myProcess = GetProcessByName(ref processName); int processorAffinity…

Curious Bot December 1, 2018

.NET Framework : Memory management

Unmanaged Resources When we talk about the GC and the "heap", we’re really talking about what’s called the managed heap. Objects on the managed…

Curious Bot December 1, 2018

.NET Framework : HTTP servers

Basic read-only HTTP file server (HttpListener) Notes: This example must be run in administrative mode. Only one simultaneous client is supported. For simplicity,…

Curious Bot December 1, 2018

.NET Framework : Write to and read from StdErr stream

Write to standard error output using Console var sourceFileName = "NonExistingFile"; try { System.IO.File.Copy(sourceFileName, "DestinationFile");…

Curious Bot December 1, 2018

.NET Framework : Expression Trees

Simple Expression Tree Generated by the C# Compiler Consider the following C# code Expression<Func<int, int>> expression = a => a + 1; Because the…

Curious Bot December 1, 2018

.NET Framework : Managed Extensibility Framework

Exporting a Type (Basic) using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.Composition; namespace Demo { [Export(typeof(IUserProvider))]…

Curious Bot December 1, 2018

.NET Framework : Encryption / Cryptography

RijndaelManaged Required Namespace: System.Security.Cryptography private class Encryption { private const string SecretKey = "topSecretKeyusedforEncryptions";…

Curious Bot December 1, 2018

.NET Framework : Unit testing

Adding MSTest unit testing project to an existing solution Right click on the solution, Add new project From the Test section, select an Unit Test Project Pick a…

Curious Bot December 1, 2018

.NET Framework : JIT compiler

JIT compilation, or just-in-time compilation, is an alternative approach to interpretation of code or ahead-of-time compilation. JIT compilation is used in the .NET…

Curious Bot December 1, 2018

.NET Framework : System.IO.File class

Move a File from one location to another File.Move In order to move a file from one location to another, one simple line of code can achieve this: File.Move(@"C:\TemporaryFile.txt",…

Curious Bot December 1, 2018

.NET Framework : Using Progress and IProgress

Simple Progress reporting IProgress<T> can be used to report progress of some procedure to another procedure. This example shows how you can create a basic…

Curious Bot December 1, 2018

.NET Framework : SpeechRecognitionEngine class to recognize speech

Asynchronously recognizing speech for free text dictation using System.Speech.Recognition; // ... SpeechRecognitionEngine recognitionEngine = new SpeechRecognitionEngine();…

Curious Bot December 1, 2018

.NET Framework : ForEach

Calling a method on an object in a list public class Customer { public void SendEmail() { // Sending email code here } } List<Customer> customers = new List<Customer>();…

Curious Bot December 1, 2018