background image

struct DriveInfoSystem

! Z; `2 i# y* @6 ^* _3 N1 B

{

+ G. e4 O7 q' k, T# A2 |1 {

    public
readonly

9 ?4 j' e! t) s1 g: w

string Drive;

5 `( B" _0 ]; I* A/ N

    public
readonly

3 i) C8 J7 x3 e

long Result;

7 S$ q8 f) W6 V  B4 h" g

    public

' c0 B" Q  P8 Q% e

readonly

# z( d- v' U" Q2 z! L+ i/ e! {

long Available;
    public
readonly

7 c7 a' G* H. {$ ?  p# g+ a

long Total;

1 n* x! ~9 n3 i  o

    public
readonly
long Free;

    public DriveInfoSystem(string drive, long result, long available, long total, long free)

) A  X5 { 

k+ ?( V3 ^% e

    {
        this.Drive = drive;

! S8 w8 l5 L, F3 g, d6 J) T6 q

        this.Result = result;

5 i9 h9 ~, b) w% V. r1 m

        this.Available = available;

/ q' p; t6 p4 |0 A, t

        this.Total = total;
        this.Free = free;

1 ^# J8 |9 ~. J. J

    }
}

  `* q- m0 h! J, o
9 R8 |6 V! p' `8 @, n* q

可以通过
DriveInfoSystem info = DriveInfo.GetInfo("c:");来获得指定磁盘的开销情况

11.如何获得不区分大小写的子字符串的索引位置

6 E+ X/ k0 x$ C0 ^& T  T# K

1)通过将两个字符串转换成小写之后使用字符串的 IndexOf 方法:

string strParent =

, d* X8 i4 Y1 ^* X

"The Codeproject site is very informative.";

+ H  _! h$ ~+ g: Q

% S7 G7 {2 u1 G1 u1 H& e

string strChild =

+ D; c8 l3 E- U0 U9 N9 C

"codeproject";