﻿// Decompiled with JetBrains decompiler
// Type: System.ComponentModel.UInt32Converter
// Assembly: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 5ABD58FD-DF31-44FD-A492-63F2B47CC9AF
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll

using System;
using System.Globalization;
using System.Runtime;
using System.Security.Permissions;

namespace System.ComponentModel
{
  /// <summary>
  /// Provides a type converter to convert 32-bit unsigned integer objects to and from various other representations.
  /// </summary>
  [HostProtection(SecurityAction.LinkDemand, SharedState = true)]
  public class UInt32Converter : BaseNumberConverter
  {
    internal override Type TargetType
    {
      get
      {
        return typeof (uint);
      }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.ComponentModel.UInt32Converter"/> class.
    /// </summary>
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public UInt32Converter()
    {
    }

    internal override object FromString(string value, int radix)
    {
      return (object) Convert.ToUInt32(value, radix);
    }

    internal override object FromString(string value, NumberFormatInfo formatInfo)
    {
      return (object) uint.Parse(value, NumberStyles.Integer, (IFormatProvider) formatInfo);
    }

    internal override object FromString(string value, CultureInfo culture)
    {
      return (object) uint.Parse(value, (IFormatProvider) culture);
    }

    internal override string ToString(object value, NumberFormatInfo formatInfo)
    {
      return ((uint) value).ToString("G", (IFormatProvider) formatInfo);
    }
  }
}
