Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var helloWorldClass = new HelloWorldClass();

            Console.ReadKey();

            Console.WriteLine("Goodbye");
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string          baseAddress = ConfigurationManager.AppSettings["BaseAddress"];
            var             response    = client.DownloadString(baseAddress + "/api/Home/Index");
            HelloWorldClass detail      = new HelloWorldClass();

            detail.ReturnValue = response.ToString();
            Console.WriteLine(detail.ReturnValue);
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder();

            builder.AddCommandLine(args, new Dictionary <string, string> {
                ["-Name"] = "Name"
            });

            var config = builder.Build();

            var name = config["Name"];

            Console.WriteLine(HelloWorldClass.SayHello(name));
        }
Ejemplo n.º 4
0
        private void m_tbNumb_KeyUp(object sender, KeyEventArgs e)
        {
            string numbstr = m_tbNumb.Text;

            if (!string.IsNullOrEmpty(numbstr))
            {
                if (Int32.TryParse(numbstr, out int n))
                {
                    m_tbFact.FontStyle = FontStyles.Normal;
                    m_tbSumm.FontStyle = FontStyles.Normal;

                    string str1 = "", str2 = "";
                    Thread t1 = new Thread(() => str1 = $"n! = {HelloWorldClass.FactorialN(n)?.ToString() ?? "? // Число слишком большое"}");
                    t1.Start();
                    Thread t2 = new Thread(() => str2 = $"Σn = {HelloWorldClass.SummN(n)?.ToString() ?? "? Число слишком большое"}");
                    t2.Start();

                    t1.Join();
                    t2.Join();

                    m_tbFact.Text = str1;
                    m_tbSumm.Text = str2;
                }
                else
                {
                    m_tbFact.Text      = "Некорректное число";
                    m_tbSumm.Text      = "";
                    m_tbFact.FontStyle = FontStyles.Italic;
                    m_tbSumm.FontStyle = FontStyles.Italic;
                }
            }
            else
            {
                m_tbFact.Text      = "Число n не задано";
                m_tbSumm.Text      = "";
                m_tbFact.FontStyle = FontStyles.Italic;
                m_tbSumm.FontStyle = FontStyles.Italic;
            }
        }