.NET 4.x Передача значения Null в конструктор - C#
Формулировка задачи:
Этот вопрос попался на тестировании
Не могу разобраться почему выполняеться конструктор с параметром Double[] ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyConsoleApp
{
class Program
{
static void Main(string[] args)
{
D myD = new D(null);
Console.ReadLine();
}
}
public class D
{
public D(object o)
{
Console.WriteLine("Object");
}
public D(double[] array)
{
Console.WriteLine("Array");
}
public D(int i)
{
Console.WriteLine("Int");
}
}
}Решение задачи: «.NET 4.x Передача значения Null в конструктор»
textual
Листинг программы
var x = new Nullable<int>(); string s = x.ToString(); Type type = x.GetType();