Apex sharing reasons are used by developers when adding sharing to a record programatically. Using an apex sharing reason prevents standard users from deleting the sharing, and allows the developer to track why they added the sharing.
1. Go to an object and click New in Apex Sharing Reason related list.
2. Create New Apex Sharing Reason.
Syntax:
Schema.CustomObject__Share.rowCause.SharingReason__c
Sample Code:
Schema.Member__share.RowCause.Sample_Reason__c