C# Object Oriented Question
Posted on 2012-08-31
I was working with the System.ServiceModel.Syndication namespace and I was using an instance of the SyndicationItem class and I was trying to read a value from item.content property. Item.content is of the type System.ServiceModel.Syndication.TextSyndicationContent and it has a property called text. I was able to see this value in my debugger and when I put a watch on it, it gave me this:
((System.ServiceModel.Syndication.TextSyndicationContent)(item.Content)).Text. I have a good understanding of OOP, but I have never run into an instance where I needed to use this type of syntax. I would like to someone to explain to me why I needed to read this value using this syntax. Can someone explain to me why this works that way? What does this statement: ((System.ServiceModel.Syndication.TextSyndicationContent)(item.Content)).Text mean?