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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:13:45+00:00 2026-06-12T04:13:45+00:00

I am trying to form a list with the help of multi-dimensional array that

  • 0

I am trying to form a list with the help of multi-dimensional array that should look like this.

[validatorKey][counter]
1453          10
1231          12
6431          7
1246          1
1458          2

however, I couldn’t cope with it. this is my method by the way. and also the array size should be incremented at the very end of the method. I know I should use Array.Resize(ref array, 2); but since my array is multi dimensional, in this case what should be the appropriate method.

private int AracaAitSeferSayisiDondur(int pValidatorKey)
{
     int iSeferSayisi = 0;
     int[,] iSeferListesi = (int[,])ViewState["SeferListesi"];
     if (iSeferListesi == null)
     iSeferListesi = new int[1,1];

     bool aynisiVarmi = false;

     for (int i = 0; i < iSeferListesi.Length; i++)
     {
        if (iSeferListesi[i,0] == pValidatorKey)
        {
           aynisiVarmi = true;
           iSeferListesi[i,1]++;
           iSeferSayisi = iSeferListesi[i,1]++;
           break;
        }
     }
     if (!aynisiVarmi)
     {
        int arrayLength = iSeferListesi.Length;
        iSeferListesi[arrayLength--, 0] = pValidatorKey;
        iSeferListesi[arrayLength--, 1] = 1;
        //IN THIS PART ARRAY SIZE SHOULD BE INCREASED
        iSeferSayisi = iSeferListesi[arrayLength--, 1];
     }
     ViewState["SeferListesi"] = iSeferListesi;
     return iSeferSayisi;
}
  • 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-12T04:13:47+00:00Added an answer on June 12, 2026 at 4:13 am

    I think you need sonmething like:

    // not tested
    private int AracaAitSeferSayisiDondur(int pValidatorKey)
    {
        var iSeferListesi = (Dictionary<int,int>)ViewState["SeferListesi"];
         if (iSeferListesi == null)
            iSeferListesi = new Dictionary<int,int>;
    
         int iSeferSayisi;
    
        if ( iSeferListesi.TryGetValue(pValidatorKey, out iSeferSayisi)
        {
           iSeferSayisi += 1;
           iSeferListesi[pValidatorKey] = iSeferSayisi;
           iSeferSayisi += 1;  // is this OK ??
        }
        else
        {
           iSeferSayisi = 1;
           iSeferListesi[pValidatorKey] = iSeferSayisi;
        }
    
        ViewState["SeferListesi"] = iSeferListesi;
        return iSeferSayisi;
    }
    

    The double increment of iSeferListesi (derived from your code) is probably not what you want, without it the if/else logic becomes even simpler.

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

Sidebar

Related Questions

I'm trying to form a query that returns a list of entities within a
I need help trying to create a link that submits an edit form. Let's
I am trying to make a search form that will help users filter their
I'm trying to build a form that will list all users and allow you
I'm trying to display contextual help alongside form fields, that is only visible when
I'm trying to populate a List of beans from a form: public class Foo
I am trying to delete a list of entries form my table corresponding to
I'm trying to validate a field with comma separated list of strings(particular form) or
I've a field in the form,trying to get this value using jquery.It is always
I'm trying to use form's CheckboxSelectMultiple widget but I I'd like to change the

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.