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 }); }
Also known as static member or instance member
(1)calling
Static : Static member always call from class name.
NonStatic : NonStatic member always call from instance of the class.
Note: Those values who have not change during the entire program that values keep as a static
Example:
In Circle class the pi=3.14 value always must constant so use pi as a static member
(2)declaration
NonStatic declaration : float pi=3.14F;
Static declaration : static float pi=3.14F;
(3)In case of Constructor
Static : We can't use access modifier with static constructor.
NonStatic: we use always public modifier with non static constructor.
Note:
Static Constructor is called only once , no matter how many instances you create
Static Constructors are called before instance constructors.
(4)In Case of memory
In instance member belongs to specific instance (object) of a class. If i create 3 objects of a class , i will have 3 sets of instance members in the memory , where as there will ever be only one copy of a static member , no matter how many instances of a class are created.
(1)calling
Static : Static member always call from class name.
NonStatic : NonStatic member always call from instance of the class.
Note: Those values who have not change during the entire program that values keep as a static
Example:
In Circle class the pi=3.14 value always must constant so use pi as a static member
(2)declaration
NonStatic declaration : float pi=3.14F;
Static declaration : static float pi=3.14F;
(3)In case of Constructor
Static : We can't use access modifier with static constructor.
NonStatic: we use always public modifier with non static constructor.
Note:
Static Constructor is called only once , no matter how many instances you create
Static Constructors are called before instance constructors.
(4)In Case of memory
In instance member belongs to specific instance (object) of a class. If i create 3 objects of a class , i will have 3 sets of instance members in the memory , where as there will ever be only one copy of a static member , no matter how many instances of a class are created.
Comments
Post a Comment