Csharp/CSharp Tutorial/struct/this

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Use this() to initialize a struct

public struct ComplexNumber
{
   public ComplexNumber( double real, double imaginary )
   {
      this.real = real;
      this.imaginary = imaginary;
   }
   public ComplexNumber( double real ) :this()
   {
      this.real = real;
   }
   private double real;
   private double imaginary;
}