【发布时间】:2011-10-14 15:49:05
【问题描述】:
使用 vwd express 2010 将 vb web 项目转换为 c#。 开发系统是64位windows 7。
我有一个在外部 cs 文件中声明的常用函数。 文件“clsCommon.cs”的内容=
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
namespace Project_Website
{
public class clsCommon
{
public void testA()
{
}
} // clsCommon
} // namespace
在后面的代码中,我尝试访问函数 testA(),如下所示:
testA();
也试过了:
clsCommon.testA();
和
Project_Website.clsCommon.testA();
我想使用的实际示例更复杂,但这是最简单的示例,它体现了我在下面列举的问题:
当我键入时,Intellisense 识别 clsCommon,但不认为 testA() 是其中的方法。 Intellisense 只看到两种方法:Equals() 和 ReferenceEquals()。
我忽略 Intellisense 并编译,这会产生以下错误消息:
错误 1 非静态字段、方法或属性“Project_Website.clsCommon.testA()”需要对象引用
这个问题的根本原因是什么?
【问题讨论】:
标签: c# class function global vwdexpress