using System;
using System.ComponentModel;
using System.Globalization;
namespace Spectre.Console
{
///
/// Contains extension methods for .
///
public static class ObsoleteHasCultureExtensions
{
///
/// Sets the culture.
///
/// An object type with a culture.
/// The object to set the culture for.
/// The culture to set.
/// The same instance so that multiple calls can be chained.
[Obsolete("Use Culture(..) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static T SetCulture(this T obj, CultureInfo culture)
where T : class, IHasCulture
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
if (culture is null)
{
throw new ArgumentNullException(nameof(culture));
}
obj.Culture = culture;
return obj;
}
///
/// Sets the culture.
///
/// An object type with a culture.
/// The object to set the culture for.
/// The culture to set.
/// The same instance so that multiple calls can be chained.
[Obsolete("Use Culture(..) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static T SetCulture(this T obj, string name)
where T : class, IHasCulture
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
obj.Culture = CultureInfo.GetCultureInfo(name);
return obj;
}
///
/// Sets the culture.
///
/// An object type with a culture.
/// The object to set the culture for.
/// The culture to set.
/// The same instance so that multiple calls can be chained.
[Obsolete("Use Culture(..) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static T SetCulture(this T obj, int name)
where T : class, IHasCulture
{
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
obj.Culture = CultureInfo.GetCultureInfo(name);
return obj;
}
}
}