Click here to Skip to main content
15,911,315 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to modify the data in xml file? Pin
CooperWu20-Sep-06 3:54
CooperWu20-Sep-06 3:54 
QuestionHow to get access to NET2.0 methods in VS2005 Pin
Atlemann20-Sep-06 3:14
Atlemann20-Sep-06 3:14 
AnswerRe: How to get access to NET2.0 methods in VS2005 Pin
Dave Kreskowiak20-Sep-06 6:18
mveDave Kreskowiak20-Sep-06 6:18 
QuestionData Relation / Databinding Correct With XML visible -sorry Pin
harwanegg20-Sep-06 3:10
harwanegg20-Sep-06 3:10 
QuestionData Relation / Databinding Pin
harwanegg20-Sep-06 3:08
harwanegg20-Sep-06 3:08 
Questionhorizontal scrollbar for ListView component in my WinForm Pin
a#@20-Sep-06 2:47
a#@20-Sep-06 2:47 
QuestionFunction method Pin
Kasic Slobodan20-Sep-06 2:45
Kasic Slobodan20-Sep-06 2:45 
AnswerRe: Function method Pin
User 665820-Sep-06 2:55
User 665820-Sep-06 2:55 
Your GetVersion() will need to return a type that implements GetMajor and GetMinor itself. Here is an example:

class VersionInfo
{
    public int Major
    {
         get { return major; }
         set { major = value; }
    }

    public int Minor
    {
         get { return minor; }
         set { minor = value; }
    }

    private int major;
    private int minor;

    public override string ToSting()
    {
         return major + "." + minor;
    }
}

class SomeClass
{
     public static VersionInfo GetVersion()
     {
          VersionInfo temp = new VersionInfo();
          temp.Major = 1;
          temp.Minor = 0;
     }
}


You can then use SomeClass.GetVersion() to get a VersionInfo, or SomeClass.GetVersion().Major or SomeClass.GetVersion().Minor

I modified your GetMajor() and GetMinor() functions to use properties. It's the preferred way in C# to access attributes of a class.

regards

modified 12-Sep-18 21:01pm.

QuestionRe: Function method Pin
Kasic Slobodan20-Sep-06 5:34
Kasic Slobodan20-Sep-06 5:34 
AnswerRe: Function method Pin
S. Senthil Kumar20-Sep-06 5:54
S. Senthil Kumar20-Sep-06 5:54 
GeneralRe: Function method Pin
Kasic Slobodan20-Sep-06 6:32
Kasic Slobodan20-Sep-06 6:32 
GeneralRe: Function method Pin
Kasic Slobodan20-Sep-06 6:42
Kasic Slobodan20-Sep-06 6:42 
QuestionExposing C# to COM / Inheritance of objects/interfaces Pin
Adam Clauss20-Sep-06 2:21
Adam Clauss20-Sep-06 2:21 
QuestionTrim textbox Pin
Yustme20-Sep-06 2:14
Yustme20-Sep-06 2:14 
QuestionRe: Trim textbox Pin
Sebastian Schneider20-Sep-06 2:29
Sebastian Schneider20-Sep-06 2:29 
AnswerRe: Trim textbox Pin
Yustme20-Sep-06 2:39
Yustme20-Sep-06 2:39 
GeneralRe: Trim textbox Pin
J4amieC20-Sep-06 2:54
J4amieC20-Sep-06 2:54 
GeneralRe: Trim textbox Pin
Yustme20-Sep-06 3:10
Yustme20-Sep-06 3:10 
GeneralRe: Trim textbox Pin
Sebastian Schneider20-Sep-06 3:21
Sebastian Schneider20-Sep-06 3:21 
GeneralRe: Trim textbox Pin
Yustme20-Sep-06 3:52
Yustme20-Sep-06 3:52 
QuestionMicrosecond timers/delays Pin
sjembek20-Sep-06 2:12
sjembek20-Sep-06 2:12 
AnswerRe: Microsecond timers/delays Pin
S. Senthil Kumar20-Sep-06 6:01
S. Senthil Kumar20-Sep-06 6:01 
GeneralRe: Microsecond timers/delays Pin
sjembek27-Sep-06 1:52
sjembek27-Sep-06 1:52 
QuestionHow to put a clickable button on a PropertyGrid ? Pin
sharongav20-Sep-06 1:35
sharongav20-Sep-06 1:35 
QuestionError On Running Project Of SMS Pin
manishgkumar20-Sep-06 1:27
manishgkumar20-Sep-06 1:27 

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.