function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phuc Nguyen 18Phuc Nguyen 18 

Apex mapping of mdt

I would like to covert my list of mdt records to use a map.
Her eis the current state
List<PriceSelection__mdt> priceBooks = [SELECT Id, PriceId__c, Service__c, DeveloperName, Customer__c, ProjectManager__c 
                                                        from PriceSelection__mdt];
for(SObject so : Trigger.New){
   Project__c newProj = (Project__c) so;
       if(priceBooks.size() > 0){
           for (PriceSelection__mdt pbs: priceBooks ){           
       if(newProj.Service__c == pbs.Service__c && newProj.Customer__c == pbs.Customer__c && newProj.Project_Manager__c== pbs.ProjectManager__c){
    newProj.PriceBook__c = pbs.PriceId__c;

how can I change List<PriceSelection__mdt> into a map

Thank you,
AbhinavAbhinav (Salesforce Developers) 
Check this for reference: