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

Generics with object creation needs some work #468

Open
belav opened this issue Oct 25, 2021 · 1 comment
Open

Generics with object creation needs some work #468

belav opened this issue Oct 25, 2021 · 1 comment
Labels
Milestone

Comments

@belav
Copy link
Owner

belav commented Oct 25, 2021

            var someGeneric____________________________________ = new DictionaryHelper<
                string,
                ModelState
            >()
            {
                Creator = () => new ModelStateDictionary(),
                Comparer = StringComparer.OrdinalIgnoreCase,
                SampleKeys = new string[] { "foo", "bar", "baz", "quux", "QUUX" },
                SampleValues = new ModelState[]
                {
                    new ModelState(),
                    new ModelState(),
                    new ModelState(),
                    new ModelState(),
                    new ModelState()
                },
                ThrowOnKeyNotFound = false
            };
@jods4
Copy link

jods4 commented May 19, 2022

I think I'd rather have the generic types in new never broken on several lines -- or only as a last resort if someone writes a new expression that can't stand on a line by itself (!?!).

I'd write the example above as:

            var someGeneric____________________________________ = 
                new DictionaryHelper<string, ModelState>()
                {
                    Creator = () => new ModelStateDictionary(),
                    Comparer = StringComparer.OrdinalIgnoreCase,
                    SampleKeys = new string[] { "foo", "bar", "baz", "quux", "QUUX" },
                    SampleValues = new ModelState[]
                    {
                        new ModelState(),
                        new ModelState(),
                        new ModelState(),
                        new ModelState(),
                        new ModelState(),
                    },
                    ThrowOnKeyNotFound = false,
                };

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

No branches or pull requests

2 participants