Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6969889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:38:21+00:00 2026-05-27T16:38:21+00:00

How would I get stylecop to accept something like: string something = _someDict[new CompositeKey<EnumA,

  • 0

How would I get stylecop to accept something like:

string something = _someDict[new CompositeKey<EnumA, EnumB> { Item1 = EnumA.A, Item2 = EnumB.D }];

Is this a collision between rules SA1011 and SA1013?

For your copy-and-paste convenience:

private Dictionary<CompositeKey<EnumA, EnumB>, string> _someDict = new Dictionary<CompositeKey<EnumA, EnumB>, string>
{
    { new CompositeKey<EnumA, EnumB> { Item1 = EnumA.A, Item2 = EnumB.D }, "AD" },
    { new CompositeKey<EnumA, EnumB> { Item1 = EnumA.B, Item2 = EnumB.D }, "BD" },
    { new CompositeKey<EnumA, EnumB> { Item1 = EnumA.A, Item2 = EnumB.E }, "AE" },
    { new CompositeKey<EnumA, EnumB> { Item1 = EnumA.B, Item2 = EnumB.E }, "BE" },
};

private enum EnumA
{
    A, B
}

private enum EnumB
{
    D, E
}

private struct CompositeKey<T1, T2>
{
    public T1 Item1;
    public T2 Item2;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:38:22+00:00Added an answer on May 27, 2026 at 4:38 pm

    I don’t think it’s possible.

    If you really care that much about the rules, and to make your code more readable, I suggest:

    var key = new CompositeKey<EnumA, EnumB> { Item1 = EnumA.A, Item2 = EnumB.D };
    string something = _someDict[key];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you would get an assignment to work on something like 2 years old
Is there anyway to get indexOf like you would get in a string. output.add(1
Can someone please shed some light on how I would get this to work:
You would think I would get this done in 10 seconds, but I've spent
I had this in jquery version 1.3 // ajax requests would get this method
I would like to get Magento to tell me any discounts that a product
Hello I need to find regex that would get middle section of this text:
In Windows I would like the C++ command or reference that would get the
Why in a world I would get this (after hosting this wcf on my
In After Effects, as a plug-in, I would like to get the name of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.