A
A
Andrey Plax2016-08-02 11:01:26
Programming
Andrey Plax, 2016-08-02 11:01:26

In what type of variable to store (m\f) sex?

In what type of variable to store floor, bool, enum (enumeration), other options? And why?
I write in C# and it seems that you can easily use boolean :) But I consulted with an experienced 1C nickname, and he says that in no case !!! That in 1C both gender and Legal Person\Physical Person and other similar parameters are enumerations of 2 values. But isn't it easier:
bool isWoman = true (or false) ;
???
In advance, thanks to everyone who adequately answers!

Answer the question

In order to leave comments, you need to log in

6 answer(s)
F
Fat Lorrie, 2016-08-02
@Hereigo

IMHO, it's wasteful to make a separate table under the floor. Perfect (if you do not go into the wilds of human deviations):

enum Sex { 
    Male,
    Female,
    Undefined
}

bool?- also an option, but it reads worse.

P
Peter, 2016-08-02
@petermzg

Due to the craziness of today's society, it's better to store "gender" as an int and use a separate table for the values.

K
Konstantin Nagibovich, 2016-08-02
@nki

1C nickname told you correctly - for such cases, enumerations are used in 1C. This makes it easier to follow. You don't have to figure out who is who - a man or a woman.

I
iv_k, 2016-08-02
@iv_k

how does facebook
www.independent.ie/business/technology/facebook-ad...
soon and inta may become small =)

G
Georgy Pelageykin, 2016-08-02
@ArXen42

For flexibility (and according to Sharp's ideology), it can be made into a structure that encapsulates this Int32 / Nullable / Enum, etc., capable of converting from different representations, issuing localized gender names, serialization, and other useful things.

A
Alexander Vladimirovich, 2017-05-25
@polyanin

The international standard ISO 5218 describes the representation of human sexes. It can be used in information systems and databases.
The 4 codes defined in the standard specification look like:
0 - unknown
1 - male
2 - female
9 - not applicable
https://ru.wikipedia.org/wiki/ISO_5218

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question