Skip to content

Instantly share code, notes, and snippets.

@AdmiralSnyder
AdmiralSnyder / TypeConstraining.cs
Last active August 4, 2020 14:22
a way to have a dictionary to a subset of types, for mapping classes to tags, for example
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApp1
{
class TypeBase<TInterface>
{
public virtual Type TheInnerType { get; }
}
@AdmiralSnyder
AdmiralSnyder / UpdateMstscWithScreens.cs
Created May 27, 2025 12:53
Updating a specific rdp file so that the screen indexes for the selectedmonitors parameter are adjusted correctly.
#! dotnet run
#:sdk Microsoft.NET.Sdk
#:property UseWindowsForms True
#:property TargetFramework net10.0-windows
using System.Windows.Forms;
var screens = Screen.AllScreens.Select(scr => (Screen: scr, Index : int.Parse(scr.DeviceName.Split("DISPLAY").Last()) - 1));
int firstScreenIdx = -1;
List<int> otherScreens = [];