G
gabriel
Greetings,
I am working on a project and cannot choose the best way to achieve this :
I got a method which returns an error code like this : DISK_FULL or
PERMISSION_DENIED.
Those are constants defined in a class named "Constants" :
public static byte DISK_FULL = 1;
public static byte PERMISSION_DENIED = 2;
Now I have a resource file with keys like this :
DISK_FULL Sorry, your disk is full, should make some room.
PERMISSION_DENIED Sorry, bla bla.
But since they are constants, the keys are not retrieved (I try to
retrieve "1" for instance), of course.
I thought to design my resource file like this :
1 Sorry, your disk is full, should make some room.
2 bla bla
My dilema is that my file is not very human-readable that way
I then thought but I could make things like this :
public static string DISK_FULL = "DISK_FULL";
public static string PERMISSION_DENIED = "PERMISSION_DENIED";
And a resource file with keys like this :
DISK_FULL Sorry, your disk is full, should make some room.
PERMISSION_DENIED Sorry, bla bla.
But I find it useless to use strings here : bytes are shorter so faster
managed (yes this does not change everything, I know )
My question : what do you do ??
phew, he finally asked the question
I come from the java world so maybe I am missing here
Thank you for your patience
I am working on a project and cannot choose the best way to achieve this :
I got a method which returns an error code like this : DISK_FULL or
PERMISSION_DENIED.
Those are constants defined in a class named "Constants" :
public static byte DISK_FULL = 1;
public static byte PERMISSION_DENIED = 2;
Now I have a resource file with keys like this :
DISK_FULL Sorry, your disk is full, should make some room.
PERMISSION_DENIED Sorry, bla bla.
But since they are constants, the keys are not retrieved (I try to
retrieve "1" for instance), of course.
I thought to design my resource file like this :
1 Sorry, your disk is full, should make some room.
2 bla bla
My dilema is that my file is not very human-readable that way
I then thought but I could make things like this :
public static string DISK_FULL = "DISK_FULL";
public static string PERMISSION_DENIED = "PERMISSION_DENIED";
And a resource file with keys like this :
DISK_FULL Sorry, your disk is full, should make some room.
PERMISSION_DENIED Sorry, bla bla.
But I find it useless to use strings here : bytes are shorter so faster
managed (yes this does not change everything, I know )
My question : what do you do ??
phew, he finally asked the question
I come from the java world so maybe I am missing here
Thank you for your patience