当我写 Console.WriteLine( new Point (1,1)); 它不调用方法ToString.但它将对象转换为Int32,并将其写入控制台.但为什么?它似乎忽略了被覆盖的方法ToString.
struct Point
{
public Int32 x;
public Int32 y;
public Point(Int32 x1,Int32 y1)
{
x = x1;
y = y1;
}
public static Point operator +(Point p1, Point p2)
{
return new Point(p1.x + p2.x, p1.y + p2.y);
}
public static implicit operator Int32(Point p)
{
Console.WriteLine("Converted to Int32");
return p.y + p.x;
}
public override string ToString()
{
return String.Format("x = {0} | y = {1}", x, …Run Code Online (Sandbox Code Playgroud) 在 jupyter notebook 中使用多光标选择的众所周知的方法是按 Alt 然后使用鼠标。但是有没有办法在没有鼠标的情况下做到这一点?例如像 Visual Studio 中的 Ctrl+Shift。
用鼠标做这件事比用键盘做要慢得多。