I am getting next error when I try to build:
Does not contain definition or extension method
I have a class like this:
[Serializable]
public class JobFile
{
private FileInfo mFileInfo;
private string mJobNumber = string.Empty;
private string mBaseJobNumber = string.Empty;
private Guid mDocumentTytpeid = Guid.Empty;
public string DocumentTypeDescription
{
get
{
string description;
DocumentType DocType;
DocType = DocumentType.GetDocType(DocumentTypeCode);
if (DocType.Code == null)
description = "Unknown";
else
description = DocType.Description;
return description;
}
}
public Guid DocumentTypeID
{
get
{
DocumentType DocType;
DocType = DocumentType.GetDocType(DocumentTypeCode);
if (DocType.Code == null)
mDocumentTytpeid = Guid.Empty;
else
mDocumentTytpeid = DocType.Id;
return mDocumentTytpeid;
}
}
Now i am trying to get the value of Documenttypeid in my other class like so:
foreach (FileInfo fi in files)
{
JobFile jf = null;
jf = new JobFile(ref fi);
f.DocumentTypeId = jf.DocumentTypeID; //<-- error is here
}
Does anyone know what could be wrong and how to fix it? Thanks.
The problem is with f.DocumentTypeId
.
Assuming it's also a JobFile
, it be f.DocumentTypeID
(note the ID not Id ). C# is case sensitive. Also, there is only a get
property accessor, not a set
.
If f
is some other type, show us the code.
The error message is very clear about what's wrong. You're trying to use a property that doesn't exist, and seeing as how the error is occuring on this line:
f.DocumentTypeId = jf.DocumentTypeID;
It could only be one of two things:
f
does not exist f.DocumentTypeId
does not exist. jf.DocumentTypeID
does not exist Honestly, I would check to make sure that f.DocumentTypeId
is not supposed to be f.DocumentTypeID
. C# is picky about things like that, and a small mistake like that would cause the error that you're receiving.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.