نظرات مطالب
Blazor 5x - قسمت هفتم - مبانی Blazor - بخش 4 - انتقال اطلاعات از کامپوننت‌های فرزند به کامپوننت والد
یک نکته‌ی تکمیلی: نیاز به دقت در ویژگی «captured into the closure» در حلقه‌های Blazor

برای مثال حلقه‌ی زیر را در نظر بگیرید:
@for( int c = 0; c < 10; c++ )
{
   <li>
       <a href="#" @onclick="@(_=> OnLinkClicked(c))">@c</a>
   </li>
}
فکر می‌کنید پس از پایان این حلقه و رندر UI، اگر بر روی لینکی کلیک شد، چه مقداری به متد OnLinkClicked ارسال می‌شود؟
برخلاف تصور، با کلیک بر روی تمام لینک‌ها، فقط عدد ثابت 10 به متد  OnLinkClicked ارسال می‌شود. علت آن، همان نکات مطلب «بررسی مفهوم Captured Variable در زبان سی شارپ» است که در حین تشکیل حلقه‌های Blazor هم صادق هستند.
برای رفع این مشکل، از یکی از دو روش زیر می‌توان استفاده کرد:
Capture متغیر داخل حلقه:
@for( int c = 0; c < 10; c++ )
{
   var current = c;
   <li>
       <a href="#" @onclick="@(_=> OnLinkClicked(current))">@current</a>
   </li>
}
و یا ایجاد یک حلقه‌ی foreach بر روی یک Enumerable:
@foreach(var c in Enumerable.Range(0,10))
{
   <li>
       <a href="#" @onclick="@(_=> OnLinkClicked(c))">@c</a>
   </li>
}
اشتراک‌ها
Tailwind CSS چیست؟

Tailwind CSS is self-described as a utility first CSS framework. Rather than focusing on the functionality of the item being styled, Tailwind is centered around how it should be displayed. This makes it easier for the developer to test out new styles and change the layout. 

Tailwind CSS چیست؟
اشتراک‌ها
به ویژوال استودیو 2022 خوش آمدید - توسط Scott Hanselman و دوستان

Want to learn about the latest and greatest in the 64-bit Visual Studio 2022? Join Scott Hanselman and Visual Studio product team as they take Visual Studio 2022 for a spin.


00:00 Intro 
00:39 Why you should care about Visual Studio 2022? 
02:20 Performance improvements in Visual Studio 2022 
04:39 Why 64-bit now? 
08:00 IntelliCode, type less code more 
11:35 Hot reload for C++ 
13:47 New for WPF and WinForms (Hot Reload, Design time data, XAML
17:20 Hot Reload in ASP.NET 

20:27 Profiling .NET apps in Visual Studio 2022 

23:19 Cross platform apps with WSL and CMake in Visual Studio 2022 

26:07 Testing your .NET app on Linux 

28:00 Easily create CI/CD pipelines using GitHub actions with Visual Studio  2022

30:40 Balloon drop! 

به ویژوال استودیو 2022 خوش آمدید - توسط Scott Hanselman و دوستان