Skip to content

Conversation

buyaa-n
Copy link
Contributor

@buyaa-n buyaa-n commented Feb 25, 2020

Summary

Method XmlConvert.ToString(DateTime) is obsolete, and suggested alternate is XmlConvert.ToString(DateTime, XmlDateTimeSerializationMode) customers want to know what XmlDateTimeSerializationMode is best fit for the replacement. Suggested mode is XmlDateTimeSerializationMode.RoundtripKind but it will not produce exact matching result in some conditions, and there is no other matching mode which produce exact matching replacement, in that case ToString(DateTime, String) can be used with format string "yyyy-MM-ddTHH:mm:ss.fffffffzzzzzz". Updating notes section for suggested XmlDateTimeSerializationMode and exact match atlernate

Fixes #2665

… can be used and exact replacement suggestion
@tarekgh
Copy link
Member

tarekgh commented Feb 25, 2020

LGTM. can we also suggest to use the overload which takes DateTimeOffset too?

Copy link
Contributor

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, @buyaa-n. I left you some suggested changes for you to consider.

Co-Authored-By: Carlos Sanchez Lopez <[email protected]>
@buyaa-n
Copy link
Contributor Author

buyaa-n commented Feb 25, 2020

LGTM. can we also suggest to use the overload which takes DateTimeOffset too?

Not sure, for using ToString(DateTimeOffset, String) overload current DateTime instance need to be converted or cast to DateTimeOffset type, cannot be used directly i assume. Then next question would come up like which conversion would give closest/exact match etc, not sure if we need to add such info in this doc

@buyaa-n buyaa-n requested a review from Thraka February 26, 2020 18:11
Copy link
Contributor

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @buyaa-n for applying the suggestions. The build has no warnings or failures, so it's good to merge.

In case you and @tarekgh decide to mention his suggestion, feel free to add it in a separate PR.

@carlossanlop carlossanlop merged commit 7a841bc into dotnet:master Feb 27, 2020
@buyaa-n buyaa-n deleted the xmlconvert_tostring_suggested branch August 11, 2021 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-content Indicates PRs that contain new articles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If this method is obsolete, how to replace it with the other overload?
4 participants