本文介绍了'xxxx'不包含'yyyy'的定义 - C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我正在研究监控CPU使用率的C#应用​​程序。原始数据必须流经图表并显示在表单应用程序上。我对C#很新,这个错误不包含...的定义现在欺负我几天哈哈。我已经对这个问题进行了大量的研究,但是我仍然没有找到任何我理解/解决的解决方案。

问题在于CpuUsage.ChartAreas [0 ]它被标记为'< ---错误'



您会发现一些代码也显示不包含'的定义'可以找到CpuUsage'和没有扩展方法'CpuUsage'接受类型'GraphMeter.Form1'的第一个参数(你是否缺少using指令或汇编引用?)



解决了(谢谢)

Hi there!
I am working on a C# application that monitor CPU Usage. The raw data must flow through a Graph and display on a form application. I'm quite new with C# and this error "Does not contain a definition for..." bullies me for a few days now haha. I've done tons of research on the problem, however I still don't find any solution(s) that I understand/snap.
The Problem lies at "CpuUsage.ChartAreas[0]"Were it has been marked '<--- Error'

Some code you will find also shows "Does not contain a definition for 'CpuUsage' and no extension method 'CpuUsage' accepting a first argument of type 'GraphMeter.Form1' could be found (are you missing a using directive or an assembly reference?)"

Solved(Thanks)

推荐答案

public void Form1_Load(object sender, CpuUsage e)

并声明

引用:

找不到类型或命名空间名称'CpuUsage'(你错过了吗?使用指令或汇编参考?)

The type or namespace name 'CpuUsage' could not be found (are you missing a using directive or an assembly reference?)



您可以采取的步骤来解决您的问题...



1.有你正确地拼写了CpuUsage - 例如它不是CPUUsage或Cpuusage。



2.您是否在项目中引用了DLL或包含了CpuUsage的类文件? br />


3. CpuUsage的命名空间是什么,你应该用包含它



4.如果没有这些工作尝试清洁解决方案



5.如果仍然无效,请尝试删除引用并将其放回



6.检查安装了CpuUsage类的是否已正确安装(例如是DLL正确注册了)



我会重复我之前的建议 - 总是开始处理错误编号为1的构建错误 - 其他许多错误只会在之后消失它是固定的


Steps you can take to resolve your problem...

1. Have you spelled "CpuUsage" correctly - it's not CPUUsage or Cpuusage for example.

2. Have you referenced the DLL or included the class file for CpuUsage in your project?

3. What is the namespace for CpuUsage and should you have included it with a using

4. If none of those work try "Clean Solution"

5. If that still doesn't work try removing the reference and putting it back

6. Check that whatever installed the CpuUsage class is properly installed (e.g. is the DLL properly registered)

I'll repeat my earlier advice - always start to deal with build errors with error number 1 - many of the others will simply disappear after it is fixed


这篇关于'xxxx'不包含'yyyy'的定义 - C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 20:16