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 }); }
By this time, you might have understood the concepts of C pointers and if any problem is given, you should be in a position to solve. After understanding the full concepts of pointers, we should be in a position to answer the question " What are the advantages and disadvantages of pointers?"
Advantages
Disadvantages
Advantages
- More than one value can be returned using pointer concept (pass by reference).
- Very compact code can be written using pointers.
- Data accessing is much faster when compared to arrays.
- Using pointers, we can access byte or word locations and the CPU register directly. The pointers in C are mainly useful in processing of non-primitive data structures such as arrays, linked list etc.
Disadvantages
- Un-initialized pointers or pointers containing invalid addresses can cause system crash.
- They are likely to be used incorrectly causing bugs that are very difficult to identify and rectify.
- They are confusing and difficult to understand in the beginning and if they are misused the result is unpredictable.
Comments
Post a Comment