-
Uses of delegates
What is a delegate in C# and when are they commonly used in Windows Forms programming?
-
Threading
Write a very simple multi threaded program in C#. 1. The program should create two threads that each add data to the same list at the same time. Then after they are both done, print out the entire list. 2. So each thread should loop through 100 times adding the name of the thread doing the work to the list. For example, the first thread should add the string "thread1" to the shared list and the second...
-
Delegate
The following code illustrates a situation where a boss wants to keep track of the work progress of its subordinates: using System;namespace BigCompany { public class Boss { public void WorkerPercentageDone(int percentage) { Console.WriteLine("I am the boss, and my worker is " + percentage + "% done."); } } public class Worker { Boss boss = null; public Worker(Boss boss) ...
-
class Design
. Below is a set of birds and movements they can perform. Birds:Penguin:• hopping: moves 2 ft• flying: can't flyHawk:• hopping: can't hop• flying: moves 100 ft; won't fly if World.windSpeed > 40Robin:• hopping: moves 1 ft; won't hop if World.temperature < 0• flying: moves 20 ft; won't fly if World.windSpeed > 20Crow:• hopping: moves 1 ft; won't hop if World.temperature < 0• flying: moves 30 ft; won't...
-
Data Structures
Assume you have large set of data, say more than 100,000 elements. Each data element has a unique string associated with it. 1. What data structure has the optimal algorithmic access time to any element when the only thing you know about the element is the unique string associated with it? 2. What is the O() time for access to any element using this data structure? 3. What data structures would you...
-
Given colors, subtract the fade value and print
What is wrong with the following C# code? It should take the given colors and subtract the given fadeValue and then print out the new faded values. Please copy and paste the code into your response and fix it so that it works correctly. using System;namespace PCD{ class MainClass { static void Main(string[] args) { int red=110; int green=220; int blue=230; getFadedColor(red, green,...
-
-
which is not cls compliant built in value type?
intushortdecimalenum
-
which of the following is not a member of System.Object?
a)Instance equalsb)Static Equalsc)Instance referenceequalsd)Instance Gettype
-
-
which keywords can do case insensitive string comparison in c#?
string.Equals("string number 1", "String NUMBER 1", StringComparison.CurrentCultureIgnoreCase) There is also a similar override of String.Compare().
-