W
WJ
I have this class:
******************************************
using System;
namespace myNameSpace.DBRec
{
[Serializable]
public class myRec
{
private string _Field1;
private string _Field2;
public myRec()
{
}
public myRec
(
string Field1
,string Field2
)
{
this._Field1=Field1;
this._Field2=Field2;
}
public string Field1
{
get
{
return _Field1;
}
set
{
Field1=value;
}
}
public string Field2
{
get
{
return _Field2;
}
set
{
Field2=value;
}
}
}
}
******************************************
In my asp.net page, I have:
private string F1="test1";
private string F2="test2";
1. If I call this:
myRec mr=new myRec(F1,F2); then there is no problem.
2. However, if I do these:
myRec mr=myRec();
mr.Field1=F1;
mr.Field2=F2;
then I got the exception below.
Server Error in '/myDotNet' Application.
--------------------------------------------------------------------------------
Exception of type System.StackOverflowException was thrown.
Description: An unhandled exception occurred during the execution of the
current
web request. Please review the stack trace for more information about the
error
and where it originated in the code.
Exception Details: System.StackOverflowException: Exception of type
System.StackOverflowException was thrown.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be
identified using the exception stack trace below.
Stack Trace:
[StackOverflowException: Exception of type System.StackOverflowException was
thrown.]
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework
Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
Thanks for your help,
John
******************************************
using System;
namespace myNameSpace.DBRec
{
[Serializable]
public class myRec
{
private string _Field1;
private string _Field2;
public myRec()
{
}
public myRec
(
string Field1
,string Field2
)
{
this._Field1=Field1;
this._Field2=Field2;
}
public string Field1
{
get
{
return _Field1;
}
set
{
Field1=value;
}
}
public string Field2
{
get
{
return _Field2;
}
set
{
Field2=value;
}
}
}
}
******************************************
In my asp.net page, I have:
private string F1="test1";
private string F2="test2";
1. If I call this:
myRec mr=new myRec(F1,F2); then there is no problem.
2. However, if I do these:
myRec mr=myRec();
mr.Field1=F1;
mr.Field2=F2;
then I got the exception below.
Server Error in '/myDotNet' Application.
--------------------------------------------------------------------------------
Exception of type System.StackOverflowException was thrown.
Description: An unhandled exception occurred during the execution of the
current
web request. Please review the stack trace for more information about the
error
and where it originated in the code.
Exception Details: System.StackOverflowException: Exception of type
System.StackOverflowException was thrown.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be
identified using the exception stack trace below.
Stack Trace:
[StackOverflowException: Exception of type System.StackOverflowException was
thrown.]
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework
Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
Thanks for your help,
John