public static readonly System.ComponentModel.BrowsableAttribute Yes;
public BrowsableAttribute(bool browsable) { }
public bool Browsable { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public static System.ComponentModel.CategoryAttribute Layout { get { throw null; } }
public static System.ComponentModel.CategoryAttribute Mouse { get { throw null; } }
public static System.ComponentModel.CategoryAttribute WindowStyle { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
- protected virtual string GetLocalizedString(string value) { throw null; }
+ protected virtual string? GetLocalizedString(string value) { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
[System.ComponentModel.DesignerCategoryAttribute("Component")]
protected virtual bool CanRaiseEvents { get { throw null; } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
- public System.ComponentModel.IContainer Container { get { throw null; } }
+ public System.ComponentModel.IContainer? Container { get { throw null; } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
protected bool DesignMode { get { throw null; } }
protected System.ComponentModel.EventHandlerList Events { get { throw null; } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
- public virtual System.ComponentModel.ISite Site { get { throw null; } set { } }
+ public virtual System.ComponentModel.ISite? Site { get { throw null; } set { } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
- public event System.EventHandler Disposed { add { } remove { } }
+ public event System.EventHandler? Disposed { add { } remove { } }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~Component() { }
- protected virtual object GetService(System.Type service) { throw null; }
+ protected virtual object? GetService(System.Type service) { throw null; }
public override string ToString() { throw null; }
}
public partial class ComponentCollection : System.Collections.ReadOnlyCollectionBase
{
public ComponentCollection(System.ComponentModel.IComponent[] components) { }
- public virtual System.ComponentModel.IComponent this[int index] { get { throw null; } }
- public virtual System.ComponentModel.IComponent this[string name] { get { throw null; } }
+ public virtual System.ComponentModel.IComponent? this[int index] { get { throw null; } }
+ public virtual System.ComponentModel.IComponent? this[string? name] { get { throw null; } }
public void CopyTo(System.ComponentModel.IComponent[] array, int index) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All)]
public DescriptionAttribute(string description) { }
public virtual string Description { get { throw null; } }
protected string DescriptionValue { get { throw null; } set { } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public DesignerCategoryAttribute(string category) { }
public string Category { get { throw null; } }
public override object TypeId { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public static readonly System.ComponentModel.DesignerSerializationVisibilityAttribute Visible;
public DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility visibility) { }
public System.ComponentModel.DesignerSerializationVisibility Visibility { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public static readonly System.ComponentModel.DesignOnlyAttribute Yes;
public DesignOnlyAttribute(bool isDesignOnly) { }
public bool IsDesignOnly { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public DisplayNameAttribute(string displayName) { }
public virtual string DisplayName { get { throw null; } }
protected string DisplayNameValue { get { throw null; } set { } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public sealed partial class EventHandlerList : System.IDisposable
{
public EventHandlerList() { }
- public System.Delegate this[object key] { get { throw null; } set { } }
- public void AddHandler(object key, System.Delegate value) { }
+ public System.Delegate? this[object key] { get { throw null; } set { } }
+ public void AddHandler(object key, System.Delegate? value) { }
public void AddHandlers(System.ComponentModel.EventHandlerList listToAddFrom) { }
public void Dispose() { }
- public void RemoveHandler(object key, System.Delegate value) { }
+ public void RemoveHandler(object key, System.Delegate? value) { }
}
public partial interface IComponent : System.IDisposable
{
- System.ComponentModel.ISite Site { get; set; }
- event System.EventHandler Disposed;
+ System.ComponentModel.ISite? Site { get; set; }
+ event System.EventHandler? Disposed;
}
public partial interface IContainer : System.IDisposable
{
System.ComponentModel.ComponentCollection Components { get; }
- void Add(System.ComponentModel.IComponent component);
- void Add(System.ComponentModel.IComponent component, string name);
- void Remove(System.ComponentModel.IComponent component);
+ void Add(System.ComponentModel.IComponent? component);
+ void Add(System.ComponentModel.IComponent? component, string? name);
+ void Remove(System.ComponentModel.IComponent? component);
}
[System.AttributeUsageAttribute(System.AttributeTargets.All)]
public sealed partial class ImmutableObjectAttribute : System.Attribute
public static readonly System.ComponentModel.ImmutableObjectAttribute Yes;
public ImmutableObjectAttribute(bool immutable) { }
public bool Immutable { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
{
public InvalidAsynchronousStateException() { }
protected InvalidAsynchronousStateException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public InvalidAsynchronousStateException(string message) { }
- public InvalidAsynchronousStateException(string message, System.Exception innerException) { }
+ public InvalidAsynchronousStateException(string? message) { }
+ public InvalidAsynchronousStateException(string? message, System.Exception? innerException) { }
}
public partial class InvalidEnumArgumentException : System.ArgumentException
{
public InvalidEnumArgumentException() { }
protected InvalidEnumArgumentException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public InvalidEnumArgumentException(string message) { }
- public InvalidEnumArgumentException(string message, System.Exception innerException) { }
- public InvalidEnumArgumentException(string argumentName, int invalidValue, System.Type enumClass) { }
+ public InvalidEnumArgumentException(string? message) { }
+ public InvalidEnumArgumentException(string? message, System.Exception? innerException) { }
+ public InvalidEnumArgumentException(string? argumentName, int invalidValue, System.Type enumClass) { }
}
public partial interface ISite : System.IServiceProvider
{
System.ComponentModel.IComponent Component { get; }
System.ComponentModel.IContainer Container { get; }
bool DesignMode { get; }
- string Name { get; set; }
+ string? Name { get; set; }
}
public partial interface ISupportInitialize
{
public partial interface ISynchronizeInvoke
{
bool InvokeRequired { get; }
- System.IAsyncResult BeginInvoke(System.Delegate method, object[] args);
- object EndInvoke(System.IAsyncResult result);
- object Invoke(System.Delegate method, object[] args);
+ System.IAsyncResult BeginInvoke(System.Delegate method, object?[]? args);
+ object? EndInvoke(System.IAsyncResult result);
+ object? Invoke(System.Delegate method, object?[]? args);
}
[System.AttributeUsageAttribute(System.AttributeTargets.All)]
public sealed partial class LocalizableAttribute : System.Attribute
public static readonly System.ComponentModel.LocalizableAttribute Yes;
public LocalizableAttribute(bool isLocalizable) { }
public bool IsLocalizable { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public static readonly System.ComponentModel.MergablePropertyAttribute Yes;
public MergablePropertyAttribute(bool allowMerge) { }
public bool AllowMerge { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public static readonly System.ComponentModel.NotifyParentPropertyAttribute Yes;
public NotifyParentPropertyAttribute(bool notifyParent) { }
public bool NotifyParent { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public ParenthesizePropertyNameAttribute() { }
public ParenthesizePropertyNameAttribute(bool needParenthesis) { }
public bool NeedParenthesis { get { throw null; } }
- public override bool Equals(object o) { throw null; }
+ public override bool Equals(object? o) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public static readonly System.ComponentModel.ReadOnlyAttribute Yes;
public ReadOnlyAttribute(bool isReadOnly) { }
public bool IsReadOnly { get { throw null; } }
- public override bool Equals(object value) { throw null; }
+ public override bool Equals(object? value) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
public static readonly System.ComponentModel.RefreshPropertiesAttribute Repaint;
public RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties refresh) { }
public System.ComponentModel.RefreshProperties RefreshProperties { get { throw null; } }
- public override bool Equals(object value) { throw null; }
+ public override bool Equals(object? value) { throw null; }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configurations>netcoreapp-Debug;netcoreapp-Release;uap-Debug;uap-Release</Configurations>
+ <Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.ComponentModel.Primitives.cs" />
<RootNamespace>System.ComponentModel.Primitives</RootNamespace>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<Configurations>netcoreapp-Debug;netcoreapp-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release</Configurations>
+ <Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System\ComponentModel\ISynchronizeInvoke.cs" />
/// </summary>
public bool Browsable { get; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- BrowsableAttribute other = obj as BrowsableAttribute;
- return other?.Browsable == Browsable;
- }
+ public override bool Equals(object? obj) =>
+ obj is BrowsableAttribute other && other.Browsable == Browsable;
public override int GetHashCode() => Browsable.GetHashCode();
[AttributeUsage(AttributeTargets.All)]
public class CategoryAttribute : Attribute
{
- private static volatile CategoryAttribute s_action;
- private static volatile CategoryAttribute s_appearance;
- private static volatile CategoryAttribute s_asynchronous;
- private static volatile CategoryAttribute s_behavior;
- private static volatile CategoryAttribute s_data;
- private static volatile CategoryAttribute s_design;
- private static volatile CategoryAttribute s_dragDrop;
- private static volatile CategoryAttribute s_defAttr;
- private static volatile CategoryAttribute s_focus;
- private static volatile CategoryAttribute s_format;
- private static volatile CategoryAttribute s_key;
- private static volatile CategoryAttribute s_layout;
- private static volatile CategoryAttribute s_mouse;
- private static volatile CategoryAttribute s_windowStyle;
+ private static volatile CategoryAttribute? s_action;
+ private static volatile CategoryAttribute? s_appearance;
+ private static volatile CategoryAttribute? s_asynchronous;
+ private static volatile CategoryAttribute? s_behavior;
+ private static volatile CategoryAttribute? s_data;
+ private static volatile CategoryAttribute? s_design;
+ private static volatile CategoryAttribute? s_dragDrop;
+ private static volatile CategoryAttribute? s_defAttr;
+ private static volatile CategoryAttribute? s_focus;
+ private static volatile CategoryAttribute? s_format;
+ private static volatile CategoryAttribute? s_key;
+ private static volatile CategoryAttribute? s_layout;
+ private static volatile CategoryAttribute? s_mouse;
+ private static volatile CategoryAttribute? s_windowStyle;
private bool _localized;
{
lock (_locker)
{
- string localizedValue = GetLocalizedString(_categoryValue);
+ string? localizedValue = GetLocalizedString(_categoryValue);
if (localizedValue != null)
{
_categoryValue = localizedValue;
}
}
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- CategoryAttribute other = obj as CategoryAttribute;
- return other != null && Category == other.Category;
- }
+ public override bool Equals(object? obj) =>
+ obj is CategoryAttribute other && other.Category == Category;
public override int GetHashCode() => Category?.GetHashCode() ?? 0;
/// <summary>
/// Looks up the localized name of a given category.
/// </summary>
- protected virtual string GetLocalizedString(string value) => SR.GetResourceString("PropertyCategory" + value, null);
+ protected virtual string? GetLocalizedString(string value) => SR.GetResourceString("PropertyCategory" + value, null);
public override bool IsDefaultAttribute() => Category == Default.Category;
}
/// </summary>
private static readonly object s_eventDisposed = new object();
- private ISite _site;
- private EventHandlerList _events;
+ private ISite? _site;
+ private EventHandlerList? _events;
~Component() => Dispose(false);
/// </summary>
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public event EventHandler Disposed
+ public event EventHandler? Disposed
{
add => Events.AddHandler(s_eventDisposed, value);
remove => Events.RemoveHandler(s_eventDisposed, value);
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public virtual ISite Site
+ public virtual ISite? Site
{
get => _site;
set => _site = value;
_site?.Container?.Remove(this);
if (_events != null)
{
- ((EventHandler)_events[s_eventDisposed])?.Invoke(this, EventArgs.Empty);
+ ((EventHandler?)_events[s_eventDisposed])?.Invoke(this, EventArgs.Empty);
}
}
}
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public IContainer Container => _site?.Container;
+ public IContainer? Container => _site?.Container;
/// <summary>
/// Returns an object representing a service provided by
/// the <see cref='System.ComponentModel.Component'/>.
/// </summary>
- protected virtual object GetService(Type service) => _site?.GetService(service);
+ protected virtual object? GetService(Type service) => _site?.GetService(service);
/// <summary>
/// Gets a value indicating whether the <see cref='System.ComponentModel.Component'/>
/// </summary>
public override string ToString()
{
- ISite s = _site;
+ ISite? s = _site;
if (s == null)
{
- return GetType().FullName;
+ return GetType().FullName!;
}
return s.Name + " [" + GetType().FullName + "]";
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the
/// <see cref='System.ComponentModel.IContainer'/>.
/// </summary>
- public virtual IComponent this[string name]
+ public virtual IComponent? this[string? name]
{
get
{
if (name != null)
{
IList list = InnerList;
- foreach (IComponent comp in list)
+ foreach (IComponent? comp in list)
{
if (comp != null && comp.Site != null && comp.Site.Name != null && string.Equals(comp.Site.Name, name, StringComparison.OrdinalIgnoreCase))
{
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the
/// <see cref='System.ComponentModel.IContainer'/>.
/// </summary>
- public virtual IComponent this[int index] => (IComponent)InnerList[index];
+ public virtual IComponent? this[int index] => (IComponent?)InnerList[index];
public void CopyTo(IComponent[] array, int index) => InnerList.CopyTo(array, index);
}
/// </summary>
protected string DescriptionValue { get; set; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- DescriptionAttribute other = obj as DescriptionAttribute;
- return other != null && other.Description == Description;
- }
+ public override bool Equals(object? obj) =>
+ obj is DescriptionAttribute other && other.Description == Description;
public override int GetHashCode() => Description?.GetHashCode() ?? 0;
/// </summary>
public bool IsDesignOnly { get; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- DesignOnlyAttribute other = obj as DesignOnlyAttribute;
- return other?.IsDesignOnly == IsDesignOnly;
- }
+ public override bool Equals(object? obj) =>
+ obj is DesignOnlyAttribute other && other.IsDesignOnly == IsDesignOnly;
public override int GetHashCode() => IsDesignOnly.GetHashCode();
/// </summary>
public string Category { get; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- DesignerCategoryAttribute other = obj as DesignerCategoryAttribute;
- return other != null && other.Category == Category;
- }
+ public override bool Equals(object? obj) =>
+ obj is DesignerCategoryAttribute other && other.Category == Category;
public override int GetHashCode() => Category?.GetHashCode() ?? 0;
/// </summary>
public DesignerSerializationVisibility Visibility { get; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- DesignerSerializationVisibilityAttribute other = obj as DesignerSerializationVisibilityAttribute;
- return other?.Visibility == Visibility;
- }
+ public override bool Equals(object? obj) =>
+ obj is DesignerSerializationVisibilityAttribute other && other.Visibility == Visibility;
public override int GetHashCode() => base.GetHashCode();
/// </summary>
protected string DisplayNameValue { get; set; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- DisplayNameAttribute other = obj as DisplayNameAttribute;
- return other != null && other.DisplayName == DisplayName;
- }
+ public override bool Equals(object? obj) =>
+ obj is DisplayNameAttribute other && other.DisplayName == DisplayName;
public override int GetHashCode() => DisplayName?.GetHashCode() ?? 0;
/// </summary>
public sealed class EventHandlerList : IDisposable
{
- private ListEntry _head;
- private readonly Component _parent;
+ private ListEntry? _head;
+ private readonly Component? _parent;
/// <summary>
/// Creates a new event handler list. The parent component is used to check the
/// <summary>
/// Gets or sets the delegate for the specified key.
/// </summary>
- public Delegate this[object key]
+ public Delegate? this[object key]
{
get
{
- ListEntry e = null;
+ ListEntry? e = null;
if (_parent == null || _parent.CanRaiseEventsInternal)
{
e = Find(key);
}
set
{
- ListEntry e = Find(key);
+ ListEntry? e = Find(key);
if (e != null)
{
e._handler = value;
}
}
- public void AddHandler(object key, Delegate value)
+ public void AddHandler(object key, Delegate? value)
{
- ListEntry e = Find(key);
+ ListEntry? e = Find(key);
if (e != null)
{
e._handler = Delegate.Combine(e._handler, value);
throw new ArgumentNullException(nameof(listToAddFrom));
}
- ListEntry currentListEntry = listToAddFrom._head;
+ ListEntry? currentListEntry = listToAddFrom._head;
while (currentListEntry != null)
{
AddHandler(currentListEntry._key, currentListEntry._handler);
public void Dispose() => _head = null;
- private ListEntry Find(object key)
+ private ListEntry? Find(object key)
{
- ListEntry found = _head;
+ ListEntry? found = _head;
while (found != null)
{
if (found._key == key)
return found;
}
- public void RemoveHandler(object key, Delegate value)
+ public void RemoveHandler(object key, Delegate? value)
{
- ListEntry e = Find(key);
+ ListEntry? e = Find(key);
if (e != null)
{
e._handler = Delegate.Remove(e._handler, value);
private sealed class ListEntry
{
- internal readonly ListEntry _next;
+ internal readonly ListEntry? _next;
internal readonly object _key;
- internal Delegate _handler;
+ internal Delegate? _handler;
- public ListEntry(object key, Delegate handler, ListEntry next)
+ public ListEntry(object key, Delegate? handler, ListEntry? next)
{
_next = next;
_key = key;
/// When implemented by a class, gets or sets the <see cref='System.ComponentModel.ISite'/>
/// associated with the <see cref='System.ComponentModel.IComponent'/>.
/// </summary>
- ISite Site { get; set; }
+ ISite? Site { get; set; }
/// <summary>
/// Adds an event handler to listen to the Disposed event on the component.
/// </summary>
- event EventHandler Disposed;
+ event EventHandler? Disposed;
}
}
/// Adds the specified <see cref='System.ComponentModel.IComponent'/> to the
/// <see cref='System.ComponentModel.IContainer'/> at the end of the list.
/// </summary>
- void Add(IComponent component);
+ void Add(IComponent? component);
// Adds a component to the container.
/// <summary>
/// <see cref='System.ComponentModel.IContainer'/> at the end of the list,
/// and assigns a name to the component.
/// </summary>
- void Add(IComponent component, string name);
+ void Add(IComponent? component, string? name);
/// <summary>
/// Gets all the components in the <see cref='System.ComponentModel.IContainer'/>.
/// <summary>
/// Removes a component from the <see cref='System.ComponentModel.IContainer'/>.
/// </summary>
- void Remove(IComponent component);
+ void Remove(IComponent? component);
}
}
/// When implemented by a class, gets or sets the name of the component
/// associated with the <see cref='System.ComponentModel.ISite'/>.
/// </summary>
- string Name { get; set; }
+ string? Name { get; set; }
}
}
/// <summary>
/// Executes the given delegate on the main thread that this object executes on.
/// </summary>
- IAsyncResult BeginInvoke(Delegate method, object[] args);
+ IAsyncResult BeginInvoke(Delegate method, object?[]? args);
/// <summary>
/// Waits until the process you started by calling <see cref='System.ComponentModel.ISynchronizeInvoke.BeginInvoke'/>
/// completes, and then returns the value generated by the process.
/// </summary>
- object EndInvoke(IAsyncResult result);
+ object? EndInvoke(IAsyncResult result);
/// <summary>
/// Executes the given delegate on the main thread that this object executes on.
/// </summary>
- object Invoke(Delegate method, object[] args);
+ object? Invoke(Delegate method, object?[]? args);
}
}
public bool Immutable { get; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- ImmutableObjectAttribute other = obj as ImmutableObjectAttribute;
- return other?.Immutable == Immutable;
- }
+ public override bool Equals(object? obj) =>
+ obj is ImmutableObjectAttribute other && other.Immutable == Immutable;
public override int GetHashCode() => base.GetHashCode();
/// Initializes a new instance of the <see cref='System.ComponentModel.InvalidAsynchronousStateException'/>
/// class with the specified message.
/// </summary>
- public InvalidAsynchronousStateException(string message) : base(message)
+ public InvalidAsynchronousStateException(string? message) : base(message)
{
}
/// Initializes a new instance of the Exception class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
- public InvalidAsynchronousStateException(string message, Exception innerException) : base(message, innerException)
+ public InvalidAsynchronousStateException(string? message, Exception? innerException) : base(message, innerException)
{
}
/// Initializes a new instance of the <see cref='InvalidEnumArgumentException'/>
/// class with the specified message.
/// </summary>
- public InvalidEnumArgumentException(string message) : base(message)
+ public InvalidEnumArgumentException(string? message) : base(message)
{
}
/// Initializes a new instance of the Exception class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
- public InvalidEnumArgumentException(string message, Exception innerException)
+ public InvalidEnumArgumentException(string? message, Exception? innerException)
: base(message, innerException)
{
}
/// class with a message generated from the argument, invalid value, and
/// enumeration class.
/// </summary>
- public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass)
+ public InvalidEnumArgumentException(string? argumentName, int invalidValue, Type enumClass)
: base(SR.Format(SR.InvalidEnumArgument,
argumentName,
invalidValue,
/// </summary>
public static readonly LocalizableAttribute Default = No;
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- LocalizableAttribute other = obj as LocalizableAttribute;
- return other?.IsLocalizable == IsLocalizable;
- }
+ public override bool Equals(object? obj) =>
+ obj is LocalizableAttribute other && other.IsLocalizable == IsLocalizable;
public override int GetHashCode() => base.GetHashCode();
/// </summary>
public bool AllowMerge { get; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- MergablePropertyAttribute other = obj as MergablePropertyAttribute;
- return other?.AllowMerge == AllowMerge;
- }
+ public override bool Equals(object? obj) =>
+ obj is MergablePropertyAttribute other && other.AllowMerge == AllowMerge;
public override int GetHashCode() => base.GetHashCode();
/// <summary>
/// Tests whether the specified object is the same as the current object.
/// </summary>
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- NotifyParentPropertyAttribute other = obj as NotifyParentPropertyAttribute;
- return other?.NotifyParent == NotifyParent;
- }
+ public override bool Equals(object? obj) =>
+ obj is NotifyParentPropertyAttribute other && other.NotifyParent == NotifyParent;
public override int GetHashCode() => base.GetHashCode();
/// <summary>
/// Compares the specified object to this object and tests for equality.
/// </summary>
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- ParenthesizePropertyNameAttribute other = obj as ParenthesizePropertyNameAttribute;
- return other?.NeedParenthesis == NeedParenthesis;
- }
+ public override bool Equals(object? obj) =>
+ obj is ParenthesizePropertyNameAttribute other && other.NeedParenthesis == NeedParenthesis;
public override int GetHashCode() => base.GetHashCode();
/// </summary>
public bool IsReadOnly { get; }
- public override bool Equals(object value)
- {
- if (this == value)
- {
- return true;
- }
-
- ReadOnlyAttribute other = value as ReadOnlyAttribute;
- return other?.IsReadOnly == IsReadOnly;
- }
+ public override bool Equals(object? value) =>
+ value is ReadOnlyAttribute other && other.IsReadOnly == IsReadOnly;
public override int GetHashCode() => base.GetHashCode();
/// </summary>
public RefreshProperties RefreshProperties { get; }
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- RefreshPropertiesAttribute other = obj as RefreshPropertiesAttribute;
- return other?.RefreshProperties == RefreshProperties;
- }
+ public override bool Equals(object? obj) =>
+ obj is RefreshPropertiesAttribute other && other.RefreshProperties == RefreshProperties;
public override int GetHashCode() => base.GetHashCode();
{
public partial interface IServiceProvider
{
- object? GetService(System.Type? serviceType);
+ object? GetService(System.Type serviceType);
}
}
namespace System.ComponentModel