Maximizing.ASP.dot.NET.Real.World.ObjectOriented.Development [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Maximizing.ASP.dot.NET.Real.World.ObjectOriented.Development [Electronic resources] - نسخه متنی

Jeffrey Putz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






The Class Declaration


Just to cover our bases, you already know that declaring a class and putting it in a particular namespace looks like Listing 2.1.

Listing 2.1. The basic class declaration

C#


namespace MyNamespace
{
public class Car
{
// class members
}
}

VB.NET


Namespace MyNamespace
Public Class Car
' class members
End Class
End Namespace

We use namespaces because the .NET Framework is strongly typed. That means we give every class a fully qualified name to make sure that it's not duplicated and that there's no confusion about the class we're referencing. For example, both ASP.NET and Windows Forms have a TextBox class. The framework knows the difference because one lives in the System.Web.UI.WebControls namespace and the other in the System.Windows.Forms.Control namespace. We don't need to use its fully qualified name because we make using (Imports in VB.NET) declarations at the top of our code files so the compiler knows what we're talking about.


/ 146