TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Valerie Meunier
NA
693
84.6k
This returns 0 but i expected 9
May 8 2021 10:17 PM
Hello
This code returns 0 instead of 9. I can't find my mistake.
Thanks
Valerie
oop.aspx.cs file
namespace
OopC
{
public
partial
class
oop : System.Web.UI.Page
{
protected
void
Button2_Click(
object
sender, System.EventArgs e)
{
Encaps enc =
new
Encaps();
int
z = 3;
enc.Field = z;
z= enc.Result;
Label2.Text = z.ToString();
}
}
oop.apsx file
<%@ page language=
"C#"
autoeventwireup=
"true"
validaterequest=
"false"
inherits=
"OopC.oop"
CodeBehind=
"oop.aspx.cs"
%>
<asp:Button ID=
"Button2"
runat=
"server"
Text=
"encapsulation"
OnClick=
"Button2_Click"
/>
<asp:Label ID=
"Label2"
runat=
"server"
Text=
""
></asp:Label><br />
in App_Code map: there is a file which contains this:
public
class
Encaps
{
private
int
_Field;
private
int
MethodB()
{
return
_Field * 3;
}
public
int
Field
{
get
{
return
_Field;
}
set
{
_Field = value;
}
}
public
int
Result
{
get
{
return
MethodB();
}
}
}
Reply
Answers (
7
)
Finding .NET Core Version
Same encryption Description for C# and SQL