mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 10:08:00 +02:00
More generics tests
This commit is contained in:
parent
7434885d07
commit
2510c16389
2 changed files with 67 additions and 1 deletions
|
@ -1,8 +1,31 @@
|
|||
using System;
|
||||
namespace LibA
|
||||
{
|
||||
interface IVal
|
||||
{
|
||||
int Val
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
class LibA0
|
||||
{
|
||||
public static int GetVal<T>(T val) where T : IVal
|
||||
{
|
||||
return val.Val;
|
||||
}
|
||||
|
||||
public static void Dispose<T>(mut T val) where T : IDisposable
|
||||
{
|
||||
val.Dispose();
|
||||
}
|
||||
|
||||
public static void Alloc<T>() where T : new, delete
|
||||
{
|
||||
let t = new T();
|
||||
delete t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue