1
0
Fork 0
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:
Brian Fiete 2020-05-16 08:21:34 -07:00
parent 7434885d07
commit 2510c16389
2 changed files with 67 additions and 1 deletions

View file

@ -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;
}
}
}