Skip to content

Commit be65b8e

Browse files
Merge pull request #11279 from dotnet/main
Merge main into live
2 parents 177b2a7 + 31531a9 commit be65b8e

File tree

2 files changed

+44
-17
lines changed

2 files changed

+44
-17
lines changed

snippets/csharp/System.IO/Directory/CreateDirectory/dir_createdir.cs

+18-17
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,30 @@ public static void Main()
88
{
99
// Specify the directory you want to manipulate.
1010
string path = @"c:\MyDir";
11-
11+
12+
// Determine whether the directory exists.
13+
if (Directory.Exists(path))
14+
{
15+
Console.WriteLine("That path exists already.");
16+
return;
17+
}
18+
19+
DirectoryInfo di;
1220
try
1321
{
14-
// Determine whether the directory exists.
15-
if (Directory.Exists(path))
16-
{
17-
Console.WriteLine("That path exists already.");
18-
return;
19-
}
20-
2122
// Try to create the directory.
22-
DirectoryInfo di = Directory.CreateDirectory(path);
23+
di = Directory.CreateDirectory(path);
2324
Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(path));
24-
25-
// Delete the directory.
26-
di.Delete();
27-
Console.WriteLine("The directory was deleted successfully.");
2825
}
29-
catch (Exception e)
26+
catch (UnauthorizedAccessException e)
3027
{
31-
Console.WriteLine("The process failed: {0}", e.ToString());
28+
Console.WriteLine("The caller does not have the required permission to create `{0}`", path);
29+
return;
3230
}
33-
finally {}
31+
32+
// Delete the directory.
33+
di.Delete();
34+
Console.WriteLine("The directory was deleted successfully.");
3435
}
3536
}
36-
// </Snippet1>
37+
// </Snippet1>

xml/System/Math.xml

+26
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
18241824
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</para>
18251825
</returns>
18261826
<remarks>To be added.</remarks>
1827+
<exception cref="T:System.ArgumentException">
1828+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
18271829
</Docs>
18281830
</Member>
18291831
<Member MemberName="Clamp">
@@ -1880,6 +1882,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
18801882

18811883
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
18821884
<remarks>To be added.</remarks>
1885+
<exception cref="T:System.ArgumentException">
1886+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
18831887
</Docs>
18841888
</Member>
18851889
<Member MemberName="Clamp">
@@ -1940,6 +1944,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
19401944

19411945
<see cref="F:System.Double.NaN" /> if <paramref name="value" /> equals <see cref="F:System.Double.NaN" />.</returns>
19421946
<remarks>To be added.</remarks>
1947+
<exception cref="T:System.ArgumentException">
1948+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
19431949
</Docs>
19441950
</Member>
19451951
<Member MemberName="Clamp">
@@ -1996,6 +2002,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
19962002

19972003
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
19982004
<remarks>To be added.</remarks>
2005+
<exception cref="T:System.ArgumentException">
2006+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
19992007
</Docs>
20002008
</Member>
20012009
<Member MemberName="Clamp">
@@ -2052,6 +2060,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
20522060

20532061
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
20542062
<remarks>To be added.</remarks>
2063+
<exception cref="T:System.ArgumentException">
2064+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
20552065
</Docs>
20562066
</Member>
20572067
<Member MemberName="Clamp">
@@ -2108,6 +2118,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
21082118

21092119
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
21102120
<remarks>To be added.</remarks>
2121+
<exception cref="T:System.ArgumentException">
2122+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
21112123
</Docs>
21122124
</Member>
21132125
<Member MemberName="Clamp">
@@ -2181,6 +2193,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
21812193
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</para>
21822194
</returns>
21832195
<remarks>To be added.</remarks>
2196+
<exception cref="T:System.ArgumentException">
2197+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
21842198
</Docs>
21852199
</Member>
21862200
<Member MemberName="Clamp">
@@ -2243,6 +2257,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
22432257

22442258
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
22452259
<remarks>To be added.</remarks>
2260+
<exception cref="T:System.ArgumentException">
2261+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
22462262
</Docs>
22472263
</Member>
22482264
<Member MemberName="Clamp">
@@ -2303,6 +2319,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
23032319

23042320
<see cref="F:System.Single.NaN" /> if <paramref name="value" /> equals <see cref="F:System.Single.NaN" />.</returns>
23052321
<remarks>To be added.</remarks>
2322+
<exception cref="T:System.ArgumentException">
2323+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
23062324
</Docs>
23072325
</Member>
23082326
<Member MemberName="Clamp">
@@ -2365,6 +2383,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
23652383

23662384
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
23672385
<remarks>To be added.</remarks>
2386+
<exception cref="T:System.ArgumentException">
2387+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
23682388
</Docs>
23692389
</Member>
23702390
<Member MemberName="Clamp">
@@ -2427,6 +2447,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
24272447

24282448
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
24292449
<remarks>To be added.</remarks>
2450+
<exception cref="T:System.ArgumentException">
2451+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
24302452
</Docs>
24312453
</Member>
24322454
<Member MemberName="Clamp">
@@ -2489,6 +2511,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
24892511

24902512
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</returns>
24912513
<remarks>To be added.</remarks>
2514+
<exception cref="T:System.ArgumentException">
2515+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
24922516
</Docs>
24932517
</Member>
24942518
<Member MemberName="Clamp">
@@ -2568,6 +2592,8 @@ Dim i2 As Integer = CInt(Math.Ceiling(d2)) ' Result: 7969
25682592
<paramref name="max" /> if <paramref name="max" /> &lt; <paramref name="value" />.</para>
25692593
</returns>
25702594
<remarks>To be added.</remarks>
2595+
<exception cref="T:System.ArgumentException">
2596+
<paramref name="max" /> is less than <paramref name="min"/>. </exception>
25712597
</Docs>
25722598
</Member>
25732599
<Member MemberName="CopySign">

0 commit comments

Comments
 (0)