I have code where I'm trying to set property like below.
protected ICredentials Credentials
{
get
{
if (Credentials == null)
{
Credentials = string.IsNullOrEmpty(ApplicationId) || string.IsNullOrEmpty(Password)
? CredentialCache.DefaultNetworkCredentials
: new NetworkCredential(ApplicationId, Password);
}
return Credentials;
}
}
It is giving error like below.
"ICredentials" is an "Interface" from "System.Net". See here
Any idea how to fix it?
I checked following threads but they are not of any use.
Property or indexer cannot be assigned to -- it is read only
Property or indexer cannot be assigned to :: string2[i] = sting1[i]
cannot be assigned to -- it is read only - C#
"cannot be assigned to -- it is read only" error on ConditionExpression