Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
GeneralInvoke/BeginInvoke Problem Pin
khchan15-Aug-04 20:56
khchan15-Aug-04 20:56 
GeneralRe: Invoke/BeginInvoke Problem Pin
Stanciu Vlad16-Aug-04 2:08
Stanciu Vlad16-Aug-04 2:08 
GeneralRe: Invoke/BeginInvoke Problem Pin
leppie16-Aug-04 2:39
leppie16-Aug-04 2:39 
GeneralRe: Invoke/BeginInvoke Problem Pin
khchan16-Aug-04 16:59
khchan16-Aug-04 16:59 
GeneralInherited GroupBox or Panel Pin
Clickok15-Aug-04 20:56
Clickok15-Aug-04 20:56 
GeneralRe: Inherited GroupBox or Panel Pin
sreejith ss nair15-Aug-04 21:44
sreejith ss nair15-Aug-04 21:44 
GeneralRe: Inherited GroupBox or Panel Pin
Clickok15-Aug-04 21:56
Clickok15-Aug-04 21:56 
GeneralStructure and Interface Pin
Paul Selormey15-Aug-04 19:53
Paul Selormey15-Aug-04 19:53 
Consider the following codes
using System;

namespace ConsoleApplication1
{
    interface IPointD
    {  
        double X {get; set;}
        double Y {get; set;}
    }

    struct PointD : IPointD
    {
        private double x;
        private double y;
        public PointD(double x, double y)
        { this.x = x; this.y = y;}

        public double X 
        { 
            get { return x; } 
            set { x= value; }
        }

        public double Y 
        {
            get { return y; }
            set { y = value; }
        }
    }

	class Class1
	{
        static void Method(IPointD point)
        {
            if (point != null)
            {
                point.X = 10;
                point.Y = 10;
            }
        }

		[STAThread]
		static void Main(string[] args)
		{
            PointD point = new PointD(1, 1);
            IPointD dPoint = (IPointD)point;
            Method(dPoint);

            Console.WriteLine("X = {0}, Y = {1}", point.X, point.Y);
            Console.WriteLine("X = {0}, Y = {1}", dPoint .X, dPoint.Y);
		}
	}
}


Why is the dPoint modified, but "point" is not in the call to Method?

Does the cast
IPointD dPoint = (IPointD)point;
creates a copy of the "point"?

Best regards,
Paul.

Jesus Christ is LOVE! Please tell somebody.
GeneralRe: Structure and Interface Pin
S Sansanwal15-Aug-04 21:03
S Sansanwal15-Aug-04 21:03 
GeneralRe: Structure and Interface Pin
Paul Selormey15-Aug-04 21:32
Paul Selormey15-Aug-04 21:32 
GeneralRe: Structure and Interface Pin
Nick Parker16-Aug-04 3:29
protectorNick Parker16-Aug-04 3:29 
GeneralRe: Structure and Interface Pin
Paul Selormey16-Aug-04 3:58
Paul Selormey16-Aug-04 3:58 
GeneralArrayList comparsion Pin
azusakt15-Aug-04 16:49
azusakt15-Aug-04 16:49 
GeneralRe: ArrayList comparsion Pin
sreejith ss nair15-Aug-04 17:44
sreejith ss nair15-Aug-04 17:44 
GeneralRe: ArrayList comparsion Pin
leppie15-Aug-04 19:17
leppie15-Aug-04 19:17 
GeneralRe: ArrayList comparsion Pin
Danny Rodriguez15-Aug-04 20:28
Danny Rodriguez15-Aug-04 20:28 
GeneralForm's this.Close() is not responding Pin
CNU15-Aug-04 16:47
CNU15-Aug-04 16:47 
GeneralRe: Form's this.Close() is not responding Pin
S Sansanwal15-Aug-04 16:49
S Sansanwal15-Aug-04 16:49 
GeneralRe: Form's this.Close() is not responding Pin
CNU15-Aug-04 16:59
CNU15-Aug-04 16:59 
GeneralRe: Form's this.Close() is not responding Pin
sreejith ss nair15-Aug-04 17:17
sreejith ss nair15-Aug-04 17:17 
GeneralRe: Form's this.Close() is not responding Pin
CNU15-Aug-04 17:22
CNU15-Aug-04 17:22 
GeneralRe: Form's this.Close() is not responding Pin
sreejith ss nair15-Aug-04 21:17
sreejith ss nair15-Aug-04 21:17 
GeneralRe: Form's this.Close() is not responding Pin
sreejith ss nair15-Aug-04 17:10
sreejith ss nair15-Aug-04 17:10 
GeneralRe: Form's this.Close() is not responding Pin
leppie15-Aug-04 19:26
leppie15-Aug-04 19:26 
GeneralRe: Form's this.Close() is not responding Pin
mav.northwind17-Aug-04 3:10
mav.northwind17-Aug-04 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.