Hi to everybody. Lastweek i had taken an interview on c#.
They ask what is boxing & unboxing, Masking.Please tell the
answer and it is useful for me.
Answers were Sorted based on User's Feedback
Answer / saubhagya
Boxing:converting from value types to reference type is
known as boxing.
Unboxing:Converting from reference types to value type is
known as unboxing.
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / mr. d
class Test
{
static void Main()
{
int i = 1;
object o = i; // boxing
int j = (int) o; // unboxing
}
}
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / swaminathan
Masking is the process of Changing BITS in a BYTE
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / chandu
Boxing:converting from value types to reference type is
known as boxing.
Unboxing:Converting from reference types to value type is
known as unboxing.
boxing ex: int i=1;
obj o=i;
unboxing ex: int i=1;
obj o=i;
int j=int o;
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sdfasd
Boxing:converting the value type into reference type is called as boxing
during boxing typecasting can be done implicitly.
during boxing the values are copied from method stack to managed heap.
Unboxing:
converting the reference type into value type is called as unboxing
during unboxing typecasting can be done explicitly.
during unboxing the values are copied from managed heap to methodstack.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sravanthi
BOXING:We can translate value type to reference type.
UN BOXING:We can translate reference type to value type.
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / raj
Boxing: Implicitly converting value type to object type
Eg: int i=1;
object obj=i;
UnBoxing:Explicitly Converting object type to value type
Eg: int j=(int) obj;
| Is This Answer Correct ? | 0 Yes | 0 No |
How many kinds of elements an array can have?
How more than one version of an assembly can keep in same place?
What is use of super class
What operators can be used to cast from one reference type to another without the risk of throwing an exception?
What you mean by inner exception in c#?
What are async and await?
What are the Types of configuration files and their differences
In a stored procedure 4 select stmts there.If error comes in one select stmt will remaining normally executes?
Why do we use overloading in c#?
Which class does the remote object has to inherit?
How to raise an selection changed event associated with listbox in datagridview control with a sample example?Here the listbox is a child control associated with datagridview control.
Can a class have static constructor?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)