Using C # to develop smartphone software: Push Box (ii)

Source: Internet
Author: User
Tags static class

In the article "using C # to develop smartphone software: Push Box (a)", I made a general introduction to the Push box program. This time, I first introduce Common/fcl.cs source program files.

The following is a reference fragment:

1 using System;
2 using System.IO
3 using System.Drawing;
4
5 namespace Skyiv.Ben.PushBox.Common
6 {
7///
8///here is the. NET Framework support, and the. NET Compact framework does not support Dongdong
9///
static class FCL
1 1 {
///
13///Gets the newline string defined for this environment. --Environment
///
public static string newline {get {return "\ r \ n";}}

///
18///opens a text file, reads all the rows of the file into a string, and then closes the file. ---File
///
20///The files to be opened for reading
21///The string containing all rows of the file
public static string ReadAllText (string path)
{
String text = ';
if (file.exists (path))
{
using (StreamReader sr = new StreamReader (path, pub.encode))
{
Tex t = Sr. ReadToEnd ();
30}
31}
Return text;
33}

///
36///Creates a new file, writes the specified string to it, and then closes the file. --File
Notoginseng///
38///to write to the
39///the string to write to the file
public static void WriteAllText (string path, String conte NTS)
The
(StreamWriterSW = new StreamWriter (path, False, Pub.encode))
{
SW. Write (contents);
45}
46}
$
///
49///Adds the specified Size to the specified point. --point
///
51///To add the point
52///the Size to add
53///The result of the addition operation
"public static" add (Point poi NT, size size

to return to new point. X + size. Width, point. Y + size. Height);
57} The

///
60///Changes the size of a one-dimensional array to the specified new size. --Array
///
62///The type of the array element
63///The one-dimensional array to resize
64///The size of the new array
-public static void Resize (ref t[] Ar Ray, int newsize)
$ {
(array!= null && array). Length = = newsize) return;
if (array = = null) array = new T[0];
t[] NewArray = new T[newsize];
Array.copy (Array, NewArray, Math.min (array). Length, newarray.length));
the array = NewArray;
72}
73}
I}

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.