Skip to content

Commit 10cbdbb

Browse files
committed
use First instead of FirstOrDefault
1 parent eba7b64 commit 10cbdbb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/Linq/SvgExample/StronglyTypedTools.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public static void AddSvg(Stream stream, string svgPath, double percentageOfCy)
2828
}
2929

3030
// Get relationship ID of first slide.
31-
string sldRelId = presentationPart
31+
string? sldRelId = presentationPart
3232
.Presentation
3333
.SlideIdList?
3434
.Elements<Presentation.SlideId>()
3535
.Select(slideId => (string)slideId.RelationshipId!)
36-
.FirstOrDefault() ?? throw new InvalidOperationException("Presentation has no slides.");
36+
.First();
3737

3838
// Get first slide's part.
3939
var slidePart = (SlidePart)presentationPart.GetPartById(sldRelId);

0 commit comments

Comments
 (0)