Skip to content

Instantly share code, notes, and snippets.

View KirillOsenkov's full-sized avatar

Kirill Osenkov KirillOsenkov

View GitHub Profile
<PropertyGroup Label="Output directory">
<BinariesFolder>$(SrcRoot)bin</BinariesFolder>
<CommonIntermediateOutputRoot>$(SrcRoot)obj\</CommonIntermediateOutputRoot>
<BaseIntermediateOutputPath>$(CommonIntermediateOutputRoot)$(Configuration)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
<AssemblyInfoPath Condition="'$(AssemblyInfoPath)' == ''">$(BaseIntermediateOutputPath)GlobalAssemblyInfo.cs</AssemblyInfoPath>
<CommonOutputDirectory>$(BinariesFolder)\$(Configuration)</CommonOutputDirectory>
<BuildToCommonOutputDirectory Condition="'$(BuildToCommonOutputDirectory)' == ''">true</BuildToCommonOutputDirectory>
<OutputPath Condition="'$(OutputPath)' == ''">$(BinariesFolder)\$(Configuration)\$(MSBuildProjectName)</OutputPath>
<OutputPath Condition="'$(BuildToCommonOutputDirectory)' == 'true'">$(CommonOutputDirectory)\</OutputPath>
bool CanConvertToHex(object value)
{
return value switch
{
byte or sbyte or ushort or short or uint or int or ulong or long or IntPtr or UIntPtr => true,
_ => false
};
}
using System;
public partial class Program
{
static void Main(string[] args)
{
Console.WriteLine();
_ = ThisAssembly.Info.InformationalVersion;
}
}
using System;
using System.Runtime.InteropServices;
static class PdbGuidAndAgeExtractor
{
public static string GetGuidAndAge(string pdbFile)
{
var dataSource = (IDiaDataSource) Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("83AB22C8-993A-4D14-A0E0-37BC0AAEA793")));
dataSource.loadDataFromPdb(pdbFile);
public static class Extensions
{
public static void DiffSortedSequences<T>(
this IReadOnlyList<T> left,
IReadOnlyList<T> right,
IComparer<T> comparer,
Action<T> added = null,
Action<T> removed = null,
Action<T> same = null)
{