KCN is predominantly ionic and provides cyanide ions in solution. Although both carbon and nitrogen atoms of CN can donate electron pairs but the attack takes place mainly through carbon atom and not through nitrogen atom because 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 main product.