Skip to content

Instantly share code, notes, and snippets.

View amithegde's full-sized avatar
🎯
Focusing

Amit Hegde amithegde

🎯
Focusing
View GitHub Profile
@j2jensen
j2jensen / BenchmarkTemplate.cs
Created November 10, 2010 00:22
Fill in the blanks to test the difference in performance between different actions.
void Main()
{
var actions = new[]
{
new TimedAction("first", () =>
{
// Insert logic here.
}),
new TimedAction("second", () =>
{
@rymoore99
rymoore99 / IEnumerableExtension.cs
Last active August 29, 2015 13:56
IEnumerable Paging Extension
// Usage: myCollection.Page(pageNumber, pageSize);
public static class IEnumerableExtension {
public static IEnumerable<T> Page<T>(this IList<T> source, int pageNumber, int pageSize)
{
return source.Skip((pageNumber - 1) * pageSize).Take(pageSize);
}
}

Upcoming Features in C#

Mads Torgersen, MSFT

This document describes the C# language features currently featured in the March CTP. There's also discussion of a few of the VB features in the preview, where those are intended to be eventually implemented in C# as well.

Note that we have more language features planned that are not yet implemented. So look out for more to come in future CTPs and eventually a shipping version of C#.

@leonardo-m
leonardo-m / gist:6e9315a57fe9caa893472c2935e9d589
Last active June 19, 2024 05:43
A selection of 101 LINQ Samples converted to Rust
// Port of the C# 101 LINQ Samples rewritten into Apple's Swift 3.
#![feature(ordering_chaining, step_by)]
fn main() {
// linq5: Where - Indexed
/*
//c#
public void Linq5()
{
@davidfowl
davidfowl / TimeHttpEvents.cs
Last active April 6, 2024 20:17
Using Yarp.Telemetry.Consumption to track outbound network events (this package isn't tied to YARP)
using System.Diagnostics;
using System.Net.Sockets;
using System.Security.Authentication;
using Yarp.Telemetry.Consumption;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddTelemetryConsumer<TelemetryConsumer>();
var app = builder.Build();