[Serializable]
struct BBText {
public string Body;
public bool Bold;
public bool Underline;
public bool Italic;
public bool Strikeout;
public BBText(string body = "", bool bold = false, bool underline = false, bool italic = false, bool strikeout = false) {
Body = body;
Bold = bold;
Underline = underline;
Italic = italic;
Strikeout = strikeout;
}
public static implicit operator string (BBText bbtext) {
return bbtext.Body;
}
}
//I removed the Serialize methods to cut it down to size
string messageText = new BBText("A message probably in the shoutbox").Body;
struct ExampleStructure {
public bool ExampleBool;
public string ExampleString;
public int ExampleInt;
public static implicit operator bool (ExampleStructure examplestructure) {
return examplestructure.ExampleBool;
}
public static implicit operator string (ExampleStructure examplestructure) {
return examplestructure.ExampleString;
}
public static implicit operator int (ExampleStructure examplestructure) {
return examplestructure.ExampleInt;
}
}
ExampleStructure es = new ExampleStructure() { ExampleBool = true, ExampleString = "Hello", ExampleInt = 10 };
bool _bool = es.ExampleBool;
string _string = es.ExampleString;
int _int = es.ExampleInt;
Copyright © 2024, NextGenUpdate.
All Rights Reserved.