How would I convert WPF to Console Application

Question!

So I have a method and what it does is it gets the processor name of my PC basically..

Now how would I do the same thing if I were to do it in a Console Application.

This is what I tried but it didnt print out anything

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;    
using System.Management;

namespace testereeee
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("hello World");
            Console.ReadKey();
        }

        private string GetProcessorName()
        {
            string ProcessorName = "";
            ManagementObjectSearcher mos
            = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");

            foreach (ManagementObject mo in mos.Get())
                ProcessorName = mo["Name"].ToString();
            Console.WriteLine(ProcessorName.ToString());
            return ProcessorName;
        }        
    }
}


Answers

It didn't print anything because it was never called, update your code to be like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;    
using System.Management;

namespace testereeee
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("hello World");
            GetProcessorName()

            Console.ReadKey();
        }

        private static string GetProcessorName()
        {
            string ProcessorName = "";
            ManagementObjectSearcher mos
            = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");

            foreach (ManagementObject mo in mos.Get())
                ProcessorName = mo["Name"].ToString();
            Console.WriteLine(ProcessorName.ToString());
            return ProcessorName;
        }        
    }
}


The smallest floating point number representable in Python is 5e-324, or 2.0**-1075.

The other two answers have each given you half of what you need to find this number. It can be found by multiplying sys.float_info.min (2.2250738585072014e-308, the smallest normalized float) by sys.float_info.epsilon (2.220446049250313e-16, the smallest proportion you can modify a number by while still getting a distinct value).

By : Blckknght


The key word that you're apparently missing is "epsilon." If you search on Python epsilon value then it returns a links to StackOverflow: Value for epsilon in Python near the top of the results in Google.

Obviously it helps if you understand how the term is associated with this concept.



This video can help you solving your question :)
By: admin