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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:01:35+00:00 2026-05-27T15:01:35+00:00

I am having a bit of trouble getting this c# code to work I

  • 0

I am having a bit of trouble getting this c# code to work I can get it to work if I use the console.write that I have commented out but I can get those same results stored in this array for me to use in a different section of my program.

FileInfo[] selectionFileOrder;
     for (int index = 0; index < dateAllOrder.Length; index++)
     {
          if (dateAllOrder[index].LastAccessTime.Month == DateTime.Now.Month)
          {
               int i = 0;
               i++;
               selectionFileOrder[i] = dateAllOrder[index];
               // Console.Write("{1}. {0}", dateAllOrder[index].Name, index);
               // Console.Write(" ({0}) ", dateAllOrder[index].Length);
               Console.WriteLine();
          }
      }

I have looked at google and can’t seem to find any answers to my issue I know that it is the variable selectionFileOrder that is unsigned but I don’t have anything to assign to it. Any fresh ideas would be helpful

Thanks

  • 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-27T15:01:36+00:00Added an answer on May 27, 2026 at 3:01 pm

    You need to initialize the array:

    FileInfo[] selectionFileOrder = new FileInfo[dateAllOrder.Length];
    

    or better, use a List:

    IList<FileInfo> selectionFileOrder = new List<FileInfo>();
    foreach(FileInfo item in dateAllOrder)
    {
         if (item.LastAccessTime.Month == DateTime.Now.Month)
         {
              selectionFileOrder.Add(item);
              // Console.Write("{1}. {0}", dateAllOrder[index].Name, index);
              // Console.Write(" ({0}) ", dateAllOrder[index].Length);
              Console.WriteLine();
         }
    }
    

    Or best, use LINQ!

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

Sidebar

Related Questions

I'm having a bit of trouble trying to get this quicksort algorithm to work
I'm having a bit of trouble trying to get class variables to work in
I'm having a tad bit of trouble getting the jQuery Form Plugin to work
I am having a bit of trouble getting Gravatars to work properly: When I
I am having a bit of trouble understanding this bug. Here is the code:
I'm having a bit of trouble writing a class that uses generics because this
I'm having some trouble getting this layout to work correctly in IE. The problem
I am having trouble getting the following code to work in FireFox (3.6.4), however,
I am having a bit of trouble getting these polymorphic associations to work completely.
I'm having a bit of trouble getting a script to work within a CMS.

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.