Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Pryor jonpryor

View GitHub Profile
View Range spec
Range:
Min/Max rather than Start/End, better naming when dealing with non-contiguous ranges.
Start and end values are inclusive.
How enumeration works for stepping, etc is left to the class to decide, provide a static class with some standard implementations that use Math<T>.
Assumption is the main IRange<T> can be either contiguous or non-contiguous
Assumptions for SubRanges():
No two sub-ranges overlap.
Each sub-range is atomic (ie contiguous).
View gist:485550
I/MonoDroid-Timing( 2903): 634153676364465130
I/MonoDroid-Timing( 2903): 634153676372732120
I/MonoDroid-Timing( 2903): 634153676372765720
I/MonoDroid-Timing( 2903): CreateNativeInterface: CreateNativeInterface [elapsed: 53.565 ms]
I/MonoDroid-Timing( 2903): 634153676375435070
I/MonoDroid-Timing( 2903): 634153676376707730
View gist:544182
diff --git a/mcs/mcs/typespec.cs b/mcs/mcs/typespec.cs
index 8bb6f56..da19f08 100644
--- a/mcs/mcs/typespec.cs
+++ b/mcs/mcs/typespec.cs
@@ -1049,6 +1049,16 @@ namespace Mono.CSharp
}
}
+ public override string Name {
+ get {
View gist:547467
diff --git a/mcs/mcs/doc.cs b/mcs/mcs/doc.cs
index 2b4ca5d..7107568 100644
--- a/mcs/mcs/doc.cs
+++ b/mcs/mcs/doc.cs
@@ -741,10 +741,25 @@ namespace Mono.CSharp {
{
var tp = type as TypeParameterSpec;
if (tp != null) {
+ int c = 0;
+ type = type.DeclaringType;
View gist:547533
diff --git a/mcs/mcs/doc.cs b/mcs/mcs/doc.cs
index 7107568..2b8ed2c 100644
--- a/mcs/mcs/doc.cs
+++ b/mcs/mcs/doc.cs
@@ -720,8 +720,16 @@ namespace Mono.CSharp {
if (paramSpec.Length > 0)
paramSpec += ")";
- string name = mc is Constructor ? "#ctor" : mc.Name;
- if (mc.MemberName.IsGeneric)
View gist:1051125
Enter statements below.
csharp> var x = "<response><video>Hi!</video></response>";
csharp> using System.IO;
csharp> using System.Xml;
csharp> var xs = new StringReader(x);
csharp> var d = new XmlDocument();
csharp> d.Load(xs);
csharp> d.DocumentElement;
{ { { } } }
csharp> d.DocumentElement.Name;
View gist:1051157
csharp> var x = "<response xmlns='http://example.org/'><video>Hi!</video></response>";
csharp> var xs = new StringReader(x);
csharp> var d = new XmlDocument();
csharp> d.Load(xs);
csharp> foreach (XmlNode n in d.DocumentElement.SelectNodes("video")) Console.WriteLine(n.Name);
# Note: no output
csharp> var mgr = new XmlNamespaceManager (d.NameTable);
csharp> mgr.AddNamespace("lol", "http://example.org/");
csharp> foreach (XmlNode n in d.DocumentElement.SelectNodes("lol:video", mgr)) Console.WriteLine(n.Name);
video
View gist:1107454
/* output:
# test2: (* 10 10 )
# test: (+ 10 ((* 10 10 )))
# test2: (* 10 10 )
*/
namespace Schemin.AST
{
public interface IScheminType
{
View gist:1183642
class ValueComparer<T> : IComparer<T>, IEqualityComparer<T>
{
Func<T, T, int> comparer;
Func<T, int> getHashCode;
public ValueComparer(Func<T, T, int> comparer, Func<T, int> getHashCode = null)
{
this.comparer = comparer;
this.getHashCode = getHashCode;
}
View gist:1443928
[Register ("android/accounts/AccountManagerFuture", DoNotGenerateAcw=true)]
interface IAccountManagerFuture {
[Register ("cancel", "(Z)Z", "GetCancelHandler:AccountManagerFutureInvoker, YourAssemblyName, Version=0.0.0")]
bool Cancel (bool mayInterruptIfRunning);
// ...
}
class IAccountManagerFutureInvoker : IAccountManagerFuture {
You can’t perform that action at this time.