When we write some destructive program, we need to traverse and extract the ID of the process.
For these features, let's start with a few APIs
1.createtoolhelp32snapshout function
Get a snapshot of a process, module, or thread
The syntax is as
The command mode encapsulates a request as an object, allowing you to parameterize the customer with different requests, queue up requests or log requests, and support revocable operations.
Test Case:
[Code]int Main () { Barbecuer boy;
Abstract Factory: Provides an interface to create a series of related or interdependent objects without specifying their specific classes.
Pattern implementation:
[Code]//create productaclass producta{public:virtual void Show () = 0;}; Class
Memo Mode (Memento): captures the internal state of an object without compromising encapsulation, and saves the state outside that object. The object can then be restored to its previously saved state.
Pattern implementation:
[Code]struct
Enjoy meta mode (Flyweight): Use sharing technology to effectively support a large number of fine-grained objects.
Four role classes:
Flyweight: The superclass or interface of all the specific classes of the class, through which the flyweight can
Visitor Mode (Visitor): Represents an operation that acts on elements in an object's structure, allowing you to define new actions that act on these elements without changing the individual element classes.
Five Role classes:
Visitor: Declares a
The example in this paper describes the method of C # for fast copying with pointers. Share to everyone for your reference. The implementation method is as follows:
fastcopy.cs//compile-time use:/unsafeusing system;class test{//unsafe keyword
The examples in this article describe how C # implements screen copies. Share to everyone for your reference. Specific as follows:
Method One:
Using system;using system.collections.generic;using system.componentmodel;using system.data;using
One, the T in the List object is the case of the value type (int type, etc.)
A list of value types can be copied directly using the following methods:
list oldlist = new list (); Oldlist.add (..); list NewList = new list (oldlist);
Second, the T
In C #, the way to iterate through the various collections of data is summarized here:
1. Enumeration type
Iterate through enumeration types for each enumeration name of Sample, foreach (String sp in Enum.getnames (typeof (Sample))) { ary.
C # Implementation code that imports Excel data into a database
If the data in Excel is as follows:
The database is built as follows:
Where ID is the self-increment field:
Code:
Using system;using system.collections.generic;using
The transformation of the JSON string into a C # object is implemented here using the Atrribute method. Because of functional limitations, this version is only for JSON strings, such as "response": "Hello", "id": 21231513, "result": +, "msg": "OK.";
///Convert List to DataTable////////// public static Da Tatable todatatable (this ilist data) {PropertyDescriptorCollection properties = Typ Edescriptor.getproperties (typeof (T)); DataTable dt = new DataTable (); for (int i = 0;
When the Web API writes API interface, the default return is to serialize your object and return it as XML, so how do you get it back as JSON, and here are two ways to do it:
Method One: (Change the Configuration method)
Locate the Global.asax file
Go to: correctly implement the IDisposable interface and the idisposable Interface
MSDN recommends implementing the IDisposable interface in the following mode:
public class Foo: IDisposable { public void Dispose() { Dispose(true)
. NET Assembly references the problem that the COM component MSScriptControl encounters. msscriptcontrol references
Problem description: to execute the js script in C #, compile it on a target platform as Any Cpu. the MSScriptControl component is
Generic delegation in c # (@ WhiteTaken ),
Today I want to learn about generic delegation in c.
1. The general delegate, delegate, can pass in the parameter (
1 using System; 2 using System. collections. generic; 3 using System. linq; 4 using System.
C # Study Notes 2,
1.Namespace Declaration: a namespace is a special classification mechanism that groups all types related to a specific function. Generally, the outer namespace is specified as the company name, which is the product name in turn,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service