Click here to Skip to main content
15,887,446 members
Home / Discussions / C#
   

C#

 
AnswerRe: Regarding custom collection. Pin
Abhishek Sur29-Sep-09 1:54
professionalAbhishek Sur29-Sep-09 1:54 
AnswerRe: Regarding custom collection. Pin
Calla29-Sep-09 1:56
Calla29-Sep-09 1:56 
QuestionQuckFix - FIX Engine in C# Pin
ritzy pal29-Sep-09 0:54
ritzy pal29-Sep-09 0:54 
Questionspeech rec Pin
kiran_nagar1129-Sep-09 0:49
kiran_nagar1129-Sep-09 0:49 
AnswerRe: speech rec Pin
benjymous29-Sep-09 1:03
benjymous29-Sep-09 1:03 
AnswerRe: speech rec Pin
Abhishek Sur29-Sep-09 1:52
professionalAbhishek Sur29-Sep-09 1:52 
Questionusing delegates to replace methods temporarily Pin
gchff29-Sep-09 0:23
gchff29-Sep-09 0:23 
AnswerRe: using delegates to replace methods temporarily Pin
DaveyM6929-Sep-09 0:42
professionalDaveyM6929-Sep-09 0:42 
Do you mean something like this:
using System;

class Program
{
    static void Main(string[] args)
    {
        A a = new A();
        a.PerformFoo();
        a.UseDefault = false;
        a.PerformFoo();
        Console.ReadKey();
    }
}

public class A
{
    private delegate void FooDelegate();
    private FooDelegate fooToUse;
    private bool _UseDefault;

    public A()
    {
        fooToUse = DefaultFoo;
    }

    public bool UseDefault
    {
        get { return _UseDefault; }
        set
        {
            _UseDefault = value;
            if (_UseDefault)
                fooToUse = DefaultFoo;
            else
                fooToUse = OtherFoo;
        }
    }

    private void DefaultFoo()
    {
        Console.WriteLine("Default");
    }
    private void OtherFoo()
    {
        Console.WriteLine("Other");
    }
    public void PerformFoo()
    {
        fooToUse.Invoke();
    }
}


Dave

Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: using delegates to replace methods temporarily Pin
gchff29-Sep-09 2:29
gchff29-Sep-09 2:29 
GeneralRe: using delegates to replace methods temporarily Pin
DaveyM6929-Sep-09 7:26
professionalDaveyM6929-Sep-09 7:26 
QuestionUsing new version of the assembly Pin
shivapriyak29-Sep-09 0:11
shivapriyak29-Sep-09 0:11 
AnswerRe: Using new version of the assembly Pin
SeMartens29-Sep-09 0:31
SeMartens29-Sep-09 0:31 
GeneralRe: Using new version of the assembly Pin
shivapriyak29-Sep-09 0:46
shivapriyak29-Sep-09 0:46 
QuestionManipulate a 160 char text message Pin
Md. Marufuzzaman28-Sep-09 21:48
professionalMd. Marufuzzaman28-Sep-09 21:48 
AnswerRe: Manipulate a 160 char text message Pin
stancrm28-Sep-09 22:06
stancrm28-Sep-09 22:06 
GeneralRe: Manipulate a 160 char text message Pin
Md. Marufuzzaman28-Sep-09 23:07
professionalMd. Marufuzzaman28-Sep-09 23:07 
AnswerRe: Manipulate a 160 char text message Pin
Keith Barrow29-Sep-09 0:01
professionalKeith Barrow29-Sep-09 0:01 
GeneralRe: Manipulate a 160 char text message Pin
Md. Marufuzzaman29-Sep-09 0:18
professionalMd. Marufuzzaman29-Sep-09 0:18 
QuestionClient - Server application using sockets? Pin
$uresh $hanmugam28-Sep-09 21:41
$uresh $hanmugam28-Sep-09 21:41 
AnswerRe: Client - Server application using sockets? Pin
stancrm28-Sep-09 22:03
stancrm28-Sep-09 22:03 
GeneralRe: Client - Server application using sockets? Pin
$uresh $hanmugam28-Sep-09 23:56
$uresh $hanmugam28-Sep-09 23:56 
GeneralRe: Client - Server application using sockets? crosspost Pin
Richard MacCutchan29-Sep-09 0:19
mveRichard MacCutchan29-Sep-09 0:19 
GeneralRe: Client - Server application using sockets? crosspost Pin
$uresh $hanmugam29-Sep-09 0:20
$uresh $hanmugam29-Sep-09 0:20 
AnswerRe: Client - Server application using sockets? Pin
SeMartens29-Sep-09 0:30
SeMartens29-Sep-09 0:30 
QuestionHow to change camera serttings in C#? Pin
Galonas28-Sep-09 21:18
Galonas28-Sep-09 21:18 

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.