Wednesday, September 13, 2017

Some helpful interview topics (Differences X VS Y)



IEnumrable VS IEnumarator 
IEnumrable VS IQueryable 
IEquatable VS IEqualityComparer VS IStructuralEquatable 
IComparable VS IComparer VS IStructuralComparable 
Delegates VS Events
Shadowing VS Overriding
Yield
Abstraction VS Encapsulation
Lambda expressions , Action , Func and Predicate
Generics
IOC & Dependancy Injection
async, await
MVVM, MVC, MVP
TPL
Indexer
Private Constructor
Private Class

Static Class VS Singleton
Culture and UICulture
LINQ: Single vs. First
a.Equals(b) and a == b?
SQL XML - CROSS APPLY V/S OUTER APPLY
Null values are in Sub query...
Diffrence Int32.parse, Convert.ToInt32, Int32.TryParse
Perform shallow copy of an object VS Deep Copy

Monday, September 4, 2017

Static Class VS Singleton



Static Class:-
  1. You cannot create the instance of static class.
  2. Loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace containing the class is loaded.
  3. Static Class cannot have constructor.
  4. We cannot pass the static class to method.
  5. We cannot inherit Static class to another Static class in C#.
  6. A class having all static methods.
  7. Better performance (static methods are bonded on compile time)
Singleton:-
  1. You can create one instance of the object and reuse it.
  2. Singleton instance is created for the first time when the user requested.
  3. Singleton class can have constructor.
  4. You can create the object of singleton class and pass it to method.
  5. Singleton class does not say any restriction of Inheritance.
  6. We can dispose the objects of a singleton class but not of static class.
  7. Methods can be overridden.
  8. Can be lazy loaded when need (static classes are always loaded).
  9. We can implement interface(static class can not implement interface).

Thursday, August 24, 2017

Difference between Culture and UICulture


Difference between Culture and UICulture properties in ASP.NET?

CultureInfo class plays an important role for localizing our application pages. Culture is specific in localizing non-visual parts of the page like DateTime, Currency, number formatting etc.
while UICulture is specific in localizing visual part of a webpage like Language being used to display the contents of the web page.

Wednesday, August 23, 2017

WCF Terminology


  • InstanceContextMode
PerSession
PerCall
Single

  • SessionMode
Allowed
NotAllowed
Required

  • ConcurrencyMode
Single
Multiple
Reentrant

  • WCF Throrrling
 maxConcurrentCalls
        maxConcurrentInstance
        maxConcurrentSessions
  • Message Protection  ( ProtectionLevel )
None
Sign
SignAndEncrypt


Saturday, July 29, 2017

The statement "use strict"; : List of features (non-exhaustive)



The statement "use strict"; instructs the browser to use the Strict mode, which is a reduced and safer feature set of JavaScript.

List of features (non-exhaustive)

  1. Disallows global variables. (Catches missing var declarations and typos in variable names)
  2. Silent failing assignments will throw error in strict mode (assigning NaN = 5;)
  3. Attempts to delete undeletable properties will throw (delete Object.prototype)
  4. Requires all property names in an object literal to be unique (var x = {x1: "1", x1: "2"})
  5. Function parameter names must be unique (function sum (x, x) {...})
  6. Forbids octal syntax (var x = 023; some devs assume wrongly that a preceding zero does nothing to change the number.)
  7. Forbids the with keyword
  8. eval in strict mode does not introduce new variables
  9. Forbids deleting plain names (delete x;)
  10. Forbids binding or assignment of the names eval and arguments in any form
  11. Strict mode does not alias properties of the arguments object with the formal parameters. (i.e. in function sum (a,b) { return arguments[0] + b;} This works because arguments[0] is bound to a and so on. )
  12. arguments.callee is not supported
[Ref: Strict modeMozilla Developer Network]

Wednesday, July 5, 2017

SOLVED: System.IO.FileLoadException exception by unblocking the files


When I was trying to uninstall windows service using InstallUtil.exe (This can also happen when you try to install a windows service). I was getting an error. Please read the complete story.

The command I was trying was,

installutil -u  SearchIndexService.exe

The error was,

Microsoft (R) .NET Framework Installation utility Version 4.0.30319.17929
Copyright (C) Microsoft Corporation.  All rights reserved.

Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'IDM365SearchIndexService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).

After lot of research on internet I have found following solution, You need to run following power shell command for the folder where you want to do the operation.

 get-childitem -recurse *.* | Unblock-File

The command simply unblocks the file.

You can verify the problem & solution by looking at the properties of the target file. it should show something as highlighted in following image.



After you run the command   get-childitem -recurse *.* | Unblock-File it should disappear.
After all this exercise you should be able to install/uninstall windows services.

Thanks
Happy Programming :)