Skip to content
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

Черных Илья #214

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Черных Илья #214

wants to merge 27 commits into from

Conversation

Ilya4rh
Copy link

@Ilya4rh Ilya4rh commented Dec 10, 2024

Comment on lines 31 to 36
public PrintingConfig<TOwner> Using(CultureInfo culture)
{
printingConfig.SpecifyTheCulture<TPropType>(culture);

return ParentConfig;
}
Copy link

Choose a reason for hiding this comment

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

Сейчас можно написать что-то вроде ObjectPrinter.For<Person>().Printing(x=> x.Age).Using(CultureInfo.InvariantCulture) и ожидаемым поведением будет применение культуры только к выбранному полю, а не всем полям с таким же типом. Стоит сделать, чтобы примениялось только к конкретному полю

{
public class PrintingConfig<TOwner>
private readonly HashSet<Type> finalTypes =
Copy link

Choose a reason for hiding this comment

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

В шарпе есть ещё куча базовых типов, но как минимум стоит добавть сериализацию для long и bool

IFormattable format =>
format.ToString(null, CultureInfo.InvariantCulture),
string str => str,
_ => (string)obj
Copy link

Choose a reason for hiding this comment

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

Такой каст в строку может стрельнуть, если тип не кастуется в строку. К примеру, bool так не кастуется

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants