how to set image Source in the code csharp

Code Example - how to set image Source in the code csharp

                
                        myImage.Source = new BitmapImage(new Uri(@"/Images/foo.png", UriKind.Relative));