Answer: We will write below code to check whether a file has a ReadOnly Attribute or not:-
if(((File.GetAttributes("file_path") & FileAttributes.ReadOnly) == FileAttributes.ReadOnly))
{
return true;
}
return false;
Asked In: Many Interviews |
Alert Moderator