|
Hi,
That worked, thank you!
|
|
|
|
|
Use the Hide method instead of Close, if you intend to reuse it.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I don't understand why anyone would intentionally use a partial class. Keep in mind I'm a C++ programmer who occasionally has to work on .Net crap.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
It's used primarily for:
1) Breaking up large class files to allow parallel development, which might be otherwise prevented in a single file.
2) Splitting up designer code from user code to allow MS to modify its code without disturbing yours (and visa versa).
And I would hardly think .NET is crap...since C++ is just the predecessor of C#.
|
|
|
|
|
Andrew Rissing wrote: since C++ is just the predecessor of C#.
Rubbish. C# is based on Java. It, like Java, has C++ like syntax to try and get C++ programmers to use it, but they are chalk and cheese.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well, I don't disagree that C# and Java are similiar, but C# is more like the marriage of C++ and Java.
Personally, a language is a language is a language. If it gets you to what you want with the least amount of pain/effort all the better. They're all just appropriate tools for certain tasks.
|
|
|
|
|
Andrew Rissing wrote: but C# is more like the marriage of C++ and Java.
How ?
Andrew Rissing wrote: If it gets you to what you want with the least amount of pain/effort all the better. They're all just appropriate tools for certain tasks.
I don't disagree, I use C++ and C# equally, and am happy with both. But, C# is *not* an evolution of C++, it's very different.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
C# is C++ style with Java's managed environment (if you consider Java being the 'originator' of such).
And yes, C# is very different from C++. It was from the ground up a new language (compiler/design/etc.). But the point was merely that many of the constructs/ideas from C++ found their way into C#. They designed C# to be a natural transition for C/C++ programers into the managed world. Hence, why I said it was predecessor.
I just think it was funny for someone who's a C++ programmer to knock C# because of what it was partly designed off of.
|
|
|
|
|
Christian Graus wrote: C# is based on Java.
C# is influenced by Java, C++, Delphi, Visual Basic and a few other things, according to one of the co-designers.
Kevin
|
|
|
|
|
You've never broken a C++ class into multiple cpp files, so that different areas can be checked out to different people at the same time ?
It is in fact a C++ feature that was late arriving to C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: You've never broken a C++ class into multiple cpp files, so that different areas can be checked out to different people at the same time ?
Never, in 17 years of C++ development, have I ever done that. Of course, the largest team I've ever been on was comprised of just three programmers, but still, the apps we were developing consisted of as many as 720,000 lines of code (a medical records database app consistig of over 4700 source files - the team has never been larger than three programmers) with the smallest app being just 175,000 lines (a federal and state estate tax calculation and flowcharting app with just over 1200 source files - the team was two programmers).
We weren't religiously adhering to strict OOP design/coding, but we tried to plan each class as carefully as we could before implenting it. In all that time, I've used multiple inheritance just twice, and never needed to make "friend" classes or use the "goto" keyword.
Now, back to the original question (and beyond what Christian provided), what are partial classes good for?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Andrew answered your question just fine.
Just because you don't use something that way, it doesn't mean that it's not it's intended use. It's just like the goto command, it's there even if you never use it.
---
b { font-weight: normal; }
|
|
|
|
|
John Simmons / outlaw programmer wrote: Never, in 17 years of C++ development, have I ever done that
I have to admit, the place it was most used the app was poorly designed, too much stuff going on in the View and Document classes of an MFC app. It's still a valid approach IMO, but not the way I saw it done.
But in .NET, the big thing is hiding the auto generated code, which just gets edited by newbies and clutters the class. I also used them recently, I have an app that has four threads running, I broke the code used by each thread into a partial class, to help me organise my thoughts in how it all worked.
John Simmons / outlaw programmer wrote: Now, back to the original question (and beyond what Christian provided), what are partial classes good for?
I've given another example. Any example will relate to organisation of code. The files get turned into one class, so there's no benefit beyond ways they help to organise code for the benefit of humans.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Got my 5, only to level out. I don't see why you got down voted for asking a question ( even one with a little attitude... )
Not that I expect you care too much about post voting
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
*All* of my questions ahve a little attitude.
I don't care about post voting, but article voting based on politics just pissees me off.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Little attitude?
Posting about .Net crap in a C# forum is a clear "Vote me down!" invitation.
Robert
|
|
|
|
|
i inset in datetime filed , the value from datetimepiker
i customed format it as dd/MM/yyyy
but in the insert statment it takes the value as MM/dd/yyyy
how can i handel the format in sql statment
thanks for help
MD_NADA
|
|
|
|
|
well, you can build a custom formatted string, if that's your only option.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Parse the string so that you get a DateTime value that you can put in a database parameter. If you use the string in the SQL query, the database will parse it according to the date format it's using.
---
b { font-weight: normal; }
|
|
|
|
|
Hi there.
I'm getting a headache finding a regular expression to determine if the char that I've just read in is a word char (\w) or a valid form of punctuation (not sure how to best describe this in regex terms).
Essentailly I'm in a loop reading char by char and wanting to go do "something else" at the end of each word - unless the word is follwed by a semicolon or a comma or so-on. In this case I want to loop agin to include the punctuation char in the word and then go off and do the "something else".
I have the "word char" bit so far:
Regex reg = new Regex("\\w", RegexOptions.IgnoreCase|RegexOptions.Compiled);
But I need to add the "or a punctuation char" bit to this. I tried to using a number constructs to add the but nothing is working out!
Any help is greatly appreciated.
Kind regards,
John.
_______
Your system must be restarted for these changes to take effect.
This is not a drill.
|
|
|
|
|
Use the OR operator (|) in your regular expression:
\w|\.| ;|\?
If you haven't already, you may want to get a copy of Regex Coach. It's a free utility for designing and testing regular expressions.
|
|
|
|
|
Jim,
That worked a treat - many thanks.
I wasn't sure about the syntax - most of the web pages I saw have very complex examples or only code for one specifi thing - not a combination of several.
Once again, thanks for your response.
John.
PS: The smiley in the middle of the expression was interesting!
|
|
|
|
|
Most examples are more complex because they use regular expression to match the entire strings, not just to identify single characters. You should consider using the regular expression for what you are doing, instead of looping through the characters.
---
b { font-weight: normal; }
|
|
|
|
|
Im trying to code an email message. From what ive found is that im supposed to use system.web.mail however when i try to use it, it tells me that the namespace doesnt exist, can anyone help me out?
|
|
|
|
|
I suspect you're writing a windows app ( not ASP.NET ) and need to add a reference to System.Web to your project.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|