|
Hello? You there? You want a C++ style vector to store 2 values? Why should it change in size? You didn't studied even the stl, did you?
This just proves that you don't know anything about the things you're writing and just keep whining about everything you don't get right in the first place (by pure chance).
Why List<string> isn't fit? Or ArrayString, if you need not type checking?
Why string[2] is not ok?
If the 2 elements are really different things, why not write down a class with 2 properties?
Noooo, let's just pretend you already know everything you need and bash the framework on the internet.
I hope I'll never have to maintain your code.
|
|
|
|
|
robocodeboy wrote: Why List<string> isn't fit? Or ArrayString, if you need not type checking?
Why string[2] is not ok?
If the 2 elements are really different things, why not write down a class with 2 properties?
Because i have a pairs of 2 strings which i have to store and modify.
Did you try making List<string[2]> type value ?
I don't need a new class i have a structure defined already in c# (even 3 stuctures)
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
Either you're a troll or you don't know what you're talking about.
Strings in C# are immutable anyway. But you can assign to List and array in which way you want.
List<string> list = new List<string>() { "a", "b" };
list[0] = "I";
list[1] = "work";
string[] array = new string[2] { "1", "2" };
array[0] = "Me";
array[1] = "too";
|
|
|
|
|
robocodeboy wrote: And an elegance in C# that is unknown to Java. You are mistaken c# doesn't have any elegance. The elegance you see is only part of the beauties of c and c++. But ofcouse M$ decided that not all is needed and they decided to leave some things (templates, pointers, friend, and so on) and call it a new language because they added few libraries.
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
Yes, of course.
C++ is so elegant that his grammar is undecidable, and no IDE in the world can give you a decent code completion. But maybe you're Klingon and you remember variable names by heart.
C is elegant, yes. Just as an haiku. I completely enjoyed writing really quick, incomprehensible code that did simple stuff in clever ways, but designing UIs in C or C++ is an exercise in pain. Not mentioning organizing and building complex projects.
C++ templates can do some clever stuff, but generics are pretty similar and less prone to breaking apart your build time. The only thing I miss in C# are mixins, but they are hard to manage even in C++.
Pointers are in C# too, but you don't need to use them, usually. You can, but only if you have tight loops to be optimized.
Friend is useless if you have internal members and friend assemblies. And private is considered more valuable than it is and not unit testable.
Oh, and if "few libraries" means the single most extended library in existence yes, you are right.
To one that makes this kind of statements, I can only suggest to (choose one in three):
- RTFM and stop blaming others for what you get in the toolkit, instead of having to roll your own.
- change language. Maybe the kind of stuff you're doing is not best suited for C# (I doubt, but...)
- write your own language. You seem to be a world class language guru. Way better than that M$ scum. For sure you can tackle that task.
A language is a tool, if you can't do stuff and blame the tool, either you change it or learn to use it.
Blaming is easier (I remember people complaining about that stupid C compiler that was continually raising segmentation faults).
Good luck!
|
|
|
|
|
Argonia wrote: Who the hell had the brilliant idea to make Tuples read only?
er Eric Lippert[^]...but what does he know anyway!
|
|
|
|
|
I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:
if (Session["tWidth"] != null)
{
htmlToImageConverter.BrowserWidth = int.Parse("1025");
}
I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
And what is the tWidth for? Is it an integer? Or just some random value?
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
I had a difficult time understanding that as well. 'tWidth' is, in fact, an integer. In other places throughout the project it's used to store the width of certain widgets in a report. But this particular statement, I have no idea. That's literally all the code in it. It never references 'tWidth' in this particular section. *smh*
There are a ton of bad practices in this project. A lot of empty 'catch' statements after a large 'try' block and so forth. Almost *ZERO* comments. Blah, blah, blah.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
It may be for those special people with a 1025 x 768½ screen resolution?
|
|
|
|
|
The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace temporarily
htmlToImageConverter.BrowserWidth = int.Parse(tWidth);
by
htmlToImageConverter.BrowserWidth = int.Parse("1025");
But then forgot to change it back. And nobody complained till you happened to find that WTF...
|
|
|
|
|
Quote: But then forgot to change it back. You're probably right; however, that takes all the fun out of harassing the previous developer for this.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
That's a very reasonable observation, and you're probably quite right. Thank you for that. Now I'm going to put "tWidth" back in there and see if it fixes some of these problems. Haha.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Be careful! It might introduce a new defect now - do you know how many later changes assume that that WTF is the correct solution?
|
|
|
|
|
Haha. I changed it and it didn't make any difference whatsoever.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
You lack experience with such WTF code! In some two or three years, a customer will complain about a page being too wide or too narrow...
And then the new guy working on the project will submit your little change as a WTF: a useless change introducing a new bug.
That's how such WTF code works...
|
|
|
|
|
I do lack experience. This is the first project I've ever worked on that was written by someone else.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Bernhard Hiller wrote: and a developer decided to replace temporarily
You seem to know about it very well. I can almost pinpoint who that was.
Signature construction in progress. Sorry for the inconvenience.
Damn you have the perfect signature - CBadger
|
|
|
|
|
Oh dear, I'd better use a different login name for such posts...
|
|
|
|
|
that's easy to fix, just change it to:
int.Parse(int.Parse("1025").ToString());
|
|
|
|
|
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
This is from another forum I visit once in a while, somebody posting a code snippet:
void loop(){
byte rxbyte; byte temp; rxbyte = serial_getch();
if (rxbyte == 254) {
switch (serial_getch()) {
And it continues on like that. At least we know what the 'compiler' is doing when you declare a variable
|
|
|
|
|
You'd think they'd spell check it.
|
|
|
|
|
I see not speelign errors!
Mind you, I like the quotes round "compiler" - as if they aren't quite sure it is a compiler, it might be a fridge or something like that...
I do rely on spell checkers a lot - I even have a VS extension for string and comment checking - but I like the Chrome one, especially when it picks up grammar problems!
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|