Skip to content

Instantly share code, notes, and snippets.

Alexander Shvedov controlflow

Block or report user

Report or block controlflow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View benchmark.txt
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 |
View benchmark.txt
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 |
View foo1.cs
switch (targetIdentifier.Name)
{
case "assembly":
return AttributeTargets.Assembly;
case "module":
return AttributeTargets.Module;
case "return":
return AttributeTargets.ReturnValue;
case "field":
return AttributeTargets.Field;
View foo1.cs
foreach (var sourceFile in transaction.GetProperties(typeof(SymbolCache)).OfType<Pair<IPsiSourceFile, bool>>())
{
SynchUpdateCacheForFile(sourceFile: sourceFile.First, isRollback: true, underTransaction: false, fireEvent: sourceFile.Second);
}
View foo1.cs
// 1
foreach (var x in xs)
using (var r = x.GetResource())
DoWork(x, r);
// 2
foreach (var x in xs)
using (var r = x.GetResource()) {
DoWork(x, r);
View foo1.cs
private void ModifyItemsCount(int newCount)
{
if (myTail == null || myTail is FrugalLocalMarkerList<T>)
{
if (newCount == 0)
myTail = null;
else if (newCount == 1)
myTail = FrugalLocalMarkerList<T>.One;
else if (newCount == 2)
myTail = FrugalLocalMarkerList<T>.Two;
View foo1.cs
var genericType = myIsAsync
? useEnumeratorType
? predefinedType.IAsyncEnumerator
: predefinedType.IAsyncEnumerable
: useEnumeratorType
? predefinedType.GenericIEnumerator
: predefinedType.GenericIEnumerable;
View csharp7.cs
case IRecursivePattern recursivePattern
when recursivePattern.TypeUsage == null
&& recursivePattern.DeconstructionPatternClause == null
&& recursivePattern.PropertyPatternClause is IPropertyPatternClause patternPropertyPatternClause
&& patternPropertyPatternClause.PatternsEnumerable.IsEmpty()
&& recursivePattern.Designation == null
&& !recursivePattern.ContainsPreprocessorDirectives():
{
}
View csharp7.cs
[Pure]
public static bool CanRemoveDesignation([NotNull] this IRecursivePattern recursivePattern)
{
if (recursivePattern.TypeUsage == null && recursivePattern.PropertyPatternClause == null)
{
var deconstructionPatternClause = recursivePattern.DeconstructionPatternClause;
if (deconstructionPatternClause != null)
{
if (deconstructionPatternClause.Patterns.Count == 1) return false;
}
View foo1.cs
var tupleTypeComponent = tupleType.ComponentOrNull(componentIndex);
if (tupleTypeComponent != null)
{
var actualTypeName = tupleTypeComponent.Value.ExplicitName ?? TupleTypeComponent.GetDefaultComponentName(componentIndex);
consumer.AddHighlighting(new DeconstructionSubpatternWrongTupleComponentNameError(subpattern, actualTypeName));
}
You can’t perform that action at this time.