/// <summary> /// Freezes the specified value as the result for any further calls to <see cref="Any"/> /// for the specified type. /// </summary> /// <param name="anon">The anonymous data provider to use.</param> /// <param name="type">The type to freeze.</param> /// <param name="value">The instance to freeze.</param> /// <exception cref="ArgumentNullException"><paramref name="anon"/> or <paramref name="type"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException"><paramref name="value"/> is not assignable to <paramref name="type"/>.</exception> public static void Freeze(this IRegisterAnonymousData anon, Type type, object value) { Argument.NotNull(anon, nameof(anon)); Argument.NotNull(type, nameof(type)); Argument.IsAssignableTo(value, type, nameof(value)); anon.Register(type, f => value); }