amazon-ion/ion-dotnet

Add more convenient method(s) to IIonReader for determining whether an annotation is present

pbcornell opened this issue · 3 comments

The IIonReader interface currently provides:

IEnumerable<SymbolToken> GetTypeAnnotations()

which isn't particularly convenient when checking to see if a specific annotation is present. Also note that ion-java's equivalent of this method is called getTypeAnnotationSymbols().

Something like string[] GetTypeAnnotations() or bool HasAnnotation(string annotation) would be more helpful.

Once this is added, use it in the Sparse Reads example in the cookbook, replacing the inline implementation that is currently there.

To clarify, I propose the following changes to the IIonReader interface:

  • rename the existing GetTypeAnnotations() method to GetTypeAnnotationSymbols()
  • add string[] GetTypeAnnotations()
  • add bool HasAnnotation(string annotation)

Note that the first two bullets represent breaking changes.

Closed via #77.