Skip to content

Conversation

@maakhhh
Copy link

@maakhhh maakhhh commented Jan 15, 2025

No description provided.

Copy link

@GlazProject GlazProject left a comment

Choose a reason for hiding this comment

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

Получился хороший результат, осталось только посмотреть несколько моментов с потенциальными исключениями

@@ -0,0 +1,57 @@
namespace ResultTools;

public class Result<T>
Copy link

@GlazProject GlazProject Jan 18, 2025

Choose a reason for hiding this comment

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

Если пытаться избавиться от Result<None>, то можно посмотреть как сделаны Task и Task<T>. Тогда бы ошибка и IsSuccess вынеслись в Result, а Result<T>:Result принёс ещё и Value. Но в этом случае придётся немного переписать (дописать) методы расширений. Тогда пропадёт такая особенность, что в метод передаётся None при вызове Then(none =>)


var format = splittedPath.Last();

var reader = readers.FirstOrDefault(r => r.SupportedFormats().Contains(format.ToLower()));

Choose a reason for hiding this comment

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

Если обращение происходит часто, лучше обернуть все ридеры в словарь на этапе инициализации. Так как линейное итерирование может потребовать много времени.

Copy link
Author

Choose a reason for hiding this comment

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

мне кажется конкретно в этом проекте обращение проходит достаточно редко, а способ более удобный, чем словарь

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.

3 participants