KCN is predominately ionic and provides cyanide ions in solution. Although both carbon and introgen atoms are in a position to donate electron pairs, the attack takes place mainly through carbon atom and not through nitrogen atom since C−C bond is more stable than C−N bond. However, AgCN is mainly covalent in nature and nitrogen is free to donate electron pair forming isocyanide as the major product R−X+AgCN⟶R−NC+AgX