sudhir sheoran


{ City } pune
< Country > india
* Profession * .net developer
User No # 92426
Total Questions Posted # 0
Total Answers Posted # 24

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 69
Users Marked my Answers as Wrong # 10
Answers / { sudhir sheoran }

Question { AG Technologies, 5588 }

what is reference type to value type.


Answer

Value Types:-
Directly contains their values either
on stack or inline in a structure.

Each value types have their own copy of
data so doesn't effect each other.

Reference Type:
Contains a reference to the values memory address
Allocated on heap.
These can be self describing,pointer type or interface type
Reference type can refer to the same object.

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 20536 }

What is Dispose method in .NET ?


Answer

There are two ways to release the unmanaged resources.
1) Finalize:- Managed/ called by CLR
2) Dispose:- Called by the programmer.

Dispose uses IDisposable interface and suppresses the finalize
method,when called by the programmer.
If programmer forgets to implement dispose method
finalize get invoked and unmanaged resources are freed.

Is This Answer Correct ?    1 Yes 0 No


Question { 3379 }

When would you set this property to false?


Answer

EnableViewState property is set to false
when we don't want to keep track of state
of a particular control or for a complete
page.

This reduces load on bandwidth during
data postbacks,because less data is
transferred to the server now.

Is This Answer Correct ?    1 Yes 0 No

Question { 7279 }

What is the main advantage of WAS?(Windows activation service)
When it is used?


Answer

1) It Supports all type of transmission modes e.g
http, tcp, namedpipe
2) Windows services are managed by service control manager
so these are controlled by o.s beacause after hosting
they behave like windows services.
3) the life time of WAS will be the life time of windows
services i.e from start of machine to shutdown.

Is This Answer Correct ?    4 Yes 1 No

Question { TCS, 5397 }

what is the use of final method


Answer

First of all sealed in c# is equivalent to final in java.

Sealed is used to stop further overriding an abstract method.

E.g:

public abstract class A
{
public abstract void print();
}

public class B:A
{
public sealed override void print()
{
Console.WriteLine("First override");
}
}

public class C:B
{
public override void print() //This will give compilation error.
{
Console.WriteLine("Second override");
}
}

Is This Answer Correct ?    0 Yes 0 No

Question { 2901 }

What are anonymous methods ? why these methods are used and in what condition these methods are useful ?


Answer

Anonymous methods are used for making delegates
use simple. In this in spite of declaring a separate
method and then assigning a delegate to it we can
directly write inline code during the declaration
of delegate. E.g;

class Program
{
public delegate bool CalculatorDelegate(int number);
static void Main(string[] args)
{
CalculatorDelegate calDel = numberGreaterThanFive;
bool value = calDel.Invoke(4);
}
public static bool numberGreaterThanFive(int number)
{
if (number > 5)
{
return true
}
return false;
}
}

Now using Anonymous method and delegate :

class Program
{
public delegate bool CalculatorDelegate(int number);
static void Main(string[] args
{
CalculatorDelegate caldel =
new CalculatorDelegate(x => x > 5);

bool value = caldel.Invoke(3);
}

}

So code reduced to much extent. No need to define separate functions

Is This Answer Correct ?    2 Yes 0 No

Question { 8727 }

What is the difference between String s(Small s) and String
S(Capital S)?


Answer

There is no difference between string and String.
string is just an alias of System.String. They both
are complied to the same code. In IL there is no difference
between the two. But as a standard followed by MSDN string
is used as datatype declaration e.g string s = "abc"
and if we are accessing some class then String should be
used. e.g String.Format("abc");

Is This Answer Correct ?    7 Yes 0 No

Question { TCS, 15330 }

STATIC METHOD CAN BE OVERLOADING AND OVERIDNG? IS POSSIBLE IN
iN c# .NET AND WHAT IS THE REASON??


Answer

Static Methods can't be override because static methods can only be accessed using class name and are inaccessible to the objects of the class. So no question of overriding.

But canbe overloaded. See the below example:

class Program
{
static void Main(string[] args)
{
abc.calculate(2, 3);
abc.calculate(2.0, 3.9);
Console.ReadLine();
}
}
public static class abc
{
public static void calculate(int a,int b)
{
Console.WriteLine("Int");
}
public static void calculate(double c,double d)
{
Console.WriteLine("Double");
}
}

Is This Answer Correct ?    25 Yes 1 No

Question { 4725 }

can we use private assembly in other project in dot net.


Answer

Yes we can use private assembly in other dot net projects. But a private assembly is used only by a single application, and is stored in that application's install directory (or a sub directory therein).

On the other hand public assembly are shared by more than one application at the same time that's why they are stored in GAC(Global assembly cache) and have a strong name with a version number,public key, culture info etc.

Is This Answer Correct ?    1 Yes 1 No

Prev    1    [2]