Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@damieng
Created May 16, 2017 18:46
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 damieng/8de07aa2b63297bf0bb7057712e2434d to your computer and use it in GitHub Desktop.
Save damieng/8de07aa2b63297bf0bb7057712e2434d to your computer and use it in GitHub Desktop.
A sample C# file that messes with syntax highlighters
extern alias b;
using System;
class A { public dictionary<int, String> func(int a) { } }
struct hi { byte q; int a = /* */ 1; char c = 'c'; }
void A() { }
#if ABC // Testing
#endif
/* Mult-line
comment */
public abstract class Outside { }
namespace A.B {
/// <xml a="b">comment</xml>abc
using Inside.Namespace; using /* */ static /* */ Inside.Namespace; // 123
using /* */ Aliased /**/ =/**/ Inside.Namespace;
enum A { Test = 1+1, [Good("" /* Sure */)]Test2 = 2l } interface ISomething { }
class A : B // Ok
{
}
[Attribute(@"ABC", typeof(G))]
private /* OK */ class Inside<T1, T2> where T1:int // Hi
{
struct hi {
byte q; //(
}
extern int[] a=new Bob[0];
public readonly Nullable<String, int> Field = "A\t";
public string AutoProperty { get; set; } = "https://ok";
public override int GetterOnly { get; } = 123f;
private Nullable<String, bool> Method<T>(out char[] a) where T:class {
var a=1;
Func<int?, int> f = (a, b) => a.Add(int.parse('a'));
}
ISomething NotGeneric<T>(int? a, Nullable<String> b) => (ISomething)b;
String message = $@"{name} exclaimed ""Hello, world!""";
}
internal static partial struct Inside2 { }
}
class Program
{
static void Main([Something("")]string A[], int b)
{
//string is highlighted
var s = "MyClass";
//MyClass IS now highlighted
IMyClass myClass = new MyClass();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment