.


:




:

































 

 

 

 


System.Text.StringBuilder




 

C# , . 䳿, , . . .

string s1 = " ";

string s2 = s1.ToUpper();

Response.Write(s1);

Response.Write("</br>");

Response.Write(s2);

s1 . ToUpper() s1 , , , . . .

, , ' ' ' .

C# StringBuilder, . , ' , , , .

, StringBuilder, . Append. . , :

StringBuilder sb = new StringBuilder(" ");

sb.Append(", ");

Response.Write(sb);

 

StringBuilder , . ϳ , 䳿, ' , , ToString() ' string.

 

 

Append '
AppendFormat (, , ) '
CopyTo
Insert '
Remove '
Replace '

 

StringBuilder, , ' ﳿ .

 

C#

 

C# C++.

, , , , . , ; , , . , , - , . , , - .

, , ' C#. C# , , C# '- , . C# .

, , "".

:

[][]{void | }

' ([ ])

' . , , , .

- , , . , , : private public.

Private , , , . Public , , - .

' , , . , - , void, .

:

private void A()

{}

public int B()

{}

public long Stepen(int , int b)

{

long r;

r = (long)Math.Pow(, b);

return (r);

}

A , B Stepen . A B , Stepen : b.

, , . , , , .

:

[ref|out|params] _ _

' , , , , , - , C#.

, , . params. , . .

: , , .

, , .

, .

, .

out, ' ; ref.

Stepen:

public void Stepen(out long r,int , int b)

{

r = (long)Math.Pow(, b);

}

, Stepen ( void). r, . , , .

:

long s;

Stepen(out s, 2, 6);

Response.Write(s.ToString());

, out. , Stepen , r s, .

, params.

3

 

Stepen . :

public void Stepen(out long r, int , params int[] b)

{

r = 0;

foreach (int i in b)

r += (long)Math.Pow(i, );

}

:

int[] digits ={1,8,4};

Stepen(out s, 2, digits);

Response.Write(s.ToString());

, . r, s . 81.

, , .

4

 

, , , . :

public void Stepen(out long[] r,int , params int[] b)

{

r=new long[0];

Array.Resize(ref r,b.Length);

int j=0;

foreach (int i in b)

r[j++]= (long)Math.Pow(i, );

}

. -, , , long.

-, , b. Resize ' Array. , , Resize r, .

, Resize ref, , r, , ﳿ. :

 

Response.Write(" :<br/>");

long [] result;

int [] data={2,3,4,5};

Stepen3(out result, 2, data);

foreach (long i in result)

Response.Write(i.ToString()+"<br/>");

.

 

 

. 2.4 ,

 

ϳ , .

, '- , #, , ' , ' , '. , ' ref out, . ' , ', . , ref out ' .

 

 

1:

 

Microsoft Visual Studio 2012 , , , .

 

1. , 10 . .

2. 10 , . ϳ , .

3. , 10 . ϳ 互 .

4. , 10 . 互 .

5. 10 , . ϳ .

6. , 10 . , .

7. , 10 . , .

8. 10 , . ϳ, .

9. , 10 . 䒺 .

10. , 10 . .

11. 10 , . ϳ , .

12. , 10 . , .

13. 10 , . ϳ .

14. , 10 . ϳ , .

15. 10 , . ϳ , .

 

 

2:

 

1. , . , .

2. . ϳ, , , .

3. . , , .

3. , . .

4. , (:). , .

5. , , . , ' .

6. . , .

7. . ϳ .

8. . ϳ, . .

9. , , , . , .

10. , . , .

11. . , .

12. . , .

13. (:). ϳ .

14. , .

15. (;). ϳ .

:

1) .

2) ?

3) , #?

4) ?

5) ?

6) Array?

7) ?

8) ³ C#?

9) System.String?

10) System. Text. StringBuilder?

11)

12) ?

13)

14) ?

15) ?

 

3





:


: 2016-11-18; !; : 481 |


:

:

, .
==> ...

1840 - | 1651 -


© 2015-2024 lektsii.org - -

: 0.046 .