Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When declaring an enum, should you force the type to byte for under 256 entities?

Tags:

c#

types

enums

If you have an enum in your application and you only have a few items, should you force the underlying type to be the smallest possible type?

    enum smaller : byte     {         one,         two,         three     }; 
like image 415
ghost Avatar asked Mar 15 '09 23:03

ghost


1 Answers

No. Don't prematurely optimize unless you've proved with a profiler that it's actually a problem.

like image 173
JaredPar Avatar answered Sep 18 '22 00:09

JaredPar