Click here to Skip to main content
15,888,025 members
Home / Discussions / C#
   

C#

 
GeneralRe: Protect DLL Pin
Mohib Sheth24-Oct-07 21:04
Mohib Sheth24-Oct-07 21:04 
GeneralRe: Protect DLL Pin
leppie24-Oct-07 21:12
leppie24-Oct-07 21:12 
AnswerRe: Protect DLL Pin
Mohib Sheth24-Oct-07 21:20
Mohib Sheth24-Oct-07 21:20 
GeneralRe: Protect DLL Pin
N a v a n e e t h24-Oct-07 21:27
N a v a n e e t h24-Oct-07 21:27 
GeneralRe: Protect DLL Pin
Mohib Sheth24-Oct-07 21:39
Mohib Sheth24-Oct-07 21:39 
QuestionCustom page setting in crystal report Pin
Sunil K Prajapati24-Oct-07 19:37
Sunil K Prajapati24-Oct-07 19:37 
QuestionWriting the content of a DataTable into XML string Pin
M.A.Burhan24-Oct-07 19:24
M.A.Burhan24-Oct-07 19:24 
Questioncomparison with delegates [modified] Pin
kabutar24-Oct-07 19:17
kabutar24-Oct-07 19:17 
hi,
i have two set of codes here for the same output....
one is by using the functions that i wrote and the other one is by using delegates(got form net)

can anybody tell me the advantage of using the delegates in this code??
please check the comments in the code using delegates...
i found the normal way much easier....

WITHOUT USING DELEGATES:::

using System;
using System.Collections.Generic;
using System.Text;

namespace trialfunctions
{
class Program
{
string name;
public void enter()
{
Console.WriteLine("enter a string");

}
public void display()
{
name = (Console.ReadLine()).ToString();
Console.WriteLine("The string entered is {0}", name);
Console.ReadLine();
}
static void Main(string[] args)
{
Program obj = new Program();
obj.enter();
obj.display();
}
}
}
----------------------------------------------------------
///////////////////////////////////////////////////////////
----------------------------------------------------------
USING DELEGATES:::::

using System;
public delegate void TestDelegate(string message); //Declare the delegate
class Test
{
public static void Display(string message)
{
Console.WriteLine("The string entered is {0} " , message);
}
static void Main()
{
TestDelegate t = new TestDelegate(Display); //Instantiate the delegate
Console.WriteLine("Please enter a string");
string message = Console.ReadLine(); //what is the need for this
t(message); //Invoke the delegate
Console.ReadLine();
}
}
thanking you



-- modified at 1:45 Thursday 25th October, 2007

C#

AnswerRe: comparison with delegates Pin
Christian Graus24-Oct-07 20:58
protectorChristian Graus24-Oct-07 20:58 
GeneralRe: comparison with delegates Pin
N a v a n e e t h24-Oct-07 21:06
N a v a n e e t h24-Oct-07 21:06 
GeneralRe: comparison with delegates Pin
kabutar24-Oct-07 21:08
kabutar24-Oct-07 21:08 
Questionkey up problem in template column of data grid Pin
veereshIndia24-Oct-07 19:13
veereshIndia24-Oct-07 19:13 
QuestionCryptoStream Pin
El Fenomeno24-Oct-07 19:00
El Fenomeno24-Oct-07 19:00 
QuestionHow can C# page play song ? Pin
whale8424-Oct-07 17:36
whale8424-Oct-07 17:36 
AnswerRe: How can C# page play song ? Pin
Martin#24-Oct-07 20:46
Martin#24-Oct-07 20:46 
GeneralRe: How can C# page play song ? Pin
whale8424-Oct-07 23:18
whale8424-Oct-07 23:18 
QuestionFullScreen Mode under Vista OS problem! [modified] Pin
Khoramdin24-Oct-07 17:22
Khoramdin24-Oct-07 17:22 
QuestionGetting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:15
JoeRip24-Oct-07 16:15 
AnswerRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 16:24
mid=574124-Oct-07 16:24 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:29
JoeRip24-Oct-07 16:29 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 16:31
mid=574124-Oct-07 16:31 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:35
JoeRip24-Oct-07 16:35 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:51
JoeRip24-Oct-07 16:51 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 17:18
mid=574124-Oct-07 17:18 
QuestionMerging Config files Pin
KrunalC24-Oct-07 15:50
KrunalC24-Oct-07 15:50 

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.