Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I declare a property. code is below:
C#
public string this[string key] { get; set; }

It shows me error: " must declare a body because it is not marked abstract, extern, or partial "

Then i changed the property to:
C#
private string[] _key;
public string this[string key] { get { return _key; } set { _key = value; } }


Not it showing me error: " Cannot implicitly convert type 'string[]' to 'string' "
and " Cannot implicitly convert type 'string' to 'string[]' "

Where is the problem? May be I'm setting the body in wrong way.
Please, tell me the way how to set this type of property.

Thanks in advance...
Posted
Updated 4-Nov-11 19:53pm
v2

1 solution

 
Share this answer
 
Comments
tanishtaman 7-Nov-11 5:06am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900