Skip to content

Commit aadcc3b

Browse files
committed
Comments/code style adjustments, some documentation, no code changes
1 parent 6594a21 commit aadcc3b

File tree

6 files changed

+81
-69
lines changed

6 files changed

+81
-69
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/KeySplineConverter.cs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public class KeySplineConverter : TypeConverter
2323
/// <summary>
2424
/// CanConvertFrom - Returns whether or not this class can convert from a given type
2525
/// </summary>
26-
/// <ExternalAPI/>
26+
/// <returns>
27+
/// <see langword="true"/> if the given <paramref name="sourceType"/> can be converted from, <see langword="false"/> otherwise.
28+
/// </returns>
29+
/// <param name="typeDescriptor">The <see cref="ITypeDescriptorContext"/> for this call.</param>
30+
/// <param name="destinationType">The <see cref="Type"/> being queried for support.</param>
2731
public override bool CanConvertFrom(ITypeDescriptorContext typeDescriptor, Type destinationType)
2832
{
2933
return destinationType == typeof(string);
@@ -34,16 +38,22 @@ public override bool CanConvertFrom(ITypeDescriptorContext typeDescriptor, Type
3438
/// </summary>
3539
/// <param name="context">ITypeDescriptorContext</param>
3640
/// <param name="destinationType">Type to convert to</param>
37-
/// <returns>true if conversion is possible</returns>
38-
/// <ExternalAPI/>
41+
/// <returns>
42+
/// <see langword="true"/> if this class can convert to <paramref name="destinationType"/>, <see langword="false"/> otherwise.
43+
/// </returns>
3944
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
4045
{
4146
return destinationType == typeof(InstanceDescriptor) || destinationType == typeof(string);
4247
}
4348

4449
/// <summary>
45-
/// ConvertFrom
50+
/// Converts <paramref name="value"/> of <see langword="string"/> type to its <see cref="KeySpline"/> represensation.
4651
/// </summary>
52+
/// <param name="context">The <see cref="ITypeDescriptorContext"/> for this call.</param>
53+
/// <param name="cultureInfo">The <see cref="CultureInfo"/> which is respected during conversion.</param>
54+
/// <param name="value"> The object to convert to a <see cref="KeySpline"/>.</param>
55+
/// <returns>A new instance of <see cref="KeySpline"/> class representing the data contained in <paramref name="value"/>.</returns>
56+
/// <exception cref="NotSupportedException">Thrown in case the <paramref name="value"/> was not a <see cref="string"/>.</exception>
4757
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo cultureInfo, object value)
4858
{
4959
if (value is not string stringValue)
@@ -58,14 +68,15 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
5868
}
5969

6070
/// <summary>
61-
/// TypeConverter method implementation.
71+
/// Attempt to convert a <see cref="KeySpline"/> class to the <paramref name="destinationType"/>.
6272
/// </summary>
6373
/// <param name="context">ITypeDescriptorContext</param>
6474
/// <param name="cultureInfo">current culture (see CLR specs), null is a valid value</param>
6575
/// <param name="value">value to convert from</param>
6676
/// <param name="destinationType">Type to convert to</param>
67-
/// <returns>converted value</returns>
68-
/// <ExternalAPI/>
77+
/// <returns>
78+
/// The formatted <paramref name="value"/> as <see cref="string"/> using the specified <paramref name="cultureInfo"/> or an <see cref="InstanceDescriptor"/>.
79+
/// </returns>
6980
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cultureInfo, object value, Type destinationType)
7081
{
7182
if (value is KeySpline keySpline && destinationType is not null)
@@ -85,17 +96,17 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
8596
}
8697

8798
/// <summary>
88-
/// Converts <paramref name="keySpline"/> to its string representation using the specified <paramref name="cultureInfo"/>.
99+
/// Converts <paramref name="keySpline"/> to its <see cref="string"/> representation using the specified <paramref name="cultureInfo"/>.
89100
/// </summary>
90101
/// <param name="keySpline">The <see cref="KeySpline"/> to convert to string.</param>
91102
/// <param name="cultureInfo">Culture to use when formatting doubles and choosing separator.</param>
92-
/// <returns>The formatted <paramref name="keySpline"/> as string using the specified <paramref name="cultureInfo"/>.</returns>
103+
/// <returns>The formatted <paramref name="keySpline"/> as <see cref="string"/> using the specified <paramref name="cultureInfo"/>.</returns>
93104
private static string ToString(KeySpline keySpline, CultureInfo cultureInfo)
94105
{
95106
string listSeparator = cultureInfo != null ? cultureInfo.TextInfo.ListSeparator : CultureInfo.InvariantCulture.TextInfo.ListSeparator;
96107

97108
// Initial capacity [64] is an estimate based on a sum of:
98-
// 48 = 4x double (fourteen digits is generous for the range of values likely)
109+
// 60 = 4x double (fifteen digits is generous for the range of values)
99110
// 3 = 3x separator characters
100111
// 1 = 1x scratch space for alignment
101112
DefaultInterpolatedStringHandler handler = new(3, 4, cultureInfo, stackalloc char[64]);

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/VirtualizationCacheLengthConverter.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
namespace System.Windows.Controls
1212
{
1313
/// <summary>
14-
/// VirtualizationCacheLengthConverter - Converter class for converting
15-
/// instances of other types to and from VirtualizationCacheLength instances.
16-
/// </summary>
14+
/// Converter class for converting instances of other types to and from <see cref="VirtualizationCacheLength"/> instances.
15+
/// </summary>
1716
public class VirtualizationCacheLengthConverter : TypeConverter
1817
{
1918
#region Public Methods
@@ -22,10 +21,10 @@ public class VirtualizationCacheLengthConverter : TypeConverter
2221
/// CanConvertFrom - Returns whether or not this class can convert from a given type.
2322
/// </summary>
2423
/// <returns>
25-
/// bool - True if thie converter can convert from the provided type, false if not.
24+
/// <see langword="true"/> if the given <paramref name="sourceType"/> can be converted from, <see langword="false"/> otherwise.
2625
/// </returns>
27-
/// <param name="typeDescriptorContext"> The ITypeDescriptorContext for this call. </param>
28-
/// <param name="sourceType"> The Type being queried for support. </param>
26+
/// <param name="typeDescriptorContext">The <see cref="ITypeDescriptorContext"/> for this call.</param>
27+
/// <param name="sourceType">The <see cref="Type"/> being queried for support.</param>
2928
public override bool CanConvertFrom(ITypeDescriptorContext typeDescriptorContext, Type sourceType)
3029
{
3130
// We can only handle strings, integral and floating types

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/CornerRadiusConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace System.Windows
1212
{
1313
/// <summary>
14-
/// CornerRadiusConverter - Converter class for converting instances of other types to and from CornerRadius instances.
14+
/// Converter class for converting instances of other types to and from <see cref="CornerRadius"/> instances.
1515
/// </summary>
1616
public class CornerRadiusConverter : TypeConverter
1717
{
@@ -21,10 +21,10 @@ public class CornerRadiusConverter : TypeConverter
2121
/// CanConvertFrom - Returns whether or not this class can convert from a given type.
2222
/// </summary>
2323
/// <returns>
24-
/// bool - True if thie converter can convert from the provided type, false if not.
24+
/// <see langword="true"/> if the given <paramref name="sourceType"/> can be converted from, <see langword="false"/> otherwise.
2525
/// </returns>
26-
/// <param name="typeDescriptorContext"> The ITypeDescriptorContext for this call. </param>
27-
/// <param name="sourceType"> The Type being queried for support. </param>
26+
/// <param name="typeDescriptorContext">The <see cref="ITypeDescriptorContext"/> for this call.</param>
27+
/// <param name="sourceType">The <see cref="Type"/> being queried for support.</param>
2828
public override bool CanConvertFrom(ITypeDescriptorContext typeDescriptorContext, Type sourceType)
2929
{
3030
// We can only handle strings, integral and floating types

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThicknessConverter.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
namespace System.Windows
1313
{
1414
/// <summary>
15-
/// ThicknessConverter - Converter class for converting instances of other types to and from Thickness instances.
15+
/// Converter class for converting instances of other types to and from <see cref="Thickness"/> instances.
1616
/// </summary>
1717
public class ThicknessConverter : TypeConverter
1818
{
1919
#region Public Methods
2020

2121
/// <summary>
22-
/// CanConvertFrom - Returns whether or not this class can convert from a given type.
22+
/// Returns whether this class can convert specific <paramref name="sourceType"/> into <see cref="Thickness"/>.
2323
/// </summary>
2424
/// <returns>
25-
/// bool - True if thie converter can convert from the provided type, false if not.
25+
/// <see langword="true"/> if the given <paramref name="sourceType"/> can be converted from, <see langword="false"/> otherwise.
2626
/// </returns>
27-
/// <param name="typeDescriptorContext"> The ITypeDescriptorContext for this call. </param>
28-
/// <param name="sourceType"> The Type being queried for support. </param>
27+
/// <param name="typeDescriptorContext">The <see cref="ITypeDescriptorContext"/> for this call.</param>
28+
/// <param name="sourceType">The <see cref="Type"/> being queried for support.</param>
2929
public override bool CanConvertFrom(ITypeDescriptorContext typeDescriptorContext, Type sourceType)
3030
{
3131
// We can only handle strings, integral and floating types
@@ -95,22 +95,22 @@ public override object ConvertFrom(ITypeDescriptorContext typeDescriptorContext,
9595
}
9696

9797
/// <summary>
98-
/// ConvertTo - Attempt to convert a Thickness to the given type
98+
/// Attempt to convert a <see cref="Thickness"/> struct to the <paramref name="destinationType"/>.
9999
/// </summary>
100100
/// <returns>
101-
/// The object which was constructed.
101+
/// The formatted <paramref name="value"/> as <see cref="string"/> using the specified <paramref name="cultureInfo"/> or an <see cref="InstanceDescriptor"/>.
102102
/// </returns>
103+
/// <param name="typeDescriptorContext"> The ITypeDescriptorContext for this call. </param>
104+
/// <param name="cultureInfo"> The CultureInfo which is respected when converting. </param>
105+
/// <param name="value"> The Thickness to convert. </param>
106+
/// <param name="destinationType">The type to which to convert the Thickness instance. </param>
103107
/// <exception cref="ArgumentNullException">
104108
/// An ArgumentNullException is thrown if the example object is null.
105109
/// </exception>
106110
/// <exception cref="ArgumentException">
107111
/// An ArgumentException is thrown if the object is not null and is not a Thickness,
108112
/// or if the destinationType isn't one of the valid destination types.
109113
/// </exception>
110-
/// <param name="typeDescriptorContext"> The ITypeDescriptorContext for this call. </param>
111-
/// <param name="cultureInfo"> The CultureInfo which is respected when converting. </param>
112-
/// <param name="value"> The Thickness to convert. </param>
113-
/// <param name="destinationType">The type to which to convert the Thickness instance. </param>
114114
public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object value, Type destinationType)
115115
{
116116
ArgumentNullException.ThrowIfNull(value);
@@ -144,9 +144,9 @@ public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, C
144144
/// <summary>
145145
/// Converts <paramref name="thickness"/> to its string representation using the specified <paramref name="cultureInfo"/>.
146146
/// </summary>
147-
/// <param name="thickness">The <see cref="Thickness"/> to convert to string.</param>
147+
/// <param name="thickness">The <see cref="Thickness"/> to convert to <see cref="string"/>.</param>
148148
/// <param name="cultureInfo">Culture to use when formatting doubles and choosing separator.</param>
149-
/// <returns>The formatted <paramref name="thickness"/> as string using the specified <paramref name="cultureInfo"/>.</returns>
149+
/// <returns>The formatted <paramref name="thickness"/> as <see cref="string"/> using the specified <paramref name="cultureInfo"/>.</returns>
150150
internal static string ToString(Thickness thickness, CultureInfo cultureInfo)
151151
{
152152
char listSeparator = TokenizerHelper.GetNumericListSeparator(cultureInfo);

0 commit comments

Comments
 (0)