what do you think

"Neil Cawse" <[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <AD5227CC61948542858F505100BC7FB0173C69@Server.burlington.geotab.com>
What do you think about reducing the instance size doing this:

	private BitVector32 flags = new BitVector32();

	private const int AcceptsTabFlag = 0x00;
	private const int AutoSizeFlag = 0x01;
	private const int HideSelectionFlag = 0x02;
	private const int ModifiedFlag = 0x04;
	private const int MultilineFlag = 0x08;
	private const int ReadOnlyFlag = 0x0F;
	private const int WordWrapFlag = 0x10;
	private const int InsertModeFlag = 0x20;


	// Constructor.
	internal TextBoxBase() : base()
			{
				flags[AutoSizeFlag | HideSelectionFlag |
WordWrapFlag | InsertModeFlag] = true;
				...
			}

	// Get or set this object's properties.
	public bool AcceptsTab
			{
				get
				{
					return flags[AcceptsTabFlag];
				}
				set
				{
					if (flags[AcceptsTabFlag] !=
value)
					{
						flags[AcceptsTabFlag] =
value;
	
OnAcceptsTabChanged(EventArgs.Empty);
					}
				}
			}

I was thinking about putting it into Control where we have lots of bit
fields too. Its probably not necessary on all controls.
In this example we save 28 bytes but it will be more for Control.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.