public static bool TryRead(ReadOnlySpan <char> text, out PollId pollId) { try { return(MemoryMarshal.TryRead(Base58.Flickr.Decode(text), out pollId)); } catch (Exception) { pollId = default; return(false); } }
public static bool TryGetPollId(ReadOnlySpan <char> text, out int pollId, out VoteEnum?format) { if (!int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out pollId)) { if (!PollId.TryRead(text, out var pollIdCombined)) { format = VoteEnum.None; return(false); } pollId = pollIdCombined.Id; format = pollIdCombined.Format; } else { format = null; } return(true); }