summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHugh Bellamy <hughbellars@gmail.com>2019-04-07 01:17:01 +0100
committerAaron Robinson <arobins@microsoft.com>2019-04-06 17:17:01 -0700
commit1f1801ff0d983bbedea00fca3b8ecc674eaddc13 (patch)
tree236ed2209591a8ad95935635f9744f9f7162e071 /src
parentaea7846fc71591739e47c65c0632007bff1cc4a4 (diff)
downloadcoreclr-1f1801ff0d983bbedea00fca3b8ecc674eaddc13.tar.gz
coreclr-1f1801ff0d983bbedea00fca3b8ecc674eaddc13.tar.bz2
coreclr-1f1801ff0d983bbedea00fca3b8ecc674eaddc13.zip
Remove remaining devdocs and cleanup ComponentModel code (#23175)
* Remove remaining devdocs and cleanup ComponentModel code
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems1
-rw-r--r--src/System.Private.CoreLib/shared/System/ComponentModel/DefaultValueAttribute.cs206
-rw-r--r--src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableAttribute.cs25
-rw-r--r--src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableState.cs13
-rw-r--r--src/System.Private.CoreLib/shared/System/ObjectDisposedException.cs18
5 files changed, 126 insertions, 137 deletions
diff --git a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
index 69fb5565a4..0ba0bbb8d1 100644
--- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
+++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
@@ -177,6 +177,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\ObjectModel\ReadOnlyCollection.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\ComponentModel\DefaultValueAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\ComponentModel\EditorBrowsableAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\ComponentModel\EditorBrowsableState.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Configuration\Assemblies\AssemblyHashAlgorithm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Configuration\Assemblies\AssemblyVersionCompatibility.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Convert.cs" />
diff --git a/src/System.Private.CoreLib/shared/System/ComponentModel/DefaultValueAttribute.cs b/src/System.Private.CoreLib/shared/System/ComponentModel/DefaultValueAttribute.cs
index 136e4324ed..fb2b49c94c 100644
--- a/src/System.Private.CoreLib/shared/System/ComponentModel/DefaultValueAttribute.cs
+++ b/src/System.Private.CoreLib/shared/System/ComponentModel/DefaultValueAttribute.cs
@@ -2,39 +2,38 @@
// 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.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using System.Threading;
namespace System.ComponentModel
{
- /// <devdoc>
- /// <para>Specifies the default value for a property.</para>
- /// </devdoc>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
+ /// <summary>
+ /// Specifies the default value for a property.
+ /// </summary>
+ [SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
+ [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
[AttributeUsage(AttributeTargets.All)]
public class DefaultValueAttribute : Attribute
{
- /// <devdoc>
- /// This is the default value.
- /// </devdoc>
+ /// <summary>
+ /// This is the default value.
+ /// </summary>
private object _value;
// Delegate ad hoc created 'TypeDescriptor.ConvertFromInvariantString' reflection object cache
- static object s_convertFromInvariantString;
+ private static object s_convertFromInvariantString;
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class, converting the
- /// specified value to the
- /// specified type, and using the U.S. English culture as the
- /// translation
- /// context.</para>
- /// </devdoc>
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class, converting the specified value to the specified type, and using the U.S. English
+ /// culture as the translation context.
+ /// </summary>
public DefaultValueAttribute(Type type, string value)
{
- // The try/catch here is because attributes should never throw exceptions. We would fail to
- // load an otherwise normal class.
+ // The try/catch here is because attributes should never throw exceptions.
+ // We would fail to load an otherwise normal class.
try
{
if (TryConvertFromInvariantString(type, value, out object convertedValue))
@@ -54,8 +53,6 @@ namespace System.ComponentModel
_value = Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
}
- return;
-
// Looking for ad hoc created TypeDescriptor.ConvertFromInvariantString(Type, string)
bool TryConvertFromInvariantString(Type typeToConvert, string stringValue, out object conversionResult)
{
@@ -89,143 +86,140 @@ namespace System.ComponentModel
}
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a Unicode
- /// character.</para>
- /// </devdoc>
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a Unicode character.
+ /// </summary>
public DefaultValueAttribute(char value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using an 8-bit unsigned
- /// integer.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using an 8-bit unsigned integer.
+ /// </summary>
public DefaultValueAttribute(byte value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a 16-bit signed
- /// integer.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a 16-bit signed integer.
+ /// </summary>
public DefaultValueAttribute(short value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a 32-bit signed
- /// integer.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a 32-bit signed integer.
+ /// </summary>
public DefaultValueAttribute(int value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a 64-bit signed
- /// integer.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a 64-bit signed integer.
+ /// </summary>
public DefaultValueAttribute(long value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a
- /// single-precision floating point
- /// number.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a single-precision floating point number.
+ /// </summary>
public DefaultValueAttribute(float value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a
- /// double-precision floating point
- /// number.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a double-precision floating point number.
+ /// </summary>
public DefaultValueAttribute(double value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a <see cref='System.Boolean'/>
- /// value.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a <see cref='System.Boolean'/> value.
+ /// </summary>
public DefaultValueAttribute(bool value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a <see cref='System.String'/>.</para>
- /// </devdoc>
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a <see cref='System.String'/>.
+ /// </summary>
public DefaultValueAttribute(string value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
- /// class.</para>
- /// </devdoc>
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class.
+ /// </summary>
public DefaultValueAttribute(object value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a <see cref='System.SByte'/>
- /// value.</para>
- /// </devdoc>
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a <see cref='System.SByte'/> value.
+ /// </summary>
[CLSCompliant(false)]
public DefaultValueAttribute(sbyte value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a <see cref='System.UInt16'/>
- /// value.</para>
- /// </devdoc>
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a <see cref='System.UInt16'/> value.
+ /// </summary>
[CLSCompliant(false)]
public DefaultValueAttribute(ushort value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a <see cref='System.UInt32'/>
- /// value.</para>
- /// </devdoc>
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a <see cref='System.UInt32'/> value.
+ /// </summary>
[CLSCompliant(false)]
public DefaultValueAttribute(uint value)
{
_value = value;
}
- /// <devdoc>
- /// <para>Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/> class using a <see cref='System.UInt64'/>
- /// value.</para>
- /// </devdoc>
+ /// <summary>
+ /// Initializes a new instance of the <see cref='System.ComponentModel.DefaultValueAttribute'/>
+ /// class using a <see cref='System.UInt64'/> value.
+ /// </summary>
[CLSCompliant(false)]
public DefaultValueAttribute(ulong value)
{
_value = value;
}
- /// <devdoc>
- /// <para>
- /// Gets the default value of the property this
- /// attribute is
- /// bound to.
- /// </para>
- /// </devdoc>
- public virtual object Value
- {
- get
- {
- return _value;
- }
- }
+ /// <summary>
+ /// Gets the default value of the property this attribute is bound to.
+ /// </summary>
+ public virtual object Value => _value;
public override bool Equals(object obj)
{
@@ -233,29 +227,21 @@ namespace System.ComponentModel
{
return true;
}
-
- if (obj is DefaultValueAttribute other)
+ if (!(obj is DefaultValueAttribute other))
{
- if (Value != null)
- {
- return Value.Equals(other.Value);
- }
- else
- {
- return (other.Value == null);
- }
+ return false;
+ }
+
+ if (Value == null)
+ {
+ return other.Value == null;
}
- return false;
- }
- public override int GetHashCode()
- {
- return base.GetHashCode();
+ return Value.Equals(other.Value);
}
- protected void SetValue(object value)
- {
- _value = value;
- }
+ public override int GetHashCode() => base.GetHashCode();
+
+ protected void SetValue(object value) => _value = value;
}
}
diff --git a/src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableAttribute.cs b/src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableAttribute.cs
index a59ee839bc..de69538532 100644
--- a/src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableAttribute.cs
+++ b/src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableAttribute.cs
@@ -7,20 +7,17 @@ namespace System.ComponentModel
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate | AttributeTargets.Interface)]
public sealed class EditorBrowsableAttribute : Attribute
{
- private EditorBrowsableState browsableState;
-
public EditorBrowsableAttribute(EditorBrowsableState state)
{
- browsableState = state;
+ State = state;
}
- public EditorBrowsableAttribute() : this(EditorBrowsableState.Always) { }
-
- public EditorBrowsableState State
+ public EditorBrowsableAttribute() : this(EditorBrowsableState.Always)
{
- get { return browsableState; }
}
+ public EditorBrowsableState State { get; }
+
public override bool Equals(object obj)
{
if (obj == this)
@@ -28,19 +25,9 @@ namespace System.ComponentModel
return true;
}
- return (obj is EditorBrowsableAttribute other) && other.browsableState == browsableState;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
+ return (obj is EditorBrowsableAttribute other) && other.State == State;
}
- }
- public enum EditorBrowsableState
- {
- Always,
- Never,
- Advanced
+ public override int GetHashCode() => base.GetHashCode();
}
}
diff --git a/src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableState.cs b/src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableState.cs
new file mode 100644
index 0000000000..a98669c4e9
--- /dev/null
+++ b/src/System.Private.CoreLib/shared/System/ComponentModel/EditorBrowsableState.cs
@@ -0,0 +1,13 @@
+// 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.
+
+namespace System.ComponentModel
+{
+ public enum EditorBrowsableState
+ {
+ Always,
+ Never,
+ Advanced
+ }
+}
diff --git a/src/System.Private.CoreLib/shared/System/ObjectDisposedException.cs b/src/System.Private.CoreLib/shared/System/ObjectDisposedException.cs
index d5d488447f..450a9597e3 100644
--- a/src/System.Private.CoreLib/shared/System/ObjectDisposedException.cs
+++ b/src/System.Private.CoreLib/shared/System/ObjectDisposedException.cs
@@ -4,16 +4,16 @@
#nullable enable
using System.Globalization;
+using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace System
{
- /// <devdoc>
- /// <para> The exception that is thrown when accessing an object that was
- /// disposed.</para>
- /// </devdoc>
+ /// <summary>
+ /// The exception that is thrown when accessing an object that was disposed.
+ /// </summary>
[Serializable]
- [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+ [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class ObjectDisposedException : InvalidOperationException
{
private string? _objectName;
@@ -53,16 +53,18 @@ namespace System
info.AddValue("ObjectName", ObjectName, typeof(string));
}
- /// <devdoc>
- /// <para>Gets the text for the message for this exception.</para>
- /// </devdoc>
+ /// <summary>
+ /// Gets the text for the message for this exception.
+ /// </summary>
public override string Message
{
get
{
string name = ObjectName;
if (string.IsNullOrEmpty(name))
+ {
return base.Message;
+ }
string objectDisposed = SR.Format(SR.ObjectDisposed_ObjectName_Name, name);
return base.Message + Environment.NewLine + objectDisposed;