Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Last active December 1, 2015 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfbjarne/a439c2853a9b8f7907df to your computer and use it in GitHub Desktop.
Save rolfbjarne/a439c2853a9b8f7907df to your computer and use it in GitHub Desktop.
#region Imports
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Security;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using AddressBook;
using AudioUnit;
using AVFoundation;
using CoreAnimation;
using CoreFoundation;
using CoreGraphics;
using CoreImage;
using CoreMedia;
using CoreText;
using EventKit;
using ExternalAccessory;
using Foundation;
using JavaScriptCore;
using MapKit;
using MediaPlayer;
using MessageUI;
using ObjCRuntime;
using OpenTK;
using ReplayKit;
using Social;
using SpriteKit;
using StoreKit;
using SystemConfiguration;
using UIKit;
#endregion
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
UIViewController dvc;
UIButton button;
enum UInt8Enum : byte
{
A, B
}
enum Int8Enum : sbyte
{
A, B
}
enum UInt16Enum : ushort
{
A, B
}
enum Int16Enum : short
{
A, B
}
enum UInt32Enum : uint
{
A, B
}
enum Int32Enum : int
{
A, B
}
enum UInt64Enum : ulong
{
A, B
}
enum Int64Enum : long
{
A, B
}
public void Test<T> ()
{
var t = new Dictionary<T, object> ();
T value = (T) Enum.Parse (typeof (T), "A");
try {
t [value] = "foo";
Console.WriteLine ("Success: {0}", typeof (T).Name);
} catch (Exception e) {
Console.WriteLine ("Failed: {0}: {1}", typeof (T).Name, e);
}
}
public void TickOnce ()
{
Test<UInt8Enum> ();
Test<UInt16Enum> ();
Test<UInt32Enum> ();
Test<UInt64Enum> ();
Test<Int8Enum> ();
Test<Int16Enum> ();
Test<Int32Enum> ();
Test<Int64Enum> ();
}
void Tapped ()
{
TickOnce ();
}
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
NSTimer.CreateScheduledTimer (0.1, (v) => TickOnce ());
dvc = new UIViewController ();
dvc.View.BackgroundColor = UIColor.White;
button = new UIButton (window.Bounds);
button.TouchDown += (object sender, EventArgs e) =>
{
Tapped ();
};
button.SetTitleColor (UIColor.Blue, UIControlState.Normal);
button.SetTitleColor (UIColor.Gray, UIControlState.Highlighted);
button.SetTitle ("Click here", UIControlState.Normal);
dvc.Add (button);
window.RootViewController = dvc;
window.MakeKeyAndVisible ();
return true;
}
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment