Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
🐳4🔥1👨💻1
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥3🐳2👨💻1
const num = 10
console.log( Number.isInteger(num) )
// true
const num = 10.3
if (num % 1 === 0) {
console.log ('Число целое')
} else {
console.log ('Число не целое')
}
// Число не целое
Please open Telegram to view this post
VIEW IN TELEGRAM
🐳3👨💻2🔥1
Пример ниже выполняет несколько вызовов
HttpClient
и обрабатывает их результаты по мере завершения:using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
HttpClient client = new HttpClient();
Task<string>[] tasks = new Task<string>[]
{
client.GetStringAsync("https://example.com/1"),
client.GetStringAsync("https://example.com/2"),
client.GetStringAsync("https://example.com/3")
};
await Task.WhenEach(tasks, async task =>
{
string result = await task;
Console.WriteLine(result);
});
}
}
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥3🐳2👨💻1
//This is a single line comment
/*This is a multiple line comment
We are in line 2
Last line of comment*/
/// <summary>
/// Set error message for multilingual language.
/// </summary>
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥3🐳2👨💻1
Please open Telegram to view this post
VIEW IN TELEGRAM
👨💻3🔥2🐳1
Синтаксис:
SELECT DISTINCT column_name FROM table_name
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥4🐳1👨💻1
Примеры:
List<string> people = new List<string>();
Обращение к элементам списка:
var people = new List<string>() { "Tom", "Bob", "Sam" };
string firstPerson = people[0]; // получаем первый элемент
Console.WriteLine(firstPerson); // Tom
people[0] = "Mike"; // изменяем первый элемент
Console.WriteLine(people[0]); // Mike
Длина списка:
var people = new List<string>() { "Tom", "Bob", "Sam" };
Console.WriteLine(people.Count); // 3
Добавление в список:
List<string> people = new List<string> () { "Tom" };
people.Add("Bob"); // добавление элемента
// people = { "Tom", "Bob" };
people.AddRange(new[] { "Sam", "Alice" }); // добавляем массив
// people = { "Tom", "Bob", "Sam", "Alice" };
// также можно было бы добавить другой список
// people.AddRange(new List<string>(){ "Sam", "Alice" });
people.Insert(0, "Eugene"); // вставляем на первое место
// people = { "Eugene", "Tom", "Bob", "Sam", "Alice" };
people.InsertRange(1, new string[] {"Mike", "Kate"}); // вставляем массив с индекса 1
// people = { "Eugene", "Mike", "Kate", "Tom", "Bob", "Sam", "Alice" };
// также можно было бы добавить другой список
// people.InsertRange(1, new List<string>(){ "Mike", "Kate" });
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥2🐳2👨💻2
Пример кода:
<div data-role="page" data-hidden="true" data-custom="12345">Пример элемента</div>
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥3🐳2👨💻1
Пример:
clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
Пример интерактивного элемента:
<style>
#demo-image {
clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
</style>
<img id="demo-image" src="path/to/image.jpg" alt="Demo Image">
<input type="range" min="0" max="100" value="50" oninput="updateClipPath(this.value)">
<script>
function updateClipPath(value) {
document.getElementById('demo-image').style.clipPath = `polygon(${value}% 0%, 100% 50%, ${value}% 100%, 0% 50%)`;
}
</script>
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥3🐳2👨💻1
Интерактивное демо:
Написать код JavaScript, который активирует кнопку, меняя её data-status с inactive на active.
<button data-status="inactive" data-user-id="12345">Activate User 12345</button>
<button data-status="inactive" data-user-id="12346">Activate User 12346</button>
<script>
document.querySelectorAll('button').forEach(button => {
button.addEventListener('click', function() {
if (this.dataset.status === 'inactive') {
this.dataset.status = 'active';
this.textContent = 'Deactivate User ' + this.dataset.userId;
} else {
this.dataset.status = 'inactive';
this.textContent = 'Activate User ' + this.dataset.userId;
}
});
});
</script>
Please open Telegram to view this post
VIEW IN TELEGRAM
👨💻3🔥2🐳1
Пример кода:
try {
int divisor = 0;
int result = 10 / divisor;
} catch (DivideByZeroException ex) {
Console.WriteLine("Error: " + ex.Message);
}
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥3👨💻2🐳1
Пример использования:
$theme: dark;
body {
@if $theme == dark {
background-color: #333;
color: #fff;
} @else {
background-color: #fff;
color: #000;
}
}
Преимущества:
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥2🐳2👨💻2