Cannot convert from Link to RelatedLink !!

Joined
Aug 5, 2008
Messages
2
Reaction score
0
Hi,

i have the following lines of code:

foreach (Link link in workItem.Links)

{

RelatedLink relatedLink = link as RelatedLink;
if (relatedLink != null)

{

WorkItem relatedWorkItem = workItem.Store.GetWorkItem(relatedLink.RelatedWorkItemId);
txtTaskHistory.Text = relatedWorkItem.Id.ToString();

}

else

MessageBox.Show("there is a mistake");

}

When i debug, i see that link is not null, but relatedLink becomes null after the line
RelatedLink relatedLink=link as RelatedLink and displays error message.
Can anyone tell me what is wrong with it?

Thank you..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top