summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/WeakReferenceExtensions.cs
blob: e4e883a4f58af9c1477926e36fd9cc51299bf2dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System;

namespace Xamarin.Forms
{
	internal static class WeakReferenceExtensions
	{
		internal static bool TryGetTarget<T>(this WeakReference self, out T target) where T : class
		{
			if (self == null)
				throw new ArgumentNullException("self");

			target = (T)self.Target;
			return target != null;
		}
	}
}