Friday, August 10, 2018

Thursday, February 22, 2018

All in Interview

1. Basics of .Net
2. Interface/Abstract class
3. Abstraction and Encapsulation
4. Inheritance and objects
5. Garbage collection
--------------------------------
6. ASP.net
7. Controls, User Defined controls, sessions, data transfer
--------------------------
8. MVC
9
10
-----------------------
11. Angular
12
13
----------------------
14. Node
15
16
-----------------------
17. Web API
18
19
--------------------
20. WCF
21
22
-----------------
23. Delegates
24
25
----------------
26. Threading
27
28
----------------
29. Design Pattern
30. SOLID

Sunday, December 24, 2017

Angular

Pre-requisite
1. Have npm, node installed.

Important facts
Components are the fundamental building blocks of Angular applications.They display data on the screen, listen for user input, and take action based on that input.

The ng serve command builds the app, starts the development server, watches the source files, and rebuilds the app as you make changes to those files.

You'll find the implementation of the shell AppComponent distributed over three files:
  1. app.component.ts— the component class code, written in TypeScript.
  2. app.component.html— the component template, written in HTML.
  3. app.component.css— the component's private CSS styles.

Sunday, November 19, 2017

Mutable vs Immutable

Mutable means can change and Immutable means can not change

string is immutable means whenver we assign a new value, a new string object is created in memory.


Stringbuilder is immutable, we can modify using different methods like append etc.

Random

Composition vs Inheritance - Inheritance shows -is-a relation. Composition shows - has-a relation.
extension methods in c#
  1. An extension method is defined as static method but it is called like as instance method.
  2. An extension method first parameter specifies the type of the extended object, and it is preceded by the "this" keyword.
  3. An extension method having the same name and signature like as an instance method will never be called since it has low priority than instance method.
  4. An extension method can't override the existing instance methods.
  5. An extension method cannot be used with fields, properties or events.
  6. The compiler doesn't cause an error if two extension methods with same name and signature are defined in two different namespaces and these namespaces are included in same class file using directives. Compiler will cause an error if you will try to call one of them extension method.
  1. //defining extension method
  2. public static class MyExtensions
  3. {
  4. public static int WordCount(this String str)
  5. {
  6. return str.Split(new char[] { ' ', '.', ',' }).Length;
  7. }
  8. }
  9.  
  10. class Program
  11. {
  12. public static void Main()
  13. {
  14. string s = "Dot Net Tricks Extension Method Example";
  15. //calling extension method
  16. int i = s.WordCount();
  17.  
  18. Console.WriteLine(i);
  19. }
  20. }
Chaining of extension method

  1. public static class ExtensionClass
  2. {
  3. public static string Pluralize (this string s) {...}
  4. public static string Capitalize (this string s) {...}
  5. }
  6. //we can do chainig of above methods like as
  7. string x = "Products".Pluralize().Capitalize();

Removing ambiguity

  1. static class StringExtension
  2. { // first method
  3. public static bool IsCapitalized (this string s) {...}
  4. }
  5. static class ObjectExtension
  6. {
  7. // second method
  8. public static bool IsCapitalized (this object s) {...}
  9. }
  10. // code here
  11. // first method is called
  12. bool flag1 = "Dotnet-Tricks".IsCapitalized();
  13. // second method is called
  14. bool test2 = (ObjectHelper.IsCapitalized ("Dotnet-Tricks"));

Javascript

- If we don't put var keyword variable becomes global.
- If we write  "use strict " , variable must be declared before use
- JavaScript can pull and reorganize variable declaration (javascript hoisting)
  alert(x);
var x=10;
above two lines throws undefined exception

When To Use IEnumerable, ICollection, IList And List

When To Use IEnumerable, ICollection, IList And List


IEnumerable, ICollection, IList



InterfaceScenario
IEnumerable, IEnumerable<T>The only thing you want is to iterate over the elements in a collection. You only need read-only access to that collection.
ICollection, ICollection<T>You want to modify the collection or you care about its size.
IList, IList<T>
You want to modify the collection and you care about the ordering and / or positioning of the elements in the collection.
..