Browsing 7239 questions and answers with Jon Skeet
Both are correct singleton implementations. Whether you need the static constructor just depends on how much you care about full laziness. If you really, really don't want the singleton to be instantiated until it's used by a caller, you... more 3/21/2016 2:56:14 PM
I would try very hard to make the default value valid, yes. For example, you could do something like: public struct ResizeFactor { private readonly float horizontal; private readonly float vertical; public float Horizontal... more 3/19/2016 6:17:38 PM
That's fine - it's just an array. All the compiler does with a parameter array is convert a call like this: Foo("x", "y"); into: Foo(new string[] { "x", "y" }); That's really all there is to it. Anything you'd expect to be... more 3/19/2016 5:45:21 PM
The type of Transform.position is Vector3, which is a struct. That means when you access it, you get a copy of the value. Then ScreenToWorldPoint takes that value and returns another Vector3. Mutating that value wouldn't do anything useful... more 3/19/2016 1:43:04 PM
Your visualization should be: If number = 4, 1st return: 4 x (2nd return) 2nd return: 3 x (3rd return) 3rd return: 2 x (4th return) 4th return: 1 That then simplifies to 4 x 3 x 2 x 1, as expected. Basically, you... more 3/19/2016 8:29:15 AM
Unless this[string] calls CoreApiRootUrl, then it's not recursive. You're right that nameof(...) doesn't actually make a call at all. I've just validated that I see the same bug (with R# 10.0.1) in a small test class: public class... more 3/18/2016 5:34:45 PM
It's just calling the BigInteger(String) constructor, because there isn't a constructor taking an int. Using string concatenation is a nasty way of converting an int to a String, but it will work. A cleaner approach IMO would be to use... more 3/17/2016 11:00:44 PM
You just need to map each sub-array to an int by taking the first element: import java.util.*; import java.util.stream.*; class Test { public static void main(String args[]) { int[][] data = { { 1, 2, 3 }, ... more 3/17/2016 7:52:51 PM
I wish to store the IV as a string representation so using UTF-8, this would equate to a 16 character string. No. Just don't do this. Yes, you could interpret the 32 bytes as a UCS-2 sequence, but it's a really bad idea. This isn't... more 3/17/2016 3:45:41 PM
Hash maps only use hash codes to find keys efficiently. When you ask the map to find a value, it basically has to iterate over all its entries, at which point there's no point in using hashCode(), so it just calls equals. If you try the... more 3/17/2016 2:46:30 PM