Error while creating a method that returns an Array

  • Thread starter Thread starter Khurram
  • Start date Start date
K

Khurram

Hi,
Get the following error when trying to create a method that returns a
one-dimentional array.

You must implement a default accessor on System.Array because it
inherits from ICollection.

Below is how I am writing the method.

public Array Diagnosis(DataSet assessmentData)
{

//Do some logic work with assessmentData DataSet

//An array of SNOMED CT coded possible diagnosis results
int[] diagnosis = { 74400008, 162031009, 7093002, 76581006,
75694006};

return diagnosis;
}

New to both Arrays and Csharp so any help will be greatly appreciated.
I thought it was a namespace problem but I have "using System;"
namespace added.


Thank you kindly

Khurram
 
Thank you greg, worked like a charm

Khurram

Greg said:
public int [] Diagnosis(DataSet assessmentData) {}

should fix it for you

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

Khurram said:
Hi,
Get the following error when trying to create a method that returns a
one-dimentional array.

You must implement a default accessor on System.Array because it
inherits from ICollection.

Below is how I am writing the method.

public Array Diagnosis(DataSet assessmentData)
{

//Do some logic work with assessmentData DataSet

//An array of SNOMED CT coded possible diagnosis results
int[] diagnosis = { 74400008, 162031009, 7093002, 76581006,
75694006};

return diagnosis;
}

New to both Arrays and Csharp so any help will be greatly appreciated.
I thought it was a namespace problem but I have "using System;"
namespace added.


Thank you kindly

Khurram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top