Search results for query: *

  1. M

    Array as function parameter, on stack or on heap?

    Okay. But what if I encounter the hypothetical situation where a programmer before me has made an enormous struct, and puts it in a function parameter? .. Actually I think you are going to say: refacture it to a class, dont use ref as a performance patch, right.? But theoretically using a ref...
  2. M

    Array as function parameter, on stack or on heap?

    Okay, if there is no copying, it makes no use adding ref, similar to passing it as a pointer in C++, for performance reasons, right? Since that is what triggered my question.
  3. M

    Array as function parameter, on stack or on heap?

    Okay, but is "int[] ar" a reference type or a value type? I am a little confused here. If I google I find that "Arrays are referece types in C#", but I have some doubts since in C++ something like "int[]" is passed by value, and you should pass it as a pointer for performance. Does something...
  4. M

    Array as function parameter, on stack or on heap?

    Say I have this: "double CalculateSomething(double[,] VeryLargArray)", is the array actually referenced to memory on the heap, or is the whole array placed on the function stack? If the latter, is there a way to prevent this, if your array is really large? I think if the array is really large...
  5. M

    The use of readonly

    Thank you. Can you tell me how to Fix the code formatting myself, I cannot find it.
  6. M

    The use of readonly

    What is the use of making the class member timeouts readonly in the code below, what is the effect? I think the content of the timeouts list can still be changed, the only thing that is being prohibited is assigning a new Dictionary object to it. Is that right? And is this good coding, since no...
  7. M

    Question Strange code, why doesn't the compiler give an error and what could the use

    Thanks. One more question. If I understand that it are integers under the hood, this would mean that the actual strings used in the enumerations are irrelevant, right? So if OrgType has the members A, B, C, and OrgRType the members C, B, A (in that order) it maps. But A 'goes to' C, since the...
  8. M

    Question Strange code, why doesn't the compiler give an error and what could the use

    I am encountering some strange old code: foreach (OrgType type in Enum.GetValues(typeof(OrgRType))) { // ... } I thought that the two Types here (OrgType and OrgRType) should be the same, and even if it does compile, I fail to see the use. You are looping over the wrong enum type right?
Back
Top Bottom