Wrox Programmer Forums
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 19th, 2006, 09:26 PM
Registered User
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Delegates

Hi All,

I'm new to the group and C# but pgm'g for over 12 years. I feel like a rookie again. Anyway here's my problem:

I'm having a tough time with delegates. Just when I thought I was getting a handle on it - after spending 2 days in chap 6 - I ran into p178. I don't understand the code here.

Here's what I believe is going on: the code is creating a two dimensional array of objects/static methods, which I think is very cool, but I dont see the size of the array defined anywhere.

So my question is how is the for loop going to work.

Thanking you in advance,
AKA - New Jack

Old April 29th, 2006, 08:06 AM
Registered User
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

(I presume the book you are looking at is Professional C# 2005, since it has the same code you were talking about)

The size of the array is implicitly defined by the number of objects that are being used to initialize it. In this case, there are 2 DoubleOp objects (delegates, actually) being used to initialize it, so it has a size of 2.

The same is true for simpler cases, like an array of int's:

int[] intArray = { 100, 200 }; // Creates an array of 2 members.

Does this answer the question? -- RB

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with delegates mike_remember ASP.NET 1.0 and 1.1 Professional 2 November 7th, 2006 12:33 AM
Delegates pramos.21d C# 1 April 11th, 2006 03:43 AM
Help with Delegates mike_remember ASP.NET 1.0 and 1.1 Basics 4 October 4th, 2005 07:32 AM
I still Don't get Delegates p_nut33 Pro VB.NET 2002/2003 2 April 26th, 2004 01:50 PM
Delegates Ibn_Aziz C# 0 February 3rd, 2004 05:55 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.