SoapYearMonth 构造函数

定义

初始化 SoapYearMonth 类的新实例。

重载

SoapYearMonth()

初始化 SoapYearMonth 类的新实例。

SoapYearMonth(DateTime)

用指定的 SoapYearMonth 对象初始化 DateTime 类的新实例。

SoapYearMonth(DateTime, Int32)

用指定的 SoapYearMonth 对象和一个指示 DateTime 是正值还是负值的整数初始化 Value 类的新实例。

SoapYearMonth()

初始化 SoapYearMonth 类的新实例。

public:
 SoapYearMonth();
public SoapYearMonth ();
Public Sub New ()

示例

下面的代码示例演示如何使用此构造函数。

// Create a SoapYearMonth object.
SoapYearMonth^ year = gcnew SoapYearMonth;
year->Value = DateTime::Now;
Console::WriteLine( "The year is {0}.", year );
// Create a SoapYearMonth object.
SoapYearMonth yearMonth = new SoapYearMonth();
yearMonth.Value = DateTime.Now;
Console.WriteLine("The yearMonth is {0}.", yearMonth.ToString());

适用于

SoapYearMonth(DateTime)

用指定的 SoapYearMonth 对象初始化 DateTime 类的新实例。

public:
 SoapYearMonth(DateTime value);
public SoapYearMonth (DateTime value);
new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth : DateTime -> System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth
Public Sub New (value As DateTime)

参数

value
DateTime

用于初始化当前实例的 DateTime 对象。

示例

下面的代码示例演示如何使用此构造函数。

// Create a SoapYearMonth object.
SoapYearMonth^ year = gcnew SoapYearMonth( DateTime::Now );
Console::WriteLine( "The year is {0}.", year );
// Create a SoapYearMonth object.
SoapYearMonth yearMonth = new SoapYearMonth(DateTime.Now);
Console.WriteLine("The yearMonth is {0}.", yearMonth.ToString());

适用于

SoapYearMonth(DateTime, Int32)

用指定的 SoapYearMonth 对象和一个指示 DateTime 是正值还是负值的整数初始化 Value 类的新实例。

public:
 SoapYearMonth(DateTime value, int sign);
public SoapYearMonth (DateTime value, int sign);
new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth : DateTime * int -> System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth
Public Sub New (value As DateTime, sign As Integer)

参数

value
DateTime

用于初始化当前实例的 DateTime 对象。

sign
Int32

一个整数,指示 value 是否为正。

示例

下面的代码示例演示如何使用此构造函数。

// Create a SoapYearMonth object with a positive sign.
SoapYearMonth^ year = gcnew SoapYearMonth( DateTime::Now,1 );
Console::WriteLine( "The year is {0}.", year );
// Create a SoapYearMonth object with a positive sign.
SoapYearMonth yearMonth = new SoapYearMonth(DateTime.Now, 1);
Console.WriteLine("The yearMonth is {0}.", yearMonth.ToString());

注解

小于 0 的整数表示负 sign

适用于