|
Gerry Schmitz wrote: Reflection can tell you what's being passed even when using all "objects". Why would you bring "reflection" into this ? Make the mess worse ?
Show me the code !
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 7-Apr-19 6:57am.
|
|
|
|
|
Please consider my response to Schmitz here:
imho, all of these implementations are hacks, and writing straightforward individual methods for each group of Types is better practice.
To me the attempt here to make these generic methods more "generalized" just leads to semantic confusion. It's not that much work to write a bunch of specific methods that can provide strict control over parameter validation, and can be unit tested efficiently. Sometimes it's better not to be clever
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Using a step by step guild I created a "Engine" project in the solutions explorer and added classes to this "Engine project. In the main code I was able to refer to the "Engine" project by using "include Engine;. I noticed that when compiled C# had created a Engine.dll that contained all the classes.
I was wondering where the library of dll's are kept so I could add this engine.dll to the library to use in the future for some other code.
I'm pleased that you can create a lot of libraries to handle varibles and procedures which makes coding the main program much easier as you can use code such as '_player.CurtrentLocation.Description' and '_player.CurrentHitPoint' to refer to parts of the program within the DLL. Also there is no need for extra variables within the brackets, so this is possibles 'DisplayCurrentLocation()' making the code more tidier.
Brian
|
|
|
|
|
They are kept ... exactly where you put them!
When you create a solution, it creates a folder for it, and sub folders for each project in that solution - the source code is stored there, and the binaries in yet more subfolders.
The easiest way to find out exactly where a referenced library is is to open the "References" tab of your new project, and right click the reference. Select "Properties" and you will see the location under "Path".
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks Griff for your reply.
I tried right clicking on Engine3 in the
At the moment Engine.dll is stored at
Documents\Visual Studio 2015\Projects\SuperAdventure3\Engine3
But if I create a new project called such as Test010119 then I want to copy the Engine3.dll over to my new project so I can reuse some of the classes in Engine3. I don't know where to move Engine3.dll so it's recognized by the new program.
Brian
|
|
|
|
|
I don't tend to move them, instead I add a reference to the project, so I get the "latest version" if it gets updated (and a copy of the DLL will get added to your debug or release folders) or I add the project as an "Existing Project" to the solution which lets me update the DLL project from both solutions (that one takes a little discipline in order to not break other apps!)
My Utilities are never constant - I add methods and classes to them all the time, and this way I get the "Latest version" to work with regardless of the project I am working on.
The other solution is to install your DLL in the GAC but that means strong names and so forth: How to: Install an assembly into the global assembly cache | Microsoft Docs[^]
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the link Griff, it will be very useful.
Brian
|
|
|
|
|
BTW Brian, you do realize you can have a better username than "Member 14154627" if you want?
It's easy to do, just hover over your username at the top right and select "Settings" - change "Your Display Name" to one that is free ("Brian" is taken, but "Brian The Great" isn't for example - though that last may be a little presumptuous ). Click "Save My Settings" and you have a new display name
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks Griff.
I should now appear as Brian the Lion if all goes well (the name just popped up in my head).
Brian
|
|
|
|
|
Hopefully this time I appear as BrianTheLion
Brian
|
|
|
|
|
At the moment it says "Brain" instead of "Brian" … but that's quite cool
|
|
|
|
|
CHill60 wrote: that's quite cool animal cruelty
FTFY!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
It should be BrianTheLoin.
It may have picked up Brain from my computer. When the tech installed the operating system he typed in Brain instead of Brian by mistake.
Brian
|
|
|
|
|
And now you have BriainTheLion!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Opps I see what you mean.
It won't let me change to BrianTheLion (says it's taken) so BriainTheLion well have to do.
|
|
|
|
|
The standard libraries that are part of .NET are already on your system. Most of them will be in the GAC.
If you want to distribute your assembly, then I'd suggest CodeProject if you can take the time to write an article on what the thing does, and how/why it was built. If you don't feel like writing an article and just want to share the code, I'd recommend GitHub.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi Eddy.
I just want to use some of the classes within Engine3.dll in a new project. So I need to copy Engine.dll from my old project over to my new project but don't know where the destination is to put Engine3.dll
Brian
|
|
|
|
|
The assembly would need to become part of the project; easiest way to do so is to create a "bin" folder (or similar) and drop them all there, with "Copy to target" to true. When building, the assemblies would be copied to the build-folder.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thanks Eddy, I'll keep that in mind.
Brian
|
|
|
|
|
You're welcome
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi,
when you want to reuse a library (a managed code DLL file), you must “add a reference” and Visual Studio will include the DLL in your new project and copy it to the approapriate location. Copying the file yourself would not be sufficient.
|
|
|
|
|
Hi Luc.
When you say reference do you mean add "using Engine3" to my code?
If I did that then it still needs to know where to find Engine.dll, maybe your referring to something else.
Brian
|
|
|
|
|
There is a menu item that says either “add ...” or “add reference”, it may be a context menu for your project in the “solution pane”. Look around and you will find it.
|
|
|
|
|