I hereby claim:
- I am chrcar01 on github.
- I am chriscarter3 (https://keybase.io/chriscarter3) on keybase.
- I have a public key ASCH8bbvwZrHAs5CC3Se2g_LFIsApYodRUGKUIBJnXgdpQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
namespace LazyCreatorCon | |
{ | |
/// <summary> | |
/// Creates an instance of a shitty class that can't be mocked, | |
/// can't be changed, and requires dozens of constructors. |
public class GenericComparer<T> : IComparer<T> | |
{ | |
private readonly Func<T, IComparable> _comparer; | |
private GenericComparer(Func<T, IComparable> comparer) | |
{ | |
_comparer = comparer ?? throw new ArgumentNullException(nameof(comparer)); | |
} | |
public static GenericComparer<T> Create(Func<T, IComparable> comparer) |
using System.Runtime.CompilerServices; | |
// Ripped from S.O. answer: https://stackoverflow.com/a/66285728/1594171 | |
// 1. Put this code in ProjectSourcePath.cs at root of project | |
// 2. Reference project path like this: ProjectSourcePath.Value | |
internal static class ProjectSourcePath | |
{ | |
private const string myRelativePath = nameof(ProjectSourcePath) + ".cs"; | |
private static string? lazyValue; | |
public static string Value => lazyValue ??= CalculatePath(); |
using System; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
// https://www.pinvoke.net/default.aspx/shlwapi.assocquerystring | |
// https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-assocquerystringa | |
// https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-findexecutablea | |
// https://stackoverflow.com/a/9540278 |
/// <summary> | |
/// Helper for working with calendar concepts. | |
/// </summary> | |
public static class CalendarHelper | |
{ | |
/// <summary> | |
/// Returns all of the weeks for specified calendar month. | |
/// </summary> | |
public static IEnumerable<Week> GetWeeksForCalendarMonth(DateOnly month) | |
{ |
async Task Main() | |
{ | |
var builder = WebApplication.CreateBuilder(); | |
builder.Services.AddEndpointsApiExplorer(); | |
builder.Services.AddSwaggerGen(s => s.SwaggerDoc("v1", new OpenApiInfo | |
{ | |
Title = "Report API", | |
Description = "Manager all of your reporting needs.", | |
Version = "v1", | |
TermsOfService = null, |
/* | |
* Arguments class: application arguments interpreter | |
* | |
* Authors: R. LOPES | |
* Contributors: R. LOPES | |
* Created: 25 October 2002 | |
* Modified: 28 October 2002 | |
* | |
* Version: 1.0 | |
*/ |