Hi
Could someone please make it clear for me, how come the "ticket" variable keeps adding up, everytime the button is clicked ? I though the garbage collector should remove it automatically ? Even when i try to call GC.Collect explicit, it still keeps adding up in the Xamarin Profiler.
namespace ScannerAppCross
{
public class TestPage : BaseContentPage
{
Ticket ticket;
public TestPage ()
{
var b = new Button { Text = "Alloc" };
b.Clicked += (sender, e) => {
ticket = new Ticket ();
};
var g = new Button { Text = "GC" };
g.Clicked += (sender, e) => {
ticket = null;
};
Content = new StackLayout {
Padding = 20,
Children = {
b,
g,
}
};
}
}
public class Ticket
{
public string id { get; set; }
}
}
Is there something fundemental that I'm missing here ?? I sure hope so ;-)
Regards,
Kent Fonager