S
shapper
Hello,
I created the following class:
public class SyndicationResult : ActionResult {
public SyndicationFeed Feed { get; set; }
public SyndicationFormat Format { get; set; }
public override void ExecuteResult(ControllerContext context,
SyndicationFeed feed, SyndicationFeed format) : this(context, feed,
format) {
} // ExecuteResult
public override void ExecuteResult(ControllerContext context) {
context.HttpContext.Response.ContentType = "application/rss
+xml";
using (XmlWriter writer = XmlWriter.Create
(context.HttpContext.Response.Output)) {
switch (Format) {
case SyndicationFormat.Atom10:
Atom10FeedFormatter atom = new Atom10FeedFormatter(Feed);
atom.WriteTo(writer);
break;
case SyndicationFormat.Rss20:
Rss20FeedFormatter rss = new Rss20FeedFormatter(Feed);
rss.WriteTo(writer);
break;
}
}
} // ExecuteResult
} // SyndicationResult
On "this(context, feed, format) {" I get the error "; expected".
Can't I do it this way?
And do I need the properties on this case? ... Or maybe better, should
I have the properties in this class?
Thanks,
Miguel
I created the following class:
public class SyndicationResult : ActionResult {
public SyndicationFeed Feed { get; set; }
public SyndicationFormat Format { get; set; }
public override void ExecuteResult(ControllerContext context,
SyndicationFeed feed, SyndicationFeed format) : this(context, feed,
format) {
} // ExecuteResult
public override void ExecuteResult(ControllerContext context) {
context.HttpContext.Response.ContentType = "application/rss
+xml";
using (XmlWriter writer = XmlWriter.Create
(context.HttpContext.Response.Output)) {
switch (Format) {
case SyndicationFormat.Atom10:
Atom10FeedFormatter atom = new Atom10FeedFormatter(Feed);
atom.WriteTo(writer);
break;
case SyndicationFormat.Rss20:
Rss20FeedFormatter rss = new Rss20FeedFormatter(Feed);
rss.WriteTo(writer);
break;
}
}
} // ExecuteResult
} // SyndicationResult
On "this(context, feed, format) {" I get the error "; expected".
Can't I do it this way?
And do I need the properties on this case? ... Or maybe better, should
I have the properties in this class?
Thanks,
Miguel