How to remove duplicates from object list based on that object property in c#Remove duplicates from a List<T> in C#How do I calculate someone's age in C#?Calling the base constructor in C#How do you give a C# Auto-Property a default value?Remove duplicates from a List<T> in C#How do I enumerate an enum in C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?MetadataException: Unable to load the specified metadata resourceGet int value from enum in C#How to Sort a List<T> by a property in the objectWhy not inherit from List<T>?

Does Forgotten Realms setting count as “High magic”?

What would happen if Protagoras v Euathlus were heard in court today?

When it rains it pours

Why are two-stroke engines nearly unheard of in aviation?

Why is the car dealer insisting on a loan instead of cash?

Why is the year in this ISO timestamp not 2019?

Is there a generally agreed upon solution to Bradley's Infinite Regress without appeal to Paraconsistent Logic?

Tips for remembering the order of parameters for ln?

Test to know when to use GLM over Linear Regression?

What is this WWII four-engine plane on skis?

How To Make Earth's Oceans as Brackish as Lyr's

What does the Free Recovery sign (UK) actually mean?

What does "boys rule, girls drool" mean?

How to make my “custom integer type” perform better?

Transit visa to Hong Kong

Wouldn't Kreacher have been able to escape even without following an order?

Is there a theorem in Real analysis similar to Cauchy's theorem in Complex analysis?

Are all men created equal according to Hinduism? Is this predominant western belief in agreement with the Vedas?

Why 1.5fill is 0pt

Why is the return value of the fun function 8 instead of 7?

Why is the UK still pressing on with Brexit?

Is it acceptable to use decoupling capacitor ground pad as ground for oscilloscope probe?

What is the origin of the "being immortal sucks" trope?

Why does dd not make working bootable USB sticks for Microsoft?



How to remove duplicates from object list based on that object property in c#


Remove duplicates from a List<T> in C#How do I calculate someone's age in C#?Calling the base constructor in C#How do you give a C# Auto-Property a default value?Remove duplicates from a List<T> in C#How do I enumerate an enum in C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?MetadataException: Unable to load the specified metadata resourceGet int value from enum in C#How to Sort a List<T> by a property in the objectWhy not inherit from List<T>?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I've got a problem with removing duplicates at runtime from my list of object.



I would like to remove duplicates from my list of object and then set counter=counter+1 of base object.



public class MyObject 

MyObject(string name)

this.counter = 0;
this.name = name;

public string name;
public int counter;


List<MyObject> objects_list = new List<MyObject>();
objects_list.Add(new MyObject("john"));
objects_list.Add(new MyObject("anna"));
objects_list.Add(new MyObject("john"));
foreach (MyObject my_object in objects_list)

foreach (MyObject my_second_object in objects_list)

if (my_object.name == my_second_object.name)

my_object.counter = my_object.counter + 1;
objects_list.remove(my_second_object);





It return an error, because objects_list is modified at runtime. How can I get this working?










share|improve this question


























  • do a for loop instead of a foreach and go backwards. this way when you remove an element you can still move up the list

    – sLw
    Mar 28 at 13:02












  • If you want to mofify the elemnts in a list while iterating that list, use for instead of foreach.

    – HimBromBeere
    Mar 28 at 13:02











  • You are by the way comparing object to object.name, which makes no sense and cannot compile, I guess just a mistype?

    – Ilya Chernomordik
    Mar 28 at 13:09












  • I can't just use for, because during delete the iterator will change. Also I can't make two backwards for, because I will get the same error.

    – equnex
    Mar 28 at 13:09











  • You can't use foreach either to iterate a collection that you change

    – Ilya Chernomordik
    Mar 28 at 13:10

















0















I've got a problem with removing duplicates at runtime from my list of object.



I would like to remove duplicates from my list of object and then set counter=counter+1 of base object.



public class MyObject 

MyObject(string name)

this.counter = 0;
this.name = name;

public string name;
public int counter;


List<MyObject> objects_list = new List<MyObject>();
objects_list.Add(new MyObject("john"));
objects_list.Add(new MyObject("anna"));
objects_list.Add(new MyObject("john"));
foreach (MyObject my_object in objects_list)

foreach (MyObject my_second_object in objects_list)

if (my_object.name == my_second_object.name)

my_object.counter = my_object.counter + 1;
objects_list.remove(my_second_object);





It return an error, because objects_list is modified at runtime. How can I get this working?










share|improve this question


























  • do a for loop instead of a foreach and go backwards. this way when you remove an element you can still move up the list

    – sLw
    Mar 28 at 13:02












  • If you want to mofify the elemnts in a list while iterating that list, use for instead of foreach.

    – HimBromBeere
    Mar 28 at 13:02











  • You are by the way comparing object to object.name, which makes no sense and cannot compile, I guess just a mistype?

    – Ilya Chernomordik
    Mar 28 at 13:09












  • I can't just use for, because during delete the iterator will change. Also I can't make two backwards for, because I will get the same error.

    – equnex
    Mar 28 at 13:09











  • You can't use foreach either to iterate a collection that you change

    – Ilya Chernomordik
    Mar 28 at 13:10













0












0








0








I've got a problem with removing duplicates at runtime from my list of object.



I would like to remove duplicates from my list of object and then set counter=counter+1 of base object.



public class MyObject 

MyObject(string name)

this.counter = 0;
this.name = name;

public string name;
public int counter;


List<MyObject> objects_list = new List<MyObject>();
objects_list.Add(new MyObject("john"));
objects_list.Add(new MyObject("anna"));
objects_list.Add(new MyObject("john"));
foreach (MyObject my_object in objects_list)

foreach (MyObject my_second_object in objects_list)

if (my_object.name == my_second_object.name)

my_object.counter = my_object.counter + 1;
objects_list.remove(my_second_object);





It return an error, because objects_list is modified at runtime. How can I get this working?










share|improve this question
















I've got a problem with removing duplicates at runtime from my list of object.



I would like to remove duplicates from my list of object and then set counter=counter+1 of base object.



public class MyObject 

MyObject(string name)

this.counter = 0;
this.name = name;

public string name;
public int counter;


List<MyObject> objects_list = new List<MyObject>();
objects_list.Add(new MyObject("john"));
objects_list.Add(new MyObject("anna"));
objects_list.Add(new MyObject("john"));
foreach (MyObject my_object in objects_list)

foreach (MyObject my_second_object in objects_list)

if (my_object.name == my_second_object.name)

my_object.counter = my_object.counter + 1;
objects_list.remove(my_second_object);





It return an error, because objects_list is modified at runtime. How can I get this working?







c#






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 13:10







equnex

















asked Mar 28 at 13:00









equnexequnex

32 bronze badges




32 bronze badges















  • do a for loop instead of a foreach and go backwards. this way when you remove an element you can still move up the list

    – sLw
    Mar 28 at 13:02












  • If you want to mofify the elemnts in a list while iterating that list, use for instead of foreach.

    – HimBromBeere
    Mar 28 at 13:02











  • You are by the way comparing object to object.name, which makes no sense and cannot compile, I guess just a mistype?

    – Ilya Chernomordik
    Mar 28 at 13:09












  • I can't just use for, because during delete the iterator will change. Also I can't make two backwards for, because I will get the same error.

    – equnex
    Mar 28 at 13:09











  • You can't use foreach either to iterate a collection that you change

    – Ilya Chernomordik
    Mar 28 at 13:10

















  • do a for loop instead of a foreach and go backwards. this way when you remove an element you can still move up the list

    – sLw
    Mar 28 at 13:02












  • If you want to mofify the elemnts in a list while iterating that list, use for instead of foreach.

    – HimBromBeere
    Mar 28 at 13:02











  • You are by the way comparing object to object.name, which makes no sense and cannot compile, I guess just a mistype?

    – Ilya Chernomordik
    Mar 28 at 13:09












  • I can't just use for, because during delete the iterator will change. Also I can't make two backwards for, because I will get the same error.

    – equnex
    Mar 28 at 13:09











  • You can't use foreach either to iterate a collection that you change

    – Ilya Chernomordik
    Mar 28 at 13:10
















do a for loop instead of a foreach and go backwards. this way when you remove an element you can still move up the list

– sLw
Mar 28 at 13:02






do a for loop instead of a foreach and go backwards. this way when you remove an element you can still move up the list

– sLw
Mar 28 at 13:02














If you want to mofify the elemnts in a list while iterating that list, use for instead of foreach.

– HimBromBeere
Mar 28 at 13:02





If you want to mofify the elemnts in a list while iterating that list, use for instead of foreach.

– HimBromBeere
Mar 28 at 13:02













You are by the way comparing object to object.name, which makes no sense and cannot compile, I guess just a mistype?

– Ilya Chernomordik
Mar 28 at 13:09






You are by the way comparing object to object.name, which makes no sense and cannot compile, I guess just a mistype?

– Ilya Chernomordik
Mar 28 at 13:09














I can't just use for, because during delete the iterator will change. Also I can't make two backwards for, because I will get the same error.

– equnex
Mar 28 at 13:09





I can't just use for, because during delete the iterator will change. Also I can't make two backwards for, because I will get the same error.

– equnex
Mar 28 at 13:09













You can't use foreach either to iterate a collection that you change

– Ilya Chernomordik
Mar 28 at 13:10





You can't use foreach either to iterate a collection that you change

– Ilya Chernomordik
Mar 28 at 13:10












2 Answers
2






active

oldest

votes


















0
















The other answer seem to be correct, though I think it will do scan of the whole list twice, depending on your requirement this might or might not be good enough. Here is how you can do it in one go:



var dictionary = new Dictionary<string, MyObject>();
foreach(var obj in objects_list)

if(!dictionary.ContainsKey(obj.name)

dictionary[obj.name] = obj;
obj.counter++;

else

dictionary[obj.name].counter++;




Then dictionary.Values will contain your collection






share|improve this answer



























  • That also won´t give number of dupes.

    – HimBromBeere
    Mar 28 at 13:15











  • Well, the example is simplified, but list can contain 100 000 records :/

    – equnex
    Mar 28 at 13:15











  • Not sure which number of dupes OP wanted: the one I counted or the number of "uniqeq" dupes

    – Ilya Chernomordik
    Mar 28 at 13:16











  • Then you'll need to create a dictionary

    – Ilya Chernomordik
    Mar 28 at 13:17






  • 1





    Just count of the same names. If list contains MyObject with name "anna" counter at the end should be 1, if list contains two MyObject with names "john" counter at the end should be 2. I think it's clear.

    – equnex
    Mar 28 at 13:18


















1
















With a help of Linq GroupBy we can combine duplicates in a single group and process it (i.e. return an item which represents all the duplicates):



 List<MyObject> objects_list = ...

objects_list = objects_list
.GroupBy(item => item.name)
.Select(group => // given a group of duplicates we
var item = group.First(); // - take the 1st item
item.counter = group.Sum(g => g.counter); // - update its counter
return item; // - and return it instead of group
)
.ToList();





share|improve this answer



























  • With a little bit change it works: item.counter = group.Sum(g => g.counter + 1); but as far I'm not from C# and it looks a little bit confusing for me.

    – equnex
    Mar 28 at 13:25












  • Actually it should work if you just write item.counter = group.Count(). You will get the number of same names in each group (you might want to subtract one if that's what you want)

    – Ilya Chernomordik
    Mar 28 at 13:32














Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55398313%2fhow-to-remove-duplicates-from-object-list-based-on-that-object-property-in-c-sha%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0
















The other answer seem to be correct, though I think it will do scan of the whole list twice, depending on your requirement this might or might not be good enough. Here is how you can do it in one go:



var dictionary = new Dictionary<string, MyObject>();
foreach(var obj in objects_list)

if(!dictionary.ContainsKey(obj.name)

dictionary[obj.name] = obj;
obj.counter++;

else

dictionary[obj.name].counter++;




Then dictionary.Values will contain your collection






share|improve this answer



























  • That also won´t give number of dupes.

    – HimBromBeere
    Mar 28 at 13:15











  • Well, the example is simplified, but list can contain 100 000 records :/

    – equnex
    Mar 28 at 13:15











  • Not sure which number of dupes OP wanted: the one I counted or the number of "uniqeq" dupes

    – Ilya Chernomordik
    Mar 28 at 13:16











  • Then you'll need to create a dictionary

    – Ilya Chernomordik
    Mar 28 at 13:17






  • 1





    Just count of the same names. If list contains MyObject with name "anna" counter at the end should be 1, if list contains two MyObject with names "john" counter at the end should be 2. I think it's clear.

    – equnex
    Mar 28 at 13:18















0
















The other answer seem to be correct, though I think it will do scan of the whole list twice, depending on your requirement this might or might not be good enough. Here is how you can do it in one go:



var dictionary = new Dictionary<string, MyObject>();
foreach(var obj in objects_list)

if(!dictionary.ContainsKey(obj.name)

dictionary[obj.name] = obj;
obj.counter++;

else

dictionary[obj.name].counter++;




Then dictionary.Values will contain your collection






share|improve this answer



























  • That also won´t give number of dupes.

    – HimBromBeere
    Mar 28 at 13:15











  • Well, the example is simplified, but list can contain 100 000 records :/

    – equnex
    Mar 28 at 13:15











  • Not sure which number of dupes OP wanted: the one I counted or the number of "uniqeq" dupes

    – Ilya Chernomordik
    Mar 28 at 13:16











  • Then you'll need to create a dictionary

    – Ilya Chernomordik
    Mar 28 at 13:17






  • 1





    Just count of the same names. If list contains MyObject with name "anna" counter at the end should be 1, if list contains two MyObject with names "john" counter at the end should be 2. I think it's clear.

    – equnex
    Mar 28 at 13:18













0














0










0









The other answer seem to be correct, though I think it will do scan of the whole list twice, depending on your requirement this might or might not be good enough. Here is how you can do it in one go:



var dictionary = new Dictionary<string, MyObject>();
foreach(var obj in objects_list)

if(!dictionary.ContainsKey(obj.name)

dictionary[obj.name] = obj;
obj.counter++;

else

dictionary[obj.name].counter++;




Then dictionary.Values will contain your collection






share|improve this answer















The other answer seem to be correct, though I think it will do scan of the whole list twice, depending on your requirement this might or might not be good enough. Here is how you can do it in one go:



var dictionary = new Dictionary<string, MyObject>();
foreach(var obj in objects_list)

if(!dictionary.ContainsKey(obj.name)

dictionary[obj.name] = obj;
obj.counter++;

else

dictionary[obj.name].counter++;




Then dictionary.Values will contain your collection







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 28 at 13:36

























answered Mar 28 at 13:14









Ilya ChernomordikIlya Chernomordik

11.1k8 gold badges53 silver badges101 bronze badges




11.1k8 gold badges53 silver badges101 bronze badges















  • That also won´t give number of dupes.

    – HimBromBeere
    Mar 28 at 13:15











  • Well, the example is simplified, but list can contain 100 000 records :/

    – equnex
    Mar 28 at 13:15











  • Not sure which number of dupes OP wanted: the one I counted or the number of "uniqeq" dupes

    – Ilya Chernomordik
    Mar 28 at 13:16











  • Then you'll need to create a dictionary

    – Ilya Chernomordik
    Mar 28 at 13:17






  • 1





    Just count of the same names. If list contains MyObject with name "anna" counter at the end should be 1, if list contains two MyObject with names "john" counter at the end should be 2. I think it's clear.

    – equnex
    Mar 28 at 13:18

















  • That also won´t give number of dupes.

    – HimBromBeere
    Mar 28 at 13:15











  • Well, the example is simplified, but list can contain 100 000 records :/

    – equnex
    Mar 28 at 13:15











  • Not sure which number of dupes OP wanted: the one I counted or the number of "uniqeq" dupes

    – Ilya Chernomordik
    Mar 28 at 13:16











  • Then you'll need to create a dictionary

    – Ilya Chernomordik
    Mar 28 at 13:17






  • 1





    Just count of the same names. If list contains MyObject with name "anna" counter at the end should be 1, if list contains two MyObject with names "john" counter at the end should be 2. I think it's clear.

    – equnex
    Mar 28 at 13:18
















That also won´t give number of dupes.

– HimBromBeere
Mar 28 at 13:15





That also won´t give number of dupes.

– HimBromBeere
Mar 28 at 13:15













Well, the example is simplified, but list can contain 100 000 records :/

– equnex
Mar 28 at 13:15





Well, the example is simplified, but list can contain 100 000 records :/

– equnex
Mar 28 at 13:15













Not sure which number of dupes OP wanted: the one I counted or the number of "uniqeq" dupes

– Ilya Chernomordik
Mar 28 at 13:16





Not sure which number of dupes OP wanted: the one I counted or the number of "uniqeq" dupes

– Ilya Chernomordik
Mar 28 at 13:16













Then you'll need to create a dictionary

– Ilya Chernomordik
Mar 28 at 13:17





Then you'll need to create a dictionary

– Ilya Chernomordik
Mar 28 at 13:17




1




1





Just count of the same names. If list contains MyObject with name "anna" counter at the end should be 1, if list contains two MyObject with names "john" counter at the end should be 2. I think it's clear.

– equnex
Mar 28 at 13:18





Just count of the same names. If list contains MyObject with name "anna" counter at the end should be 1, if list contains two MyObject with names "john" counter at the end should be 2. I think it's clear.

– equnex
Mar 28 at 13:18













1
















With a help of Linq GroupBy we can combine duplicates in a single group and process it (i.e. return an item which represents all the duplicates):



 List<MyObject> objects_list = ...

objects_list = objects_list
.GroupBy(item => item.name)
.Select(group => // given a group of duplicates we
var item = group.First(); // - take the 1st item
item.counter = group.Sum(g => g.counter); // - update its counter
return item; // - and return it instead of group
)
.ToList();





share|improve this answer



























  • With a little bit change it works: item.counter = group.Sum(g => g.counter + 1); but as far I'm not from C# and it looks a little bit confusing for me.

    – equnex
    Mar 28 at 13:25












  • Actually it should work if you just write item.counter = group.Count(). You will get the number of same names in each group (you might want to subtract one if that's what you want)

    – Ilya Chernomordik
    Mar 28 at 13:32
















1
















With a help of Linq GroupBy we can combine duplicates in a single group and process it (i.e. return an item which represents all the duplicates):



 List<MyObject> objects_list = ...

objects_list = objects_list
.GroupBy(item => item.name)
.Select(group => // given a group of duplicates we
var item = group.First(); // - take the 1st item
item.counter = group.Sum(g => g.counter); // - update its counter
return item; // - and return it instead of group
)
.ToList();





share|improve this answer



























  • With a little bit change it works: item.counter = group.Sum(g => g.counter + 1); but as far I'm not from C# and it looks a little bit confusing for me.

    – equnex
    Mar 28 at 13:25












  • Actually it should work if you just write item.counter = group.Count(). You will get the number of same names in each group (you might want to subtract one if that's what you want)

    – Ilya Chernomordik
    Mar 28 at 13:32














1














1










1









With a help of Linq GroupBy we can combine duplicates in a single group and process it (i.e. return an item which represents all the duplicates):



 List<MyObject> objects_list = ...

objects_list = objects_list
.GroupBy(item => item.name)
.Select(group => // given a group of duplicates we
var item = group.First(); // - take the 1st item
item.counter = group.Sum(g => g.counter); // - update its counter
return item; // - and return it instead of group
)
.ToList();





share|improve this answer















With a help of Linq GroupBy we can combine duplicates in a single group and process it (i.e. return an item which represents all the duplicates):



 List<MyObject> objects_list = ...

objects_list = objects_list
.GroupBy(item => item.name)
.Select(group => // given a group of duplicates we
var item = group.First(); // - take the 1st item
item.counter = group.Sum(g => g.counter); // - update its counter
return item; // - and return it instead of group
)
.ToList();






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 28 at 13:27

























answered Mar 28 at 13:05









Dmitry BychenkoDmitry Bychenko

123k15 gold badges115 silver badges150 bronze badges




123k15 gold badges115 silver badges150 bronze badges















  • With a little bit change it works: item.counter = group.Sum(g => g.counter + 1); but as far I'm not from C# and it looks a little bit confusing for me.

    – equnex
    Mar 28 at 13:25












  • Actually it should work if you just write item.counter = group.Count(). You will get the number of same names in each group (you might want to subtract one if that's what you want)

    – Ilya Chernomordik
    Mar 28 at 13:32


















  • With a little bit change it works: item.counter = group.Sum(g => g.counter + 1); but as far I'm not from C# and it looks a little bit confusing for me.

    – equnex
    Mar 28 at 13:25












  • Actually it should work if you just write item.counter = group.Count(). You will get the number of same names in each group (you might want to subtract one if that's what you want)

    – Ilya Chernomordik
    Mar 28 at 13:32

















With a little bit change it works: item.counter = group.Sum(g => g.counter + 1); but as far I'm not from C# and it looks a little bit confusing for me.

– equnex
Mar 28 at 13:25






With a little bit change it works: item.counter = group.Sum(g => g.counter + 1); but as far I'm not from C# and it looks a little bit confusing for me.

– equnex
Mar 28 at 13:25














Actually it should work if you just write item.counter = group.Count(). You will get the number of same names in each group (you might want to subtract one if that's what you want)

– Ilya Chernomordik
Mar 28 at 13:32






Actually it should work if you just write item.counter = group.Count(). You will get the number of same names in each group (you might want to subtract one if that's what you want)

– Ilya Chernomordik
Mar 28 at 13:32



















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55398313%2fhow-to-remove-duplicates-from-object-list-based-on-that-object-property-in-c-sha%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript