C# question: What is a Weak Reference

Q

In C#, what is a weak reference?

✍: Guest

A
Generally, when you talk about a reference to an object in .NET (and in most other garbage collected languages), you are talking about a "strong" reference. As long as that reference exists, the garbage collector won't collect the object behind that reference. A weak reference is a special type of reference where the garbage collector can still collect the underlying object, even though you still technically have a reference to it. http://www.switchonthecode.com/tutorials/csharp-tutorial-weak-references

2009-09-04, 6236👍, 0💬