This file contains hidden or 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
public void SetInfo(string code) | |
{ | |
eventCode = code switch | |
{ | |
"K" => eventCodes[0], | |
"L" => eventCodes[1], | |
"R" => eventCodes[2], | |
"Q" => eventCodes[3], | |
"N" => eventCodes[4], | |
_ => "I" |
This file contains hidden or 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.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); |
This file contains hidden or 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
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 |
This file contains hidden or 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.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); |
This file contains hidden or 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.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; |
This file contains hidden or 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
String res = | |
stuff.equals("TV") ? "Walter" | |
: stuff.equals("Movie") ? "White" | |
: "No result"; |
This file contains hidden or 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.Collections; | |
using System.Collections.Generic; | |
class Program | |
{ | |
static void Main() | |
{ | |
MySetting setting = new MySetting() | |
{ |
This file contains hidden or 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; | |
class Program | |
{ | |
static void Main() | |
{ | |
int yas; | |
yas=Convert.ToInt32(Console.ReadLine()); | |
} | |
} |
This file contains hidden or 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 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 |
This file contains hidden or 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
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)); |