File permission

Dim currentUser As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name
Dim fSecurity As System.Security.AccessControl.FileSecurity= File.GetAccessControl(filePath)
FileSystemAccessRule(currentUser,FileSystemRights.FullControl,AccessControlType.Allow)
File.SetAccessControl(filePath,fSecurity)

i am writing this vb code in invoke code activity in uipathstudio for the background automation to change the file permission but getting one error like fileSystemAccessRule is a type and cannot be used as an expression.can anyone help me in this?

This might help. You have not instantiated the FileSystemAccessRule

fSecurity.AddAccessRule(new FileSystemAccessRule(account, rights, controlType))

thanks