How do you concatenate Lists in C#?

If I have: List<string> myList1; List<string> myList2; myList1 = getMeAList(); // Checked myList1, it contains 4 strings myList2 = getMeAnotherList(); // Checked myList2, it contains 6 strings myList1.Concat(myList2); // Checked mylist1, it contains 4 strings… why? I ran code similar to this in Visual Studio 2008 and set break points after each execution. After myList1 … Read more

What does ${} (dollar sign and curly braces) mean in a string in JavaScript?

I haven’t seen anything here or on MDN. I’m sure I’m just missing something. There’s got to be some documentation on this somewhere? Functionally, it looks like it allows you to nest a variable inside a string without doing concatenation using the + operator. I’m looking for documentation on this feature. Example: var string = … Read more

PHP – concatenate or directly insert variables in string

I am wondering, What is the proper way for inserting PHP variables into a string? This way: echo “Welcome “.$name.”!” Or this way: echo “Welcome $name!” Both of these methods work in my PHP v5.3.5. The latter is shorter and simpler but I’m not sure if the first is better formatting or accepted as more … Read more

Is it better practice to use String.format over string Concatenation in Java?

Is there a perceptible difference between using String.format and String concatenation in Java? I tend to use String.format but occasionally will slip and use a concatenation. I was wondering if one was better than the other. The way I see it, String.format gives you more power in “formatting” the string; and concatenation means you don’t … Read more

How to concatenate two dictionaries to create a new one? [duplicate]

This question already has answers here: How do I merge two dictionaries in a single expression (take union of dictionaries)? (48 answers) Closed 8 years ago. Say I have three dicts d1={1:2,3:4} d2={5:6,7:9} d3={10:8,13:22} How do I create a new d4 that combines these three dictionaries? i.e.: d4={1:2,3:4,5:6,7:9,10:8,13:22} 5 Answers 5