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.Threading; | |
| using JetBrains.Annotations; | |
| namespace JetBrains.Util.Concurrency.Threading; | |
| /// <summary> | |
| /// Reader-writer lock for reader-heavy scenarios. | |
| /// </summary> | |
| public sealed class StripedReaderWriterLock |
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.Text; | |
| PrintNumber(0f); | |
| PrintNumber(-0f); | |
| PrintNumber(1f); | |
| PrintNumber(-1f); | |
| PrintNumber(float.PositiveInfinity); | |
| PrintNumber(float.NegativeInfinity); | |
| PrintNumber(float.NaN); | |
| PrintNumber(float.Epsilon); |
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.CompilerServices; | |
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Jobs; | |
| using BenchmarkDotNet.Running; | |
| // ReSharper disable RedundantToStringCall | |
| // ReSharper disable NotAccessedField.Local | |
| #pragma warning disable 169 | |
| BenchmarkRunner.Run<NullChecksBenchmark>(); |
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
| BenchmarkDotNet=v0.12.0, OS=Windows 10.0.17763.805 (1809/October2018Update/Redstone5), VM=VMware | |
| Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 4 logical and 4 physical cores | |
| .NET Core SDK=2.1.507 | |
| [Host] : .NET Core 2.1.11 (CoreCLR 4.6.27617.04, CoreFX 4.6.27617.02), X64 RyuJIT | |
| DefaultJob : .NET Core 2.1.11 (CoreCLR 4.6.27617.04, CoreFX 4.6.27617.02), X64 RyuJIT | |
| | Method | Count | Mean | Error | StdDev | Rank | | |
| |--------------- |------ |------------:|----------:|----------:|-----:| | |
| | IntArray | 1000 | 407.0 ns | 5.17 ns | 4.84 ns | 1 | |
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
| BenchmarkDotNet=v0.12.0, OS=Windows 10.0.17763.805 (1809/October2018Update/Redstone5), VM=VMware | |
| Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 4 logical and 4 physical cores | |
| [Host] : .NET Framework 4.8 (4.8.4018.0), X86 LegacyJIT | |
| DefaultJob : .NET Framework 4.8 (4.8.4018.0), X86 LegacyJIT | |
| | Method | Count | Mean | Error | StdDev | Rank | | |
| |--------------- |------ |------------:|----------:|----------:|-----:| | |
| | IntArray | 1000 | 260.9 ns | 3.25 ns | 3.04 ns | 1 | | |
| | StringArray | 1000 | 3,372.6 ns | 25.71 ns | 22.79 ns | 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
| [Pure, ContractAnnotation("null => false")] | |
| public static bool IsValueTuple([CanBeNull] this ITypeElement typeElement) | |
| { | |
| var structType = typeElement as IStruct; | |
| if (structType == null) return false; | |
| return typeElement.ShortName == "ValueTuple" | |
| && typeElement.GetContainingNamespace() is INamespace ns | |
| && ns.ShortName == "System" | |
| && ns.GetContainingNamespace() is INamespace root |
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
| var inferredType = currentStyle == VariableStyle.UseVar | |
| ? variableType | |
| : deconstructionInfo.Indices.IsEmpty() | |
| ? deconstructionInfo.TopmostExpression.Type() | |
| : FindInferredTypeForDeconstructionVariable(deconstructionInfo.TopmostExpression.GetExpressionType(),deconstructionInfo.Indices); |
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
| var isInGeneratedCode = IsInGeneratedCode(node, parameters.RegionsInfo); | |
| UsageState state; | |
| if (isInGeneratedCode != null) | |
| { | |
| state = (bool) isInGeneratedCode | |
| ? UsageState.METHOD_ASSIGNED_TO_DELEGATE_IN_GENERATED_CODE | |
| : UsageState.METHOD_ASSIGNED_TO_DELEGATE_IN_USER_CODE; | |
| } | |
| else |
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
| if (invocationExpression.InvokedExpression is IReferenceExpression invokedReferenceExpression | |
| && invokedReferenceExpression.TypeArgumentList != null | |
| && invokedReferenceExpression.TypeArgumentList.TypeArgumentNodes.Count == 0 | |
| && invokedReferenceExpression.TypeArgumentList.LAngle != null | |
| && invokedReferenceExpression.TypeArgumentList.RAngle != null) | |
| { | |
| textControl.Caret.MoveTo(invokedReferenceExpression.TypeArgumentList.RAngle.GetDocumentStartOffset(), CaretVisualPlacement.DontScrollIfVisible); | |
| return; | |
| } |
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
| if (myConditionalExpression.ThenResult is IRefExpression thenRefExpression && thenRefExpression.Expression != null) | |
| { | |
| thenRefExpression.ReplaceBy(thenRefExpression.Expression); | |
| } | |
| else if (myConditionalExpression.ElseResult is IRefExpression elseRefExpression && elseRefExpression.Expression != null) | |
| { | |
| elseRefExpression.ReplaceBy(elseRefExpression.Expression); | |
| } |
NewerOlder