Skip to content

Instantly share code, notes, and snippets.

@urasandesu
Created February 1, 2014 12:06
Show Gist options
  • Select an option

  • Save urasandesu/8751409 to your computer and use it in GitHub Desktop.

Select an option

Save urasandesu/8751409 to your computer and use it in GitHub Desktop.
using System;
using System.Prig;
using System.Reflection;
using Urasandesu.Prig.Framework;
namespace program1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("★入れ替え前: {0}", InternalToString());
using (new IndirectionsContext())
{
PException.InternalToString.Body = () => "にゃんぱすー";
Console.WriteLine("★入れ替え中: {0}", InternalToString());
}
Console.WriteLine("★戻し: {0}", InternalToString());
}
static string InternalToString()
{
var e = new NotImplementedException();
var internalToStringInfo = typeof(NotImplementedException).GetMethod("InternalToString", BindingFlags.Instance | BindingFlags.NonPublic);
return (string)internalToStringInfo.Invoke(e, new object[0]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment