我应该在我的任意结构中执行哪个成员,以使下列任务成为可能:
public struct MyStruct {
String s;
Int length;
}
MyStruct myStruct = new MyStruct { s = "Hello", length = 5 };
// Now, I want the following code to set the 's' to "Lol" and the
// length to 3 (length of "Lol"). The second part should be done
// automatically.
myStruct = "Lol"; // Or myStruct = String("Lol");
这应该怎么做呢?