Skip to content

Commit

Permalink
Revert "Improve/simplify Optional OrDefault()"
Browse files Browse the repository at this point in the history
This reverts commit c73a1cd.
  • Loading branch information
andreise committed Jan 11, 2025
1 parent c73a1cd commit ff98747
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Runtime.CompilerServices;

namespace System;

partial struct Optional<T>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private T? InnerOrDefault()
=>
hasValue ? value : default;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ partial struct Optional<T>
{
public T? OrDefault()
=>
value;
InnerOrDefault();
}

0 comments on commit ff98747

Please sign in to comment.