Posts

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.

Difference between object,var, dynamic in C#

1. object,var,dynamic can store any type of value.object and dynamic no need to initilize at the time of declaration but var should be initilize at the time of declaration. 2. object is not type safe because compiler has little information about type. dynamic is not type safe because compiler does not have any information about type. var is type safe beacuse compiler have all information about stored value. 3. object and dynamic can be passed as method arguments and also a method can return object ,dynamic type. but var can't be pass as method arguments and also no method can return var type.

What is the Default Values for HorizontalContentAlignment and VerticalContentAlignment ?

Controls have different default values for the HorizontalContentAlignment and VerticalContentAlignment properties. Default values for HorizontalContentAlignment / VerticalContentAlignment for the most common controls are listed below. Button – Center, Center Calendar – Left, Top CheckBox – Left, Top ComboBox – Left, Top ContextMenu – Left, Center DataGrid – Left, Top DatePicker – Stretch, Top Expander – Stretch, Stretch GroupBox – Left, Top Label – Left, Top ListBox – Left, Center Menu – Left, Top PasswordBox – Left, Top ProgressBar – Left, Top RadioButton – Left, Top RepeatButton – Center, Center RichTextBox – Left, Top Slider – Left, Top StatusBar – Left, Top TabControl – Center, Center TextBox – Left, Top TreeView – Left, Center