This file contains 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.Diagnostics; | |
using System.Net; | |
using APITesting.Contracts; | |
namespace YOUR_NAMESPACE_HERE; | |
public readonly struct ApiError : IEquatable<ApiError> | |
{ | |
private const string DefaultErrorMessage = "An error occurred"; | |
internal ApiError(HttpStatusCode statusCode, object? data) |
This file contains 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.Windows.Controls; | |
using System.Windows.Markup; | |
using System.Windows.Media; | |
using FontAwesome6; | |
using FontAwesome6.Svg; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace MyNamespace; | |
[MarkupExtensionReturnType(typeof(SvgAwesome))] |
This file contains 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
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
<SolidColorBrush x:Key="ToolBarDarkFill" Color="#FFEEF5FD" /> | |
<SolidColorBrush x:Key="ToolBarDisabledFill" Color="#FFDADADA" /> | |
<SolidColorBrush x:Key="ToolBarDisabledBorder" Color="#FFDADADA" /> | |
<SolidColorBrush x:Key="ToolBarSeparatorFill" Color="#FFB6BDC5" /> | |
<SolidColorBrush x:Key="ToolBarButtonHover" Color="#210080FF" /> | |
<SolidColorBrush x:Key="ToolBarButtonHoverBorder" Color="#80DADADA" /> | |
<SolidColorBrush x:Key="ToolBarButtonChecked" Color="#400080FF" /> | |
<SolidColorBrush x:Key="ToolBarButtonPressed" Color="#400080FF" /> |
This file contains 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; | |
using System.Collections.Concurrent; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace Test; | |
public static class Casting | |
{ | |
private static readonly ConcurrentDictionary<Type, Delegate> cache = new(); |
This file contains 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; | |
using System.Threading.Channels; | |
namespace Demo; | |
public interface IConsoleAsync | |
{ | |
public TimeSpan CharacterDelay { get; set; } | |
public Task<string?> ReadLineAsync(CancellationToken cancellationToken); | |
public Task<string?> ReadLineAsync(); |
This file contains 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
module alpha { | |
yang-version 1.1; | |
prefix a; | |
namespace urn:alpha; | |
import bravo { | |
prefix b; | |
} | |
augment /network-device/interface { |
This file contains 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 class SimpleTests : TestBase | |
{ | |
[Test] | |
[TestCase( | |
new []{ 96, 45, 69, 18, 94, 50, 21, 75, 64, 77, 30, 45, 89, 80, 57, 55, 93, 87, 83, 79, 50, 33, 12 }, | |
new [] { 96, 69, 94, 50, 75, 64, 77, 89, 80, 57, 55, 93, 87, 83, 79, 50 } | |
)] | |
[TestCase( |
This file contains 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 readonly struct Error : IEquatable<Error> | |
{ | |
public const string DefaultErrorMessage = "An unspecified error has occurred"; | |
public static Error Default => default; | |
private readonly string? message; | |
public string Message => message ?? Exception?.Message ?? DefaultErrorMessage; | |
public Exception? Exception { get; } |
This file contains 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
[AttributeUsage(AttributeTargets.Class)] | |
public sealed class ViewAttribute : Attribute | |
{ | |
public Type ViewType { get; } | |
public ViewAttribute(Type viewType) => this.ViewType = viewType; | |
} | |
public class DataTemplateResourceDictionary : ResourceDictionary |
This file contains 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 NumberExtensions | |
{ | |
public static bool TryConvertChecked<TFrom, TTo>(this TFrom value, out TTo result) | |
where TFrom : INumberBase<TFrom> | |
where TTo : INumberBase<TTo> | |
{ | |
try | |
{ | |
result = TTo.CreateChecked(value); | |
return true; |
NewerOlder