Monday, 7 September 2015

Difference between static variable vs application variables?




Static variables is faster than application variables 
1.It is not storing data in collection 
2.No need to cast object in compare to application variables.

Swap two numbers without using any third variable and arithmetic operator.


Swap two numbers without using any third variable and arithmetic operator.


int a =10,int b=20;

a= a b;
b= a-b;
a= a-b;
Or


x = x * y; 
y = x / y; 
x = x / y;

C# Primitive Data Types

C# Primitive Data Types.


primitive type is a data type in c# language which is understandable by the C# compiler . in C# int , string , float etc... data types are considered as primitive types . during compilation usually primitive types are converted into MSIL types.
Ex: if you write int x=20 ; in C# language during compilation the code is converted as shown below .
Int32 x=20;
Note: Int32 is MSIL equivalent for int primitive type . question copied from below weblink .




C# PRIMITIVE TYPE
FCL DATA TYPE
DESCRIPTION
object
System.Object
Ultimate base type of all other types.
string
System.String
A sequence of Unicode characters.
decimal
System.Decimal
Precise decimal with 28 significant digits.
bool
System.Boolean
A value represented as true or false.
char
System.Char
A 16-bit Unicode character.
byte
System.Byte
8-bit unsigned integral type.
sbyte
System.SByte
8-bit signed integral type.
short
System.Int16
16-bit signed integral type.
int
System.Int32
32-bit signed integral type.
long
System.Int64
64-bit signed integral type.
ushort
System.UInt16
16-bit unsigned integral type.
uint
System.UInt32
32-bit unsigned integral type.
ulong
System.UIint64
64-bit unsigned integral type.
single (float)
System.Single
Single-precision floating-point type.
double
System.Double
Double-precision floating-point type.


What are the types of comment in C# with examples?


c# contain 3 types of comments
1. Single line //
2. multiple line /* */
3. XML comment /// it use for documentation

What is the difference between string.Empty and ""?Which one is best to use?


What is the difference between string.Empty and ""?Which one is best to use?


The difference between string.Empty and "" is very small. String.empty will not create any object while "" will create a new object in the memory for the checking. Hence string.empty is better in memory management.

Static constructor do not have parameter

How can we pass parameters to Static Constructors?



As MSDN says, A static constructor is called automatically to initialize the class before the first instance is created. Therefore you can't send it any parameters.
If the CLR must call a static constructor how will it know which parameters to pass it?

Wednesday, 2 September 2015

Project Architecture diagram sample


Common mistakes :- Many 
developers make a common mistake of answering this question by saying that we 
have used C# , SQL server , ASP.NET etc. But please do note that the question 
is, what is the architecture of your project and not technology.


So a typical answer will be something as 
below. Please note your answer will vary as per your architecture and structure.


"My current architecture is a simple 3 tier 
architecture with UI in ASP.NET , middle layer are simple .NET classes and DAL 
is using enterprise application blocks.


The UI  is responsible to take user inputs , all my 
business validations are centrally located in middle layer and the data access 
layer is responsible to execute stored procedured and SQL queries to SQL Server.


Strongly typed business objects are used to pass data from one layer to 
other layer. The database of the project is in a 3rd normal form."




So first start with the overall architecture , talk about each layer , how data 
is passed between each layer and the database design structure.



One very important tip if you can draw a diagram and explain....I think you have
the job.


Ee658090.81d3da8e-53bc-4250-9e91-5511d6787a6e(en-us,PandP.10).png