Refactoring Into Generic Methods This might be a loaded question, but here goes.  I have some code that is very similar between all the methods.  I am trying to find a way to accomplish all methods with a generic method/function. I'm not sure if I should be using delegates, and if so how to implement in this specific situation, or if there is a much more simple way to make a generic method. 

Below I have copied the code I am trying to make generic.  All methods take this basic syntax: (Parameters) ConcurrentQueue(pPeople),  With that collection, the first part gets the count of the records.  Each method iterates over a different part of the collection (or collection in the collection). 

Thanks for any help or nudges in the right direction!  If you have an idea that would help, it would be great if you could give an example related to this code (or very similar).

Code:  I have copied three methods that give that show similar code (there are many more).

    private void UpdatepPeopleAddressIDs(ConcurrentQueue&lt;pPeople&gt; people)
    {
        //Get Count of records that need an ID from uMaxIDs
        int updateCount = 0; object lockObject = new object();
        Parallel.ForEach&lt;pPeople&gt;(people, person =&gt;
        {
            person.myPeopleAddressList.ForEach(address =&gt;
            {
                if (address.ID == 0)
                {
                    lock (lockObject)
                    {
                        updateCount++;
                    }
                }
            });
        });
    }

    private void UpdatepPeopleContactNumbersIDs(ConcurrentQueue&lt;pPeople&gt; people)
    {
        //Get Count of records that need an ID from uMaxIDs
        int updateCount = 0; object lockObject = new object();
        Parallel.ForEach&lt;pPeople&gt;(people, person =&gt;
        {
            person.myPeopleContactsList.ForEach(contact =&gt;
            {
                if (contact.ID == 0)
                {
                    lock (lockObject)
                    {
                        updateCount++;
                    }
                }
            });
        });
    }

    private void UpdatepPeopleEmailIDs(ConcurrentQueue&lt;pPeople&gt; people)
    {
        //Get Count of records that need an ID from uMaxIDs
        int updateCount = 0; object lockObject = new object();
        Parallel.ForEach&lt;pPeople&gt;(people, person =&gt;
        {
            person.myPeopleEmailsList.ForEach(emails =&gt;
            {
                if (emails.ID == 0)
                {
                    lock (lockObject)
                    {
                        updateCount++;
                    }
                }
            });
        });
    }
This is fairly easy to achieve. You need to make use of callback, which can perform the functionality specific to the method, which your generic method then uses. Something like this:

private void UpdatepPeople&lt;T&gt;(ConcurrentQueue&lt;pPeople&gt; people,
                              Func&lt;PersonClass, List&lt;T&gt;&gt; listProvider,
                              Func&lt;T, bool&gt; updateRequiredTest)
{
    var updateCount = 0; 
    var lockObject = new object();

    Parallel.ForEach&lt;pPeople&gt;(people, person =&gt;
    {
        listProvider(person).ForEach(item =&gt;
        {
            if (updateRequiredTest(item))
            {
                lock (lockObject)
                {
                    updateCount++;
                }
            }
        });
    });
}

private void UpdatepPeopleContactNumbersIDs(ConcurrentQueue&lt;pPeople&gt; people)
{
    UpdatepPeople&lt;ContactType&gt;(people,
                               person =&gt; person.myPeopleContactsList,
                               contact =&gt; contact.ID == 0);
}

private void UpdatepPeopleEmailIDs(ConcurrentQueue&lt;pPeople&gt; people)
{
    UpdatepPeople&lt;EmailType&gt;(people,
                               person =&gt; person.myPeopleEmailsList,
                               contact =&gt; emails.ID == 0);
}