Add HasValue and IsEmpty properties#37
Open
cieciurm wants to merge 2 commits intomcintyre321:masterfrom
Open
Conversation
Owner
|
I'm not sure what circumstances it could not be set?
…On Fri, 24 Mar 2023, 17:15 Mateusz, ***@***.***> wrote:
Hi @mcintyre321 <https://github.com/mcintyre321>,
Thanks for your awesome work on ValueOf.
I was trying it out and everything is great, except for the fact that I
was missing a way to check if the identifier was actually initialized with
a value. So I thought adding two properties:
- HasValue - which checks if the Value was set
- IsEmpty - which is a negation of HasValue
could be a small tweak for this small library.
Please let me know if it works for you. If there is something I can
adjust, just let me know.
Thanks,
Mateusz
BTW. I also took the liberty and updated package versions for the Test
project.
------------------------------
You can view, comment on, or merge this pull request online at:
#37
Commit Summary
- b4c4958
<b4c4958>
Add HasValue and IsEmpty properties
File Changes
(3 files <https://github.com/mcintyre321/ValueOf/pull/37/files>)
- *A* ValueOf.Tests/HasValue.cs
<https://github.com/mcintyre321/ValueOf/pull/37/files#diff-1dab2d9a854f5a60cbab9ee8046e269be51dd19dc2bcc713ec98ead4a86e0630>
(71)
- *M* ValueOf.Tests/ValueOf.Tests.csproj
<https://github.com/mcintyre321/ValueOf/pull/37/files#diff-78b79a46bf976d09eea9d8183285608d6e834e0567b0fa21befd315d4480c758>
(6)
- *M* ValueOf/ValueOf.cs
<https://github.com/mcintyre321/ValueOf/pull/37/files#diff-009de4af0fa7a432848cafd361ab40f9449b7e36e7917c6346740bafe34aefee>
(4)
Patch Links:
- https://github.com/mcintyre321/ValueOf/pull/37.patch
- https://github.com/mcintyre321/ValueOf/pull/37.diff
—
Reply to this email directly, view it on GitHub
<#37>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACDJ6RTUHE6NSLPSERSC23W5XJCJANCNFSM6AAAAAAWG2MPSU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Author
|
Currently, if you instantiate a new object deriving from Example: public class StringId : ValueOf<string, StringId> { }
var id = new StringId();The When I was trying out the library for the first time, that's how I created an instance of my identifier. I didn't notice that there was a So, I think that having those properties could be helpful in other parts of codebase to determine whether the identifier has been initialized from a value, or is it being created without specifying it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @mcintyre321,
Thanks for your awesome work on
ValueOf.I was trying it out and everything is great, except for the fact that I was missing a way to check if the identifier was actually initialized with a value. So I thought adding two properties:
HasValue- which checks if theValuewas setIsEmpty- which is a negation ofHasValuecould be a small tweak for this small library.
Please let me know if it works for you. If there is something I can adjust, just let me know.
Thanks,
Mateusz
BTW. I also took the liberty and updated package versions for the Test project.