Posts

Showing posts from January, 2019

What is Prism?

Image
Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Windows 10 UWP, and Xamarin Forms.Prism provides an implementation of a collection of design patterns that are helpful in writing well-structured and maintainable XAML applications, including MVVM, dependency injection, commands, EventAggregator, and others. Prism's core functionality is a shared code base in a Portable Class Library targeting these platforms. Those things that need to be platform specific are implemented in the respective libraries for the target platform. Prism also provides great integration of these patterns with the target platform. Here is the video for creating Application using Prism in Wpf

what is ConcurrentDictionary?

ConcurrentDictionary is one of five collection classes introduced in .NET 4.0. It exists in System.Collections.Concurrent namespace.ConcurrentDictionary is thread-safe collection class to store key/value pairs. ConcurrentDictionary can be used with multiple threads concurrently. Without ConcurrentDictionary class, if we have to use Dictionary class with multiple threads, then we have to use locks to provides thread-safety which is always error-prone.ConcurrentDictionary provides you an easy option. It internally manages the locking gives you an easy interface to add/update items. ConcurrentDictionary provides different methods as compared to Dictionary class. We can use AddOrUpdate, GetOrAdd ,TryAdd, TryUpdate, TryRemove, and TryGetValue to do CRUD operations on ConcurrentDictionary.

What is the difference between Finalize() and Dispose() methods?

Dispose() is called when we want to realese an unmanaged resources of an object. finalize() also called for same but it doesn't assure object is garbage collected. The dispose() method is defined inside the interface IDisposable whereas, the method finalize() is defined inside the class object. The main difference between dispose() and finalize() is that the method  dispose() has to be explicitly invoked by the user whereas, the method  finalize() is invoked by the garbage collector, just before the object is destroyed.