-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Зарипов Кирилл #210
base: master
Are you sure you want to change the base?
Зарипов Кирилл #210
Conversation
ObjectPrinting/PrintingConfig.cs
Outdated
|
||
private readonly HashSet<Type> excludedTypes = []; | ||
private readonly HashSet<string> excludedProperties = []; | ||
private readonly HashSet<object> processedObjects = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не уверен, но скорее всего в конструктор HashSet
'а нужно передать ReferenceEqualityComparer.Instance
. Иначе будет использоваться Equals
объекта и есть вероятность, что "совпадут" два одинаковых по состоянию, но разных по ссылке объекта
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ObjectPrinting/PrintingConfig.cs
Outdated
result = obj switch | ||
{ | ||
IFormattable formattable => formattable.ToString(null, numberCulture) + Environment.NewLine, | ||
string str when maxStringLength.HasValue => string.Concat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Круто что знаешь про Span
, но при наличии ограничения на длину, сама строка может быть сразу подходящей и тогда всё это преобразование будет избыточным. Кстати, что будет, если сравнить str.Length <
(или >
) int?(null)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Будет False в обоих случаях
ObjectPrinting/PrintingExtensions.cs
Outdated
|
||
namespace ObjectPrinting; | ||
|
||
public static class PrintingExtensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Операция выглядит слишком специфичной, чтобы быть расширением. Я бы завел статические методы в ObjectPrinter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ObjectPrinting/PrintingConfig.cs
Outdated
return this; | ||
} | ||
|
||
public PrintingConfig<TOwner> SetCulture(IFormatProvider culture) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Насколько понял постановку задачи, культуру должно быть можно задать для каждого типа в отдельности (хотя я плохо понимаю сценарий, в котором могло бы такое понадобиться)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.