File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -201,10 +201,14 @@ public static string GenerateCSharp () {
201
201
_sb . AppendLine ( " public string GetError () => err;" ) ;
202
202
_sb . AppendLine ( " public static Optional<T> FromValue (T _t) => new Optional<T> { t = _t };" ) ;
203
203
_sb . AppendLine ( " public static Optional<T> FromError (string _err) => new Optional<T> { err = _err };" ) ;
204
- //_sb.AppendLine (" public static T operator | (Optional<T> t1, T t2) => t1.HasValue () ? t1.GetValue () : t2; // operator ??");
205
- //_sb.AppendLine (" public static Optional<T> operator | (Optional<T> t1, Optional<T> t2) => t1.HasValue () ? t1 : t2; // operator ??");
206
- // FIXME: 支持“?? 异常”用法,但传字符串不对,假如出现 string? 类型的 ?? 就尴尬了
207
204
_sb . AppendLine ( "}" ) ;
205
+ //_sb.AppendLine ("public class OptionalVoid {");
206
+ //_sb.AppendLine (" public string err = \"\";");
207
+ //_sb.AppendLine (" public bool HasValue () => err == \"\";");
208
+ //_sb.AppendLine (" public string GetError () => err;");
209
+ //_sb.AppendLine (" public static OptionalVoid FromValue () => new OptionalVoid {};");
210
+ //_sb.AppendLine (" public static OptionalVoid FromError (string _err) => new OptionalVoid { err = _err };");
211
+ //_sb.AppendLine ("}");
208
212
_sb . AppendLine ( "}" ) ;
209
213
_sb . AppendLine ( ) ;
210
214
_sb . AppendLine ( ) ;
Original file line number Diff line number Diff line change
1
+ public enum Error {
2
+ DivideZero,
3
+ IndexOutOfBounds,
4
+ }
You can’t perform that action at this time.
0 commit comments