Получи случайную криптовалюту за регистрацию!

C# 1001 notes

Логотип телеграм канала @csharp_1001_notes — C# 1001 notes C
Логотип телеграм канала @csharp_1001_notes — C# 1001 notes
Адрес канала: @csharp_1001_notes
Категории: Технологии
Язык: Русский
Количество подписчиков: 2.63K
Описание канала:

Регулярные короткие заметки по C# и .NET.
Просто о сложном для каждого.
admin - @notxxx1

Рейтинги и Отзывы

3.50

2 отзыва

Оценить канал csharp_1001_notes и оставить отзыв — могут только зарегестрированные пользователи. Все отзывы проходят модерацию.

5 звезд

1

4 звезд

0

3 звезд

0

2 звезд

1

1 звезд

0


Последние сообщения 14

2021-10-14 18:22:00 #challenge

Is the Input Factorial of an Integer? | #easy

Create a function that checks if a given integer is exactly the factorial of an integer or not. true if it is, false otherwise.

Examples:

isFactorial(2) ➞ true
// 2 = 2 * 1 = 2!

isFactorial(27) ➞ false

isFactorial(24) ➞ true
// 24 = 4 * 3 * 2 * 1 = 4!

Leave your solutions in the comments. The solution will be posted below in a couple of hours

#interview
347 views15:22
Открыть/Комментировать
2021-10-13 18:21:00
You have defined a destructor but it never executed. Why?

The runtime environment automatically invokes the destructor of a class to release the resources that are occupied by variables and methods of an object.

However, in C#, programmers cannot control the timing for invoking destructors, as Garbage Collector is only responsible for releasing the resources used by an object.

Garbage Collector automatically gets information about unreferenced objects from .NET's runtime environment and then invokes the Finalize() method.

Although, it is not preferable to force Garbage Collector to perform garbage collection and retrieve all inaccessible memory (programmers can use the Collect() method of the Garbage Collector class to forcefully execute Garbage Collector).

Take notice that the destructor doesn't (and can't) have a public modifier in-front of it, it's sort of an hint that you can't explicitly call the destructor of an object.

#post
399 views15:21
Открыть/Комментировать
2021-10-12 18:20:00
421 views15:20
Открыть/Комментировать
2021-10-11 19:19:00
What are Property Accessors?

The get and set portions or blocks of a property are called accessors.

These are useful to restrict the accessibility of a property.

The set accessor specifies that we can assign a value to a private field in a property and without the set accessor property it is like a read-only field.

By the get accessor we can access the value of the private field. A Get accessor specifies that we can access the value of a field publicly.

#post
485 views16:19
Открыть/Комментировать
2021-10-08 16:49:00
HTTP/3 support in .NET 6

New LINQ Methods in .NET 6

Properly Disposing Objects

Code Coverage in .NET

Useful Libraries for .NET projects

Всем хороших выходных :)
359 views13:49
Открыть/Комментировать
2021-10-07 21:22:00
Here is a solution for the #challenge above
418 views18:22
Открыть/Комментировать
2021-10-07 18:22:00 #challenge

Perfect Number | #easy

Create a function that tests whether or not an integer is a perfect number. A perfect number is a number that can be written as the sum of its factors, (equal to sum of its proper divisors) excluding the number itself.

For example, 6 is a perfect number, since 1 + 2 + 3 = 6, where 1, 2, and 3 are all factors of 6. Similarly, 28 is a perfect number, since 1 + 2 + 4 + 7 + 14 = 28.

Examples:

CheckPerfect(6) ➞ true
CheckPerfect(28) ➞ true
CheckPerfect(496) ➞ true
CheckPerfect(12) ➞ false
CheckPerfect(97) ➞ false

Leave your solutions in the comments. The solution will be posted below in a couple of hours

#interview
446 views15:22
Открыть/Комментировать
2021-10-06 18:21:00
When to use Finalize vs Dispose?

The finalizer method is called when your object is garbage collected and you have no guarantee when this will happen (you can force it, but it will hurt performance).

The Dispose method, on the other hand, is meant to be called by the code that created your class so that you can clean up and release any resources you have acquired (unmanaged data, database connections, file handles, etc) the moment the code is done with your object.

The standard practice is to implement IDisposable and Dispose so that you can use your object in a using statement such as using(var foo = new MyObject()) { }.

And in your finalizer, you call Dispose, just in case the calling code forgot to dispose of you.

#post
467 views15:21
Открыть/Комментировать