Skip to content

Commit

Permalink
Port the doc changes to source (#72638)
Browse files Browse the repository at this point in the history
* Port the doc changes to source

* Address the feedback

* Update src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DateOnlyConverter.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>

* Remove duplicated summary section

* reorder the doc elements

* reorder the remaining doc elements

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
  • Loading branch information
tarekgh and eerhardt authored Jul 22, 2022
1 parent c0b9416 commit 8d5c303
Showing 2 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -9,25 +9,21 @@
namespace System.ComponentModel
{
/// <summary>
/// Provides a type converter to convert <see cref='System.DateOnly'/>
/// objects to and from various other representations.
/// Provides a type converter to convert <see cref='System.DateOnly'/> objects to and from various other representations.
/// </summary>
public class DateOnlyConverter : TypeConverter
{
/// <summary>
/// Gets a value indicating whether this converter can convert an
/// object in the given source type to a <see cref='System.DateOnly'/>
/// Gets a value indicating whether this converter can convert an object in the given source type to a <see cref='System.DateOnly'/>
/// object using the specified context.
/// </summary>
/// <inheritdoc />
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}

/// <summary>
/// Gets a value indicating whether this converter can convert an object
/// to the given destination type using the context.
/// </summary>
/// <inheritdoc />
public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
{
return destinationType == typeof(InstanceDescriptor) || base.CanConvertTo(context, destinationType);
@@ -36,6 +32,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(
/// <summary>
/// Converts the given value object to a <see cref='System.DateOnly'/> object.
/// </summary>
/// <inheritdoc />
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
{
if (value is string text)
@@ -77,6 +74,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(
/// <summary>
/// Converts the given value object from a <see cref='System.DateOnly'/> object using the arguments.
/// </summary>
/// <inheritdoc />
public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
{
if (destinationType == typeof(string) && value is DateOnly dateOnly)
Original file line number Diff line number Diff line change
@@ -9,25 +9,21 @@
namespace System.ComponentModel
{
/// <summary>
/// Provides a type converter to convert <see cref='System.TimeOnly'/>
/// objects to and from various other representations.
/// Provides a type converter to convert <see cref='System.TimeOnly'/> objects to and from various other representations.
/// </summary>
public class TimeOnlyConverter : TypeConverter
{
/// <summary>
/// Gets a value indicating whether this converter can convert an
/// object in the given source type to a <see cref='System.TimeOnly'/>
/// Gets a value indicating whether this converter can convert an object in the given source type to a <see cref='System.TimeOnly'/>
/// object using the specified context.
/// </summary>
/// <inheritdoc />
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}

/// <summary>
/// Gets a value indicating whether this converter can convert an object
/// to the given destination type using the context.
/// </summary>
/// <inheritdoc />
public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
{
return destinationType == typeof(InstanceDescriptor) || base.CanConvertTo(context, destinationType);
@@ -36,6 +32,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(
/// <summary>
/// Converts the given value object to a <see cref='System.TimeOnly'/> object.
/// </summary>
/// <inheritdoc />
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
{
if (value is string text)
@@ -77,6 +74,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(
/// <summary>
/// Converts the given value object from a <see cref='System.TimeOnly'/> object using the arguments.
/// </summary>
/// <inheritdoc />
public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
{
if (destinationType == typeof(string) && value is TimeOnly timeOnly)

0 comments on commit 8d5c303

Please sign in to comment.