|
I am not sure, but the With keyword disposes the current object (if it implements Idisposable) rather then waiting for the GC to come along.
|
|
|
|
|
[sarcasm]
try resume on ObjectReferenceException
{
object o = null;
string s = o.ToString();
return 0;
}
catch (Exception)
{
}
finally
{
}
[end sarcasm]
|
|
|
|
|
How about
Option Explicit Off ?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Oh ouch. I forgot about that one!
|
|
|
|
|
Something like this...
System.CSharp.OptionExplicit(false);
Best regards,
Lizandro Campbell
|
|
|
|
|
Under the hood, .NET actually can support that exception model IIRC. C# doesn't face it, however. I always figured it was left in their during initial planning for VB.NET.
--
Russell Morris
Morbo: "WINDMILLS DO NOT WORK THAT WAY!"
|
|
|
|
|
OMG, somebody shoot me ,)
|
|
|
|
|
Begging here: Should MS fix GDI+/WinForms not to cause 10,000 page-faults in 3 seconds of operation.
|
|
|
|
|
No point in starting a "Should Microsoft fix Personal Issue #4,712".
There's always things that can be done better, but for the moment we're busy whining about the keywords.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
I so wish it was a 'personal issue'.
Never mind, I guess no one cares about something that has meaning, and background on around 9 million references to the problem, as well as every PC issue with a .NET framework on it.
Keywords are far more important I guess..
|
|
|
|
|
Guess I gotta state the obvious to the oblivious here.
For one, wrong forum.
For two, exactly what do you expect CP to do? Want them to mount a bronco and mosey on over to Washington to lasso up Billy G and make him watch Linux installs for days until he caves in and makes MS fix your issue?
Here's a thought, if it's a bug in .NET, email MS. If they ignore you, well, get a mac.
|
|
|
|
|
For one, there is never a wrong time to care about what you do, love, enjoy or your job.
For two, forget the place, it is just a statistic you obviously failed to grasp (reading the forum name helps)
"My issue" is just the right attitude that precisely led to much of the mess out there you're watching.. and will keep watching for some time, movie called: le mega-culling of overhead (Part 1- Falcon Returns)!
Btw, I only mail to myself
|
|
|
|
|
Chris Maunder wrote: but for the moment we're busy whining about the keywords
Darn, we got caught.
|
|
|
|
|
As an aside I was explaining the programming language I had written to one of the senior managers recently. I was explaining the use of logical operator such as And, Or, Not etc. when she suddenly looked inspired and asked me if the language could have a "But" operator.
|
|
|
|
|
Just curious, what would that "But" operator do?
|
|
|
|
|
|
a little bonus of less typing is IMHO nothing compared to subtle bugs you may enounter. Consider simple classes:
class A
{
public string Name;
public string foo();
}
class B
{
public string foo();
public void bar()
{
A a = new A();
with A
{
Name = foo();
}
}
}
now decorate above classes with bunch of other methods and properties and good luck finding very subtle bug. Especially if A.foo() and B.foo() are almost the same...
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Mariusz Wojsyk wrote: now decorate above classes with bunch of other methods and properties and good luck finding very subtle bug.
Actually, if you're used to a With construct it's not hard to figure out. I've used it for years when in classic VB and never once encountered this subtle bug when even using nested Withs without easily being able to recognize what goes where. Maybe if you spread them out ten miles long it would be harder to notice, but that's the fault of the programmer more so than the construct.
|
|
|
|
|
Actually, your usage of With (at least from a VB point of view) is incorrect. That example wouldn't compile, even under VB.
The key to using the With construct is that the members are prepended with a dot. eg:
with A
{
.Name = .foo()
}
Or
with A
{
.Name = foo()
}
Your example would receive a compiler error at "Name" because class B doesn't have a "Name" property.
Agreed that the initial problem still exists (i.e. ".foo()" and "foo()" are indeed rather similar looking), but as someone with a VB background I can assure you that as you use it more, you get real sensitive to missing dots in a With construct.
|
|
|
|
|
I dropped VB like a rotten [insert fruit] when Version 4 came out
and have not had time for anything but perfecting my C++ since.
Certainly no time for C Pound Sign, my API's don't work in it.
(Mayhap they do, but who has time to check?)
You are missing a default routine in your poll for the 'none of
the above' case. Only those who use both languages will both
understand the question and care about the answer. Surely even
a "Don't really care" and/or "What is that?" choice would have
actually added valid data points to your poll.
Did you know C++ .NET will still run on WinNT Version 4.0?
|
|
|
|
|
In c++ the default case isn't required unlike .NET languages.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
What default case? In a switch statement? Where is it required?
|
|
|
|
|
hey, it was funnier when I wrote it, however, I am not responsible for any posts I make after 8pm.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Seems unlikely. Consider yourself on double-secret probation.
|
|
|
|
|
NotUnique wrote: Surely even
a "Don't really care" and/or "What is that?" choice would have
actually added valid data points to your poll.
You're in .NET land though, so tread carefully.
NotUnique wrote: Did you know C++ .NET will still run on WinNT Version 4.0?
Well, I'm no .NET fan, but I do think it's time for an upgrade. lol Unless you have clients running it or something.
|
|
|
|