class PicInFo
{
private string _fullname;
private string _nameNoExtension;
public PicInFo(string path)
{
_fullname=path;
_nameNoExtension=Path.GetFileNameWithOutExtension(Path);
}
}
如上面 的程序 ,构造函数中参数path是 由哪个函数或类传过来的,也就说该构造函数参数如何获得值的 呢?
{
private string _fullname;
private string _nameNoExtension;
public PicInFo(string path)
{
_fullname=path;
_nameNoExtension=Path.GetFileNameWithOutExtension(Path);
}
}
如上面 的程序 ,构造函数中参数path是 由哪个函数或类传过来的,也就说该构造函数参数如何获得值的 呢?
PicInfo info = new PicInfo(path);
PicInfo pi=new PicInfo(Path);
PicInfo piFuck = new PicInfo(path);
StackFrame[] _StackFrames = _StackList.GetFrames();
StackFrame应该是你要的东西.
PicInfo pi=new PicInfo(Path);
木有看过这个路径。LZ先这样试试
PicInfo piFuck = new PicInfo();
系统提示你没有该(无参)构造函数。
再这样:
PicInfo piFuck = new PicInfo("Fuck Lady");
编译通过,说明该函数里面的值是在实例化的时候,用户必须给的,所以它是从实例化该类的时候得到的。你定义了该构造函数说明你要求在实例化的时候必须先给个路径,要不你为什么不默认系统定义呢。