Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as C# by schabi ( 9 years ago )
namespace AmbigousCall
{
using System;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
class Program
{
const string SRC = @"
import clr
print instance.Plain()
print instance.Plain(clr.Reference[int]())
print instance.Method[str](clr.Reference[int]())
print instance.Method[str]()
";
static void Main(string[] args)
{
ScriptEngine engine = Python.CreateEngine();
ScriptScope mainScope = engine.CreateScope();
mainScope.SetVariable("instance", new TwoMinded());
engine.Execute(SRC, mainScope);
Console.ReadLine();
}
}
public class TwoMinded
{
public int Plain() { return 1; }
public int Plain(out int anotherInt)
{
anotherInt = 2;
return 3;
}
public T Method<T>() { return default(T); }
public T Method<T>(out int anotherInt)
{
anotherInt = 0;
return default(T);
}
}
}
Revise this Paste