How does the dedication of merit work, according to the texts?

Maybe it is worth considering what is found in Milinda Pañña of Pali Canon and Nāgasena Bhikṣu Sūtra of the Chinese Canon.

This topic from a few years back looked at that.

3 Likes