5
Answers

Write Only Property

Photo of Sarmad Rehman

Sarmad Rehman

7y
201
1
using System;
namespace Tester
{
public class MyClass
{
private int _age;
public int Age
{
set
{
this._age = value;

}
}

} // MyClass ends here.

class Program
{
static void Main()
{
MyClass MC = new MyClass();
int i = MC.Age = 19;
Console.WriteLine(i);
Console.ReadLine();
}
}
}
 
I have only set accessor but i can still read the value of age. how i can implement write only property which cannot be read.
 

Answers (5)

0
Photo of Deepak Tewatia
14 15.8k 23.5k 1y

It seems like you're seeking guidance on the usage of the HttpContext.Current.Session in ASP.NET within the scope of career advice technology. Let's delve into this technical query.

The provided code snippet aims to retrieve the value stored in the session variable "cUserType" within the ASP.NET framework. This implies that the cUserType session variable is being accessed and its value is being converted to a string using the ToString() method.

In the context of career advice technology, it's important to ensure secure and efficient usage of session variables. This includes considering data persistence, session management, and potential security vulnerabilities.

If you have specific questions or concerns about using session variables in ASP.NET for career advice technology, feel free to elaborate, and I'd be glad to provide further insights or code examples.