I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Comments are non-executale statements. Generally created for making user-friendly application. If we talk about c# comments, there are three types.
first one single line second one is multi-line and last one is XML documentation comments. Look like
Single-line Comments --- // (created through double slash)
Multi-line Comments ---- /* */
XML Documentation comments --- ///
Note : Don't try to comment every line of code. Use comments only for code, which is difficult to understand.
If you want to create comment in c# application , you can use keyboard shortcut. CTRL+K with C for comment, CTRL+K with U for un-comment.
Lets create a simple application demo for understanding all types of comments.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Addtwonumber qd = new Addtwonumber();
//int number = 10;
/*if (number == 10)
{
Console.WriteLine(number);
}*/
}
}
/// <summary>
/// This class is designed for adding two number
/// </summary>
public class Addtwonumber
{
}
}
Code generate the following output
first one single line second one is multi-line and last one is XML documentation comments. Look like
Single-line Comments --- // (created through double slash)
Multi-line Comments ---- /* */
XML Documentation comments --- ///
Note : Don't try to comment every line of code. Use comments only for code, which is difficult to understand.
If you want to create comment in c# application , you can use keyboard shortcut. CTRL+K with C for comment, CTRL+K with U for un-comment.
Lets create a simple application demo for understanding all types of comments.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Addtwonumber qd = new Addtwonumber();
//int number = 10;
/*if (number == 10)
{
Console.WriteLine(number);
}*/
}
}
/// <summary>
/// This class is designed for adding two number
/// </summary>
public class Addtwonumber
{
}
}
Code generate the following output
This example cover all types of comments. According to screen snap, you can better understand XML comments. If you don't use XML comment , before creating the class. Intellisense doesn't dispay the summary of the class.
Comments
Post a Comment