What should you do?

You create a class named User that provides user information from a variety of data sources. Different instances of User connect to different data sources to load the data. User is a read-only representation of user information and does not support writing changes back to a data source.

The User class includes the following code segment:

[Serializable]
public class User {
public User(string connectionString) {
this.connectionString = connectionString;
// Additional construction code goes here.
}
internal string ConnectionString {
get { return connectionString; }
}
private string connectionString;
// Other methods and properties go here.
}

Once a User object has been populated, it no longer needs the connectionString member variable.

You have a .NET Remoting object named Project that returns User objects. You want to prevent remote client applications from being able to view the contents of the connectionString member variable.

What should you do?

You create a class named User that provides user information from a variety of data sources. Different instances of User connect to different data sources to load the data. User is a read-only representation of user information and does not support writing changes back to a data source.

The User class includes the following code segment:

[Serializable]
public class User {
public User(string connectionString) {
this.connectionString = connectionString;
// Additional construction code goes here.
}
internal string ConnectionString {
get { return connectionString; }
}
private string connectionString;
// Other methods and properties go here.
}

Once a User object has been populated, it no longer needs the connectionString member variable.

You have a .NET Remoting object named Project that returns User objects. You want to prevent remote client applications from being able to view the contents of the connectionString member variable.

What should you do?

A.
Make the ConnectionString property private.

B.
Remove the connectionString parameter from the constructor.

C.
Add the NonSerialized attribute to the ConnectionString property.

D.
Add the NonSerialized attribute to the connectionString member variable.



Leave a Reply 0

Your email address will not be published. Required fields are marked *