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

C#

 
QuestionHow to use the operators DIV and MOD Pin
CodeItWell16-Dec-06 9:51
CodeItWell16-Dec-06 9:51 
AnswerRe: How to use the operators DIV and MOD Pin
ejuanpp16-Dec-06 10:23
ejuanpp16-Dec-06 10:23 
AnswerRe: How to use the operators DIV and MOD Pin
Ravi Bhavnani16-Dec-06 11:31
professionalRavi Bhavnani16-Dec-06 11:31 
QuestionCorrect a date in a textBox Pin
CodeItWell16-Dec-06 8:40
CodeItWell16-Dec-06 8:40 
AnswerRe: Correct a date in a textBox Pin
Luc Pattyn16-Dec-06 9:15
sitebuilderLuc Pattyn16-Dec-06 9:15 
AnswerRe: Correct a date in a textBox Pin
Bassam Saoud16-Dec-06 11:13
Bassam Saoud16-Dec-06 11:13 
Questiondataset changes Pin
fmardani16-Dec-06 7:43
fmardani16-Dec-06 7:43 
QuestionObject creation at internal condition in constructor Pin
Tony Lambert16-Dec-06 7:23
Tony Lambert16-Dec-06 7:23 
Hi All,

I'm having an issue with constructors. I want to prevent the creation internally in the following example:

using System;<br />
<br />
public class ConditionalObject<br />
{<br />
	private string _MajorName;<br />
	private string _MinorName;<br />
	public string MajorName { get { return _MajorName; } }<br />
	public string MinorName { get { return _MinorName; } }<br />
	public ConditionalObject()<br />
	{<br />
		if ((_MajorName.Length == 0) || (_MinorName.Length == 0))<br />
		{<br />
			throw new Exception("Unable to initialise new object without identifier.");<br />
			/******* what to do here to be destroyed? *******/<br />
		}<br />
	}<br />
	public ConditionalObject(string AMajorName, string AMinorName): base()<br />
	{<br />
		_MajorName = AMajorName;<br />
		_MinorName = AMinorName;<br />
	}<br />
}


Neither Dispose(); nor return null; nor this = null; can be applied in constructor. Could anybody help me guys?

Thanks for the answers. Smile | :)
AnswerRe: Object creation at internal condition in constructor Pin
Guffa16-Dec-06 8:43
Guffa16-Dec-06 8:43 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert16-Dec-06 9:15
Tony Lambert16-Dec-06 9:15 
GeneralRe: Object creation at internal condition in constructor Pin
Guffa16-Dec-06 11:43
Guffa16-Dec-06 11:43 
GeneralRe: Object creation at internal condition in constructor Pin
Tony Lambert16-Dec-06 12:10
Tony Lambert16-Dec-06 12:10 
AnswerRe: Object creation at internal condition in constructor Pin
Guffa16-Dec-06 13:45
Guffa16-Dec-06 13:45 
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 
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 

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.