You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -184,6 +184,14 @@ namespace System.ComponentModel
|
||||
public InitializationEventAttribute(string eventName) { }
|
||||
public string EventName { get; }
|
||||
}
|
||||
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 partial interface ISite : System.IServiceProvider
|
||||
{
|
||||
System.ComponentModel.IComponent Component { get; }
|
||||
|
@@ -58,6 +58,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="InvalidEnumArgument" xml:space="preserve">
|
||||
<value>The value of argument '{0}' ({1}) is invalid for Enum type '{2}'.</value>
|
||||
</data>
|
||||
<data name="PropertyCategoryAction" xml:space="preserve">
|
||||
<value>Action</value>
|
||||
</data>
|
||||
|
@@ -28,6 +28,7 @@
|
||||
<Compile Include="System\ComponentModel\IContainer.cs" />
|
||||
<Compile Include="System\ComponentModel\ImmutableObjectAttribute.cs" />
|
||||
<Compile Include="System\ComponentModel\InitializationEventAttribute.cs" />
|
||||
<Compile Include="System\ComponentModel\InvalidEnumArgumentException.cs" />
|
||||
<Compile Include="System\ComponentModel\ISite.cs" />
|
||||
<Compile Include="System\ComponentModel\ISupportInitialize.cs" />
|
||||
<Compile Include="System\ComponentModel\LocalizableAttribute.cs" />
|
||||
@@ -51,4 +52,4 @@
|
||||
<Reference Include="System.Threading" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
@@ -34,14 +34,12 @@ namespace System.ComponentModel
|
||||
/// </summary>
|
||||
public static readonly BrowsableAttribute Default = Yes;
|
||||
|
||||
private bool _browsable;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.BrowsableAttribute'/> class.</para>
|
||||
/// </summary>
|
||||
public BrowsableAttribute(bool browsable)
|
||||
{
|
||||
_browsable = browsable;
|
||||
Browsable = browsable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,10 +47,8 @@ namespace System.ComponentModel
|
||||
/// Gets a value indicating whether an object is browsable.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool Browsable => _browsable;
|
||||
public bool Browsable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == this)
|
||||
@@ -61,20 +57,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
BrowsableAttribute other = obj as BrowsableAttribute;
|
||||
|
||||
return (other != null) && other.Browsable == _browsable;
|
||||
return other?.Browsable == Browsable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return _browsable.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => Browsable.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(BrowsableAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,8 @@ namespace System.ComponentModel
|
||||
|
||||
private bool _localized;
|
||||
|
||||
private object _locker = new Object();
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Provides the actual category name.
|
||||
@@ -261,7 +263,6 @@ namespace System.ComponentModel
|
||||
public CategoryAttribute(string category)
|
||||
{
|
||||
_categoryValue = category;
|
||||
_localized = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -274,23 +275,22 @@ namespace System.ComponentModel
|
||||
{
|
||||
if (!_localized)
|
||||
{
|
||||
_localized = true;
|
||||
string localizedValue = GetLocalizedString(_categoryValue);
|
||||
if (localizedValue != null)
|
||||
lock (_locker)
|
||||
{
|
||||
_categoryValue = localizedValue;
|
||||
string localizedValue = GetLocalizedString(_categoryValue);
|
||||
if (localizedValue != null)
|
||||
{
|
||||
_categoryValue = localizedValue;
|
||||
}
|
||||
|
||||
_localized = true;
|
||||
}
|
||||
}
|
||||
|
||||
return _categoryValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <internalonly/>
|
||||
/// <internalonly/>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == this)
|
||||
@@ -302,25 +302,13 @@ namespace System.ComponentModel
|
||||
return other != null && Category.Equals(other.Category);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Category.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => Category.GetHashCode();
|
||||
|
||||
/// <summary>
|
||||
/// <para>Looks up the localized name of a given category.</para>
|
||||
/// </summary>
|
||||
protected virtual string GetLocalizedString(string value)
|
||||
{
|
||||
return SR.GetResourceString("PropertyCategory" + value, null);
|
||||
}
|
||||
protected virtual string GetLocalizedString(string value) => SR.GetResourceString("PropertyCategory" + value, null);
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Category.Equals(CategoryAttribute.Default.Category);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Category.Equals(Default.Category);
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,6 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.ComponentModel
|
||||
{
|
||||
/// <summary>
|
||||
@@ -12,9 +9,7 @@ namespace System.ComponentModel
|
||||
/// <see cref='System.ComponentModel.IComponent'/>
|
||||
/// interface and enables object-sharing between applications.</para>
|
||||
/// </summary>
|
||||
[
|
||||
DesignerCategory("Component")
|
||||
]
|
||||
[DesignerCategory("Component")]
|
||||
public class Component : MarshalByRefObject, IComponent
|
||||
{
|
||||
/// <summary>
|
||||
@@ -25,10 +20,7 @@ namespace System.ComponentModel
|
||||
private ISite _site;
|
||||
private EventHandlerList _events;
|
||||
|
||||
~Component()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
~Component() => Dispose(false);
|
||||
|
||||
/// <summary>
|
||||
/// This property returns true if the component is in a mode that supports
|
||||
@@ -40,59 +32,29 @@ namespace System.ComponentModel
|
||||
/// removed from the collection, but retrieving them through the collection's Item
|
||||
/// property will always return null.
|
||||
/// </summary>
|
||||
protected virtual bool CanRaiseEvents
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
protected virtual bool CanRaiseEvents => true;
|
||||
|
||||
/// <summary>
|
||||
/// Internal API that allows the event handler list class to access the
|
||||
/// CanRaiseEvents property.
|
||||
/// </summary>
|
||||
internal bool CanRaiseEventsInternal
|
||||
{
|
||||
get
|
||||
{
|
||||
return CanRaiseEvents;
|
||||
}
|
||||
}
|
||||
internal bool CanRaiseEventsInternal => CanRaiseEvents;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Adds a event handler to listen to the Disposed event on the component.</para>
|
||||
/// </summary>
|
||||
[
|
||||
Browsable(false),
|
||||
EditorBrowsable(EditorBrowsableState.Advanced)
|
||||
]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||
public event EventHandler Disposed
|
||||
{
|
||||
add
|
||||
{
|
||||
Events.AddHandler(s_eventDisposed, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
Events.RemoveHandler(s_eventDisposed, value);
|
||||
}
|
||||
add => Events.AddHandler(s_eventDisposed, value);
|
||||
remove => Events.RemoveHandler(s_eventDisposed, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the list of event handlers that are attached to this component.</para>
|
||||
/// </summary>
|
||||
protected EventHandlerList Events
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_events == null)
|
||||
{
|
||||
_events = new EventHandlerList(this);
|
||||
}
|
||||
return _events;
|
||||
}
|
||||
}
|
||||
protected EventHandlerList Events => _events ?? (_events = new EventHandlerList(this));
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -100,14 +62,12 @@ namespace System.ComponentModel
|
||||
/// .
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[
|
||||
Browsable(false),
|
||||
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
|
||||
]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public virtual ISite Site
|
||||
{
|
||||
get { return _site; }
|
||||
set { _site = value; }
|
||||
get => _site;
|
||||
set => _site = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -185,14 +145,10 @@ namespace System.ComponentModel
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (_site != null && _site.Container != null)
|
||||
{
|
||||
_site.Container.Remove(this);
|
||||
}
|
||||
_site?.Container?.Remove(this);
|
||||
if (_events != null)
|
||||
{
|
||||
EventHandler handler = (EventHandler)_events[s_eventDisposed];
|
||||
if (handler != null) handler(this, EventArgs.Empty);
|
||||
((EventHandler)_events[s_eventDisposed])?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,35 +159,20 @@ namespace System.ComponentModel
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns the <see cref='System.ComponentModel.IContainer'/>
|
||||
/// that contains the <see cref='System.ComponentModel.Component'/>
|
||||
/// .
|
||||
/// that contains the <see cref='System.ComponentModel.Component'/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[
|
||||
Browsable(false),
|
||||
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
|
||||
]
|
||||
public IContainer Container
|
||||
{
|
||||
get
|
||||
{
|
||||
ISite s = _site;
|
||||
return s == null ? null : s.Container;
|
||||
}
|
||||
}
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public IContainer Container => _site?.Container;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns an object representing a service provided by
|
||||
/// the <see cref='System.ComponentModel.Component'/>
|
||||
/// .
|
||||
/// the <see cref='System.ComponentModel.Component'/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
protected virtual object GetService(Type service)
|
||||
{
|
||||
ISite s = _site;
|
||||
return ((s == null) ? null : s.GetService(service));
|
||||
}
|
||||
protected virtual object GetService(Type service) => _site?.GetService(service);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -239,18 +180,9 @@ namespace System.ComponentModel
|
||||
/// is currently in design mode.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[
|
||||
Browsable(false),
|
||||
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
|
||||
]
|
||||
protected bool DesignMode
|
||||
{
|
||||
get
|
||||
{
|
||||
ISite s = _site;
|
||||
return (s == null) ? false : s.DesignMode;
|
||||
}
|
||||
}
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
protected bool DesignMode => _site?.DesignMode ?? false;
|
||||
|
||||
/// <internalonly/>
|
||||
/// <summary>
|
||||
@@ -260,7 +192,7 @@ namespace System.ComponentModel
|
||||
/// internal use only.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public override String ToString()
|
||||
public override string ToString()
|
||||
{
|
||||
ISite s = _site;
|
||||
|
||||
|
@@ -12,19 +12,11 @@ namespace System.ComponentModel
|
||||
{
|
||||
public class ComponentCollection : ReadOnlyCollectionBase
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public ComponentCollection(IComponent[] components)
|
||||
{
|
||||
InnerList.AddRange(components);
|
||||
}
|
||||
public ComponentCollection(IComponent[] components) => InnerList.AddRange(components);
|
||||
|
||||
/** The component in the container identified by name. */
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the <see cref='System.ComponentModel.Container'/>
|
||||
/// .
|
||||
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the <see cref='System.ComponentModel.Container'/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public virtual IComponent this[string name]
|
||||
@@ -46,28 +38,14 @@ namespace System.ComponentModel
|
||||
}
|
||||
}
|
||||
|
||||
/** The component in the container identified by index. */
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the <see cref='System.ComponentModel.Container'/>
|
||||
/// .
|
||||
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the <see cref='System.ComponentModel.Container'/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public virtual IComponent this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IComponent)InnerList[index];
|
||||
}
|
||||
}
|
||||
public virtual IComponent this[int index] => (IComponent)InnerList[index];
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public void CopyTo(IComponent[] array, int index)
|
||||
{
|
||||
InnerList.CopyTo(array, index);
|
||||
}
|
||||
public void CopyTo(IComponent[] array, int index) => InnerList.CopyTo(array, index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,7 @@
|
||||
namespace System.ComponentModel
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Specifies a description for a property
|
||||
/// or event.</para>
|
||||
/// <para>Specifies a description for a property or event.</para>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class DescriptionAttribute : Attribute
|
||||
@@ -17,9 +16,6 @@ namespace System.ComponentModel
|
||||
/// </summary>
|
||||
public static readonly DescriptionAttribute Default = new DescriptionAttribute();
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public DescriptionAttribute() : this(string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -27,10 +23,7 @@ namespace System.ComponentModel
|
||||
/// <summary>
|
||||
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.DescriptionAttribute'/> class.</para>
|
||||
/// </summary>
|
||||
public DescriptionAttribute(string description)
|
||||
{
|
||||
DescriptionValue = description;
|
||||
}
|
||||
public DescriptionAttribute(string description) => DescriptionValue = description;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the description stored in this attribute.</para>
|
||||
@@ -52,17 +45,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
DescriptionAttribute other = obj as DescriptionAttribute;
|
||||
return (other != null) && other.Description == Description;
|
||||
return other != null && other.Description == Description;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Description.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => Description.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(DescriptionAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -16,33 +16,25 @@ namespace System.ComponentModel
|
||||
/// Initializes a new instance of the <see cref='System.ComponentModel.DesignOnlyAttribute'/> class.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public DesignOnlyAttribute(bool isDesignOnly)
|
||||
{
|
||||
IsDesignOnly = isDesignOnly;
|
||||
}
|
||||
public DesignOnlyAttribute(bool isDesignOnly) => IsDesignOnly = isDesignOnly;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets a value indicating whether a property
|
||||
/// can be set only at design time.
|
||||
/// Gets a value indicating whether a property can be set only at design time.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool IsDesignOnly { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Specifies that a property can be set only at design time. This
|
||||
/// <see langword='static '/>field is read-only.
|
||||
/// Specifies that a property can be set only at design time. This <see langword='static '/>field is read-only.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static readonly DesignOnlyAttribute Yes = new DesignOnlyAttribute(true);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Specifies
|
||||
/// that a
|
||||
/// property can be set at design time or at run
|
||||
/// time. This <see langword='static '/>field is read-only.
|
||||
/// Specifies that a property can be set at design time or at run time. This <see langword='static '/>field is read-only.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static readonly DesignOnlyAttribute No = new DesignOnlyAttribute(false);
|
||||
@@ -63,17 +55,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
DesignOnlyAttribute other = obj as DesignOnlyAttribute;
|
||||
return (other != null) && other.IsDesignOnly == IsDesignOnly;
|
||||
return other?.IsDesignOnly == IsDesignOnly;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return IsDesignOnly.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => IsDesignOnly.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return IsDesignOnly == DesignOnlyAttribute.Default.IsDesignOnly;
|
||||
}
|
||||
public override bool IsDefaultAttribute() => IsDesignOnly == Default.IsDesignOnly;
|
||||
}
|
||||
}
|
||||
|
@@ -48,10 +48,7 @@ namespace System.ComponentModel
|
||||
/// default category.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public DesignerCategoryAttribute()
|
||||
{
|
||||
Category = string.Empty;
|
||||
}
|
||||
public DesignerCategoryAttribute() => Category = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -59,10 +56,7 @@ namespace System.ComponentModel
|
||||
/// the given category name.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public DesignerCategoryAttribute(string category)
|
||||
{
|
||||
Category = category;
|
||||
}
|
||||
public DesignerCategoryAttribute(string category) => Category = category;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -82,22 +76,10 @@ namespace System.ComponentModel
|
||||
return other != null && other.Category == Category;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Category.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => Category.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Category.Equals(DesignerCategoryAttribute.Default.Category);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Category.Equals(Default.Category);
|
||||
|
||||
public override object TypeId
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.GetType().FullName + Category;
|
||||
}
|
||||
}
|
||||
public override object TypeId => GetType().FullName + Category;
|
||||
}
|
||||
}
|
||||
|
@@ -49,17 +49,12 @@ namespace System.ComponentModel
|
||||
/// </summary>
|
||||
public static readonly DesignerSerializationVisibilityAttribute Default = Visible;
|
||||
|
||||
private readonly DesignerSerializationVisibility _visibility;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Initializes a new instance of the System.ComponentModel.PersistContentsAttribute class.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility visibility)
|
||||
{
|
||||
_visibility = visibility;
|
||||
}
|
||||
public DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility visibility) => Visibility = visibility;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -67,17 +62,8 @@ namespace System.ComponentModel
|
||||
/// visual designer must generate special code to persist the value of a property.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public DesignerSerializationVisibility Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
return _visibility;
|
||||
}
|
||||
}
|
||||
public DesignerSerializationVisibility Visibility { get; }
|
||||
|
||||
/// <internalonly/>
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == this)
|
||||
@@ -86,22 +72,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
DesignerSerializationVisibilityAttribute other = obj as DesignerSerializationVisibilityAttribute;
|
||||
return other != null && other.Visibility == _visibility;
|
||||
return other?.Visibility == Visibility;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns the hashcode for this object.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(DesignerSerializationVisibilityAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -16,9 +16,6 @@ namespace System.ComponentModel
|
||||
/// </summary>
|
||||
public static readonly DisplayNameAttribute Default = new DisplayNameAttribute();
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public DisplayNameAttribute() : this(string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -26,10 +23,7 @@ namespace System.ComponentModel
|
||||
/// <summary>
|
||||
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.DisplayNameAttribute'/> class.</para>
|
||||
/// </summary>
|
||||
public DisplayNameAttribute(string displayName)
|
||||
{
|
||||
DisplayNameValue = displayName;
|
||||
}
|
||||
public DisplayNameAttribute(string displayName) => DisplayNameValue = displayName;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the description stored in this attribute.</para>
|
||||
@@ -51,18 +45,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
DisplayNameAttribute other = obj as DisplayNameAttribute;
|
||||
|
||||
return (other != null) && other.DisplayName == DisplayName;
|
||||
return other != null && other.DisplayName == DisplayName;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return DisplayName.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => DisplayName.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(DisplayNameAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -16,10 +16,7 @@ namespace System.ComponentModel
|
||||
/// Creates a new event handler list. The parent component is used to check the component's
|
||||
/// CanRaiseEvents property.
|
||||
/// </summary>
|
||||
internal EventHandlerList(Component parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
internal EventHandlerList(Component parent) => _parent = parent;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new event handler list.
|
||||
@@ -41,21 +38,14 @@ namespace System.ComponentModel
|
||||
e = Find(key);
|
||||
}
|
||||
|
||||
if (e != null)
|
||||
{
|
||||
return e.Handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return e?._handler;
|
||||
}
|
||||
set
|
||||
{
|
||||
ListEntry e = Find(key);
|
||||
if (e != null)
|
||||
{
|
||||
e.Handler = value;
|
||||
e._handler = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -72,7 +62,7 @@ namespace System.ComponentModel
|
||||
ListEntry e = Find(key);
|
||||
if (e != null)
|
||||
{
|
||||
e.Handler = Delegate.Combine(e.Handler, value);
|
||||
e._handler = Delegate.Combine(e._handler, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -86,42 +76,33 @@ namespace System.ComponentModel
|
||||
ListEntry currentListEntry = listToAddFrom._head;
|
||||
while (currentListEntry != null)
|
||||
{
|
||||
AddHandler(currentListEntry.Key, currentListEntry.Handler);
|
||||
currentListEntry = currentListEntry.Next;
|
||||
AddHandler(currentListEntry._key, currentListEntry._handler);
|
||||
currentListEntry = currentListEntry._next;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_head = null;
|
||||
}
|
||||
public void Dispose() => _head = null;
|
||||
|
||||
private ListEntry Find(object key)
|
||||
{
|
||||
ListEntry found = _head;
|
||||
while (found != null)
|
||||
{
|
||||
if (found.Key == key)
|
||||
if (found._key == key)
|
||||
{
|
||||
break;
|
||||
}
|
||||
found = found.Next;
|
||||
found = found._next;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public void RemoveHandler(object key, Delegate value)
|
||||
{
|
||||
ListEntry e = Find(key);
|
||||
if (e != null)
|
||||
{
|
||||
e.Handler = Delegate.Remove(e.Handler, value);
|
||||
e._handler = Delegate.Remove(e._handler, value);
|
||||
}
|
||||
// else... no error for removal of non-existent delegate
|
||||
//
|
||||
@@ -129,15 +110,15 @@ namespace System.ComponentModel
|
||||
|
||||
private sealed class ListEntry
|
||||
{
|
||||
internal ListEntry Next;
|
||||
internal object Key;
|
||||
internal Delegate Handler;
|
||||
internal ListEntry _next;
|
||||
internal object _key;
|
||||
internal Delegate _handler;
|
||||
|
||||
public ListEntry(object key, Delegate handler, ListEntry next)
|
||||
{
|
||||
Next = next;
|
||||
Key = key;
|
||||
Handler = handler;
|
||||
_next = next;
|
||||
_key = key;
|
||||
_handler = handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -36,19 +36,10 @@ namespace System.ComponentModel
|
||||
/// Constructs an ImmutableObjectAttribute object.
|
||||
///
|
||||
/// </summary>
|
||||
public ImmutableObjectAttribute(bool immutable)
|
||||
{
|
||||
Immutable = immutable;
|
||||
}
|
||||
public ImmutableObjectAttribute(bool immutable) => Immutable = immutable;
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public bool Immutable { get; }
|
||||
|
||||
/// <internalonly/>
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == this)
|
||||
@@ -57,22 +48,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
ImmutableObjectAttribute other = obj as ImmutableObjectAttribute;
|
||||
return other != null && other.Immutable == Immutable;
|
||||
return other?.Immutable == Immutable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns the hashcode for this object.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(ImmutableObjectAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,64 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.ComponentModel
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>The exception that is thrown when using invalid arguments that are enumerators.</para>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class InvalidEnumArgumentException : ArgumentException
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Initializes a new instance of the <see cref='InvalidEnumArgumentException'/> class without a message.</para>
|
||||
/// </summary>
|
||||
public InvalidEnumArgumentException() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Initializes a new instance of the <see cref='InvalidEnumArgumentException'/> class with
|
||||
/// the specified message.</para>
|
||||
/// </summary>
|
||||
public InvalidEnumArgumentException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// FxCop CA1032: Multiple constructors are required to correctly implement a custom exception.
|
||||
/// </summary>
|
||||
public InvalidEnumArgumentException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Initializes a new instance of the <see cref='InvalidEnumArgumentException'/> class with a
|
||||
/// message generated from the argument, invalid value, and enumeration
|
||||
/// class.</para>
|
||||
/// </summary>
|
||||
public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass)
|
||||
: base(SR.Format(SR.InvalidEnumArgument,
|
||||
argumentName,
|
||||
invalidValue.ToString(CultureInfo.CurrentCulture),
|
||||
enumClass.Name), argumentName)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Need this constructor since Exception implements ISerializable. We don't have any fields,
|
||||
/// so just forward this to base.
|
||||
/// </summary>
|
||||
protected InvalidEnumArgumentException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,31 +15,25 @@ namespace System.ComponentModel
|
||||
/// Initializes a new instance of the <see cref='System.ComponentModel.LocalizableAttribute'/> class.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public LocalizableAttribute(bool isLocalizable)
|
||||
{
|
||||
IsLocalizable = isLocalizable;
|
||||
}
|
||||
public LocalizableAttribute(bool isLocalizable) => IsLocalizable = isLocalizable;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets a value indicating whether
|
||||
/// a property should be localized.
|
||||
/// Gets a value indicating whether a property should be localized.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool IsLocalizable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Specifies that a property should be localized. This
|
||||
/// <see langword='static '/>field is read-only.
|
||||
/// Specifies that a property should be localized. This <see langword='static '/>field is read-only.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static readonly LocalizableAttribute Yes = new LocalizableAttribute(true);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Specifies that a property should not be localized. This
|
||||
/// <see langword='static '/>field is read-only.
|
||||
/// Specifies that a property should not be localized. This <see langword='static '/>field is read-only.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static readonly LocalizableAttribute No = new LocalizableAttribute(false);
|
||||
@@ -47,8 +41,7 @@ namespace System.ComponentModel
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Specifies the default value, which is <see cref='System.ComponentModel.LocalizableAttribute.No'/> , that is
|
||||
/// a property should not be localized. This <see langword='static '/>field is
|
||||
/// read-only.
|
||||
/// a property should not be localized. This <see langword='static '/>field is read-only.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static readonly LocalizableAttribute Default = No;
|
||||
@@ -61,17 +54,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
LocalizableAttribute other = obj as LocalizableAttribute;
|
||||
return (other != null) && other.IsLocalizable == IsLocalizable;
|
||||
return other?.IsLocalizable == IsLocalizable;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return IsLocalizable == LocalizableAttribute.Default.IsLocalizable;
|
||||
}
|
||||
public override bool IsDefaultAttribute() => IsLocalizable == Default.IsLocalizable;
|
||||
}
|
||||
}
|
||||
|
@@ -43,23 +43,16 @@ namespace System.ComponentModel
|
||||
/// class.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public MergablePropertyAttribute(bool allowMerge)
|
||||
{
|
||||
AllowMerge = allowMerge;
|
||||
}
|
||||
public MergablePropertyAttribute(bool allowMerge) => AllowMerge = allowMerge;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets a value indicating whether this
|
||||
/// property can be combined with properties belonging to other objects in a
|
||||
/// properties window.
|
||||
/// Gets a value indicating whether this property can be combined with properties
|
||||
/// belonging to other objects in a properties window.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool AllowMerge { get; }
|
||||
|
||||
/// <internalonly/>
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == this)
|
||||
@@ -68,22 +61,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
MergablePropertyAttribute other = obj as MergablePropertyAttribute;
|
||||
return other != null && other.AllowMerge == AllowMerge;
|
||||
return other?.AllowMerge == AllowMerge;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns the hashcode for this object.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(MergablePropertyAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -36,10 +36,7 @@ namespace System.ComponentModel
|
||||
/// that uses the specified value
|
||||
/// to indicate whether the parent property should be notified when a child namespace property is modified.</para>
|
||||
/// </summary>
|
||||
public NotifyParentPropertyAttribute(bool notifyParent)
|
||||
{
|
||||
NotifyParent = notifyParent;
|
||||
}
|
||||
public NotifyParentPropertyAttribute(bool notifyParent) => NotifyParent = notifyParent;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -63,22 +60,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
NotifyParentPropertyAttribute other = obj as NotifyParentPropertyAttribute;
|
||||
return other != null && other.NotifyParent == NotifyParent;
|
||||
return other?.NotifyParent == NotifyParent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns the hashcode for this object.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(NotifyParentPropertyAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -14,15 +14,11 @@ namespace System.ComponentModel
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Sets the System.ComponentModel.Design.ParenthesizePropertyName
|
||||
/// attribute by default to
|
||||
/// <see langword='false'/>.
|
||||
/// attribute by default to <see langword='false'/>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static readonly ParenthesizePropertyNameAttribute Default = new ParenthesizePropertyNameAttribute();
|
||||
|
||||
/// <summary>
|
||||
/// <para>[To be supplied.]</para>
|
||||
/// </summary>
|
||||
public ParenthesizePropertyNameAttribute() : this(false)
|
||||
{
|
||||
}
|
||||
@@ -32,24 +28,18 @@ namespace System.ComponentModel
|
||||
/// class, using the specified value to indicate whether the attribute is
|
||||
/// marked for display with parentheses.</para>
|
||||
/// </summary>
|
||||
public ParenthesizePropertyNameAttribute(bool needParenthesis)
|
||||
{
|
||||
NeedParenthesis = needParenthesis;
|
||||
}
|
||||
public ParenthesizePropertyNameAttribute(bool needParenthesis) => NeedParenthesis = needParenthesis;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets a value indicating
|
||||
/// whether the
|
||||
/// attribute is placed in parentheses when listed in
|
||||
/// the properties window.
|
||||
/// Gets a value indicating whether the attribute is
|
||||
/// placed in parentheses when listed in the properties window.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool NeedParenthesis { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Compares the specified object
|
||||
/// to this object and tests for equality.</para>
|
||||
/// <para>Compares the specified object to this object and tests for equality.</para>
|
||||
/// </summary>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
@@ -59,22 +49,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
ParenthesizePropertyNameAttribute other = obj as ParenthesizePropertyNameAttribute;
|
||||
return other != null && other.NeedParenthesis == NeedParenthesis;
|
||||
return other?.NeedParenthesis == NeedParenthesis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns the hashcode for this object.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return Equals(ParenthesizePropertyNameAttribute.Default);
|
||||
}
|
||||
public override bool IsDefaultAttribute() => Equals(Default);
|
||||
}
|
||||
}
|
||||
|
@@ -41,10 +41,7 @@ namespace System.ComponentModel
|
||||
/// Initializes a new instance of the <see cref='System.ComponentModel.ReadOnlyAttribute'/> class.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public ReadOnlyAttribute(bool isReadOnly)
|
||||
{
|
||||
IsReadOnly = isReadOnly;
|
||||
}
|
||||
public ReadOnlyAttribute(bool isReadOnly) => IsReadOnly = isReadOnly;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -54,9 +51,6 @@ namespace System.ComponentModel
|
||||
/// </summary>
|
||||
public bool IsReadOnly { get; }
|
||||
|
||||
/// <internalonly/>
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
if (this == value)
|
||||
@@ -65,22 +59,11 @@ namespace System.ComponentModel
|
||||
}
|
||||
|
||||
ReadOnlyAttribute other = value as ReadOnlyAttribute;
|
||||
return other != null && other.IsReadOnly == IsReadOnly;
|
||||
return other?.IsReadOnly == IsReadOnly;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Returns the hashcode for this object.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public override bool IsDefaultAttribute()
|
||||
{
|
||||
return IsReadOnly == ReadOnlyAttribute.Default.IsReadOnly;
|
||||
}
|
||||
public override bool IsDefaultAttribute() => IsReadOnly == Default.IsReadOnly;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user