|
In other words, you should write (parent.Parent as ProjectDoc).myfunc(p)
|
|
|
|
|
yes, if you want it to blow up in your face at the first unforeseen way of using it, that is what you do. There is another approach called defensive programming that keeps you from putting everything in one line of code.
|
|
|
|
|
|
make sure to keep the catch block empty, no reason to alarm the user or burden the support people.
|
|
|
|
|
Makes you wonder why "On Error Resume Next" never made it into the C# spec.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
I was just talking to a colleague about that following the BBC Micro post in the lounge!
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Luc Pattyn wrote: in one line of code
What's a line of code?
MyType x = y as MyType ; if ( x != null ) { x.foo() ; x.bar() ; } else { something.else() ; } ...
|
|
|
|
|
you discovered the space bar now? usually you have a newline where we put a space...
|
|
|
|
|
Yes, just more proof that (in the C family of languages) spaces and newlines are interchangable and generally unimportant (to the compiler).
|
|
|
|
|
Thank you Sauro Viti.
That worked !!!
|
|
|
|
|
Thank you for explaining.
I got your point.
and the code from "Sauro Viti" worked fine
|
|
|
|
|
I have some class that derived from class queue ( generic namespace ) and i need to implement the IConable Interface.
Each object on the queue is implament the IClonable interface also.
Im not sure that my clone impementation of the queue derived class is the right way ...
The code:
<code>
public object Clone()
{
derivedFromQueueCollection retCollection = new derivedFromQueueCollection();
lock( this )
{
ObjectOnQueue[] arr = ToArray();
for( Int32 i = arr.Length ; i > 0 ; i-- )
{
retCollection.Enqueue( arr[ i ].Clone() as ObjectOnQueue);
}
}
return retCollection;
}
</code>
modified on Wednesday, August 25, 2010 9:36 AM
|
|
|
|
|
|
|
Rather than having the same question asked 3 times, why not stick with 1?
|
|
|
|
|
|
and you probably won't until you tidy up all of your duplicate posts!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
I'm sorry, but the answer today[^] is INFEASIBLE
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
|
Well spotted!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
c# code for instal my font to client machine when my setup run
SuresPanneer
|
|
|
|
|
|
I don't see anything particularly wrong with the question, but apart from there being no code it seems OK to me
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
How about:
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
?
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|