示例#1
0
文件: Program.cs 项目: AcidNuke/Udemy
        public static void Main(string[] args)
        {
            var helloWorldClass = new HelloWorldClass();

            Console.ReadKey();

            Console.WriteLine("Goodbye");
        }
示例#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();
        }
示例#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));
        }
示例#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;
            }
        }