Skip to content

Instantly share code, notes, and snippets.

View jskeet's full-sized avatar
💭
Very happily employed. I do not wish to hear from recruiters.

Jon Skeet jskeet

💭
Very happily employed. I do not wish to hear from recruiters.
View GitHub Profile
using System;
using System.Threading;
class Program
{
~Program()
{
Console.WriteLine("Finalizer executed.");
}
using Q75832457;
using System.Text.Json;
JsonSerializerOptions JsonSerializerOptions = new()
{
PropertyNameCaseInsensitive = true
};
string json = @"
[
// This is a perfectly valid complete
// program making use of implicit using directives
// from C# 10, and top-level statements from C# 9.
int x = 10;
Console.WriteLine(x);
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
class Program
{
static async Task Main()
{
using IHost host = Host.CreateDefaultBuilder()
.ConfigureServices(services =>
delegate void SampleDelegate(string text);
class Test
{
static void Main()
{
string x = "";
var del = new SampleDelegate(Method, x);
}
using System;
using System.Text;
public class Program
{
static void Main()
{
var builder = new StringBuilder();
for (int i = 0; i < 256; i++)
{
import org.json.JSONObject;
public class Test {
public static void main(String args[]) {
String json = "{ \"status\": \"failed\", \"message\": \"All fields are required\" }";
JSONObject jsonObject = new JSONObject(json);
String status = jsonObject.getString("status");
String message = jsonObject.getString("message");
using System;
using System.IO;
using System.Collections.Generic;
public interface IWriterService
{
Stream WriteTXT<T>(List<T> content, string delimator, string header = "", bool isHeader = false) where T : class;
}
public class WriterService : IWriterService
using System;
using System.IO;
using System.Collections.Generic;
public interface IWriterService
{
Stream WriteTXT<T>(List<T> content, string delimiter,
string header, bool isHeader)
where T : class;
}
using System;
using System.Collections.Generic;
using System.Linq;
List<string> list1 = new List<string> {"1", "2", "3"};
List<string> list2 = new List<string> {"1", "2", "3"};
// Prints True
Console.WriteLine(list1.SequenceEqual(list2));