Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = false:none
csharp_style_conditional_delegate_call = true:suggestion

csharp_style_namespace_declarations = file_scoped:warning

# http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.CSharp.Workspaces/Formatting/CSharpFormattingOptions.cs

csharp_space_between_method_declaration_name_and_open_parenthesis = false
Expand Down
17 changes: 8 additions & 9 deletions src/TypeNameInterpretation.Benchmark/AssemblyNameParsing.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright (c) Brian Reichle. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.
using BenchmarkDotNet.Attributes;

namespace TypeNameInterpretation.Benchmark
namespace TypeNameInterpretation.Benchmark;

[MemoryDiagnoser]
public class AssemblyNameParsing
{
[MemoryDiagnoser]
public class AssemblyNameParsing
{
[Params("Foo", "Foo, Bar=\"Qux Quux\"", "Foo, Bar=\"Qux \\\"Quux\"")]
public string Text { get; set; }
[Params("Foo", "Foo, Bar=\"Qux Quux\"", "Foo, Bar=\"Qux \\\"Quux\"")]
public string Text { get; set; }

[Benchmark]
public InsAssembly Parse() => InsTypeFactory.ParseAssemblyName(Text);
}
[Benchmark]
public InsAssembly Parse() => InsTypeFactory.ParseAssemblyName(Text);
}
33 changes: 16 additions & 17 deletions src/TypeNameInterpretation.Benchmark/FormatAssemblyName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
using BenchmarkDotNet.Attributes;
using static TypeNameInterpretation.InsTypeFactory;

namespace TypeNameInterpretation.Benchmark
namespace TypeNameInterpretation.Benchmark;

[MemoryDiagnoser]
public class FormatAssemblyName
{
[MemoryDiagnoser]
public class FormatAssemblyName
{
[ParamsSource(nameof(TypesToFormat))]
public InsAssembly Type { get; set; }
[ParamsSource(nameof(TypesToFormat))]
public InsAssembly Type { get; set; }

public static IEnumerable<InsAssembly> TypesToFormat()
public static IEnumerable<InsAssembly> TypesToFormat()
{
return new[]
{
return new[]
{
Assembly("Foo"),
Assembly("Foo", Qualification("Bar", "Qux Quux")),
Assembly("Foo", Qualification("Bar", "Qux \"Quux")),
};
}

[Benchmark]
public string Format() => InsFormatter.Format(Type);
Assembly("Foo"),
Assembly("Foo", Qualification("Bar", "Qux Quux")),
Assembly("Foo", Qualification("Bar", "Qux \"Quux")),
};
}

[Benchmark]
public string Format() => InsFormatter.Format(Type);
}
33 changes: 16 additions & 17 deletions src/TypeNameInterpretation.Benchmark/FormatTypeName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
using BenchmarkDotNet.Attributes;
using static TypeNameInterpretation.InsTypeFactory;

namespace TypeNameInterpretation.Benchmark
namespace TypeNameInterpretation.Benchmark;

[MemoryDiagnoser]
public class FormatTypeName
{
[MemoryDiagnoser]
public class FormatTypeName
{
[ParamsSource(nameof(TypesToFormat))]
public InsType Type { get; set; }
[ParamsSource(nameof(TypesToFormat))]
public InsType Type { get; set; }

public static IEnumerable<InsType> TypesToFormat()
public static IEnumerable<InsType> TypesToFormat()
{
return new InsType[]
{
return new InsType[]
{
NamedType("Foo"),
NamedType("Foo", Assembly("Bar", Qualification("Baz", "Qux Quux"))),
Generic(NamedType("Foo"), NamedType("Bar"), NamedType("Baz")),
};
}

[Benchmark]
public string Format() => InsFormatter.Format(Type);
NamedType("Foo"),
NamedType("Foo", Assembly("Bar", Qualification("Baz", "Qux Quux"))),
Generic(NamedType("Foo"), NamedType("Bar"), NamedType("Baz")),
};
}

[Benchmark]
public string Format() => InsFormatter.Format(Type);
}
15 changes: 7 additions & 8 deletions src/TypeNameInterpretation.Benchmark/Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright (c) Brian Reichle. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.
using BenchmarkDotNet.Running;

namespace TypeNameInterpretation.Benchmark
namespace TypeNameInterpretation.Benchmark;

static class Program
{
static class Program
static void Main(string[] args)
{
static void Main(string[] args)
{
BenchmarkSwitcher
.FromAssembly(typeof(Program).Assembly)
.Run(args: args);
}
BenchmarkSwitcher
.FromAssembly(typeof(Program).Assembly)
.Run(args: args);
}
}
17 changes: 8 additions & 9 deletions src/TypeNameInterpretation.Benchmark/TypeNameParsing.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright (c) Brian Reichle. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.
using BenchmarkDotNet.Attributes;

namespace TypeNameInterpretation.Benchmark
namespace TypeNameInterpretation.Benchmark;

[MemoryDiagnoser]
public class TypeNameParsing
{
[MemoryDiagnoser]
public class TypeNameParsing
{
[Params("Foo", "Foo`2[[Bar, BarAssembly],[Baz, BazAssembly]]", "Foo, Bar, Baz=\"Qux Quux\"")]
public string Text { get; set; }
[Params("Foo", "Foo`2[[Bar, BarAssembly],[Baz, BazAssembly]]", "Foo, Bar, Baz=\"Qux Quux\"")]
public string Text { get; set; }

[Benchmark]
public InsType Parse() => InsTypeFactory.ParseTypeName(Text);
}
[Benchmark]
public InsType Parse() => InsTypeFactory.ParseTypeName(Text);
}
Loading