Skip to content

Кр 3#28

Open
Palezehvat wants to merge 3 commits intomasterfrom
Kr3
Open

Кр 3#28
Palezehvat wants to merge 3 commits intomasterfrom
Kr3

Conversation

@Palezehvat
Copy link
Owner

No description provided.

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

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

  • CI не работает, там в тестах что-то с переводами строк не сложилось.
  • Параметры-типы в методах, кстати, не поддерживаются, но это ладно :)


namespace Kr3;

public class Reflector

Choose a reason for hiding this comment

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

Надо комментарии

using System.Linq.Expressions;
using System.Reflection;

namespace Kr3;

Choose a reason for hiding this comment

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

namespace лучше писать первой строкой в файле, хотя дело вкуса

Comment on lines +33 to +36
private static string GetStaticOrNotFromClass(Type someClass)
{
return someClass.IsAbstract && someClass.IsSealed ? "static " : "";
}

Choose a reason for hiding this comment

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

Тут и ниже лучше через => писать

return "internal ";
}
return "";
}

Choose a reason for hiding this comment

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

Так-то MethodInfo и ConstructorInfo — потомки MethodBase (потому что они суть методы), и IsPrivate/IsPublic/и т.д. — это свойства MethodBase. Так что один из этих двух методов не нужен.

return "";
}

private void WriteParameters(StreamWriter writer, ParameterInfo[] parameters)

Choose a reason for hiding this comment

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

Можно было бы сделать решение несколько более ООПшным, если бы разделить читалку структуры класса и писалку результатов в разные классы.

Comment on lines +209 to +210
}
private static void WriteDifferentFields(StreamWriter writer,

Choose a reason for hiding this comment

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

Suggested change
}
private static void WriteDifferentFields(StreamWriter writer,
}
private static void WriteDifferentFields(StreamWriter writer,

return methodB != null;
}

private static void WriteDifferentMethods(StreamWriter writer,

Choose a reason for hiding this comment

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

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

@@ -0,0 +1,6 @@
class TestClassSum

Choose a reason for hiding this comment

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

Не выкладывайте ничего в bin/Debug. А то я вот перешёл на .NET 8 (и Вам советую, .NET 7 уже пару месяцев как ненужное старьё), и у меня эти файлы не находятся.

else if (someField.IsAssembly)
{
return "internal ";
}

Choose a reason for hiding this comment

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

Кстати, есть ещё protected internal :)

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

Comments