Why is IPrefixLabel internal?

I’m trying to write this helper function for myself, bu I can’t because IPrefixLabel is internal.

Why is that? Because IPrefixLabel isn’t public, there isn’t another easy way for me to do what I’m trying to do here. I can’t cast the ‘child’ to ‘BaseField’ either because ‘BaseField’ requires a generic type parameter.

So, the only options I have now are to either a) try to cast the child to each non-generic child class of ‘BaseType’, or b) use reflection to set the value via PropertyInfo.

Is there any chance that IPrefixLabel could be made public in the future? Is there a security concern about exposing it?

I understand the frustration here. Often felt it myself. The reason many (useful) APIs are still internal is simply a capacity issue. Making an API public comes with extra requirements like extra testing (more use cases out there than in here) and extra certainty that we won’t need to change it in the future.

I can’t say exactly when or if this specific API will be made public so for now, the Reflection option is your best bet. Given this API has actually changed in years, you should be relatively safe against breaking changes.

2 Likes

Ah, yeah, I totally get that. Thank you for the response! :pray: