|
What does that even mean?
|
|
|
|
|
Using concurrent collections.
Thread-Safe Collections | Microsoft Learn
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.
Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?
That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Member 14055879 wrote: same background process for all forms
Just guessing and a question that is not specific enough...
No.
A windows "background process" is one that does not have a UI and thus would not have "forms"
(Also wondering if this same question was asked a long time ago on this site?)
|
|
|
|
|
Look Ma: field name duplication: no new, no overrides, no crash ...
public class stuff1
{
public const int somenumber = 42;
}
public class stuff2 : stuff1
{
public int getconst()
{
return somenumber;
}
public const int somenumber = 45;
}
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
I get a warning:
'stuff2.somenumber' hides inherited member 'stuff1.somenumber'. Use the new keyword if hiding was intended. And since I always run with "Treat warnings as errors" enabled, my code wouldn't compile without that being dealt with.
Check your Error pane settings - you may have warnings hidden.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Interesting, thanks; I'm using VS Version 17.4.4; I'm not seeing amy warnings/messages in Error window at either build time or run-time.
I eyeball the myriad 'Options for VS/Debugging, and it looks like everything is enabled that would catch any error, etc.
Ahhh ... one Googling later ... I did not have the 'Build + Intellisense' filter option set in the Error Window, but, I still build and run with no exception thrown.
Yes, I do see CS108 which mentions using 'new.
I have checked all the options the Break On Errors TreeView.
p.s. note that without the 'new modifier the call in 'stuff2 is accessing the const vale defined in'dtuff2: #45
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
You should at least see a squiggly underline unless you have them turned off. They're annoying, but I leave them on as they are handy...
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
|
|
|
|
|
I see demons, but, not squiggles My impaired eyes are giving out for today, but, I note the apparent absence of 'show squiggles' in Tools/Options/C#/Advanced ... while /...C/C+ still has it.
Will look again, tomorrow.
thanks, Bill
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Yes, that's what the warning is there for: to make sure you are doing what you intended, not accidentally hiding the original.
You don't get any exception because it is legal: it's a compile time problem only (and because it's a warning, it assumes the new for you).
Try going to your project properties, "Build" tab, and selecting "Treat warnings as error" to "All" - that should cause a compiler problem with that code.
My default new project includes that setting!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: Try going to your project properties, "Build" tab, and selecting "Treat warnings as error" to "All"
::::::::: :::::::: :::::::: :::: :::: :::
:+: :+: :+: :+: :+: :+: +:+:+: :+:+:+ :+:
+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+:+ +:+ +:+
+#++:++#+ +#+ +:+ +#+ +:+ +#+ +:+ +#+ +#+
+#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+# #+# #+#
######### ######## ######## ### ### ###
😂🎉
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
|
|
|
|
|
I run with it all the time - the only time it gets annoying is when I forget to add an XML comment to a public item.
Every now and then, it picks up a "whoopsie" that I would have had to scratch my head over when it failed testing ... and that makes it all worthwhile.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yep, if you do it from the start, should not be an issue, but to apply it to existing code would be painful if there are a number of existing warnings.
Personally, I kill warnings as I go. I tend to write code quickly, then tighten it up once I'm happy with the execution. Allows flexibility where and when needed. Commits must be warning-free.
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
|
|
|
|
|
That's why "Treat errors" is so valuable: it won't let you continue unless you fix 'em!
I.e. I can't get lazy and procrastinate
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
many CS*** warnings are trivial, and disatracing. the issue here is how to break on errors at build-time, and you have nailed that !
you do have the ability to name CS*** you want blocked by entering them one by one in the Build facility.
i keep thinking one of the several updates of VS/64 did alter/reset my basic default project settings.
thanks, Bill
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
So THEHORROR=VISUALSTUDIO (-> tldr)?
Since I upgraded from VS2010 to the glitzy VS2022 (64-bit) I've never been more imprressed by a Microsoft corporation product paying attenciaonen to beautiful code intepretation and the ease with which it is now possible to throw gathered VS6.0 16-bit internet snippets at a compiler and get something to deliver the white bones of an executable that'll run away on it's own on Windows 10.
Horror, no ... honorable been-there-'doin-that-now, yes.
|
|
|
|
|
Yep. The more I use it, the more impressed I get with autocomplete as well. Intelligent assistance rather than dumb templating ... nice.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Same here; I really cannot understand people who complain about Visual Studio. I guess like "the young", they have no experience of life without technology that does everything for them - well almost everything.
|
|
|
|
|
Growing up with decks of cards, then paper tape, then real time Z80 assembler with a debugger you had to write yourself gives you an appreciation of how much easier it all is these days, I guess.
And most of 'em don't use the truly excellent debugger they are given for free, or even know it exists.
When I think back to C dev for Z80: Brief editor, IAR compiler / linker (with home written assembler where needed), EPROM programmer, screwdriver, run, swear, back to Brief ... and today I get compiler errors while I type the code along with suggested code that actually helps. We've come a long way.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: I use it
Well, I twitch spasmodically like sugarboy here ... but it sounds like you get the gist.
Op, there's Jimmy now. Tice. Gotta go.
|
|
|
|
|
You post a message congratulating yourself for using a later version of VS ... I use the latest version, also ... in a thread about a specific issue using VS.
You say nothing relevant to the issue and the context.
I seldom down-vote posts, but, you earned it.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
BillWoodruff wrote: why does C# let me get away with this
Doesn't java and C++ allow the same thing?
Certainly in terms of identifier resolution I wouldn't expect anything else.
|
|
|
|
|
thanks, interesting, I have not used Java or C++ IDE's.
i do struggle with both "loving" C#, and wishing it was even more build-time "strongly typed" ... PostSharp is an example of how strong-typing can be extended via Attributes... of course, PostSharp is rewriting IL code post compilation, and what it does is fiendlishly complex ... and using it is complex.
for me, seeing duplicate top level field/property/method/whatever names is a red flag: of course, i see no flags with reuse of names for local trivial reasons, like i/j/k for for-loops.
for me, using ReSharper (been using it many years) does provide some critical support.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
From memory, I believe Java defaults to virtual methods - so unless you specifically tell it not to, the method in the derived class will be called. This increase the risk of breaking changes simply by updating a package you depend on. If the base happens to have added a method you also have (not that unheard of as you might have overwritten to add a feature the library author is also working on), then your code will execute to the surprise of both of you. In C# with default implementation both the base class and the derived class will execute the same code they did before the update if no other code change is made.
|
|
|
|
|
lmoelleb wrote: I believe Java defaults to virtual methods
Correct.
|
|
|
|