I downvoted because

an image of your code is not helpful

An image of your code is not helpful

When we ask a question about a problem with our code, we have to let the people who are helping us see it. Images of our code do not qualify.

Viewing the details of the exception

Why this is a problem

One of the first things we do when examining code for errors is to try compiling (if necessary) and running the code to see what happens. We may also copy part of the code to paste into search engines in order to learn about the types or algorithms we are using, and to find other similar questions. When we are provided an image of code, this process becomes much more difficult.

Why this is worth a downvote

When people offer to help us, for free and on their own time, it is important for us to provide them everything they need to solve our issue. When we force them to transcribe an image, we are wasting their time. In addition, errors in the transcription make it less likely that a solution to our problem can be found. Image contents cannot be searched, so future developers with the same problem will be less likely to find our question. This is even more of a problem for developers who use screen readers, as they will neither be able to help you, or help themselves by finding our answer in future.

What to do next

Edit the question. Remove the images containing code from it. Copy and paste our code into the question. It is very important that the code is the minimum needed to reproduce our problem, and that it is well formatted. If our code consists of HTML, CSS and Javascript, we can take advantage of stack snippets to make our issue reproducible right in our question! This makes it much easier to see our problem and to provide fixes quickly.

An example of well formatted code with comments explaining any issues.

public static int Calculate(string digits)
    //Issue: x is 6 should be 5
    var x = digits.Where(char.IsDigit).Count();

    var sumOfDigits = digits.Where(char.IsDigit)
        .Select((e, i) => int.Parse(e.ToString()) * (i % 2 == 0 ? 1 : 2))
        .Sum(e => e / 10 + e % 10);
    //Error: sumOfDigits is returning 100 should be 600

    return sumOfDigits % 10;

Leave a comment!

Once you have done this, leave a comment to the person who sent you this link. They will be happy to retract their downvote.

Did this page help you?

This website is here for everyone’s benefit, most importantly yours! If this did not help you, or if you would like to leave feedback, please create an Issue regarding this page on GitHub, or submit an improvement directly.