mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Improvements to interfaces: extensions, better generics, statics
This commit is contained in:
parent
bff1d657cc
commit
6cb2df65a6
12 changed files with 322 additions and 68 deletions
|
@ -270,5 +270,17 @@ namespace Tests
|
|||
|
||||
TestDefaults();
|
||||
}
|
||||
|
||||
public static TTo Convert<TFrom, TTo>(TFrom val) where TTo : operator explicit TFrom
|
||||
{
|
||||
return (TTo)val;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestConversion()
|
||||
{
|
||||
int a = 123;
|
||||
float f = Convert<int, float>(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue