Tuesday, July 20, 2021

C#

Design Patterns:

https://www.c-sharpcorner.com/UploadFile/nipuntomar/creational-design-pattern-for-net/

https://www.c-sharpcorner.com/UploadFile/nipuntomar/structural-design-pattern-for-net/

https://www.c-sharpcorner.com/UploadFile/nipuntomar/behavioral-design-pattern-for-net-part-1/

SOLID Principles:

Single Responsibility Principle (SRP): High cohesion and Loosely couples design is preferred.

refer UDEMY course

--------------------------------------------------------------------------------------------------------------------

Default access specifier of the class members is 'Private

Object class is the 'Default parent class 

Base keyword is used to refer to the members of the parent class

Default class access specifier is internal.

Sealed class- can't be inherited further

Sealed method - can't be overridden further.

Static classes are sealed and therefore cannot be inherited.

Q: If we want to make a class not accessible to anyone?

    A: Define private constructor

Q: Restrict a class not to be accessible to any other except child class?

A: Define constructor of a class protected.

Q: throw vs throws

A: 

throwthrows
throw keyword is used to throw an exception explicitly.throws keyword is used to declare one or more exceptions, separated by commas.
Only single exception is thrown by using throw.Multiple exceptions can be thrown by using throws.
throw keyword is used within the method.throws keyword is used with the method signature.

Read about delegates.

Delegate is a class, which is used to create and invoke delegates at runtime.

A delegate in C# is similar to a function pointer in C or C++

delegates are object-oriented type-safe and very secure as they ensure that the signature of the method being called is correct. 

Events and delegates work together. An event is a reference to a delegate i.e. when an event is raised, a delegate is called. 

Func, Action  & Predicate.

https://www.c-sharpcorner.com/UploadFile/puranindia/C-Sharp-interview-questions/

constant vs readonly

lazy loading vs eager loading

Tasks and threads in .NET and classes

App Domain:

Asp.Net introduces the concept of an Application Domain which is shortly known as AppDomain. It can be considered as a Lightweight process which is both a container and boundary. The .NET runtime uses an AppDomain as a container for code and data, just like the operating system uses a process as a container for code and data. As the operating system uses a process to isolate misbehaving code, the .NET runtime uses an AppDomain to isolate code inside of a secure boundary.


can destructors cause deadlocks

SQL: execution plans

Access token
Grant type = client credentials
used graph.microsoft.com/default
this will return claims related to only app

Grant type= Authorization code (This will as the user to login for claims)
this will return claims realted to App + User

JWT token :
Header
Payload
Certificate

ID_token: The purpose of ID_token is to only verify the identity of the user
Id_token is not used by applications to access protected resources, which is the case with access token
used graph.microsoft.com/default OpenID
this will return Access token and id_token

Refresh token
Re fresh token is required for the authorization/authentication flow which needs user interaction

graph.microsoft.com/default OpenID offline_access
This will return Accesstoken, id token, and refresh token
https://www.c-sharpcorner.com/article/oauth2-0-and-openid-connect-oidc-core-concepts-what-why-how/
https://www.c-sharpcorner.com/article/accesstoken-vs-id-token-vs-refresh-token-what-whywhen/
https://docs.microsoft.com/en-us/azure/active-directory-b2c/configure-tokens?pivots=b2c-user-flow

No comments:

Post a Comment