Click here to Skip to main content
15,921,697 members
Home / Discussions / C#
   

C#

 
QuestionHandling MouseWheel event? Pin
kumar.bs28-Feb-08 14:16
kumar.bs28-Feb-08 14:16 
AnswerRe: Handling MouseWheel event? Pin
J a a n s28-Feb-08 17:52
professionalJ a a n s28-Feb-08 17:52 
GeneralPInvoke guide Pin
Paul Selormey28-Feb-08 13:49
Paul Selormey28-Feb-08 13:49 
GeneralMerge two tables Pin
xoxoxoxoxoxox28-Feb-08 13:37
xoxoxoxoxoxox28-Feb-08 13:37 
GeneralRe: Merge two tables Pin
Christian Graus28-Feb-08 14:03
protectorChristian Graus28-Feb-08 14:03 
GeneralRe: Merge two tables Pin
J$28-Feb-08 14:20
J$28-Feb-08 14:20 
GeneralRe: Merge two tables Pin
xoxoxoxoxoxox29-Feb-08 6:13
xoxoxoxoxoxox29-Feb-08 6:13 
GeneralPlease help with these questions Pin
A.Asif28-Feb-08 12:15
A.Asif28-Feb-08 12:15 
Hello- Please help me with the following questions, if possible,
please also provide some explanations--thanks in advance:

1) Assuming that "valid connection string" is a valid connection string, what will be the output of the following code? If the code cannot compile, please state why.
the same rules apply to this question as for the one above
using(SqlConnection sqlConn = new SqlConnection("valid Connection string"))
{
System.Diagnostics.Debug.WriteLine("Opening a connection");
sqlConn.Open();
System.Diagnostics.Debug.WriteLine("Connection Opened");
sqlConn.Close();
System.Diagnostics.Debug.WriteLine("Connection Closed");
}

if(sqlConn == null)
System.Diagnostics.Debug.WriteLine("Connection State is NULL");
else
System.Diagnostics.Debug.WriteLine("Connection State:" + sqlConn.ConnectionState);



2)The following code needs to generate a string of 1000 alternating '+' and '-' characters
Rewrite this code to make it more efficient (Note: You can use different data types than the ones present)

string htmlOutput = string.Empty;
for(int itemIndex = 0; itemIndex < 1000; itemIndex++)
{
if( itemIndex % 2 == 0)
htmlOutput += "+";
else
htmlOutput += "-";
}



3)Assuming that CustomException is defined, what will be the output of the following code?
try
{
throw new CustomException("Something went wrong");
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine("Generic Exception has been triggered");
}
catch(CustomException ex)
{
System.Diagnostics.Debug.WriteLine("Custom Exception has been triggered");
}




4) What will be the difference in behavior between the lines marked 'a' and 'b' during runtime? (Assume that CustomClass is a defined class)


object objClass = new object();

CustomClass myClass1 = objClass as CustomClass; //a
CustomClass myClass2 = (CustomClass)objClass; //b



5) Assuming you have the following class:

public class MyClass
{
public MyClass()
{
}

public string DoNothing(string someParameter)
{
System.Diagnostics.Debug.WriteLine(someParameter);
}
}

How would you call the DoNothing function asynchronously and provide a callback?


6) What is the difference between a Monitor and a Semaphore?



7) Architectural Question: If you have pages that perform heavy DB or File I/O, what could be done to help increase the overall performance of the application? (Asp.net only! Assume all non asp.net factors have been optimized to the max)


8) What is the difference between the following 2 statements?

try
{
throw new ApplicationException("None");
}
catch(Exception ex)
{
throw ex;
}


try
{
throw new ApplicationException("None");
}
catch(Exception ex)
{
throw;}
9) What is the difference between a List and a LinkedList?


10) Assume that you retrieve a list of 1,000,000 Person objects from a database that contain the SocialSecurityID, First and Last name properties. Which collection class would you use to store and allow for quick lookup of Person objects based on the SocialSecurityID field?






















A.Asif

A.Asif

GeneralCross post warning Pin
Not Active28-Feb-08 12:28
mentorNot Active28-Feb-08 12:28 
GeneralRe: Cross post warning Pin
Christian Graus28-Feb-08 12:52
protectorChristian Graus28-Feb-08 12:52 
GeneralRe: Please help with these questions Pin
Guffa28-Feb-08 13:30
Guffa28-Feb-08 13:30 
GeneralRe: Please help with these questions Pin
Paul Conrad28-Feb-08 18:23
professionalPaul Conrad28-Feb-08 18:23 
GeneralCreating a service Pin
ffowler28-Feb-08 11:21
ffowler28-Feb-08 11:21 
GeneralRe: Creating a service Pin
Expert Coming28-Feb-08 11:29
Expert Coming28-Feb-08 11:29 
GeneralRe: Creating a service Pin
Ravi Bhavnani28-Feb-08 19:07
professionalRavi Bhavnani28-Feb-08 19:07 
GeneralRe: Creating a service Pin
Nouman Bhatti28-Feb-08 21:10
Nouman Bhatti28-Feb-08 21:10 
QuestionOLE file access C# Pin
davejsmith28-Feb-08 11:04
davejsmith28-Feb-08 11:04 
Generalthis.show() doesn't display controls. Pin
tingu28-Feb-08 7:49
tingu28-Feb-08 7:49 
GeneralRe: this.show() doesn't display controls. Pin
Gareth H28-Feb-08 8:06
Gareth H28-Feb-08 8:06 
GeneralRe: this.show() doesn't display controls. Pin
tingu28-Feb-08 8:22
tingu28-Feb-08 8:22 
GeneralRe: this.show() doesn't display controls. Pin
buchstaben28-Feb-08 8:24
buchstaben28-Feb-08 8:24 
GeneralRe: this.show() doesn't display controls. Pin
led mike28-Feb-08 9:07
led mike28-Feb-08 9:07 
GeneralRe: this.show() doesn't display controls. Pin
tingu29-Feb-08 5:23
tingu29-Feb-08 5:23 
GeneralRe: this.show() doesn't display controls. Pin
led mike29-Feb-08 6:03
led mike29-Feb-08 6:03 
GeneralRe: this.show() doesn't display controls. Pin
Luc Pattyn28-Feb-08 12:39
sitebuilderLuc Pattyn28-Feb-08 12:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.