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

  • Home
  • SEARCH
  • 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 8771921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:54:42+00:00 2026-06-13T17:54:42+00:00

Something like: forelement (element G_Element, Grid) { Grid[G_Element.dim1, G_Element.dim2] = new clsGridElement(G_Element.dim1, G_Element.dim2); }

  • 0

Something like:

forelement (element G_Element, Grid)
{
    Grid[G_Element.dim1, G_Element.dim2] = 
        new clsGridElement(G_Element.dim1, G_Element.dim2);
}

instead of

for (int X = 0; X < GridWidth; X++) 
    for (int Y = 0; Y < GridHeight; Y++) 
        Grid[X, Y] = new clsGridElement(X, Y);

If something doesn’t innately exist, is that something that could be created?

Thanks,
Tim

  • 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-13T17:54:44+00:00Added an answer on June 13, 2026 at 5:54 pm

    You could do this – just make a custom type that exposes these, and use a regular foreach:

    public class TwoDimensionalIterator
    {
        public TwoDimensionalIterator(int i, int j)
        {
           this.Dim1 = i; this.Dim2 = j;
        }
        public int Dim1 { get; private set; }
        public int Dim2 { get; private set; }
    }
    

    Then make an extension method somewhere to return an enumerable of this:

    public static IEnumerable<TwoDimensionalIterator> IterateTwoDim<T>(this T[,] array)
    {
         for (int i=0;i<array.GetLength(0);++i)
             for (int j=0;i<array.GetLength(1);++j)
                yield return new TwoDimensionalIterator(i,j);
    }
    

    With this, you could then do:

    foreach(var index in Grid.IterateTwoDim())
    {
        Grid[index.Dim1, index.Dim2] = new clsGridElement(index.Dim1, index.Dim2);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Something like new Div { new A{Href = test, Content = link}, new P(text),
Something like: element.addEventListener("displayChanged", function(){ console.log("element.style.display changed.") }, false); Of course, there is no displayChanged
Something like this... [img here ] [ Paragraph here ] instead of what I
something like this i want for(i=0; i<10; i++) { Textview tx[i] = new TextView(this);
Something like this doesn't compile because GLenum and GLint aren't declared in namespace gl
Possible Duplicate: Get Class List for Element with jQuery If I have something like
Something like this: class someclass { public: someclass(); ~someclass(); long Set(int x, int y);
Something like this: _declspec(align(16)) float dens[4]; //Here the code comes. F32vec4 S_START, Pos, _Vector
Something like? <fmt:formatDate value=${event.starttime} type=both/>
Something like: for (a,b) in kwargs.iteritems(): if not b : del kwargs[a] This code

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.