Which one best in late binding and early binding? What is the difference between them ?
Will finally block get executed if the exception had not occurred?
Yes. What is the c# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?
yes. Finally will be executed even if the exception hasn't occurred. Catch all statement.
Code
try{} catch{} Or try{} catch(Exception e){}
Yes. Finally block will always execute whether execption occur or not.
Any process can be divided into multiple
Skill/topic: advanceda) programsb) threadsc) application domains
Answered by: LordAlex
Member Since Nov-2011 | Answered On : Nov 5th, 2011
Application domains are typically created by runtime host( i.e. Windows process/program). Application domains provide an isolation boundary for security,.... .NET program is an Assembly loading into an Application domain. Threads are the operating system construct used by the common language runtime to execute code in Application domains. Therefore, for .NET, Process (runtime host) -> Application Domains -> Assemblies (.NET programs)-> Managed Threads.
App domains. This could be best understood by taking an example of a browser program. A browser may run multiple web applications simultaneously. All these could be run in separate app domains. So, i...
Threads
Constructors can not be static ?
Yes, there can be a static constructor. It will be at class level & executed just once. It is totally in run-times control & not sure of when this will be executed. But, it is assured that it will be executed before creating instance of the class.
A class can have only one static constructor. Static constructor can not have any parameter. Static constructor cannot have any access specifier, not even private. It is used to initialize the static ...
When we have string builder which are mutable why we need immutable string classes in c#.
String is immutable, meaning, if there is any change in the string value, run time allocates new memory & assign it to the string reference. For the programmer, it looks like the same string but inter...
This is how I would answer: 1) Strings are immutable and once created, cannot be changed. Hence, strings are best used in cases when you need thread safety and features where strings will not change,...
What are properties in c#? What are the advantages of using properties ?
Properties combine the behavior of method & variable.
Properties are members of classes. They are also used in structs and interfaces. Properties are an extension of fields but they do not designate storage locations. Properties provide a flexible mech...
How do I get deterministic finalization in c#?
In a garbage collected environment, it's impossible to get true determinism. However, a design pattern that we recommend is implementing idisposable on any class that contains a critical resource. Whenever this class is consumed, it may be placed in a using statement, as shown in the following example:...
That is true. A class implementing the interface IDisposable can be used in the using statement, something like: "c# using (MyClass objMyClass = new MyClass()) { objMy...
What is encoding and serialization in .Net?
Serialization is the process of converting an object into a stream of bytes in order to persist it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.
Encoding is a Format, it could be binary or soap or MTOM
How can you sort the elements of the array in descending order
A) sort methodsb) reverse methodsc) by calling sort and then reverse methodsd) can’t sort in descending
Answered by: Prakhar
Answered On : Apr 12th, 2006 int[] arr = new int[3];
arr[0] = 4;
arr[1] = 1;
arr[2] = 5;
Array.Sort(arr);
Array.Reverse(arr);
This is more elegant and efficient? Disagree.
It is far more elegant and efficient to do something like
Array.Sort(arr, delegate(int x, int y) { return y.CompareTo(x); });
Can any one give real time example for abstract class and virtual function plz in c#(.Net)
An abstract class is a class that cannot be instantiated. The purpose of an abstract class is to provide a common definition of a base class that multiple derived classes can share. For example, a cla...
Which are the important features of il
A) use of attributesb) strong data typingc) object orientation & use of interfaced) all of the above
All of the above
D all of the above
What is late binding and early binding? What is the benefits and disadvantages of using them?
Early binding is better. You can make your objects strongly type and resolve the errors if any at compile time instead of runtime
The polymorphism is achieved by early binding and late binding Early Binding: Compiler bind the objects to methods at the compile time.This is called early binding or static binding.Function overloa...
Which of the following is used to denote comments in c#?
Skill/topic: intermediatea) /* */b) //c) ///explanation: /// is used from XML documentation
// and /* */
A) /*Is used for multiple
lines omments */
// and
B) // is used for singlr line comment
All types in c# implicitly derive from
Skill/topic: beginnera) system.Object classb) system classc) system.Csharp class
From the System.Object class is correct, all value types derive from System.Value Type which in-turn derives from System.Object.
(A) System.Object class
Which of the following is not a member of system.Object?
A)instance equalsb)static equalsc)instance referenceequalsd)instance gettype
Instance equals - because Object has instance Equals
Instance referenceequals - because Object has static ReferenceEquals
Instance Gettype - because Object has instance GetType
StaticEquals and ReferenceEquals are not members of instance class object
You have multiple rows in c# data table and you have to save it in database using just one call, how will you do it?
Answered by: LordAlex
Member Since Nov-2011 | Answered On : Nov 5th, 2011
In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to: 1. Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter. 2. Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects. 3. Invoke the GetChanges method to create a second DataSet that features only the changes to the data. 4. Call the Update method of the DataAdapter, passing the second DataSet as an argument. 5. Invoke the Merge method to merge the changes from the second DataSet into the first. 6. Invoke the AcceptChanges on the DataSet. Alternatively, invoke RejectChanges to cancel the changes.
In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to: 1. Build and fill each DataTable in a DataSet with data fro...
We can also use bulk upload functionality of CSharp
What is the advantage of serialization ?
Serialization is a process of converting an object into a stream of data so that it can be is easily transmittable over the network or can be continued in a persistent storage location.
Serialization in .NET allows the programmer to take an instance of an object and convert it into a format that is easily transmittable over the network, or even stored in a database or file system. Th...
Which method is actually called ultimately when console.Writeline( ) is invoked
A) append( )b) appendformat( )c) tostring( )
Does some one dig the code with Reflector?? In deed, according the Reflector, see code.... it's clear only ToString() can be called. "c# public virtual void System.TextWriter....
The answer is C
Ultimately ToString() is called. Depending on what overload is used when calling Console.WriteLine() either Append or AppendFormat will be called called then ToString()
In c# events are actually a special form of delegates
A) trueb) false
An event is a member that enables a class or object to provide notifications. An event is declared like a field except that the declaration includes an event keyword and the type must be a delegate ty...
False
event is an instance of delegate which is used to notify some action of an object to other object.
Explain the advantages and limitations of using aliases in c#?
C# provides a set of predefined struct types called the simple types. The simple types are identified through reserved words, but these reserved words are simply aliases for predefined struct types in the System namespace.
{sbyte, byte, short, ushort, int, uint, long, ulong, and char}
Well, it is needed if for some reason you have conflicting names. Silly example, but suppose you declare a variable with the name DateTime, and to be very funny (sarcasm) you also define a variable na...
Early binding Or Compile time Or static binding: Assigning of object to type reference happens at compile time.
Late binding Or Run time Or Dynamic binding: Assigning of object to type reference happens at run time.
Early binding is efficient while late binding provides flexibility to programmers.
Early binding is best. Because any errors can be resolved at compile time. Late binding is at Run Time