V
V
Viktor Batienko2020-03-01 08:19:15
JavaScript
Viktor Batienko, 2020-03-01 08:19:15

How to add reference to System.Configuration?

I decided to start my acquaintance with c#, but there was a problem.
I take the standard code from the manual.

try
            {
                var appSettings = ConfigurationManager.AppSettings;

                if (appSettings.Count == 0)
                {
                    Console.WriteLine("AppSettings is empty.");
                }
                else
                {
                    foreach (var key in appSettings.AllKeys)
                    {
                        Console.WriteLine("Key: {0} Value: {1}", key, appSettings[key]);
                    }
                }
            }
            catch (ConfigurationErrorsException)
            {
                Console.WriteLine("Error reading app settings");
            }


at the beginning I use
using System.Configuration;

but I get an error

the configurationmanager name is missing in the current context

I find the solution that I need "Add a reference to the System.Configuration assembly"
, but I don't find it
5e5b45ad3a0f5863020915.png

Maybe I'm looking in the wrong place, how to solve this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Griboks, 2019-07-13
@Kristal9

var pic = document.getElementById("pic")
Returns undefined and the rest of the code doesn't make sense.
Learn to use the developer console.
Move the script to the end of the file.

I
irishmann, 2019-07-13
@irishmann

In this case:

<!DOCTYPE html>
<html>
    <head>
        <meta lang="ru">
        <script>
            function lol(){
                alert("AD");
            }
        </script>
    </head>
    <body>
        <title>Program</title>
        <img src="ship.png" id="pic" onclick="lol()">
     <body>
</html>

But this method is considered obsolete.

V
Vladimir Korotenko, 2020-03-01
@xaker01

Install Resharper, it will pick up the path and add a reference to the assembly, and at the same time get a great piece for development.
PS why don't you use search?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question