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 8490247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:03:48+00:00 2026-06-10T22:03:48+00:00

I have an array of zip codes. How do I obtain a list of

  • 0

I have an array of zip codes. How do I obtain a list of every unique zip code in the array, and then count how many times the unique zip code occurred in the array?

I saw this:

A method to count occurrences in a list

I have a hunch this is the solution to my problem, but I don’t really understand it. Can someone please tell me if this is

  1. indeed the best way to go about it. And
  2. show me how to put an array into a List so that I can take advantage of GroupBy?
  • 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-06-10T22:03:50+00:00Added an answer on June 10, 2026 at 10:03 pm

    This should work for you:

    var zips = new string[] { "12345", "12345", "54321" };
    var groups = zips.GroupBy(z => z);
    
    foreach(var group in groups)
        Console.WriteLine("{0} -> {1}", group.Key, group.Count());
    

    Should give you:

    12345 -> 2
    54321 -> 1
    

    driis actually gets you most of the way there. I just posted this to help show how to enumerate the groups.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code like this: case class FunctionCommand[A](function: Function1[Array[A], Unit]) class MyClass(commands: List[FunctionCommand[_]])
I have the following code: $selectColumns= array('user_id.user_email', 'user_details.first_name', 'user_details.last_name', 'user_details.zip', 'user_details.store_id'); $result = $handle->select()->from('user_id')
I have a function that creates zip files when passed an array of files
I have a FileInfo array, which returns me 15 files and one .zip folder.
I have this code: var ExtString: string; const Extensions : array[0..4] of string =
I am trying to find entries with specific zip codes in a mailing list
I have a data set that is generated by a Zip Code range search:
I have read the file stream of a zip file by the following code:
I am comparing zip codes. I have three constants of zip codes : ZIP_MORRIS
Say I have a list of error messages like so: fieldname message -------------------- zip

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.