Skip to content

Instantly share code, notes, and snippets.

View jonpryor's full-sized avatar

Jonathan Pryor jonpryor

View GitHub Profile
using System;
using System.Threading;
using Mono.Unix;
using Mono.Unix.Native;
class Test {
static void Main ()
{
StartHandler();
Console.WriteLine("Press any key to exit...");
<Member MemberName="Sort">
<MemberSignature Language="ILAsm" Value=".method public hidebysig static void Sort(class System.Array keys, class System.Array items, int32 index, int32 length, class System.Collections.IComparer comparer)" />
<MemberSignature Language="C#" Value="public static void Sort(Array keys, Array items, int index, int length, IComparer comparer);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="keys" Type="System.Array" />
<Parameter Name="items" Type="System.Array" />
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ENV_VAR</key>
<string>VALUE</string>
</dict>
</plist>
using System;
using System.Net;
using System.Linq;
using System.Text;
class Test {
public static void Main ()
{
WebHeaderCollection headers = new WebHeaderCollection();
headers.Add("test1","test2");
using System;
using System.Reflection;
[assembly: AssemblyVersion("2.2.*")]
class Test {
static void Main ()
{
Console.WriteLine ("Version: {0}",
Assembly.GetExecutingAssembly ().GetName ().Version);
// nested enum type
using System;
class Test {
public enum Foo {
A
}
static void Main ()
{
void scrim_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
XElement xmlScrim = XElement.Parse(e.Result, LoadOptions.None);
RunOnUiThread(() => {
var scrimresult = FindViewById<EditText>(Resource.Id.result);
scrimresult.Text = xmlScrim.Element("url").Value;
});
}
// Quick-and-dirty (and untested!) port of https://gist.github.com/3169945 to C#
Bitmap DecodeFile (string path)
{
var opts = new BitmapFactory.Options () {
InJustDecodeBounds = true,
};
using (var b = BitmapFactory.DecodeFile (path, opts)) {
// Ignore; we're filling `opts`
}
const int RequiredSize = 70;
diff --git a/Makefile b/Makefile
index b127bed..e5b75ae 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,6 @@ TARGET = bin/hello
# C library
CC = cc
-AR = ar cqs
-CLIB = bin/libhello.a

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",