Page 1 of 2
Early Easter Quiz Question !!?? .....
Posted: Mon Feb 20, 2017 10:37 pm
by Phil Hepburn
Hi guys,
Well, its time for some fun - educated, professional fun, before the Easter break !!
Below is an image of two Enums that I coded recently, into my test app for making data Input Masks.
- MasksANdEnums_01.jpg (118.81 KiB) Viewed 625 times
Now then, without cheating, or doing any deep research, you have to guesstimate the number of similar Enum structures available for us to use in the standard set of assemblies making up the References 'set' in a reasonably standard WPF app in X#. lets say an MVVM app with Entity Framework and Galasoft MVVM framework.
I am currently working on a WPF demo app to allow us to see those that are in the DLLs, and view the full details on screen - in an interesting way. Along with the total count.
I expect guys (friends and colleagues, and all X# Forum readers) to post their guesses in short posts - before I post my app solution - so get estimating ;-0) Answers to be posted starting NOW !
Their is more to Enums than we first think - they appear so simple on the surface - BUT - in fact have a big impact on our .NET coding. I am still coming to terms with them - years after I first found how good they are. I am sure we all need to use them more than we do.
Best regards,
Phil.
Wales, UK.
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 10:24 am
by Phil Hepburn
Hi guys,
Just to give you a general pointer I have attached an image showing the reference DLLs from which I will provide a total of the Enums available to us.
- MasksAndEnums_02.jpg (102.48 KiB) Viewed 625 times
Good Guessing ;-0)
Cheers,
Phil.
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 1:31 pm
by Phil Hepburn
Okay guys,
You obviously need some help on this topic / question !
I now know the answer BUT am not going to tell until a few of you guys post a guess. Come on Karl you are always game for this sort of a challenge ;-0)
Attached is an image of my early test / trial app running - you can only see the collection of Assemblies which I am scanning, and examining.
- MasksAndEnums_11.jpg (117.87 KiB) Viewed 625 times
I plan to have a much more fun and interactive WPF form to allow users to select individual assemblies, and then any Enums found, to see their members and values.
Does anyone out there know how to easily get hold of all the DLLs in the Reference section. I have previously used the 'Assembly.GetExecutiveAssembly()' but this is limited it which DLLs it seems to find and make available.
Okay then folks, a hint on the grand total of Enums in these bunch of assemblies.
Let me say that there are more than the number of goals that Sunderland have scored in the Premiere League this season ;-0)
I may give you a more precise hint later. Possibly you need some more time to reflect on the question, and even reflect on the answer too !
Now post in your good guesstimates ......
Cheers,
Phil.
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 1:48 pm
by Frank Maraite
OK Phil.
I would say: about a hundred and fifty.
But I would not be surprised if it is about five hundreds.
Frank
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 1:57 pm
by Phil Hepburn
Thanks for joining in the competition Frank ;-0)
Thinking about your answer I would say in that case you may just be surprised.
This now chances the 'ball park' for answers from Karl, Wolfgang et all ;-0)
I now attach another image which shows a 'window' in the ListBox display which shows some real answers - as well as the size of the 'thumb' in the scroll bar.
- MasksAndEnums_21.jpg (125.32 KiB) Viewed 625 times
Note also that the Enum items are not in alphabetic order - yet.
I have even shown you half of the code to provide the answer ;-0) So logically this means you should get half of the Grand Total value.
Good guessing .........
Cheers,
Phil.
Wales, UK.
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 3:45 pm
by wriedmann
Hi Phil,
please don't expect an answer from me - I'm much under time pressure for a project and than taht I will be offline for a few days now.
Wolfgang
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 4:01 pm
by Frank Maraite
Come on Wolfgang,
after my shot in the dark and Phil's answer it should not be difficult anymore. Just a number, not more. It's fun.
Frank
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 4:15 pm
by wriedmann
Hi Frank,
I don't think Phil was asking us about a shot in the dark.... With Reflection it should be relatively easy to find out the required number, but I don't have the time to dedicate.
I would suspect that in all these libraries there are much more than 1.000 enums. It is enough to see how many enums are only used in the WPF classes.
Wolfgang
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 4:17 pm
by FFF
Now then, some 5k i'd suspect. What reminds me of the frontispiz of one of Ivo Wessel's books, citing Ockham's razor: "non sunt multiplicanda entia sine necessitate" - don't introduce "new things" if not really, but really, necessary...
Early Easter Quiz Question !!?? .....
Posted: Tue Feb 21, 2017 4:45 pm
by Phil Hepburn
Well guys,
Now that you are loosening up a little, and letting you feelings guide you, as a team you are getting there ;-0) And how long does a quick guess take, as Frank so rightly said ?
Although what Ockham has to do with this I could not fathom out Karl !? But I did like Ivo's style of doing things. Anything.
And all my original point was about, was - we all need and use Enums, but often without much thought as to their importance, even if they are not as complex as the rest of the stuff we often need to use in .NET, we can't do without them. And our code would break if the underlying values were in any way re-mapped. Break big-time.
Below the image shows that from the large pile of 'found' enums we can in fact find the one which caused all of this fun in the first place.
'RegexOptions' is required for the Mask code I have been discussing recently.
- MasksAndEnums_31.jpg (48.67 KiB) Viewed 625 times
Notice that the long list is now in alphabetical order - and this was done by a simple and small bit of LINQ code. See this next image and the code beneath it :-
- MasksAndEnums_32.jpg (83.53 KiB) Viewed 625 times
In fact I have used quite a few bits of LINQ code in my lines of code to find Assemblies and Enums - and values etc. Long live LINQ - or 'LLL' for short ;-0)
And with an extra bit of code we can list and see the members of this Enum structure 'RegexOptions'.
The values allow multiple use of the members - in a bit-wise fashion (more another time).
- MasksAndEnums_33.jpg (33.17 KiB) Viewed 625 times
Oh! and I still have not given the answer I found ;-0)
Lets wait to see if some guy comes up with an even better guess ! Even a second Team answer.
New hint - billions is just a bit too far to imagine etc..
OR - divide the height of the 'thumb' into the length of the vertical scroll bar, and get the wrong answer !!??
Good Luck,
Speak soon,
Phil.