Skip to content

Instantly share code, notes, and snippets.


Jonathan Pryor jonpryor

View GitHub Profile
View X.targets
<IsValid Condition="$([System.Version]::TryParse(
<Target Name="Foo">
<Message Text="IsValid=$(IsValid)" Importance="High" />
View X.targets
<IsNet6IosCompatibleWithNet6 Condition="$([MSBuild]::IsTargetFrameworkCompatible('net6.0', 'net6.0-ios'))">Yes</IsNet6IosCompatibleWithNet6>
<Target Name="Foo">
<Message Text="IsNet6IosCompatibleWithNet6=$(IsNet6IosCompatibleWithNet6)" />
jonpryor / output.txt
Created May 8, 2014
Demonstrate bash dynamic scoping
View output.txt
start: str=begin
inner: str=outer
end: str=begin
View NdkUtils.cs.diff
diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs b/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs
index e4548923d..851e4fb83 100644
--- a/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs
@@ -12,6 +12,7 @@ using Microsoft.Build.Utilities;
using Java.Interop.Tools.Diagnostics;
using Xamarin.Android.Tools;
+using Microsoft.Android.Build.Tasks;
View app.cs
using System;
using System.IO;
class App {
public static void Main (string[] args)
foreach (var file in args) {
var content = File.ReadAllText (file);
var lines = content.Split ('\n');
foreach (var line in lines) {
View MyWb.cs
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Webkit;
View tuples-and-linq.cs
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
public static void Main()
var markers = new[]{
(a: 1, s: "a"),
View gist:1555261
using System;
using System.Threading;
using Mono.Unix;
using Mono.Unix.Native;
class Test {
static void Main ()
Console.WriteLine("Press any key to exit...");
View gist:3751679

How would I do the equivalent of 'in_dir=s' => \@in_dirs from Perl's Getopt::Long, i.e., a case where --in_dir was used multiple times.

Manually, by capturing values in an intermediate list:

var dirs    = new List<string> ();
var options = new OptionSet {
    { "in_dir=", v => dirs.Add (v) },
var unmatched = options.Parse(new[]{
    "--in_dir", "A",

Installation of Native Libraries

An Android .apk file can contain native libraries for one or more architectures. Historically, all native libraries for the target device are extracted at .apk installation time. This would result in two copies of native libraries on the target device: a set of native libraries which are stored compressed within the .apk, and a separate set of native libraries on the Android target filesystem.

Starting with Android v6.0 (API-23), Android added an ability for