Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How should I code this?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01398722
Message ID:
01398759
Vues:
62
This message has been marked as a message which has helped to the initial question of the thread.
>Is it OK or not really a good code
>
>
>string strOrderNo = this.txtOrderNo.Text;
>                        int? OrderNo;
>                        if (strOrderNo.Equals(String.Empty))
>                            OrderNo = null;
>                        else
>                            OrderNo = Convert.ToInt32(strOrderNo);
>
>                        _dtOrder = biz.Find(OrderNo, this.dtgStartDate.Value, this.dtgEndDate.Value);
>

That should be fine. I'd probably do something like this, but it's mostly a style preference:
int? orderNo = null;
if (!string.IsNullOrEmpty(strOrderNo))
   orderNo = Convert.ToInt32(strOrderNo);

dtOrder = biz.Find(orderNo, this.dtgStartDate.Value, this.dtgEndDate.Value);
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform