@@ -5,58 +5,52 @@ namespace SimpleFeedReader;
55/// <summary>
66/// Represents an item from a <see cref="SyndicationFeed"/>.
77/// </summary>
8- public class FeedItem
8+ public record FeedItem
99{
1010 /// <summary>
1111 /// The Id of the <see cref="FeedItem"/>.
1212 /// </summary>
13- public string ? Id { get ; set ; }
13+ public string ? Id { get ; init ; }
1414
1515 /// <summary>
1616 /// The Title of the <see cref="FeedItem"/>.
1717 /// </summary>
18- public string ? Title { get ; set ; }
18+ public string ? Title { get ; init ; }
1919
2020 /// <summary>
2121 /// The Content of the <see cref="FeedItem"/>.
2222 /// </summary>
23- public string ? Content { get ; set ; }
23+ public string ? Content { get ; init ; }
2424
2525 /// <summary>
2626 /// The Summary of the <see cref="FeedItem"/>.
2727 /// </summary>
28- public string ? Summary { get ; set ; }
28+ public string ? Summary { get ; init ; }
2929
3030 /// <summary>
3131 /// The Uri of the <see cref="FeedItem"/>.
3232 /// </summary>
33- public Uri ? Uri { get ; set ; }
33+ public Uri ? Uri { get ; init ; }
3434
3535 /// <summary>
3636 /// The images of the <see cref="FeedItem"/>.
3737 /// </summary>
38- public IEnumerable < Uri > ? Images { get ; set ; }
38+ public IEnumerable < Uri > ? Images { get ; init ; }
3939
4040 /// <summary>
4141 /// The vategories of the <see cref="FeedItem"/>.
4242 /// </summary>
43- public IEnumerable < string > ? Categories { get ; set ; }
44-
45- /// <summary>
46- /// The Date of the <see cref="FeedItem"/>.
47- /// </summary>
48- [ Obsolete ( "Split into PublishDate and LastUpdatedDate" ) ]
49- public DateTimeOffset ? Date => new [ ] { PublishDate , LastUpdatedDate } . Max ( ) ;
43+ public IEnumerable < string > ? Categories { get ; init ; }
5044
5145 /// <summary>
5246 /// The publication date of the <see cref="FeedItem"/>.
5347 /// </summary>
54- public DateTimeOffset ? PublishDate { get ; set ; }
48+ public DateTimeOffset ? PublishDate { get ; init ; }
5549
5650 /// <summary>
5751 /// The date when the feeditem was last updated <see cref="FeedItem"/>.
5852 /// </summary>
59- public DateTimeOffset ? LastUpdatedDate { get ; set ; }
53+ public DateTimeOffset ? LastUpdatedDate { get ; init ; }
6054
6155 /// <summary>
6256 /// Initializes a new <see cref="FeedItem"/>.
@@ -67,24 +61,6 @@ public FeedItem()
6761 Categories = [ ] ;
6862 }
6963
70- /// <summary>
71- /// Initializes a new <see cref="FeedItem"/> by copying the passed item's properties into the new instance.
72- /// </summary>
73- /// <param name="item">The <see cref="FeedItem"/> to copy.</param>
74- /// <remarks>This is a copy-constructor.</remarks>
75- public FeedItem ( FeedItem item )
76- : this ( )
77- {
78- Title = item . Title ;
79- Content = item . Content ;
80- Summary = item . Summary ;
81- Uri = item . Uri ;
82- PublishDate = item . PublishDate ;
83- LastUpdatedDate = item . LastUpdatedDate ;
84- Images = item . Images ;
85- Categories = item . Categories ;
86- }
87-
8864 /// <summary>
8965 /// Returns content, if any, otherwise returns the summary as content.
9066 /// </summary>
0 commit comments