PDA

View Full Version : Generic Types چیست؟



محمد عرب
چهارشنبه 16 فروردین 1385, 22:04 عصر
با سلام
Generic Types چه موارد کاربردی دارد؟


Public stringQ As New System.Collections.Generic.Queue(Of String)

مانند این.
----------------------------
با تشکر
محمد عرب

Hamedm
چهارشنبه 16 فروردین 1385, 22:17 عصر
سلام

با سلام
Generic Types چه موارد کاربردی دارد؟


Public stringQ As New System.Collections.Generic.Queue(Of String)

مانند این.
----------------------------
با تشکر
محمد عرب

One of the things developers often need to do is create new types to use in their programs. Early
attempts at type creation led to user-defined types, or the VB Structure statement. Another
approach is to use classes and objects to create new types. Yet another approach is to use generics.
Generics refers to the technology built into .NET 2.0 that allows you to define a code template and
then to declare variables using that template. The template defines the operations that the new
type can perform, and when you declare a variable based on the template, you are creating a new
type. The benefit of generics over structures or objects is that a generic template makes it easier for
your new types to be strongly typed. Generics also make it easier to reuse the template code in
different scenarios.
The primary motivation for adding generics to .NET was to allow the creation of strongly typed
collection types. Because generic collection types are strongly typed, they are significantly faster
than the previous inheritance-based collection model. Any place you use collection classes in your
code, you should consider revising that code to use generic collection types instead.
Visual Basic 2005 not only allows the use of preexisting generics but also the creation of your own
generic templates. Because the technology to support generics was created primarily to build
collection classes, it naturally follows that you might create a generic anytime you would otherwise
build a normal collection class. In general, anytime you use the Object datatype, consider
using generics instead.
In this chapter, you’ll start out with a brief discussion of the use of generics, followed by a
walkthrough of the syntax for defining your own generic templates.


در پناه حق موفق باشید و پرتوان

محمد عرب
چهارشنبه 16 فروردین 1385, 22:20 عصر
با سلام
اگه میشه لطفا همه را از F1 برایم نگذارید و از تجربیات خودتان به ما هم انتقال دهید.(خواهش می کنم)
-----------------------
با تشکر
محمد عرب

Hamedm
چهارشنبه 16 فروردین 1385, 23:07 عصر
سلام

اگه میشه لطفا همه را از F1 برایم نگذارید این یکی از MSDN نیست. از یکی از کتابهای Wrox است.

از تجربیات خودتان به ما هم انتقال دهید.(خواهش می کنم)ببین کلاسهای Generic چیز خاصی نیست که آدم تجربه کسب کنه و بعد بخواد بگه.
بعضی از کلاسها بصورت Generic تعریف میشودند که باید باهاشون کار کنی تا ببینی چقدر کارهارو راحت کردند.

در پناه حق موفق باشید و پرتوان

محمد عرب
پنج شنبه 17 فروردین 1385, 10:21 صبح
با سلام
خیلی ممنون از توجهتون.
-------------------
با تشکر
محمد عرب

m-heidari
پنج شنبه 17 فروردین 1385, 15:18 عصر
دوستمون خیلی پاسخ جالبی دادن : برو کار میکن مکن هرگز سوال سخت :قهقهه: