Click here to Skip to main content
15,919,479 members
Home / Discussions / C#
   

C#

 
GeneralRe: Object creation at internal condition in constructor Pin
Larantz17-Dec-06 0:38
Larantz17-Dec-06 0:38 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert17-Dec-06 2:37
Tony Lambert17-Dec-06 2:37 
GeneralRe: Object creation at internal condition in constructor Pin
Larantz17-Dec-06 10:07
Larantz17-Dec-06 10:07 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert17-Dec-06 10:17
Tony Lambert17-Dec-06 10:17 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert17-Dec-06 2:44
Tony Lambert17-Dec-06 2:44 
AnswerRe: Object creation at internal condition in constructor Pin
Guffa17-Dec-06 8:34
Guffa17-Dec-06 8:34 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert17-Dec-06 9:14
Tony Lambert17-Dec-06 9:14 
GeneralRe: Object creation at internal condition in constructor Pin
Guffa17-Dec-06 9:41
Guffa17-Dec-06 9:41 
Tony Lambert wrote:
It is the same without catch (first example). When I throw an exception it only gets registered in an exception buffer till something catches. It does nothing with the constructor itself. That is the reason why it comes back with not null value all the time.


An exception buffer? Why do you think that?

When you throw an exception in the constructor it immediately exits. The exception isn't stored in any buffer anywhere, it's returned from the constructor.

Tony Lambert wrote:
When I don't catch it, the application gets killed at the exit point of constuctor.


No, the application doesn't get killed. The constructor exits with an exception, and the exception travels through each level in the call stack until it's caught somewhere. As you don't catch it in your program, the program exits with the exception and it's caught by the system.

Tony Lambert wrote:
That's another problem: I need that null value.


A constructor never returns a null value, it always returns the address of the object. If you wan't to abort a constructor, an exception is the only way to do that, and you have to catch the exception in the code that calls the constructor for it to be useful.



---
It's amazing to see how much work some people will go through just to avoid a little bit of work.

GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert17-Dec-06 10:13
Tony Lambert17-Dec-06 10:13 
AnswerRe: Object creation at internal condition in constructor Pin
Luc Pattyn16-Dec-06 8:53
sitebuilderLuc Pattyn16-Dec-06 8:53 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert16-Dec-06 12:22
Tony Lambert16-Dec-06 12:22 
AnswerRe: Object creation at internal condition in constructor Pin
ejuanpp16-Dec-06 10:25
ejuanpp16-Dec-06 10:25 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert16-Dec-06 11:53
Tony Lambert16-Dec-06 11:53 
AnswerRe: Object creation at internal condition in constructor Pin
Karthik Kalyanasundaram16-Dec-06 16:44
Karthik Kalyanasundaram16-Dec-06 16:44 
Questionneed a Network Programming with VC#2005 pdf,Ebook,article. Pin
hdv21216-Dec-06 6:50
hdv21216-Dec-06 6:50 
AnswerRe: need a Network Programming with VC#2005 pdf,Ebook,article. Pin
Tony Lambert16-Dec-06 7:54
Tony Lambert16-Dec-06 7:54 
GeneralRe: need a Network Programming with VC#2005 pdf,Ebook,article. Pin
hdv21216-Dec-06 9:29
hdv21216-Dec-06 9:29 
GeneralRe: need a Network Programming with VC#2005 pdf,Ebook,article. Pin
Bassam Saoud16-Dec-06 11:22
Bassam Saoud16-Dec-06 11:22 
QuestionIndirection dilemna !! Pin
mikkasava16-Dec-06 5:52
mikkasava16-Dec-06 5:52 
AnswerRe: Indirection dilemna !! Pin
Luc Pattyn16-Dec-06 6:51
sitebuilderLuc Pattyn16-Dec-06 6:51 
AnswerRe: Indirection dilemna !! Pin
mikkasava16-Dec-06 16:06
mikkasava16-Dec-06 16:06 
QuestionIndex out of range Pin
Saamir16-Dec-06 4:27
Saamir16-Dec-06 4:27 
AnswerRe: Index out of range Pin
Luc Pattyn16-Dec-06 4:47
sitebuilderLuc Pattyn16-Dec-06 4:47 
Questionwindows search Pin
p3iy3316-Dec-06 3:26
p3iy3316-Dec-06 3:26 
AnswerRe: windows search Pin
gnadeem16-Dec-06 9:03
gnadeem16-Dec-06 9:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.