Skip to content

Commit 469c767

Browse files
committed
Implement changes from review
* Removed redundant check in `Attachment.cs` `CopyFrom` method. * Updated `Period.cs` and `Trigger.cs` to use `Copy<IDateTime>()` method. * Modified `Alarm` class to implement `IComparable<Alarm>` with `CompareTo` method.
1 parent 1a8c88e commit 469c767

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net6.0;netcoreapp3.1;net48</TargetFrameworks>
5-
<OutputType>Exe</OutputType>
6-
<LangVersion>latest</LangVersion>
7-
</PropertyGroup>
8-
9-
<ItemGroup>
10-
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
11-
</ItemGroup>
12-
13-
<ItemGroup>
14-
<ProjectReference Include="..\Ical.Net\Ical.Net.csproj" />
15-
</ItemGroup>
16-
2+
<PropertyGroup>
3+
<TargetFrameworks>net8.0;net6.0;netcoreapp3.1;net48</TargetFrameworks>
4+
<OutputType>Exe</OutputType>
5+
<LangVersion>latest</LangVersion>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
9+
</ItemGroup>
10+
<ItemGroup>
11+
<ProjectReference Include="..\Ical.Net\Ical.Net.csproj" />
12+
</ItemGroup>
1713
</Project>

Ical.Net.Tests/Ical.Net.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<TargetFrameworks>net8.0;net6.0;net48</TargetFrameworks>
44
<SignAssembly>true</SignAssembly>
55
<AssemblyOriginatorKeyFile>..\IcalNetStrongnameKey.snk</AssemblyOriginatorKeyFile>
6+
<LangVersion>latest</LangVersion>
67
</PropertyGroup>
78
<ItemGroup>
89
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />

Ical.Net/CalendarComponents/Alarm.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace Ical.Net.CalendarComponents
1010
/// </summary>
1111
public class Alarm : CalendarComponent
1212
{
13-
//ToDo: Implement IEquatable
1413
public virtual string Action
1514
{
1615
get => Properties.Get<string>(AlarmAction.Key);
@@ -177,4 +176,4 @@ protected virtual void AddRepeatedItems()
177176
}
178177
}
179178
}
180-
}
179+
}

Ical.Net/DataTypes/Attachment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public override void CopyFrom(ICopyable obj)
7878
base.CopyFrom(obj);
7979

8080
Uri = att.Uri != null ? new Uri(att.Uri.ToString()) : null;
81-
if (att.Data != null && att.Data.Length != 0)
81+
if (att.Data != null)
8282
{
8383
Data = new byte[att.Data.Length];
8484
Array.Copy(att.Data, Data, att.Data.Length);

Ical.Net/DataTypes/Period.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public override void CopyFrom(ICopyable obj)
5151

5252
if (obj is not Period p) return;
5353

54-
StartTime = p.StartTime;
55-
EndTime = p.EndTime;
54+
StartTime = p.StartTime?.Copy<IDateTime>();
55+
EndTime = p.EndTime?.Copy<IDateTime>();
5656
Duration = p.Duration;
5757
}
5858

Ical.Net/DataTypes/Trigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public override void CopyFrom(ICopyable obj)
8282
return;
8383
}
8484

85-
DateTime = t.DateTime;
85+
DateTime = t.DateTime?.Copy<IDateTime>();
8686
Duration = t.Duration;
8787
Related = t.Related;
8888
}

0 commit comments

Comments
 (0)