Question

How to use pointers to write more efficient code. C# problem

How to use pointers to write more efficient code. C# problem

Homework Answers

Answer #1

There are two main use cases for pointers in C#:

  1. You have to: For native interop, or unmanaged memory data structures.
  2. You want to get rid of array bounds checking or do some other unverifiable stuff.

In other cases it does not help. It also does not help with arrays where the bounds check is eliminated anyway.

It can also hurt code quality with the current JIT because it is not particularly optimized for raw pointers.

In any case: it is important to understand why it can help so you can predict where it will be helpful and where it will be useless.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
write a loop to print an array a with pointers backwards. You can use a variable...
write a loop to print an array a with pointers backwards. You can use a variable “size” for array size. write you code in C
Pointers in C++ may have potential problems if not properly used. For the following C++ code,...
Pointers in C++ may have potential problems if not properly used. For the following C++ code, identify the problem, briefly explain the problem, and also state Java's handling of such cases.     int *p1;    p1 = new int [1000];                                     p1 = new int [10]; (a) Name the problem: (b) Brief explain what caused the problem: (c) Does Java suffer similar problem? If yes, say so. If no, how does Java avoid such problem?
Write a sum function in C++ for LinkedBag of integers (must use pointers to traverse the...
Write a sum function in C++ for LinkedBag of integers (must use pointers to traverse the linked list) that will return a sum of all values.
C++ code: How to add a file to read/write to a code that prompt user to...
C++ code: How to add a file to read/write to a code that prompt user to add (write) infos and read infos from the file?
Program is in C++ Write a function named “removeInvalidDate” that accepts the vector of pointers to...
Program is in C++ Write a function named “removeInvalidDate” that accepts the vector of pointers to Reminder objects. It will go through that list and delete the Reminder objects with an invalid date (day is not between 1 and 31 and month is not between 1 and 12) from the list. It will return how many objects that it has deleted from the list. Reminder class and objects are not given. This is all the question provides.
Explain how you could use JIT to make your life more efficient.
Explain how you could use JIT to make your life more efficient.
Please, write a loop to print even numbers of an array a with pointers. You can...
Please, write a loop to print even numbers of an array a with pointers. You can use a variable “size” for array size
(Use Java ) please write comment on every line I need to understand the code Problem...
(Use Java ) please write comment on every line I need to understand the code Problem Description: Write a program that prompts the user to enter a point (x, y) and checks whether the point is within the rectangle centered at (0, 0) with width 10 and height 5. For example, (2, 2) is inside the rectangle and (6, 4) is outside the rectangle, as shown in the Figure. (Hint: A point is in the rectangle if its horizontal distance...
FROM The HCS12 / 9S12 (2nd Edition) E4.19 please use C language to write the code...
FROM The HCS12 / 9S12 (2nd Edition) E4.19 please use C language to write the code and submit the code and pictures of the running circuit on the board. (1) Write an instruction sequence to configure Port A and Port B for input and output, respectively; read the value of Port A and output the value to Port B.
Please write code in c++ using iostream library. Write a function that have to copy one...
Please write code in c++ using iostream library. Write a function that have to copy one char array to other avoiding any not-letter symbols, program have to use pointer. Input: First line contains sequence of chars (size is not more that 100). 1w[a3ter11 output: water
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT