Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conditional Compilation
Message
De
13/01/2009 13:53:30
 
 
À
13/01/2009 03:46:23
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01372770
Message ID:
01373312
Vues:
20
>>>>>>You can also test for debug mode
>>>>>>
>>>>>>if (System.Diagnostics.Debugger.IsAttached)
>>>>>>{
>>>>>>     DoSomething()
>>>>>>}
>>>>>>else
>>>>>>{
>>>>>>     DoSomethingElse()
>>>>>>}
>>>>>>
>>>>>
>>>>>I didn't know that. But now that I do I'm having trouble seeing a use for it.....

>>>>
>>>>
>>>>I use that occasionally for error messages. IOW, an error message that gets displayed to the user at runtime might be an abbreviated version of the error message displayed to the developer during debugging.
>>>
>>>OK. But conditional compilation can do that. Using this it feels that I would be compiling/shipping surplus production code. i.e. if you're going to be around to debug it then why not just run a debug version.......
>>
>>I would also use conditional compilation over the if statement, I go as far as doing this for the design mode test:
>>
>>
>>#if DEBUG
>>if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
>>#endif
>>  {
>>  ///Some code that I don't want in design mode.
>>  }
>>
>
>Huh. That threw for a minute - then I worked out you were in WPF mode!. I'd probably just use this.IsInDesignMode (for readability)?
>Are you doing much with WPF - it seems a while since anything has cropped up here under that category......
>Regards,
>Viv

>>this.IsInDesignMode

I'll have to look into that. It is more readable.

>>Are you doing much with WPF

All my interface code is now being done in WPF. My non LOB DP stuff is still all in VFP and runs either as COM objects or as independent apps. (My LOB stuff is being moved to Linq to SQL) I just finished roughing out an IPC module that allows my VFP and WPF apps to communicate. WPF has a huge learning curve, but it allows me easily do some of the things that I wanted to do in VFP that required massive coding to accomplish. The parent child relationship between objects also gives me a nice warm and fuzzy feeling as it reminds me a bit of VFP.

Overall I'm really liking WPF. I'm using it to take all my applications and sew them together into one cohesive interface. As I mentioned the learning curve is a b***ch, but once you get it down it's very powerful.

Today I'm trying to track down a @#$%$@#% memory leak. That didn't happen too often in VFP.

>>it seems a while since anything has cropped up here under that category......

Ya, I check 2 or 3 times a week and haven't seen anything in a while.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform