PC Review


Reply
Thread Tools Rate Thread

dim as Vs. dim as new

 
 
Sameh Ahmed
Guest
Posts: n/a
 
      2nd Apr 2004
Hello there
what's the difference between dim as and dim as new?
Thanks in advance
Regards
Sameh


 
Reply With Quote
 
 
 
 
Doknjas
Guest
Posts: n/a
 
      2nd Apr 2004
Dim As New ... creates the object instance



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      2nd Apr 2004
"Sameh Ahmed" <(E-Mail Removed)> schrieb
> what's the difference between dim as and dim as new?


There is no difference with value types (Integer, Double, Structures, ...).
The instance is created anyway in both cases.

There is a difference with reference types: Without new, only the space for
the variable is reserved (currently 4 bytes = 32 bits). No object is
created. The variable contains Nothing (= no reference). With New, it is
equal to
dim o as type
o = new type
which means it also creates an object and stores the reference to the object
in o.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

 
Reply With Quote
 
post2shan@hotmail.com
Guest
Posts: n/a
 
      7th Apr 2004

Dim objSome as Something

-This declare the objSome but memory was not allocated.

Dim objSome as new Something

-This declare and allocate memory for the object.

:new is the keyword in .net to allocate memory for the declared object.




**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 PM.