|
-
Apr 23rd, 2004, 05:17 AM
#1
Is this OK?
I'd like your opinions on this line of code...
VB Code:
'type Boundary is a custom class
'frmViewEditBoundary is a form that returns a Boundary instance
Dim temp As Boundary = (New frmViewEditBoundary).ShowDialog()
Is this acceptable coding practice? Or is there a cleaner way to get the same effect.
The code works fine but I'm not sure if its in line with oop practice. I liked it because it saves having to dim the form on a separate line of code. The form is not needed afterwards.
What are your thoughts please?
Last edited by wossname; Apr 23rd, 2004 at 05:22 AM.
I don't live here any more.
-
Apr 23rd, 2004, 05:58 AM
#2
As long as you don't need to refer to the same instance more than once, I see no problem with it. Doesn't get much cleaner.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 23rd, 2004, 07:23 AM
#3
Good. I've never seen this technique used elsewhere though, which makes me wonder if there is a reason!
I don't live here any more.
-
Apr 23rd, 2004, 10:24 AM
#4
Fanatic Member
ive always liked the idea you can declare the variable and assign it in the same line.
some people think it makes VB.NET feel more like C++ by doing this, but i just see it as a more efficient way of writing code.
i dont see anything wrong with it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|