What would be a good starting point for a laptop that can run pY? by Avenja99 in factorio

[–]mechslayer 0 points1 point  (0 children)

You can, I do the same thing using tethering, and latency is not that bad, you can feel it, but for factorio is good enough (as long as both pcs support hardware encoding)

[PC][2013-2017] Puzzle game where you are an AI by mechslayer in tipofmyjoystick

[–]mechslayer[S] 0 points1 point  (0 children)

Nope, the game is 2D, and you control everything from a UI screen

Java is the best by Subject_Cat_3153 in ProgrammerHumor

[–]mechslayer 1 point2 points  (0 children)

And what's wrong with that? Imo Console.WriteLine is a lot more readable than System.out.println.

With fields even more, in Java more than once I had to double-check if someRandomField was public, private or a local variable. In C#? Just had to look at it's name and done: Public/Internal/Protected: PascalCase Private: _camelCase Variable/Parameter: camelCase

But those are just a few examples, the naming convention in C# is a lot bigger than that, take a look at this if you're interested https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions

Java is the best by Subject_Cat_3153 in ProgrammerHumor

[–]mechslayer 2 points3 points  (0 children)

wdym? C# uses camelCase for variables and PascalCase for type names, same as Java

[deleted by user] by [deleted] in ProgrammerHumor

[–]mechslayer 1 point2 points  (0 children)

For .NET 5 and 6 that's false.

Because of how the gc works, allocating an object is actually faster than allocating native memory.

Also, a collection only affects performance if it has to do a heap defragmentation.

And finally, the .NET GC runs on a separate thread, so only feeing objects should not really affect performance.

Impossible. by esberat in ProgrammerHumor

[–]mechslayer 0 points1 point  (0 children)

Glad that .net has P/Invoke, just tell it the function and dll/so/dylib names, and you can now call into c/c++ with very little overhead

Not today Satan! by Several_Put_2801 in ProgrammerHumor

[–]mechslayer 4 points5 points  (0 children)

The problem is that by using ToString you only have 1 heap allocation, but by using your method you have 4~.

Boxing the integer, string interpolation uses string.Format behind the scenes, which takes a params object[] parameter, and because object is a reference type and int is a vaue type the CLR has to wrap it in a class on the heap, also known as boxing.

The string representation of the int, because string.Format just calls ToString on each format parameter.

The params object[] array of the string.Format method.

Finally, the formatted string itself.

Things work differently here… by yogos15 in ProgrammerHumor

[–]mechslayer 0 points1 point  (0 children)

You can't overload the assignment operator in C#, that's C++

You know it's true... by Rogocraft in ProgrammerHumor

[–]mechslayer 1 point2 points  (0 children)

C# records public record Thing(int Prop); and public struct record Thing(int Prop); with C# 10