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; | |
namespace TextBasedAdventure | |
{ | |
public class Enemy | |
{ | |
public Enemy(string name, int power, int hp) | |
{ | |
Name = name; | |
Power = power; |
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; | |
using System.Drawing; | |
using System.Windows.Forms; | |
namespace Test | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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 Game1 : Game | |
{ | |
private readonly ScreenManager _screenManager; | |
public Game1() | |
{ | |
_ = new GraphicsDeviceManager(this); | |
Content.RootDirectory = "Content"; | |
IsMouseVisible = true; | |
_screenManager = new ScreenManager(); |
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 sealed class RelativeFontSizeHelper | |
{ | |
public static readonly DependencyProperty RelativeFontSizeProperty = DependencyProperty.RegisterAttached( | |
"RelativeFontSize", | |
typeof(double), | |
typeof(RelativeFontSizeHelper), | |
new ((double)0, RelativeFontSizeChanged) | |
); | |
public static double GetRelativeFontSize(TextBlock textBlock) |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>WinExe</OutputType> | |
<TargetFramework>net6.0</TargetFramework> | |
<PublishReadyToRun>false</PublishReadyToRun> | |
<TieredCompilation>false</TieredCompilation> | |
<Nullable>enable</Nullable> | |
<WarnOn>3390;$(WarnOn)</WarnOn> | |
<LangVersion>preview</LangVersion> |
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; | |
using System.Windows.Input; | |
using CommunityToolkit.Mvvm.Input; // https://www.nuget.org/packages/CommunityToolkit.Mvvm | |
public class CustomCommand<T> : IRelayCommand<T> | |
{ | |
private readonly Action<T?> execute; | |
private readonly Predicate<T?>? canExecute; | |
public CustomCommand(Action<T?> execute, Predicate<T?>? canExecute = null) |
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.CodeAnalysis; | |
public struct BitVector<T> | |
: IBitVector<BitVector<T>, T>, | |
IEquatable<T>, IEqualityOperators<BitVector<T>, T> | |
where T : IEquatable<T>, | |
IBitwiseOperators<T, T, T>, | |
IShiftOperators<T, T>, | |
IMinMaxValue<T>, | |
IBinaryInteger<T>, |
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 PhoneNumber Parse(string text) | |
{ | |
var match = Regex.Match(text, @"^\(((?<areaCode>\d{3})\)\s*)?(?<exchange>\d{3})-(?<number>\d{4})$"); | |
var areaCode = string.IsNullOrWhiteSpace(match.Groups["areaCode"].Value) | |
? null | |
: (int?)int.Parse(match.Groups["areaCode"].Value); | |
var exchange = int.Parse(match.Groups["exchange"].Value); | |
var number = int.Parse(match.Groups["number"].Value); | |
if (areaCode is < 0 or > 999) | |
throw new Exception("Area code is invalid"); |
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 OneVarInterpolationPoint | |
: IComparable<OneVarInterpolationPoint>, | |
IComparable<decimal>, | |
IComparable, | |
IEquatable<OneVarInterpolationPoint>, | |
IEquatable<decimal> | |
{ | |
public OneVarInterpolationPoint(decimal var, decimal result) | |
{ |
OlderNewer