This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<User> list = new() | |
{ | |
new ("Raymond", 14, false), | |
new ("Shayna", 34, true), | |
new ("Vijay",20, false) | |
}; | |
Console.WriteLine("\nSingle Expr--------"); | |
ExpressionSpecification<User> exp = new(u => u.IsGraduated); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
namespace WeakDelegate | |
{ | |
// Containee needn't know anything about weak references, etc. | |
// It just fires its events as normal. | |
class Containee | |
{ | |
public Containee(string id) { _id = id; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using System.Linq.Expressions; | |
BenchmarkDotNet.Running.BenchmarkRunner.Run<Runner>(); | |
public class Runner | |
{ | |
Person p = new Person() { Name = "Pankaj" }; | |
[Benchmark] | |
public void SetUsingReflection() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var s = @"class Program {{ | |
static void Main(string[] args) {{ | |
var s = @{0}{1}{0}; | |
System.Console.WriteLine(s, (char)34, s); | |
}} | |
}}"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace BuilderPattern | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |