Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building Console Apps
Message
Information générale
Forum:
ASP.NET
Catégorie:
Visual Studio
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01612162
Message ID:
01612235
Vues:
57
>>Good point. Left me wondering if they considered a different keyword for the using statement. 'wrapping', 'disposing'; ?
>>Actually 'disposing' sounds good - descriptive of what it does.....
>
>My point is that it is an unnecessary directive, you can write the same program without it, more verbose, but more readable as it answers unambiguously the question raised by Nicholas

Certainly more verbose. But don't think it's more readable. Say I have a custom class library:
namespace Viv.SomeApp
{
    public static class File
    {
        public static void ReadAllLines(string s)
        {
        }
    }
}
Options if I need to use this and System.File.IO in same code:
using VFile = Viv.SomeApp.File;
using System.IO;
public class Program
{
    public static void Main()
    {
        //Without using
        Viv.SomeApp.File.ReadAllLines("xxx");
        System.IO.File.ReadAllLines("xxx");

        // With using
        VFile.ReadAllLines("xxx");
        File.ReadAllLines("xxx");
    }
}
I prefer the 'using' version.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform