Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building Console Apps
Message
General information
Forum:
ASP.NET
Category:
Visual Studio
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01612162
Message ID:
01612235
Views:
58
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform