public object GetSomething()
{
var key = ToDoSomething();
return key;
}
public object GetSomething()
{
return ToDoSomething();
}
public Tuple<object,object> GetSomething()
{
return new Tuple<object,object>( SomeDo(), SOmeDoing);
}
public object GetSomething(ref object k)
{
k = SomeDo();
return SomeDoing();
}
public object GetSomething(out int k)
{
k = SomeDo();
return SomeDoing();
}
var
и return
можно еще что-нибудь сделать с key./*ILCODE
.method private hidebysig static string GetString() cil managed
{
// Размер кода: 11 (0xb)
.maxstack 1
.locals init ([0] string V_0)
IL_0000: nop
IL_0001: ldstr "MyString"
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method Program::GetString*/
/* OILCODE
.method private hidebysig static string GetString() cil managed
{
// Размер кода: 6 (0x6)
.maxstack 8
IL_0000: ldstr "MyString"
IL_0005: ret
} // end of method Program::GetString
*/
private static string GetString()
{
return "MyString";
}
/*ILCODE
.method private hidebysig static string GetStringVar() cil managed
{
// Размер кода: 13 (0xd)
.maxstack 1
.locals init ([0] string str,
[1] string V_1)
IL_0000: nop
IL_0001: ldstr "MyString"
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: br.s IL_000b
IL_000b: ldloc.1
IL_000c: ret
} // end of method Program::GetStringVar
*/
/*OILCODE
.method private hidebysig static string GetStringVar() cil managed
{
// Размер кода: 8 (0x8)
.maxstack 1
.locals init ([0] string str)
IL_0000: ldstr "MyString"
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: ret
} // end of method Program::GetStringVar
*/
private static string GetStringVar()
{
var str = "MyString";
return str;
}
/*ILCODE
.method private hidebysig static object GetObject() cil managed
{
// Размер кода: 11 (0xb)
.maxstack 1
.locals init ([0] object V_0)
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.Object::.ctor()
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method Program::GetObject
*/
/*OILCODE
.method private hidebysig static object GetObject() cil managed
{
// Размер кода: 6 (0x6)
.maxstack 8
IL_0000: newobj instance void [mscorlib]System.Object::.ctor()
IL_0005: ret
} // end of method Program::GetObject
*/
private static object GetObject()
{
return new object();
}
/*ILCODE
.method private hidebysig static object GetObjectVar() cil managed
{
// Размер кода: 13 (0xd)
.maxstack 1
.locals init ([0] object b,
[1] object V_1)
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.Object::.ctor()
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: br.s IL_000b
IL_000b: ldloc.1
IL_000c: ret
} // end of method Program::GetObjectVar
*/
/*OILCODE
.method private hidebysig static object GetObjectVar() cil managed
{
// Размер кода: 8 (0x8)
.maxstack 1
.locals init ([0] object b)
IL_0000: newobj instance void [mscorlib]System.Object::.ctor()
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: ret
} // end of method Program::GetObjectVar
*/
private static object GetObjectVar()
{
var b = new object();
return b;
}