C#
1. String Vs String builder
String
|
String Builder
|
Inmutable(unable
to be changed.)
|
Mutable
|
Object
reacted for each string object separately in memory and it will create plenty
of memory so it may be run slow
|
Use less
memory and run faster
|
2. Read-only Vs Const Vs Static
3. Abstract Vs Interface
4. Ref Vs Out
Ref
|
Out
|
- The ref keyword is used
to pass an argument as a reference.
- This means that when the
value of that parameter is changed in the method.
- It gets reflected in the
calling method.
- An argument that is
passed using a ref keyword must be initialized in the calling method
before it is passed to the called method.
|
- The out keyword is also
used to pass an argument like the ref keyword.
- But the argument can be
passed without assigning any value to it.
- An argument that is
passed using an out keyword must be initialized in the called method
before it returns back to the calling method.
|
5. For Vs Foreach
6.Type of Constructor Default Constructor:
public Person()
{
Name = "John Doe";
Age = 30;
}
Parameterized Constructor:
Scholar(String name, int id)
{
this.name = name;
this.id = id;
}
Copy Constructor:
class Scholars
{
private string month;
private int year;
// Declaring Copy constructor
public Scholars(Scholars s)
{
month = s.month;
year = s.year;
}
// Instance constructor
public Scholars(string month, int year)
{
this.month = month;
this.year = year;
}
}
Private Constructor:
A constructor is referred to as a private constructor if it was created with the private specifier. This class cannot be derived from by any other classes, nor can an instance of this class be created.
public class Scholars
{
// Declare a private constructor
private Scholars()
{
}
// Declare a static variable field
public static int count_scholars;
// Declare a static method
public static int scholars_Count()
{
return ++count_scholars;
}
}
Static Constructor:
Static constructors are designed to be used just once to initialize static class fields or data.
class scholars {
// It is invoked before the first
// instance constructor is run.
static scholars()
{
// The following statement produces
// the first line of output,
// and the line occurs only once.
Console.WriteLine("Static Constructor");
}
}
7. SOLID Principle
8. Delegate with Example
9. Type of Routing
Conventional Routing and Attributal Routing
10. Sealed Class Vs Static Class
11. MVC filter
After MVC 5 Authentication filter is also available
12. Action Results
13. Tempdata - Peek Vs Keep
- Not Read
- Normal Read
- Read and Keep
- Peek and Read
14. As Vs Is
- IS keyword is helpful to check if the object is that type or not.
- AS keyword is helpful too if we want to convert one type to another type.
- IS keyword type is boolean and AS keyword is not a boolean type.
- The operator returns true if the given object is of the same type whereas as operator returns the object when they are compatible with the given type.
15. Extenstion Methods
16. Overloading (Compile-Time) Vs Overrding(Run-Time)
17.Generic Collections(Array, IDictory,List ,IList)
Generic is a type to be specified later. They are instantiated when needed for a specific type provided as parameters. In other words, a Generic allows you to write a class or method that can work with any data type(System.Collection.Generic namespace)
18. Icollections Vs IEnumerable
19. DI Life Time and DI in .NET core
20. CORS
21. React Hook
22. React Life Cycle
23. Thirdparty React - Router, Redux , Axios
24. SQL Optimization (Exection Plan tab check ,etc.)
25. Handle Error
.NET using log4net Vs .NET Core Serilogger
26. Struc Vs Class