Editing\DeclarationModifiers.cs (96)
19private readonly Modifiers _modifiers;
21private DeclarationModifiers(Modifiers modifiers)
44(isStatic ? Modifiers.Static : Modifiers.None) |
45(isAbstract ? Modifiers.Abstract : Modifiers.None) |
46(isNew ? Modifiers.New : Modifiers.None) |
47(isUnsafe ? Modifiers.Unsafe : Modifiers.None) |
48(isReadOnly ? Modifiers.ReadOnly : Modifiers.None) |
49(isVirtual ? Modifiers.Virtual : Modifiers.None) |
50(isOverride ? Modifiers.Override : Modifiers.None) |
51(isSealed ? Modifiers.Sealed : Modifiers.None) |
52(isConst ? Modifiers.Const : Modifiers.None) |
53(isWithEvents ? Modifiers.WithEvents : Modifiers.None) |
54(isPartial ? Modifiers.Partial : Modifiers.None) |
55(isAsync ? Modifiers.Async : Modifiers.None) |
56(isWriteOnly ? Modifiers.WriteOnly : Modifiers.None) |
57(isRef ? Modifiers.Ref : Modifiers.None) |
58(isVolatile ? Modifiers.Volatile : Modifiers.None) |
59(isExtern ? Modifiers.Extern : Modifiers.None) |
60(isRequired ? Modifiers.Required : Modifiers.None) |
61(isFile ? Modifiers.File : Modifiers.None))
101public bool IsStatic => (_modifiers & Modifiers.Static) != 0;
103public bool IsAbstract => (_modifiers & Modifiers.Abstract) != 0;
105public bool IsNew => (_modifiers & Modifiers.New) != 0;
107public bool IsUnsafe => (_modifiers & Modifiers.Unsafe) != 0;
109public bool IsReadOnly => (_modifiers & Modifiers.ReadOnly) != 0;
111public bool IsVirtual => (_modifiers & Modifiers.Virtual) != 0;
113public bool IsOverride => (_modifiers & Modifiers.Override) != 0;
115public bool IsSealed => (_modifiers & Modifiers.Sealed) != 0;
117public bool IsConst => (_modifiers & Modifiers.Const) != 0;
119public bool IsWithEvents => (_modifiers & Modifiers.WithEvents) != 0;
121public bool IsPartial => (_modifiers & Modifiers.Partial) != 0;
123public bool IsAsync => (_modifiers & Modifiers.Async) != 0;
125public bool IsWriteOnly => (_modifiers & Modifiers.WriteOnly) != 0;
127public bool IsRef => (_modifiers & Modifiers.Ref) != 0;
129public bool IsVolatile => (_modifiers & Modifiers.Volatile) != 0;
131public bool IsExtern => (_modifiers & Modifiers.Extern) != 0;
133public bool IsRequired => (_modifiers & Modifiers.Required) != 0;
135public bool IsFile => (_modifiers & Modifiers.File) != 0;
138=> new(SetFlag(_modifiers, Modifiers.Static, isStatic));
141=> new(SetFlag(_modifiers, Modifiers.Abstract, isAbstract));
144=> new(SetFlag(_modifiers, Modifiers.New, isNew));
147=> new(SetFlag(_modifiers, Modifiers.Unsafe, isUnsafe));
150=> new(SetFlag(_modifiers, Modifiers.ReadOnly, isReadOnly));
153=> new(SetFlag(_modifiers, Modifiers.Virtual, isVirtual));
156=> new(SetFlag(_modifiers, Modifiers.Override, isOverride));
159=> new(SetFlag(_modifiers, Modifiers.Sealed, isSealed));
162=> new(SetFlag(_modifiers, Modifiers.Const, isConst));
165=> new(SetFlag(_modifiers, Modifiers.WithEvents, withEvents));
168=> new(SetFlag(_modifiers, Modifiers.Partial, isPartial));
172=> new(SetFlag(_modifiers, Modifiers.Async, isAsync));
175=> new(SetFlag(_modifiers, Modifiers.WriteOnly, isWriteOnly));
178=> new(SetFlag(_modifiers, Modifiers.Ref, isRef));
181=> new(SetFlag(_modifiers, Modifiers.Volatile, isVolatile));
184=> new(SetFlag(_modifiers, Modifiers.Extern, isExtern));
187=> new(SetFlag(_modifiers, Modifiers.Required, isRequired));
190=> new(SetFlag(_modifiers, Modifiers.File, isFile));
192private static Modifiers SetFlag(Modifiers existing, Modifiers modifier, bool isSet)
223public static DeclarationModifiers Static => new(Modifiers.Static);
224public static DeclarationModifiers Abstract => new(Modifiers.Abstract);
225public static DeclarationModifiers New => new(Modifiers.New);
226public static DeclarationModifiers Unsafe => new(Modifiers.Unsafe);
227public static DeclarationModifiers ReadOnly => new(Modifiers.ReadOnly);
228public static DeclarationModifiers Virtual => new(Modifiers.Virtual);
229public static DeclarationModifiers Override => new(Modifiers.Override);
230public static DeclarationModifiers Sealed => new(Modifiers.Sealed);
231public static DeclarationModifiers Const => new(Modifiers.Const);
232public static DeclarationModifiers WithEvents => new(Modifiers.WithEvents);
233public static DeclarationModifiers Partial => new(Modifiers.Partial);
234public static DeclarationModifiers Async => new(Modifiers.Async);
235public static DeclarationModifiers WriteOnly => new(Modifiers.WriteOnly);
236public static DeclarationModifiers Ref => new(Modifiers.Ref);
237public static DeclarationModifiers Volatile => new(Modifiers.Volatile);
238public static DeclarationModifiers Extern => new(Modifiers.Extern);
239public static DeclarationModifiers Required => new(Modifiers.Required);
240public static DeclarationModifiers File => new(Modifiers.File);
259if (Enum.TryParse(value, out Modifiers mods))