﻿// Decompiled with JetBrains decompiler
// Type: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth
// Assembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 255ABCDF-D9D6-4E3D-BAD4-F74D4CE3D7A8
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll

using System;
using System.Globalization;
using System.Runtime;
using System.Runtime.InteropServices;

namespace System.Runtime.Remoting.Metadata.W3cXsd2001
{
  /// <summary>
  /// Wraps an XSD gMonth type.
  /// </summary>
  [ComVisible(true)]
  [Serializable]
  public sealed class SoapMonth : ISoapXsd
  {
    private static string[] formats = new string[2]
    {
      "--MM--",
      "--MM--zzz"
    };
    private DateTime _value = DateTime.MinValue;

    /// <summary>
    /// Gets the XML Schema definition language (XSD) of the current SOAP type.
    /// </summary>
    /// 
    /// <returns>
    /// A <see cref="T:System.String"/> that indicates the XSD of the current SOAP type.
    /// </returns>
    public static string XsdType
    {
      get
      {
        return "gMonth";
      }
    }

    /// <summary>
    /// Gets or sets the date and time of the current instance.
    /// </summary>
    /// 
    /// <returns>
    /// The <see cref="T:System.DateTime"/> object that contains the date and time of the current instance.
    /// </returns>
    public DateTime Value
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this._value;
      }
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] set
      {
        this._value = value;
      }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth"/> class.
    /// </summary>
    public SoapMonth()
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth"/> class with a specified <see cref="T:System.DateTime"/> object.
    /// </summary>
    /// <param name="value">A <see cref="T:System.DateTime"/> object to initialize the current instance. </param>
    public SoapMonth(DateTime value)
    {
      this._value = value;
    }

    /// <summary>
    /// Returns the XML Schema definition language (XSD) of the current SOAP type.
    /// </summary>
    /// 
    /// <returns>
    /// A <see cref="T:System.String"/> that indicates the XSD of the current SOAP type.
    /// </returns>
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public string GetXsdType()
    {
      return SoapMonth.XsdType;
    }

    /// <summary>
    /// Returns <see cref="P:System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth.Value"/> as a <see cref="T:System.String"/>.
    /// </summary>
    /// 
    /// <returns>
    /// A <see cref="T:System.String"/> that is obtained from <see cref="P:System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth.Value"/> in the format "--MM--".
    /// </returns>
    public override string ToString()
    {
      return this._value.ToString("--MM--", (IFormatProvider) CultureInfo.InvariantCulture);
    }

    /// <summary>
    /// Converts the specified <see cref="T:System.String"/> into a <see cref="T:System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth"/> object.
    /// </summary>
    /// 
    /// <returns>
    /// A <see cref="T:System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay"/> object that is obtained from <paramref name="value"/>.
    /// </returns>
    /// <param name="value">The String to convert. </param><exception cref="T:System.Runtime.Remoting.RemotingException"><paramref name="value"/> does not contain a date and time that corresponds to any of the recognized format patterns. </exception>
    public static SoapMonth Parse(string value)
    {
      return new SoapMonth(DateTime.ParseExact(value, SoapMonth.formats, (IFormatProvider) CultureInfo.InvariantCulture, DateTimeStyles.None));
    }
  }
}
