Skip to content

Instantly share code, notes, and snippets.

View jevansaks's full-sized avatar

Jevan Saks jevansaks

  • Microsoft
  • Redmond, WA
View GitHub Profile
@jevansaks
jevansaks / OptionalRef.cs
Created October 27, 2025 16:05
OptionalRef
// See https://aka.ms/new-console-template for more information
using System;
using System.Runtime.CompilerServices;
public readonly ref struct OptionalRef<T> where T : unmanaged
{
private readonly ref T _reference;
public unsafe OptionalRef(ref T value) { _reference = ref value; }
public unsafe OptionalRef(T* ptr) { _reference = ref *ptr; }
@jevansaks
jevansaks / PackDevApp.ps1
Created November 1, 2024 17:16
Script to pack an msix into a self-contained ps1 deployment
<#
.Synopsis
Takes an appxrecipe file and creates a powershell script that contains the contents of that MSIX
and knows how to deploy it.
.Description
Provide the path to the appxrecipe file
.Example
PackDevApp.ps1 -AppxRecipe <myapp.appxrecipe> [-OutputFile <outputfile.ps1>]