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
public void SetInfo(string code)
{
eventCode = code switch
{
"K" => eventCodes[0],
"L" => eventCodes[1],
"R" => eventCodes[2],
"Q" => eventCodes[3],
"N" => eventCodes[4],
_ => "I"
using System;
using System.Globalization;
class Program
{
static void Main()
{
var zone = TimeZoneInfo.FindSystemTimeZoneById("Altai Standard Time");
DateTime start = new DateTime(2013, 12, 31, 16, 0, 0, DateTimeKind.Utc);
DateTime end = start.AddHours(4);
Imports System
Module Program
Sub Main(args As String())
Dim upload As Dictionary(Of (Long, Long, Long), Long) = New Dictionary(Of (Long, Long, Long), Long)
upload.Add((1, 2, 3), 5)
End Sub
End Module
using System;
using System.Globalization;
string text = "2020-10-14T13:11:51Z";
var dt = DateTime.ParseExact(text, "yyyy'-'MM'-'dd'T'hh':'mm':'ss'Z'", CultureInfo.InvariantCulture);
Console.WriteLine(dt);
using System;
using System.Reflection;
[System.AttributeUsage(System.AttributeTargets.All, Inherited = false, AllowMultiple = true)]
sealed class CustomDateTimeAttribute : System.Attribute
{
// See the attribute guidelines at
// http://go.microsoft.com/fwlink/?LinkId=85236
readonly string positionalString;
String res =
stuff.equals("TV") ? "Walter"
: stuff.equals("Movie") ? "White"
: "No result";
using System;
using System.Collections;
using System.Collections.Generic;
class Program
{
static void Main()
{
MySetting setting = new MySetting()
{
using System;
class Program
{
static void Main()
{
int yas;
yas=Convert.ToInt32(Console.ReadLine());
}
}
using Newtonsoft.Json;
class Data
{
public string Title { get; set; }
public DateTime SomeTimestamp { get; set; }
public List<int> Numbers { get; set; } = new List<int>();
}
class Program
private IEnumerable<EnumDescriptor> GetEnumDefinitions(IReadOnlyList<FileDescriptor> fileDescriptors) =>
fileDescriptors.SelectMany(GetEnumDefinitions);
private IEnumerable<EnumDescriptor> GetEnumDefinitions(FileDescriptor fileDescriptor) =>
fileDescriptor.EnumTypes.Concat(fileDescriptor.MessageTypes.SelectMany(GetEnumDefinitions));
private IEnumerable<EnumDescriptor> GetEnumDefinitions(MessageDescriptor messageDescriptor) =>
messageDescriptor.EnumTypes.Concat(messageDescriptor.NestedTypes.SelectMany(GetEnumDefinitions));