Click here to Skip to main content
15,889,879 members
Home / Discussions / C#
   

C#

 
GeneralRe: Debugging: Stepping into Entity Framework Pin
Dave Kreskowiak25-Feb-16 5:41
mveDave Kreskowiak25-Feb-16 5:41 
GeneralRe: Debugging: Stepping into Entity Framework Pin
Sascha Lefèvre25-Feb-16 6:07
professionalSascha Lefèvre25-Feb-16 6:07 
GeneralRe: Debugging: Stepping into Entity Framework Pin
Sascha Lefèvre25-Feb-16 8:45
professionalSascha Lefèvre25-Feb-16 8:45 
GeneralRe: Debugging: Stepping into Entity Framework Pin
Dave Kreskowiak25-Feb-16 9:25
mveDave Kreskowiak25-Feb-16 9:25 
GeneralRe: Debugging: Stepping into Entity Framework Pin
Sascha Lefèvre25-Feb-16 9:59
professionalSascha Lefèvre25-Feb-16 9:59 
QuestionRx SubscribeOn and ObserveOn Pin
Kenneth Haugland24-Feb-16 20:02
mvaKenneth Haugland24-Feb-16 20:02 
AnswerRe: Rx SubscribeOn and ObserveOn Pin
Pete O'Hanlon25-Feb-16 0:13
mvePete O'Hanlon25-Feb-16 0:13 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Kenneth Haugland25-Feb-16 1:42
mvaKenneth Haugland25-Feb-16 1:42 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Pete O'Hanlon25-Feb-16 2:05
mvePete O'Hanlon25-Feb-16 2:05 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Kenneth Haugland25-Feb-16 2:31
mvaKenneth Haugland25-Feb-16 2:31 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Pete O'Hanlon25-Feb-16 2:34
mvePete O'Hanlon25-Feb-16 2:34 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Kenneth Haugland25-Feb-16 4:38
mvaKenneth Haugland25-Feb-16 4:38 
SuggestionRe: Rx SubscribeOn and ObserveOn Pin
Matt T Heffron25-Feb-16 10:26
professionalMatt T Heffron25-Feb-16 10:26 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Kenneth Haugland25-Feb-16 10:33
mvaKenneth Haugland25-Feb-16 10:33 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Kenneth Haugland25-Feb-16 20:27
mvaKenneth Haugland25-Feb-16 20:27 
AnswerRe: Rx SubscribeOn and ObserveOn Pin
Matt T Heffron26-Feb-16 7:20
professionalMatt T Heffron26-Feb-16 7:20 
GeneralRe: Rx SubscribeOn and ObserveOn Pin
Kenneth Haugland25-Feb-16 20:55
mvaKenneth Haugland25-Feb-16 20:55 
QuestionIssue with retrieving items from an IEnumerable<T> Pin
RichardGrimmer24-Feb-16 3:27
RichardGrimmer24-Feb-16 3:27 
SuggestionRe: Issue with retrieving items from an IEnumerable<T> Pin
Richard Deeming24-Feb-16 3:50
mveRichard Deeming24-Feb-16 3:50 
GeneralRe: Issue with retrieving items from an IEnumerable<T> Pin
RichardGrimmer24-Feb-16 4:23
RichardGrimmer24-Feb-16 4:23 
GeneralRe: Issue with retrieving items from an IEnumerable<T> Pin
Richard Deeming24-Feb-16 4:34
mveRichard Deeming24-Feb-16 4:34 
GeneralRe: Issue with retrieving items from an IEnumerable<T> Pin
RichardGrimmer24-Feb-16 4:44
RichardGrimmer24-Feb-16 4:44 
GeneralRe: Issue with retrieving items from an IEnumerable<T> Pin
Pete O'Hanlon24-Feb-16 5:06
mvePete O'Hanlon24-Feb-16 5:06 
What do your classes actually look like? I took your description and built these out:
C#
public class ChildItem
{
  public ChildItem()
  {
    Count = int.MaxValue;
    LongCount = long.MaxValue;
    Nullable2 = int.MaxValue - 3;
    Nullable3 = Nullable2.Value - 2;
  }
  public int Count { get; set; }
  public long LongCount { get; set; }
  public int? Nullable1 { get; set; }
  public int? Nullable2 { get; set; }
  public int? Nullable3 { get; set; }
}
public class MasterList
{
  private List<ChildItem> children = new List<ChildItem>();
  public MasterList()
  {
    for (int i = 0; i < 6; i++)
    {
      children.Add(new ChildItem());
    }
    Master1 = "Hi";
    Master2 = "Hi";
    Master3 = "Hi";
    Master4 = "Hi";
    Master5 = "Hi";
    Master6 = "Hi";
    Master7 = "Hi";
    Master8 = "Hi";
    Master9 = "Hi";
    Master10 = "Hi";
    Master11 = "Hi";
    Master12 = "Hi";
  }

  public IEnumerable<ChildItem> Children => children;

  public string Master1 { get; set; }
  public string Master2 { get; set; }
  public string Master3 { get; set; }
  public string Master4 { get; set; }
  public string Master5 { get; set; }
  public string Master6 { get; set; }
  public string Master7 { get; set; }
  public string Master8 { get; set; }
  public string Master9 { get; set; }
  public string Master10 { get; set; }
  public string Master11 { get; set; }
  public string Master12 { get; set; }
}
public class TestIt
{
  private List<MasterList> items = new List<MasterList>(700000);

  public TestIt()
  {
    for (int i = 0; i < 700000; i++)
    {
      items.Add(new MasterList());
    }
    Console.WriteLine("Ready");
  }

  public void StartTest(string text = "Dummy run")
  {
    var enumerator = items.GetEnumerator();

    enumerator.MoveNext();

    List<object> entityBatch = new List<object>();

    Stopwatch sw = new Stopwatch();
    sw.Start();

    for (int iterStep = 0; iterStep < 700000; iterStep++)
    {
      entityBatch.Add(enumerator.Current);
      enumerator.MoveNext();
    }
    sw.Stop();

    Console.WriteLine(text);
    Console.WriteLine("Total time {0}", sw.ElapsedMilliseconds);
  }
}
Running this through a few times consistently returns a time of less than 50 milliseconds.
This space for rent

GeneralRe: Issue with retrieving items from an IEnumerable<T> Pin
RichardGrimmer24-Feb-16 5:34
RichardGrimmer24-Feb-16 5:34 
GeneralRe: Issue with retrieving items from an IEnumerable<T> Pin
RichardGrimmer24-Feb-16 20:15
RichardGrimmer24-Feb-16 20:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.