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 }); }
Structure
|
Class
|
Structure use public modifier by default
|
Class use private modifier by default
|
In concept of inheritance, derived structure is public by default
when access modifier doesn’t use in base class.
|
In case of class concept, derived class is private by default when
access modifier doesn’t use in base class.
|
Use ‘struct’ keyword in language c, c# and ‘structure’ keyword use in
VB for implementing structure block
|
Use ‘class’ keyword for implementing class block.
|
Structure is a collection of bits.
|
Class is a collection of members of society.
|
Structure is based on procedural approach
|
Class is based on object-oriented approach.
|
It doesn’t support Data hiding concepts. Means you can’t implement
security in it.
|
You can implement security in it Using data hiding.
|
It is a value type
|
It is reference type
|
Size of empty structure is 0 byte
|
Size of empty class is 1 byte
|
In case of template, we can’t use it.
|
Always we use class in case of structure.
|
template<struct T> // ERROR, struct not allowed here
|
template<class T> // OK
|
Structure may represent real world object.
|
Class is highly suitable to represent real world objects rather than
"Structures"
|
Structure value will be stored in stack memory
|
Class members are stored in heap memory.
|
Structure used for light weight object.
|
Class is used for complex data type
|
Comments
Post a Comment