OSDN Git Service

readonly structを使用する
authorKimura Youichi <kim.upsilon@bucyou.net>
Sun, 23 Jun 2019 08:36:48 +0000 (17:36 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sun, 23 Jun 2019 08:52:53 +0000 (17:52 +0900)
OpenTween/DateTimeUtc.cs
OpenTween/Models/PostClass.cs
OpenTween/Models/TabModel.cs
OpenTween/Tween.cs

index 38d5727..5dad2c7 100644 (file)
@@ -27,7 +27,7 @@ namespace OpenTween
     /// <summary>
     /// <see cref="DateTimeKind.Utc"/> に固定された <see cref="DateTime"/> を扱うための構造体
     /// </summary>
-    public struct DateTimeUtc : IComparable<DateTimeUtc>, IEquatable<DateTimeUtc>
+    public readonly struct DateTimeUtc : IComparable<DateTimeUtc>, IEquatable<DateTimeUtc>
     {
         public static DateTimeUtc MinValue { get; }
             = new DateTimeUtc(DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc));
index e1d61a3..2954189 100644 (file)
@@ -37,7 +37,7 @@ namespace OpenTween.Models
 {
     public class PostClass : ICloneable
     {
-        public struct StatusGeo : IEquatable<StatusGeo>
+        public readonly struct StatusGeo : IEquatable<StatusGeo>
         {
             public double Longitude { get; }
             public double Latitude { get; }
index e8c485d..ce9b973 100644 (file)
@@ -103,7 +103,7 @@ namespace OpenTween.Models
 
         public abstract Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress);
 
-        private struct TemporaryId
+        private readonly struct TemporaryId
         {
             public long StatusId { get; }
             public bool Read { get; }
index 2d232d6..a2e597f 100644 (file)
@@ -285,11 +285,11 @@ namespace OpenTween
 
         private List<urlUndo> urlUndoBuffer = null;
 
-        private struct ReplyChain
+        private readonly struct ReplyChain
         {
-            public long OriginalId;
-            public long InReplyToId;
-            public TabModel OriginalTab;
+            public readonly long OriginalId;
+            public readonly long InReplyToId;
+            public readonly TabModel OriginalTab;
 
             public ReplyChain(long originalId, long inReplyToId, TabModel originalTab)
             {