Scroll to top

Random


Category

C# Language : Yield Keyword

When you use the yield keyword in a statement, you indicate that the method, operator, or get accessor in which it appears is an iterator. Using yield to define…

Curious Bot December 1, 2018

C# Language : Windows Communication Foundation

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one…

Curious Bot December 1, 2018

C# Language : Constructors and Finalizers

Constructors are methods in a class that are invoked when an instance of that class is created. Their main responsibility is to leave the new object in a useful…

Curious Bot December 1, 2018

C# Language : Using Directive

Basic Usage using System; using BasicStuff = System; using Sayer = System.Console; using static System.Console; //From C# 6 class Program { public static void Main()…

Curious Bot December 1, 2018

C# Language : Type Conversion

MSDN implicit operator example class Digit { public Digit(double d) { val = d; } public double val; // User-defined conversion from Digit to double public static…

Curious Bot December 1, 2018

C# Language : Generating Random Numbers in C#

Generate a random int This example generates random values between 0 and 2147483647. Random rnd = new Random(); int randomNumber = rnd.Next(); Generate a Random…

Curious Bot December 1, 2018

C# Language : .NET Compiler Platform (Roslyn)

Create workspace from MSBuild project First obtain the Microsoft.CodeAnalysis.CSharp.Workspaces nuget before continuing. var workspace = Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create();…

Curious Bot December 1, 2018

C# Language : Task Parallel Library (TPL) Dataflow Constructs

JoinBlock (Collects 2-3 inputs and combines them into a Tuple) Like BatchBlock, JoinBlock<T1, T2, …> is able to group data from multiple data sources.…

Curious Bot December 1, 2018

C# Language : Overflow

Integer overflow There is a maximum capacity an integer can store. And when you go over that limit, it will loop back to the negative side. For int, it is 2147483647…

Curious Bot December 1, 2018

C# Language : System.DirectoryServices.Protocols.LdapConnection

Authenticated SSL LDAP connection, SSL cert does not match reverse DNS Set up some constants for the server and authentication information. Assuming LDAPv3, but…

Curious Bot December 1, 2018

C# Language : Performing HTTP requests

Creating and sending an HTTP POST request using System.Net; using System.IO; ... string requestUrl = "https://www.example.com/submit.html"; HttpWebRequest…

Curious Bot December 1, 2018

C# Language : Partial class and methods

Partial classes provides us an option to split classes into multiple parts and in multiple source files. All parts are combined into one single class during compile…

Curious Bot December 1, 2018

C# Language : How to use C# Structs to create a Union type (Similar to C Unions)

C-Style Unions in C# Union types are used in several languages, like C-language, to contain several different types which can "overlap". In other words,…

Curious Bot December 1, 2018

C# Language : Comments and regions

Documentation comments XML documentation comments can be used to provide API documentation that can be easily processed by tools: /// <summary> /// A helper…

Curious Bot December 1, 2018

C# Language : Attributes

Creating a custom attribute //1) All attributes should be inherited from System.Attribute //2) You can customize your attribute usage (e.g. place restrictions) by…

Curious Bot December 1, 2018

C# Language : IQueryable interface

Translating a LINQ query to a SQL query The IQueryable and IQueryable<T> interfaces allows developers to translate a LINQ query (a ‘language-integrated’…

Curious Bot December 1, 2018