Skip to content

Добавила решение второй домашней работы#2

Open
Nigma-Ks wants to merge 4 commits intomainfrom
hw2-1
Open

Добавила решение второй домашней работы#2
Nigma-Ks wants to merge 4 commits intomainfrom
hw2-1

Conversation

@Nigma-Ks
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

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

В целом ок, но надо чуть доделать

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

.NET 7 умер

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Перейдите на .NET 8

@@ -0,0 +1,81 @@

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лишняя пустая строчка (по-хорошему, тут должна быть шапка с лицензией, но ладно)

int localI = i;
threads[i] = new Thread(() =>
{
arrayOfResults[localI] = lazy.Get()!;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лучше "!" вообще никогда не пользоваться, потому что он убивает весь профит от nullability-анализа. Проверяйте явно на null лучше.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не поправлено. Можно, кстати, lazy.Get() ?? new Object();

thread.Start();
}

manualResetEvent.Set();

This comment was marked as resolved.

@@ -0,0 +1 @@
public interface ILazy<T> { T? Get(); } No newline at end of file
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# по стайлгайду фигурная скобка одни на строке

finally
{
supplier = null;
isFirstCall = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В свете строки ниже эта строка не нужна

}
throw supplierException!;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тут тоже пустая строчка не нужна

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не поправлено

Comment on lines +79 to +80


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лишние пустые строчки. Если они даже при беглом просмотре кода не бросаются Вам в глаза, Вам надо первый курс раззачесть :)

int localI = i;
threads[i] = new Thread(() =>
{
arrayOfResults[localI] = lazy.Get()!;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не поправлено. Можно, кстати, lazy.Get() ?? new Object();

/// </summary>
public interface ILazy<T>
{
T? Get();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Всё ещё надо комментарии

}
throw supplierException!;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не поправлено

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Перейдите на .NET 8

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