Skip to content

Conversation

@Andrw-404
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.

Тестов не хватает и в целом самое интересное закомментировано, но выглядит хорошо, в целом всё правильно.

@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

Choose a reason for hiding this comment

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

:(

@@ -0,0 +1,297 @@
namespace SecondTestTask;

Choose a reason for hiding this comment

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

Тут вот StyleCop дело говорит, стоило поправить его замечания сразу, это же быстро

{
ArgumentNullException.ThrowIfNull(someClass);
var fileName = $"{ClearClassName(someClass)}.cs";
//File.WriteAllText(fileName, GenerateCode(someClass), Encoding.UTF8);

Choose a reason for hiding this comment

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

:(

Comment on lines +18 to +21
if (a == null || b == null)
{
throw new ArgumentNullException();
}

Choose a reason for hiding this comment

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

Это лучше двумя отдельными ThrowIfNull

Comment on lines +30 to +31
//DiffFields(a, b);
//DiffMethods(a, b);

Choose a reason for hiding this comment

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

:(

sb.AppendLine();
}

var nestedClasses = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic).Where(nt => nt.IsClass).OrderBy(nt => nt.Name).ToArray();

Choose a reason for hiding this comment

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

Тут стоило проверить, что это не автогенерённый вложенный класс (они именуются с <>), иначе не скомпилится, если в исходном классе, например, есть лямбды с замыканиями

private string FieldDeclaration(FieldInfo f)
{
var mods = new List<string> { GetMemberAccess(f) };
if (f.IsStatic) mods.Add("static");

Choose a reason for hiding this comment

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

Ещё бывают всякие readonly, const и т.п.

{
var prefix = "";
if (p.ParameterType.IsByRef)
prefix = p.IsOut ? "out " : "ref ";

Choose a reason for hiding this comment

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

👍

if (t == typeof(object)) return "object";

if (t.IsArray)
return TypeName(t.GetElementType()!) + "[]";

Choose a reason for hiding this comment

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

👍

}

var methods = type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance |
BindingFlags.Static | BindingFlags.DeclaredOnly).Where(m=> !m.IsSpecialName).OrderBy(m => m.Name).ToArray();

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.

2 participants