There is a timer, its callback must be executed once:
var timer = new Threading.Timer(callback: MyCallback, state: NotNullObject, dueTime: Timeout.Infinite, period: Timeout.Infinite);
//note state is some not-null object
//timer is local variable
//there is some code...
timer.Change(new TimeSpan(0, 0, 5), Timeout.InfiniteTimeSpan); //launch timer in 5 seconds
According this answer, if state argument is not null then garbage collector does not collect the timer. So why MyCallback never be executed here?
And there is another related question: if state argument is not null and timer is needed for once-only operation does it mean GC can not collect this timer later? i.e. is needless memory consumption in this case?