Oxygene Oxidiser conversion from C#


(Bob Russell) #1

Oxidiser conversion of C# to Oxygene:
Given the code extracts in C#

public class Student : INotifyPropertyChanged
{
    private string firstName;
    private string lastName;

    public string FirstName
    {
        get
        {
            return firstName;
        }

        set
        {
            if (firstName != value)
            {
                firstName = value;
                RaisePropertyChanged("FirstName");
                RaisePropertyChanged("FullName");
            }
        }
    }

    public string LastName
    {
        get { return lastName; }

        set
        {
            if (lastName != value)
            {
                lastName = value;
                RaisePropertyChanged("LastName");
                RaisePropertyChanged("FullName");
            }
        }
    }

    public string FullName
    {
        get
        {
            return firstName + " " + lastName;
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    private void RaisePropertyChanged(string property)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
    }
}

public class StudentViewModel
{

    public ObservableCollection<Student> Students
    {
        get;
        set;
    }

    public void LoadStudents()
    {
        ObservableCollection<Student> students = new ObservableCollection<Student>();

        _**students.Add(new Student { FirstName = "Mark", LastName = "Allain" });**_

** students.Add(new Student { FirstName = “Allen”, LastName = “Brown” });**
** students.Add(new Student { FirstName = “Linda”, LastName = “Hamerski” });**

        Students = students;
    }
}

Oxidiser converted the 3 lines (above in bold and italic) to

students.Add(new Student(‘Mark’) LastName(‘Allain’));
students.Add(new Student(‘Allen’) LastName(‘Brown’));
students.Add(new Student(‘Linda’) LastName(‘Hamerski’));

Re Oxidiser, it works very well from my short experience, but
How close to 100% is it?
Am I misunderstanding something?
Does it work in isolation with each clip, or does it need to know about “other” class definitions not in the clip?

(The student class definition above is in a separate file and namespace)

Any insights gratefully received.


(marc hoffman) #2

Can you give me the original code snippet, without any additional formatting applied, so I can log this with a test case? thanx!


(Bob Russell) #3

Apologies - my attempt at making bold and italic lines didn’t work! -The 3 lines should be:

       students.Add(new Student { FirstName = "Mark", LastName = "Allain" });
        students.Add(new Student { FirstName = "Allen", LastName = "Brown" });
        students.Add(new Student { FirstName = "Linda", LastName = "Hamerski" });

(Bob Russell) #4

Apologies for my lack of knowledge - the codei is in a couple of short cs files - can I attach these files to a reply, or just copy paste the code into the reply

Thanks.


(RemObjects) #5

Thanks, logged as bugs://82049


(Bob Russell) #6

OK. Thanks.


(RemObjects) #7

bugs://82049 got closed with status fixed.