Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOUNDATIONS: Suggestion for "List<string> GetData(string key)" #38

Open
LBoullosa opened this issue Oct 8, 2022 · 1 comment
Open
Labels
FOUNDATIONS The foundations category

Comments

@LBoullosa
Copy link
Member

Hi!,

Because Xeption creates data dictionary elements as a List, could be interesting to have a method to retrieve an element of the dictionary casted to the right type. Actually, for example, when I need to access Data is returned as object and has to be converted in every piece of code....which it´s a little bit ugly and redundant.

((List<string>)exception.Data[key])[0]

So, how do you feel about this sugestion?

Thanks,

@LBoullosa
Copy link
Member Author

Maybe could be more cleaner using an indexer property,

public List<string> this[string key]
{
    get =>Data[key] as List<string>;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FOUNDATIONS The foundations category
Projects
None yet
Development

No branches or pull requests

2 participants