我不知道爲什麼與三元運營商分配奇怪的反應: a = "foo"
=> "foo"
a = nil ? nil : a
=> "foo"
a
=> "foo"
但: a = nil ? nil : a
=> "foo"
a = "bar" ? "bar" : a
=> "bar"
a
=> "bar"
和: if a = nil
puts "should
爲什麼我不能在條件運算符中返回具有共同祖先的兄弟類型? 爲什麼C#不支持這個? class Polygon
{
public int CountSides { get; set; }
}
class Rectangle : Polygon { }
class Circle : Polygon { }
class Program
{
static void Ma