Search Results

Search found 2 results on 1 pages for 'hauge'.

Page 1/1 | 1 

  • Best way to represent Gender in a class library used in multilingual applications

    - by Hauge
    I'm creating class library with some commonly used classes like persons, addresses etc. This library will be used in an multilingual application, and I am looking for the most convenient way to represent a persons gender. Ideally I would like to be able to code like this: Person person = new Person { Gender = Genders.Male, FirstName = "Nice", LastName = "Dude" } if (person.Gender == Genders.Male) Console.WriteLine("person is Male"); Console.WriteLine(person.Gender); //Should output: Male Console.WriteLine(person.Gender.ToString("da-DK")); //Should output the name of the gender in the language provided List<Gender> genders = Genders.GetAll(); foreach(Gender gender in genders) { Console.WriteLine(gender.ToString()); Console.WriteLine(gender.ToString("da-DK")); } What would you do? An enumeration and a specialized Gender class, but what about the localization then? Regards Jesper Hauge

    Read the article

  • Prolog: using the sort/2 predicate

    - by Øyvind Hauge
    So I'm trying to get rid of the wrapper clause by using the sort library predicate directly inside split. What split does is just generating a list of numbers from a list that looks like this: [1:2,3:2,4:6] ---split-- [1,2,3,2,4,6]. But the generated list contains duplicates, and I don't want that, so I'm using the wrapper to combine split and sort, which then generates the desired result: [1,2,3,4,6]. I'd really like to get rid of the wrapper and just use sort within split, however I keep getting "ERROR: sort/2: Arguments are not sufficiently instantiated." Any ideas? Thanks :) split([],[]). split([H1:H2|T],[H1,H2|NT]) :- split(T,NT). wrapper(L,Processed) :- split(L,L2), sort(L2,Processed).

    Read the article

1