Click here to Skip to main content
15,905,614 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to determine that .NetFrameWork has been installed or not ? Pin
Luc Pattyn21-Jun-07 6:48
sitebuilderLuc Pattyn21-Jun-07 6:48 
AnswerRe: how to determine that .NetFrameWork has been installed or not ? Pin
mav.northwind21-Jun-07 9:07
mav.northwind21-Jun-07 9:07 
AnswerRe: how to determine that .NetFrameWork has been installed or not ? Pin
Stu Richardson21-Jun-07 22:29
Stu Richardson21-Jun-07 22:29 
QuestionAccessing classes/functions in .dll added as reference Pin
lechium12121-Jun-07 6:27
lechium12121-Jun-07 6:27 
AnswerRe: Accessing classes/functions in .dll added as reference Pin
Luc Pattyn21-Jun-07 6:38
sitebuilderLuc Pattyn21-Jun-07 6:38 
GeneralRe: Accessing classes/functions in .dll added as reference Pin
lechium12121-Jun-07 6:45
lechium12121-Jun-07 6:45 
GeneralRe: Accessing classes/functions in .dll added as reference Pin
Luc Pattyn21-Jun-07 7:15
sitebuilderLuc Pattyn21-Jun-07 7:15 
GeneralC++ specific help needed Pin
lechium12121-Jun-07 7:31
lechium12121-Jun-07 7:31 
GeneralRe: C++ specific help needed Pin
Luc Pattyn21-Jun-07 7:59
sitebuilderLuc Pattyn21-Jun-07 7:59 
AnswerRe: Accessing classes/functions in .dll added as reference Pin
Dan Neely21-Jun-07 7:56
Dan Neely21-Jun-07 7:56 
Question.pdb Files Pin
Brendan Vogt21-Jun-07 6:04
Brendan Vogt21-Jun-07 6:04 
AnswerRe: .pdb Files Pin
originSH21-Jun-07 6:06
originSH21-Jun-07 6:06 
AnswerRe: .pdb Files Pin
Tarakeshwar Reddy21-Jun-07 6:07
professionalTarakeshwar Reddy21-Jun-07 6:07 
QuestionMessagepump freezes Pin
Bekjong21-Jun-07 5:05
Bekjong21-Jun-07 5:05 
QuestionWrite wizard in my project using Panel - Question Pin
Yanshof21-Jun-07 4:56
Yanshof21-Jun-07 4:56 
AnswerPlease - Someone can help me with this ? Pin
Yanshof21-Jun-07 18:00
Yanshof21-Jun-07 18:00 
Questionstruct and const Pin
lune1221-Jun-07 4:33
lune1221-Jun-07 4:33 
AnswerRe: struct and const Pin
Colin Angus Mackay21-Jun-07 4:37
Colin Angus Mackay21-Jun-07 4:37 
GeneralRe: struct and const Pin
lune1221-Jun-07 5:01
lune1221-Jun-07 5:01 
GeneralRe: struct and const Pin
Colin Angus Mackay21-Jun-07 8:05
Colin Angus Mackay21-Jun-07 8:05 
AnswerRe: struct and const Pin
Luc Pattyn21-Jun-07 5:08
sitebuilderLuc Pattyn21-Jun-07 5:08 
AnswerRe: struct and const Pin
PIEBALDconsult21-Jun-07 9:05
mvePIEBALDconsult21-Jun-07 9:05 
If your goal is to have a Point type, just use the built-in one: System.Drawing.Point.

If your goal is to create a type that works like System.Drawing.Point, then look at how System.Drawing.Point is defined.

If your goal is to create a type that works the way you described (which I don't recommend)...

C#
public struct Point
{

// _z will hold two flag bits to hold whether or not the values have been set
private int _x,_y,_z;

public int
x
{
    get
    {
        if ( _z%2 == 1 )
        {
            return ( _x ) ;
        }
        else
        {
            // throw something
        }
    }

    set
    {
        if ( _z%2 == 0 )
        {
            _x = value ;
            _z |= 1 ;
        }
        else
        {
            // throw something
        }
    }
}

public int
y
{
    get
    {
        if ( _z > 1 )
        {
            return ( _y ) ;
        }
        else
        {
            // throw something
        }
    }

    set
    {
        if ( _z < 2 )
        {
            _y = value ;
            _z |= 2 ;
        }
        else
        {
            // throw something
        }
    }
}


Then
<br />
public Point my_Point;<br />
my_Point.x = 2;<br />
my_Point.y = 4;<br />
<br />
my_Point.x = 5; // The "throw something" will happen<br />

JokeRe: struct and const Pin
Luc Pattyn21-Jun-07 10:41
sitebuilderLuc Pattyn21-Jun-07 10:41 
GeneralRe: struct and const Pin
PIEBALDconsult21-Jun-07 11:00
mvePIEBALDconsult21-Jun-07 11:00 
JokeRe: struct and const Pin
Colin Angus Mackay21-Jun-07 14:07
Colin Angus Mackay21-Jun-07 14:07 

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.