Question:Which of the following code fragments are correct syntax for implementing an indexer? 

A class Sentence{ string[] words; public string this[int index]{ get{return words[index];} set{words[index]=value;} } } 

B class Sentence{ string[] words; public string this[int index,int index2]{ get{return words[index];} set{words[index]=value;} } } 

C class Sentence{ public string this[int index,int index2]{ get{return words[index];} set{words[index]=value;} } } 

D class Sentence{ string[] words; public string Index[int index]{ get{return words[index];} set{words[index]=value;} } } 

+ Answer
+ Report
Total Preview: 1075

Copyright © 2025. Powered by Intellect Software Ltd