Advanced topics

advance_dot_net9

Lazy<T>

Lazy initialization of an object means that its creation is deferred until it is first used. Lazy initialization is primarily used to improve performance, avoid wasteful computation, and reduce program memory requirements.

The lazy keyword which was introduced as part of .NET Framework 4.0 provides the built-in support for lazy initialization i.e. on-demand object initialization. If you want to make an object (such as Singleton) as lazily initialized then you just need to pass the type (Singleton) ) of the object to the lazy keyword as shown below.

private static readonly Lazy<Singleton> Instancelock = new Lazy<Singleton>(() => new Singleton());

The most important point that you need to remember is the Lazy<T> objects are by default thread-safe. In a multi-threaded environment, when multiple threads are trying to access the same Get Instance property at the same time, then the lazy object will take care of thread safety.

… read more

Volatile

The volatile keyword indicates that a field might be modified by multiple threads that are executing at the same time. The compiler, the runtime system, and even hardware may rearrange reads and writes to memory locations for performance reasons. Fields that are declared volatile are not subject to these optimizations. Adding the volatile modifier ensures that all threads will observe volatile writes performed by any other thread in the order in which they were performed. There is no guarantee of a single total ordering of volatile writes as seen from all threads of execution.

… read more

Windows Event Viewer

The Windows Event Viewer shows a log of application and system messages, including errors, information messages, and warnings. It’s a useful tool for troubleshooting all kinds of different Windows problems.

eve2

… read more

Windows Service

Windows Services are a core component of the Microsoft Windows operating system and enable the creation and management of long-running processes.
Unlike regular software that is launched by the end user and only runs when the user is logged on, Windows Services can start without user intervention and may continue to run long after the user has logged off. The services run in the background and will usually kick in when the machine is booted. Developers can create Services by creating applications that are installed as a Service, an option ideal for use on servers when long-running functionality is needed without interference with other users on the same system.

… read more

The 7 Layers of the OSI Model + TCP

The Open System Interconnection (OSI) model defines a networking framework to implement protocols in seven layers. Use this handy guide to compare the different layers of the OSI model and understand how they interact with each other.

osi7

… read more

read OSI model – wikipedia

More topics covered:

  • Developer Command Prompt for Visual Studio
  • Installutility.exe
  • Windows service tray icon
  • TCP- client
  • TCP – server
  • TCP- client fire AJAX
  • Implementing REST API in TCP

Class code:

Links:

Leave a comment