Last active
August 29, 2015 13:56
-
-
Save SLaks/9202893 to your computer and use it in GitHub Desktop.
Run this code as 32 bit and 64 bit, and explain why it crashes on 32-bit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Linq; | |
class Program { | |
static void Main(string[] args) { | |
Console.WriteLine("Attributes: " + typeof(Program) | |
.GetMembers() | |
.SelectMany(m => m.GetCustomAttributes(true)) | |
.Count() | |
); | |
} | |
[LogEvents(typeof(Program))] | |
public event EventHandler ꂢꂢ; | |
public event EventHandler ꂢꂢꂢꂢ; | |
public class LogEventsAttribute : Attribute { | |
public LogEventsAttribute(Type type) { | |
Console.WriteLine(String.Join(", ", | |
TypeDescriptor.GetEvents(type) | |
.Cast<EventDescriptor>() | |
.Distinct() | |
)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment