Click here to Skip to main content
15,908,455 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to compare two Times Pin
Dewald14-Jun-07 1:45
Dewald14-Jun-07 1:45 
AnswerRe: How to compare two Times Pin
Luc Pattyn14-Jun-07 3:07
sitebuilderLuc Pattyn14-Jun-07 3:07 
AnswerRe: How to compare two Times Pin
andreumv14-Jun-07 3:50
andreumv14-Jun-07 3:50 
GeneralRe: How to compare two Times Pin
Martin#14-Jun-07 4:01
Martin#14-Jun-07 4:01 
AnswerRe: How to compare two Times Pin
Le centriste14-Jun-07 7:21
Le centriste14-Jun-07 7:21 
Questionupload file C# web application Pin
reddyamar_uk14-Jun-07 0:56
reddyamar_uk14-Jun-07 0:56 
AnswerRe: upload file C# web application Pin
giddy_guitarist17-Jun-07 10:16
giddy_guitarist17-Jun-07 10:16 
QuestionQuestion on iterators Pin
Dewald14-Jun-07 0:13
Dewald14-Jun-07 0:13 
So I have a class for which I wrote a nice indexer, making it possible to access the class contents as if it were an array. Some like this:
public class MyClass
{
   protected byte[] buffer;
   protected int size;

   public byte this[int index]
   {
      get
      {
         if (index<0 || index >= size)
            throw new IndexOutOfRangeException();
         return buffer[index];
      }
      set
      {
         if (index<0 || index >= size)
            throw new IndexOutOfRangeException();
         buffer[index] = value;
      }
   }
}


Now I'd like to pass this entire class (the array'ed version so to speak) as a parameter to a function. Say I have a function defined as follows:
public void myFunc (byte[] inbuffer)

Obviously I can't call this function as follows:
MyClass myInstance = new MyClass();<br />
myFunc (myInstance);

because it will give a compile time error of cannot convert from 'MyClass' to 'byte[]'

So even though, through the very nice functionalty of indexers, I can access the class as an array, I still can't pass it as an array. Is there a way that I'm just not aware of?
AnswerRe: Question on iterators Pin
Colin Angus Mackay14-Jun-07 0:35
Colin Angus Mackay14-Jun-07 0:35 
GeneralRe: Question on iterators Pin
Dewald14-Jun-07 1:28
Dewald14-Jun-07 1:28 
GeneralRe: Question on iterators Pin
Colin Angus Mackay14-Jun-07 2:04
Colin Angus Mackay14-Jun-07 2:04 
GeneralRe: Question on iterators Pin
Dewald14-Jun-07 2:21
Dewald14-Jun-07 2:21 
AnswerRe: Question on iterators Pin
Luc Pattyn14-Jun-07 1:27
sitebuilderLuc Pattyn14-Jun-07 1:27 
GeneralRe: Question on iterators Pin
Dewald14-Jun-07 2:02
Dewald14-Jun-07 2:02 
GeneralRe: Question on iterators Pin
Luc Pattyn14-Jun-07 2:19
sitebuilderLuc Pattyn14-Jun-07 2:19 
GeneralRe: Question on iterators Pin
Le centriste14-Jun-07 7:24
Le centriste14-Jun-07 7:24 
QuestionStruggling with delegates Pin
kbalias14-Jun-07 0:10
kbalias14-Jun-07 0:10 
AnswerRe: Struggling with delegates Pin
Martin#14-Jun-07 1:29
Martin#14-Jun-07 1:29 
GeneralRe: Struggling with delegates Pin
kbalias14-Jun-07 18:51
kbalias14-Jun-07 18:51 
AnswerRe: Struggling with delegates Pin
Martin#14-Jun-07 19:29
Martin#14-Jun-07 19:29 
QuestionHow to read Character from Image Pin
Soosai13-Jun-07 23:59
Soosai13-Jun-07 23:59 
AnswerRe: How to read Character from Image Pin
Russell'14-Jun-07 1:52
Russell'14-Jun-07 1:52 
Questionturn a string into a querystring Pin
tim_gunning13-Jun-07 23:47
tim_gunning13-Jun-07 23:47 
Questioninclude icon to setup project Pin
korsosjosi13-Jun-07 23:20
korsosjosi13-Jun-07 23:20 
AnswerRe: include icon to setup project Pin
Colin Angus Mackay13-Jun-07 23:26
Colin Angus Mackay13-Jun-07 23:26 

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.