Tag Archives: C#

Performance Tips: Test For Empty Strings Using String Length in C#

Test for empty strings using string length, not string.Empty or “” to get the best performance. Because of the implementation of the string class, the most performant method for testing for an empty string is to test for the string length equal to zero. Other methods are effective, but are less performant. Possible Violations of […]

Static Classes in C#

Static classes and class members are used to create data and functions that can be accessed without creating an instance of the class. Static class members can be used to separate data and behavior that is independent of any object identity: the data and functions do not change regardless of what happens to the object. […]

C# Interview Questions 5

What are indexers? What are their advantages over arrays?An indexer enables you to treat an object like an array.It helps you to acces the arrays in a class using the class name. Indexer enables you to use bracket notation ([]) with an object to set and get a value from an object.They encapsulate method calls […]

C# Interview Questions 4

Explain the differences between Server-side and Client-side code? Server side code executes on the server.For this to occur page has to be submitted or posted back.Events fired by the controls are executed on the server.Client side code executes in the browser of the client without submitting the page. e.g. In ASP.NET for webcontrols like asp:button […]

C# Interview Questions 3

What does \a character do? On most systems, produces a rather annoying beep. Can you create enumerated data types in C#? Yes. What’s different about switch statements in C#? No fall-throughs allowed. What happens when you encounter a continue statement inside the for loop? The code for the rest of the loop is ignored, the […]

C# Interview Questions 2

Can DateTime variables be null? A1: No, because it is a value type (Struct) Q2: Describe the Asp.net Page Life Cycle? A2: http://msdn2.microsoft.com/en-us/library/ms178472.aspx Q3: Describe the Asp.net pipeline ? Give an Example when you need to extend it? How do you do so? A3: http://msdn.microsoft.com/msdnmag/issues/02/09/HTTPPipelines/ Q4: Describe the accessibility modifier protected internal A4: Members are […]

C# Interview Questions

What is the difference between shadow and override You have an event handler called MyEvent and you want to link the click event of control, MyButton, to use MyEvent, what is the code that will like them together? Which debugging window allows you to see the methods called in the order they were called? Which […]