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
| /// <summary> | |
| /// A hybrid immutable-mutable stack. It is an immutable chain with a regular mutable stack appended at the tail. | |
| /// Each immutable chain can point to a parent chain of the same kind. | |
| /// You can push and pop to the mutable part like a regular stack without allocating new instances. | |
| /// You can also get an immutable snapshot at any time. | |
| /// Getting a snapshot collapses the current mutable part and allocates the immutable chain appended to the current chain. | |
| /// Popping from an immutable chain just returns the parent and doesn't allocate. | |
| /// You can continue pushing and popping on every immutable instance, | |
| /// but this only affects the mutable part, the immutable part doesn't change. | |
| /// </summary> |
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.Collections.Generic; | |
| using System.Threading.Tasks; | |
| using Microsoft.CodeAnalysis; | |
| using Microsoft.CodeAnalysis.CodeActions; | |
| using Microsoft.CodeAnalysis.CodeRefactorings; | |
| using Microsoft.CodeAnalysis.CSharp; | |
| using Microsoft.CodeAnalysis.CSharp.Syntax; | |
| using Microsoft.CodeAnalysis.FindSymbols; | |
| using Microsoft.CodeAnalysis.Operations; | |
| using Microsoft.CodeAnalysis.Text; |
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 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) | |
| { |
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.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); |
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; | |
| public partial class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine(); | |
| _ = ThisAssembly.Info.InformationalVersion; | |
| } | |
| } |
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
| 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 | |
| }; | |
| } |
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
| <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> |
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; | |
| public partial class Program | |
| { | |
| private readonly string _foo; | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine(); | |
| _ = ThisAssembly.Info.InformationalVersion; |
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
| class C | |
| { | |
| static void M(string a, string b, string c) | |
| { | |
| M("مرحبا بالعالم", | |
| $"مرحبا بالعالم: {-1}", | |
| "OK"); | |
| } | |
| } |
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
| /// <summary> | |
| /// A hash combiner that is implemented with the Fowler/Noll/Vo algorithm (FNV-1a). This is a mutable struct for performance reasons. | |
| /// Taken from https://gist.github.com/StephenCleary/4f6568e5ab5bee7845943fdaef8426d2 | |
| /// </summary> | |
| public struct FnvHash | |
| { | |
| /// <summary> | |
| /// The starting point of the FNV hash. | |
| /// </summary> | |
| public const ulong Offset = 14695981039346656037; |
NewerOlder