472,373 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

New Oject() {} vs. New Object(-1) {}

This has bugged me for some time.

Is there any "behind the scenes" difference between the following two
snippets?
Dim obj1 As Object = New Oject() {}
Dim obj2 As Object = New Object(-1) {}
Thanks!
Nov 21 '05 #1
4 7964
Apart from the obvious typos', I would suggest that there is no significant
difference.

Try:

Dim obj1() As Object = New Object() {}
Dim obj2() As Object = New Object(-1) {}
Console.WriteLine(obj1.Length)
Console.WriteLine(obj1.GetLowerBound(0))
Console.WriteLine(obj1.GetUpperBound(0))
Console.WriteLine(obj2.Length)
Console.WriteLine(obj2.GetLowerBound(0))
Console.WriteLine(obj2.GetUpperBound(0))

and observe the results.
"stand__sure" <st*********@hotmail.com> wrote in message
news:d4**********@domitilla.aioe.org...
This has bugged me for some time.

Is there any "behind the scenes" difference between the following two
snippets?
Dim obj1 As Object = New Oject() {}
Dim obj2 As Object = New Object(-1) {}
Thanks!

Nov 21 '05 #2
"stand__sure" <st*********@hotmail.com> schrieb:
This has bugged me for some time.

Is there any "behind the scenes" difference between the following two
snippets?
Dim obj1 As Object = New Oject() {}
Dim obj2 As Object = New Object(-1) {}


After some corrections ('obj1()', 'obj2()', 'Oject' -> 'Object') there is no
difference, not even behind the scenes, between the two lines.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Thanks for the replies (and for tolerance of the typo).

I had seen no difference in the debugger, but the guidance from microsoft
was to use "New Object(-1) {}" to create an empty array -- the form "New
Object() {}" is more intuitive...

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ut**************@TK2MSFTNGP12.phx.gbl...
"stand__sure" <st*********@hotmail.com> schrieb:
This has bugged me for some time.

Is there any "behind the scenes" difference between the following two
snippets?
Dim obj1 As Object = New Oject() {}
Dim obj2 As Object = New Object(-1) {}


After some corrections ('obj1()', 'obj2()', 'Oject' -> 'Object') there is
no difference, not even behind the scenes, between the two lines.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
"stand__sure" <st*********@hotmail.com> schrieb:
Thanks for the replies (and for tolerance of the typo).

I had seen no difference in the debugger, but the guidance from microsoft
was to use "New Object(-1) {}" to create an empty array -- the form "New
Object() {}" is more intuitive...


I'd use the latter form.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: lauren quantrell | last post by:
Wondering if anyone has already written a snippet that will loop through every form, report, module in an ADP application and do application.SaveAsText on each item.
2
by: ElanKathir | last post by:
Hi See this, Public Class Elan Public variable as Interger Public Sub Function1() ---------- ------ End Sub
3
by: parthivjoshi | last post by:
Do anyone have the idea how to add progressbar to the existing HTTPModule and HTTPApplication for File Upload. ********************************************************************** Sent via...
1
by: Ramkumar T via DotNetMonster.com | last post by:
Hi I have written a simple web application in which the home page stores a small arraylist (populated from a remoe database) in the session object to be used by the subsequent pages. However,...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
3
by: Tracey | last post by:
sorry I post this problem again. I have to stop my work to fix the problem. I'm doing a multi form application(Not a MDI one). My startup form say Form1 has a datagrid say datagrid1, when I...
0
by: mhodkin | last post by:
What is the best way to print a graphic image contained within the canvas oject in Tkinter ruinng under Windows (XP)? The only thing I found so far was the canvas postscript method...it there a...
0
by: =?Utf-8?B?Y2xpZmY=?= | last post by:
The senerios lis like below: I have a root object called person, he has many addresses instance at different level of this class tree, what is the best way to use this type of the address class...
9
by: =?Utf-8?B?U0FM?= | last post by:
Is it possible to Cast an Object to a String Array the way I'm doing it in the code below? I'm trying to reuse code I have without creating new code if I can. Dim asNames() As String Dim...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.