Skip to content

add PrintStructure unstable - #7

Open
ArtemNikit1n wants to merge 2 commits into
mainfrom
test2
Open

add PrintStructure unstable#7
ArtemNikit1n wants to merge 2 commits into
mainfrom
test2

Conversation

@ArtemNikit1n

Copy link
Copy Markdown
Owner

No description provided.

@yurii-litvinov yurii-litvinov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тестов и Diff не хватает, но генерация круто сделана.

[Test]
public void Test1()
{
Assert.Pass();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:(


if (!string.IsNullOrEmpty(type.Namespace))
{
sb.AppendLine($"namespace {type.Namespace};");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

namespace лучше над using-ами, даже в сгенеренном коде

sb.AppendLine(indent + "}");
sb.AppendLine();
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍


if (method.IsAbstract || type.IsInterface)
{
sb.AppendLine(methodIndent + "throw new NotImplementedException();");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

}
else
{
sb.AppendLine(methodIndent + $"return default({GetTypeNameWithGenerics(method.ReturnType)});");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В современном C# можно писать просто return default;, компилятор сам тип возвращаемого значения выведет.

{
if (p.IsOut)
{
paramStr = "out ";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍


GenerateNestedTypes(type, sb, indentLevel + 1);

sb.AppendLine(indent + "}");

Copy link
Copy Markdown

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