समस्या यह है कि मैंने नई कक्षा को जोड़ने के बाद त्रुटि उत्पन्न की जब मैंने समाधान बनाया। क्या गलत हो सकता है?मेरी परियोजना में एक नई कक्षा को जोड़ा गया और त्रुटि कहें प्रोग्राम। मेन() में एक और प्रविष्टि क्यों है?
फॉर्म 1 में मेरे पास अभी तक कोई कोड नहीं है।
बस नया वर्ग कहा:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenHardwareMonitor.Hardware;
namespace OpenHardwareMonitorReport
{
class Program
{
static void Main(string[] args)
{
Computer computer = new Computer();
computer.Open();
var temps = new List<decimal>();
foreach (var hardware in computer.Hardware)
{
if (hardware.HardwareType != HardwareType.CPU)
continue;
hardware.Update();
foreach (var sensor in hardware.Sensors)
{
if (sensor.SensorType != SensorType.Temperature)
{
if (sensor.Value != null)
temps.Add((decimal)sensor.Value);
}
}
}
foreach (decimal temp in temps)
{
Console.WriteLine(temp);
}
Console.ReadLine();
}
}
}
तब मैं Program.cs और त्रुटि देखते मुख्य पर()
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace NvidiaTemp
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Error 2 Program 'D:\C-Sharp\NvidiaTemp\NvidiaTemp\NvidiaTemp\obj\x86\Debug\NvidiaTemp.exe' has more than one entry point defined: 'NvidiaTemp.Program.Main()'. Compile with /main to specify the type that contains the entry point. D:\C-Sharp\NvidiaTemp\NvidiaTemp\NvidiaTemp\Program.cs 14 21 NvidiaTemp
आपके पास अब दो 'मुख्य' हैं। –
धन्यवाद निश्चित टीएनएक्स। – user1544479