alias120's Profile User Rating: -----

Reputation: 124 Stalwart
Group:
Contributor w/DIC++
Active Posts:
707 (0.27 per day)
Joined:
02-March 09
Profile Views:
25,624
Last Active:
User is offline Mar 01 2016 09:41 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Jeep
Dream Kudos:
200

Latest Visitors

Icon   alias120 Hogwash

Posts I've Made

  1. In Topic: what would be the best way to compare 2 lists of objects

    Posted 29 Feb 2016

    Well, for the example of finding additions, you're just wanting to find all elements from the new set which are not present in the old set. There are a few ways you can do this, one of which is to use predicates. You could store in a separate list all of those elements you seek, something like this:

    List<Student> Test = Testnew.FindAll(it => !(Testold.Contains(it.SomethingUniqueToThisStudent)));
    


    A similar line of thought could be applied to find removals. As far as finding updates to a particular Student instance, you might want to look at what kind of data makes your Student instance unique. Are you assigning each Student an ID, some some kind of unique identifier?

    Edit: Updated response for this example.

    Edit2: Predicates spawn from mathematical logic. To put it simply, my FindAll() function allows me to "pick out" those elements which satisfy a set of conditions I specify.
    it => <something>
    
    is like saying, "Elements such that something". So, I want to Find All Elements such that Something. The Something is what you specify as a condition.

    So, let's say we wanted to find all students with the first name Jane. Then (FirstName == Jane) is our condition, and we might code that something like this:
    List<Student> Test = Testnew.FindAll(it => (it.FirstName == "Jane"));
    

    This is like saying "Find all elements such that element.FirstName is equal to Jane".
  2. In Topic: Error when editing post

    Posted 8 Dec 2014

    Okay, thank you for the quick response.

My Information

Member Title:
The Sum over All Paths
Age:
28 years old
Birthday:
June 5, 1987
Gender:
Location:
Amherst, NY
Interests:
Physics, Science, Technology.

Aside from that, learning is a hobby i will never cease to pursue. Poetry, some occasional gaming. Friends, family.
Full Name:
Matthew Balthrop
Years Programming:
~3
Programming Languages:
C#, Java, C++, C

Comments

alias120 has no profile comments yet. Why not say hello?