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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:40:43+00:00 2026-06-15T09:40:43+00:00

var objTypeIndex = from u in context.sistema_DocType_Index where u.docTypeId == id select u.indexId; indexIds

  • 0
var objTypeIndex = from u in context.sistema_DocType_Index where u.docTypeId == id select u.indexId;
indexIds = objTypeIndex.ToList();
int count = indexIds.Count();

string[] names = new string[] {};
int i = 0;                    

foreach (int indexId in indexIds)
{
    //resgata nome do indice e armazena em um array
    string strIndiceID = indexId.ToString();
    int indiceID = Convert.ToInt32(strIndiceID);
    var objIndexName = from u in context.sistema_Indexes where u.id == indiceID select u.idName;
    name = 

    names[i] = objIndexName.First();

    i++;
}

This line above the last:
names[i] = objIndexName.First();

gives the following error:

System.IndexOutOfRangeException: Index was outside the bounds of the array.

I know what that means.. I just can´t figure out why.

  • 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-15T09:40:45+00:00Added an answer on June 15, 2026 at 9:40 am

    Replace

    string[] names = new string[] {};
    

    By

    var names = new List<string>();
    

    And instead of

    names[i] = objIndexName.First();
    

    Use

    names.Add(objIndexName.First());
    

    Then, you will be able to get your array as follow:

    var nameArray = names.ToArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

var q = from child in doc.Descendants(level) where (int)child.Attribute(id) == 55 select (string)child.Element(Points).**Value.ToString()**; I
var queueitem = context.CrawlerQueues. Select(cq => new{cq.Guid,cq.Result}). SingleOrDefault(cq => cq.Guid == guid); Is above
var xEle = new XElement(ContentDetails, from emp in _lstContents select new XElement(Contents, new XAttribute(key,
var q = 'SELECT * FROM stories_comments WHERE story_id=? AND user_id=? ORDER BY created_at
var string = 'abcd+1'; var pattern = 'd+1' var reg = new RegExp(pattern,''); alert(string.search(reg));
var longitudeArray = new Array(<?php $result = count($longitudeArray); if ($result > 1){ echo implode(',',
var listOne = new string[] { dog, cat, car, apple}; var listTwo = new
var ref1 = new Firebase(http://gamma.firebase.com/myuser/123,456); ref1.set(123,456); var on1 = ref1.on(value, function(snapshot) { console.log(snapshot.val()); });
var fruit = [apple,pear,pear,pear,banana]; How do I remove all pear fruit from this array?
var imageData = context.getImageData(0, 0, canvas.width, canvas.height); var data = imageData.data; and var data

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.