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

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


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

2021-11-08 18:19:00
How we can pass parameters to a method?

There are three ways that parameters can be passed to a method:

Value parameters − This method copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.

Reference parameters − This method copies the reference to the memory location of an argument into the formal parameter. This means that changes made to the parameter affect the argument.

Output parameters − This method helps in returning more than one value.

#post
447 views15:19
Открыть/Комментировать
2021-11-04 21:22:00
Here is a solution for the #challenge above
337 views18:22
Открыть/Комментировать
2021-11-04 18:22:00 #challenge

Letter Distance | #easy

Given two words, the letter distance is calculated by taking the absolute value of the difference in character codes and summing up the difference.

If one word is longer than another, add the difference in lengths towards the score.

To illustrate:

"fly") = dist("h", "f") + dist("o", "l") + dist("u", "y") + dist(house.Length, fly.Length)

= |104 - 102| + |111 - 108| + |117 - 121| + |5 - 3|
= 2 + 3 + 4 + 2
= 11

Examples:

LetterDistance("sharp", "sharq") ➞ 1
LetterDistance("abcde", "Abcde") ➞ 32
LetterDistance("abcde", "bcdef") ➞ 5

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

#interview
366 views15:22
Открыть/Комментировать
2021-11-03 18:21:00
How can we check equality in .NET?

The ReferenceEquals() method - checks if two reference type variables(classes, not structs) are referred to the same memory address.

The virtual Equals() method. (System.Object) - checks if two objects are equivalent.

The static Equals() method - is used to handle problems when there is a null value in the check.

The Equals method from IEquatable interface.

The comparison operator == - usually means the same as ReferenceEquals, it checks if two variables point to the same memory address. The gotcha is that this operator can be override to perform other types of checks. In strings, for instance, it checks if two different instances are equivalent.

#post
423 views15:21
Открыть/Комментировать
2021-11-02 18:20:00
What will be the output of the following code snippet?
Anonymous Quiz
32%
5
49%
10
1%
15
17%
Error
155 voters440 views15:20
Открыть/Комментировать
2021-11-02 18:20:00
433 views15:20
Открыть/Комментировать
2021-11-01 18:19:00 What is namespace in C#?

A namespace is designed for providing a way to keep one set of names separate from another. The class names declared in one namespace does not conflict with the same class names declared in another.

NET uses namespaces to organize its many classes.

Declaring your own namespaces can help you control the scope of class and method names in larger programming projects.

SampleNamespace
{
class SampleClass
{
public void SampleMethod()
{
System.Console.WriteLine(
"SampleMethod inside SampleNamespace");
}
}
}

#post
254 views15:19
Открыть/Комментировать
2021-10-28 21:22:00
Here is a solution for the #challenge above
332 views18:22
Открыть/Комментировать
2021-10-28 18:22:00 #challenge

Compounding Letters | #easy

Create a function that takes a string and returns a new string with each new character accumulating by +1. Separate each set with a dash.

Capitalize the first letter of each set.

Examples:

Accum("abcd") ➞ "A-Bb-Ccc-Dddd"
Accum("RqaEzty") ➞ "R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy"
Accum("cwAt") ➞ "C-Ww-Aaa-Tttt"

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

#interview
128 views15:22
Открыть/Комментировать
2021-10-27 18:21:00
How to implement the Where method in C#?

The
yield keyword actually does quite a lot here. It creates a state machine "under the covers" that remembers where you were on each additional cycle of the function and picks up from there.

The function returns an object that implements the IEnumerable interface. If a calling function starts foreaching over this object, the function is called again until it "yields" result based on some predicate.

This is syntactic sugar introduced in C# 2.0. In earlier versions you had to create your own IEnumerable and IEnumerator objects to do stuff like this.

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