C# 结构体初始化
public struct MyStruct { public string s; public int length; public static implicit operator MyStruct(string value) { return new MyStruct() { s = value, length = value.Length }; } } Example: MyStruct myStruct = "Lol"; Console.WriteLine(myStruct.s); Console.WriteLine(myStruct.length); Output: Lol 3