- 浏览: 399509 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
BitVector is something that provided by the .net Framework, which is provided to aim the development in the memory effecient way.
You can use the BitVector to create some bit flags construct; The BitVector also has the concept of Sectoin, whereas you can group several bit to a bit section, and operate on the bitsection as a whole.
The original code is copied and remodeld from the MSDN discussion, for more detail son the APIs, please see the origial site here: "BitVector Structure"
Use the BitVector to create bit flags
In the following code, it shows how to create the bit flags and the relevante bit mask with the help of BItVector.
public static void DemoBitVector32() { BitVector32 myBV = new BitVector32(); int myBit1 = BitVector32.CreateMask(); // A mask that isolates the bit flag following the one that previous points to in System.Collections.Specialized.BitVector32. int myBit2 = BitVector32.CreateMask(myBit1); // it can accept the previous bit order int myBit3 = BitVector32.CreateMask(myBit2); // it can accept the previous bit order int myBit4 = BitVector32.CreateMask(myBit3); // it can accept the previous bit order int myBit5 = BitVector32.CreateMask(myBit4); // it can accept the previous bit order // set the alternating bit to TRUE: Console.WriteLine("Setting alternating bits to TRUE"); Console.WriteLine(" Initial: {0}", myBV.ToString()); myBV[myBit1] = true; Console.WriteLine("Setting alternating bits to TRUE"); Console.WriteLine(" Initial: {0}", myBV.ToString()); myBV[myBit3] = true; Console.WriteLine("Setting alternating bits to TRUE"); Console.WriteLine(" Initial: {0}", myBV.ToString()); myBV[myBit5] = true; Console.WriteLine("Setting alternating bits to TRUE"); Console.WriteLine(" Initial: {0}", myBV.ToString()); }
Use BitVector to create Bit Sections
The following code uses the BitVector to create bit Sections.
public static void DemoBitVector32_v2() { BitVector32 myBV = new BitVector32(0); BitVector32.Section mySect1 = BitVector32.CreateSection(6); BitVector32.Section mySect2 = BitVector32.CreateSection(3, mySect1); BitVector32.Section mySect3 = BitVector32.CreateSection(1, mySect2); BitVector32.Section mySect4 = BitVector32.CreateSection(15, mySect3); // Displays the values of the sections. Console.WriteLine("Initial values:"); Console.WriteLine("\tmySect1: {0}", myBV[mySect1]); Console.WriteLine("\tmySect2: {0}", myBV[mySect2]); Console.WriteLine("\tmySect3: {0}", myBV[mySect3]); Console.WriteLine("\tmySect4: {0}", myBV[mySect4]); Console.WriteLine("Changing the value of each section\n"); Console.WriteLine("\tInitial: \t{0}", myBV.ToString()); myBV[mySect1] = 5; Console.WriteLine("\tmySect1 = 5:\t{0}", myBV.ToString()); myBV[mySect2] = 3; Console.WriteLine("\tmySect1 = 5:\t{0}", myBV.ToString()); myBV[mySect3] = 1; Console.WriteLine("\tmySect1 = 5:\t{0}", myBV.ToString()); myBV[mySect4] = 9; Console.WriteLine("\tmySect1 = 5:\t{0}", myBV.ToString()); Console.WriteLine("New values:"); Console.WriteLine("\tmySect1: {0}", myBV[mySect1]); Console.WriteLine("\tmySect2: {0}", myBV[mySect2]); Console.WriteLine("\tmySect3: {0}", myBV[mySect3]); Console.WriteLine("\tmySect4: {0}", myBV[mySect4]); }
发表评论
-
wpf - example to enhance ComboBox for AutoComplete
2014-09-19 15:56 1976first let’s see an example ... -
Investigate and troubleshoot possible memory leak issue of .NET application
2014-07-31 10:42 0Hi All, I would like to sh ... -
C# – CoerceValueCallback合并、替换元数据值
2013-08-05 21:59 1925Topic: C# – CoerceValueCallbac ... -
wpf – ListView交替背景色
2013-07-02 20:56 6551Wpf – Alternate background col ... -
C# - 简单介绍TaskScheduler
2013-06-29 17:18 12038标题: C# - 简单介绍TaskSchedulerTit ... -
c# - Get enum from enum attribute
2013-06-27 21:32 1244DescriptionAttribute gives the ... -
C# - PInvoke, gotchas on the RegisterClassEx and the CreateWindowEx
2013-06-24 13:49 2571I get an exception message li ... -
c# - Use PInvoke to create simple win32 Application
2013-06-24 11:59 10946In this post, .net platform h ... -
c# - Linq's Select method as the Map function
2013-06-19 18:47 1287If you comes from a functiona ... -
c# - Tips of Linq expression Any to determine if a collection is Empty
2013-06-19 18:29 938When you are @ the linq expres ... -
myth buster - typeof accepting array of types not acceptable
2013-06-19 17:17 813I have seen from some book whe ... -
windows - trying to create WIN32 application with PInvoke
2013-06-19 14:34 0While it is stupid to do such ... -
WPF - Setting foreground color of Entire window
2013-06-13 16:00 1918You might as well as I would s ... -
WPF - Enhanced TabControl - TabControlEx aka Prerendering TabControl
2013-06-13 13:12 5330As an opening word, let's che ... -
wpf - ControlTemplate and AddLogicChild/RemoveLogicalChild
2013-06-10 15:42 1185Recently I was trying to debug ... -
c# - P/Invoke, DllImport, Marshal Structures and Type conversions
2013-06-05 15:25 1712P/Invoke as in the following q ... -
c# - A study on the NativeWindow - encapsulate window handle and procedure
2013-06-05 14:40 6091NativeWindow gives you a way t ... -
WCF - Notify server when client connects
2013-06-03 18:19 1220It is sometimes very importan ... -
wcf - Debug to enable Server exception in Fault message
2013-06-03 15:47 1091WCF will be able to send back ... -
c# - determine if a type/object is serialzable
2013-05-30 16:35 867In WCF, primitives type are s ...
相关推荐
Head First C# -- Third Edition by Andrew Stellman and Jennifer Greene Copyright © 2013 Andrew Stellman and Jennifer Greene. All rights reserved.
标题"C#-ymodem-update"指的是一个使用C#编程语言开发的YMODEM协议实现,主要功能是用于设备固件的升级,特别是针对bootloader的更新。YMODEM是一种流行的串行通信协议,用于在计算机之间传输文件,尤其是在低带宽和...
《大恒双相机开发-C#-多线程项目开源解析》 在当今信息化时代,高效、稳定的图像处理系统成为许多领域不可或缺的技术支持。本项目"大恒-双相机开发-C#-多线程"正是这样的一个实例,它利用C#语言进行编程,实现了对...
在本实例中,“protobuf实例-C#-聊天服务器”是基于C#语言实现的一个聊天服务项目,利用protobuf进行数据序列化和反序列化,以便于在网络通信中高效地传输聊天消息。 在C#环境下,protobuf提供了编译器工具,可以将...
### C# 12 in a Nutshell:The Definitive Reference #### 1. Introducing C# and .NET ...examples, and practical guidance for intermediate and advanced programmers looking to master C# and .NET.
C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition by Mark J. Price English | 24 Mar. 2017 | ASIN: B01N8UG78Q | 594 Pages | AZW3 | 23.26 MB Modern Cross-Platform Development ...
名称: “C# - 模拟开心农场” 说明: C#模拟开心农场,经历播种、生长、开花、结果、收获的过程; 源代码分为两个版本: 一是手动实现成长收获的过程,另一版本是后台线程自动实现成长收获的过程 ^_^
在本文中,我们将深入探讨如何使用C#和WPF(Windows Presentation Foundation)技术来实现一个具有抽屉效果的SplitView控件,以及如何通过MD(Material Design)主题重绘原生控件,以达到美观的效果。这个源码Demo...
C#编程 数据库操作应用 UseSelect(源码)(源码)C#编程 数据库操作应用 UseSelect(源码)(源码)C#编程 数据库操作应用 UseSelect(源码)(源码)C#编程 数据库操作应用 UseSelect(源码)(源码)C#编程 数据库操作应用 Use...
【标题】"C#版USB-HID范例" 涉及的是在C#编程环境中与USB设备进行Human Interface Device (HID)通信的技术。USB-HID类库允许开发者直接与各种类型的输入设备(如键盘、鼠标、游戏控制器等)进行交互,而无需关心具体...
#学习的101个经典例子,例子个个经典,涵盖C#的方方面面,带有说详尽的注释 Advanced - Multithreading - How-To Async Calls Advanced - Remoting - How-To TCP Remoting Advanced - Serialization - How-To ...
以上是对"最新3.3支付宝即时到账交易接口demo源码c#-gbk源码"所涉及的关键知识点的详细解析,通过这个源码,开发者可以学习如何在C#环境下实现与支付宝接口的集成,完成线上支付功能。在实际开发过程中,还需要结合...
With Microsoft speeding up its release cadence while offering more significant improvement with each update, it has never been more important to get a handle on new tools and features quickly....
在C# WinForm开发中,数据展示和处理是常见的任务,而`dataGridView`控件是常用的界面元素,用于显示和编辑表格数据。本教程将详细讲解如何高效地将`dataGridView`中的数据批量导出到Excel文件,特别是针对大量数据...
Easy-to-follow recipes to get you up-and-running with the new features of C# 7 and .NET Core 1.1 Practical solutions to assist you with microservices and serverless computing in C# Explore the new ...
Hands-On Network Programming with C# and .NET Core: A comprehensive guide to understanding network architecture, communication protocols, and network analysis to build secure applications compatible ...
《C#图书管理系统(带数据库)》是一款基于C#编程语言和数据库技术开发的应用软件,主要功能是管理和维护图书馆的图书资源。系统涵盖了图书的入库、出库、借阅、归还、查询等一系列操作,旨在提高图书管理的效率和...
这个项目源码是使用C#编程语言实现的,旨在帮助开发者实现对多块电表的数据读取、解析以及统计功能。下面我们将详细探讨这个项目涉及的关键知识点。 1. C#编程语言:C#是由微软开发的一种面向对象的编程语言,广泛...