static void ExampleInterfaceHierarchy() { BitmapImage myBitmap = new BitmapImage(); myBitmap.Draw(); myBitmap.DrawInBoundingBox(10, 10, 10, 10); myBitmap.DrawUpsideDown(); IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); } }
//Signed by Jelier static void Main(string[] args) { BitmapImage myBitmap = new BitmapImage(); myBitmap.Draw(); myBitmap.DrawInBoundingBox(10, 10, 100, 150); myBitmap.DrawUpsideDown(); IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { //Call from object level BitmapImage bitmapImage = new BitmapImage(); bitmapImage.Draw(); bitmapImage.DrawInBoundingBox(10, 10, 100, 150); bitmapImage.DrawUpsideDown(); //Get IAdvancedDraw explicitly IAdvancedDraw iAdvDraw = bitmapImage as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); Console.ReadLine(); } }
static void Simples() { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("=> simple hierarchy"); BitmapImage bitmap = new BitmapImage(); bitmap.Draw(); bitmap.DrawInBoundingBox(10, 10, 100, 150); bitmap.DrawUpsideDown(); IAdvancedDraw ia = bitmap as IAdvancedDraw; if (ia != null) { ia.DrawUpsideDown(); } }
static void Main(string[] args) { Console.WriteLine("****** Simple Interface Hierarchy ******"); BitmapImage myBitmap = new BitmapImage(); myBitmap.Draw(); myBitmap.DrawInBoundingBox(10, 10, 100, 150); myBitmap.DrawUpsideDown(); IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("**** Interface hierarchy ****"); BitmapImage myBitmap = new BitmapImage(); myBitmap.Draw(); myBitmap.DrawInBoundingBox(100, 58, 39, 78); myBitmap.DrawUpsideDown(); IAdvancedDraw iAdvanced = myBitmap as IAdvancedDraw; if (iAdvanced != null) { iAdvanced.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("*** Simple Interface Hierarchy ***\n"); BitmapImage bitmap = new BitmapImage(); bitmap.Draw(); bitmap.DrawUpsideDown(); bitmap.DrawInBoundingBox(10, 10, 30, 40); IAdvancedDraw advancedDraw = bitmap as IAdvancedDraw; if (advancedDraw != null) { advancedDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { // Вызвать на уровне объекта BitmapImage bitmap = new BitmapImage(); bitmap.Draw(); bitmap.DrawInBoundingBox(10, 10, 100, 150); bitmap.DrawUpsideDown(); // Получить IAdvancedDraw явным образом IAdvancedDraw advancedDraw = bitmap as IAdvancedDraw; if (advancedDraw != null) { advancedDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("****** Simple Interface Hierarchy ******\n"); // Call from object level. BitmapImage myBitmap = new BitmapImage(); myBitmap.Draw(); myBitmap.DrawInBoundingBox(10, 10, 100, 150); myBitmap.DrawUpsideDown(); Console.WriteLine(); // Get IAdvanced explicitly. IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("***** Simple Interface Hierarchy *****"); //Вызывть на уровне объекта BitmapImage myBitmap = new BitmapImage(); myBitmap.Draw(); myBitmap.DrawInBoundingBox(10, 10, 100, 150); myBitmap.DrawUpsideDown(); //Получить IAdvancedDraw явным образом IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void SimpleInterfaceHierarchy() { System.Console.WriteLine("=> simple interface hierarchy:"); // call from obj-lvl; BitMapImage myBitMap = new BitMapImage(); myBitMap.Draw(); myBitMap.DrawInBoundingBox(); myBitMap.DrawUpsideDown(); // call IAdvancedDraw explicitly IAdvancedDraw iAvDraw = myBitMap as IAdvancedDraw; if (iAvDraw != null) { iAvDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("**** Simple Interface Hierarchy ****"); BitMapImage myBitImage = new BitMapImage(); //callin methods from object levlel myBitImage.draw(); myBitImage.DrawInBoundingBox(10, 10, 100, 150); myBitImage.DrawUpsideDown(); //CAlling from IAdvancedDraw Explicitly IAdvancedDraw iAdvDraw = myBitImage as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); } Console.ReadLine(); }
static void Main(string[] args) { #region Interface Name Clashes //Console.WriteLine("***** Fun with Interface Name Clashes *****\n"); //Octagon oct = new Octagon(); //// We now must use casting to access the Draw() members //IDrawToForm itfForm = (IDrawToForm)oct; //itfForm.Draw(); //// Shorthand notation if you don't need the interface variable for later use. //((IDrawToPrinter)oct).Draw(); //// Could also use the "as" keyword. //if (oct is IDrawToMemory) // ((IDrawToMemory)oct).Draw(); //Console.ReadLine(); #endregion #region Interface Hierarchy Console.WriteLine("***** Simple Interface Hierarchy *****"); // Call from object level. BitmapImage myBitmap = new BitmapImage(); myBitmap.Draw(); myBitmap.DrawInBoundingBox(10, 10, 100, 150); myBitmap.DrawUpsideDown(); // Get IAdvancedDraw explicitly. IAdvancedDraw iAdvDraw = myBitmap as IAdvancedDraw; if (iAdvDraw != null) { iAdvDraw.DrawUpsideDown(); } Console.ReadLine(); #endregion }