- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathPath.xml
3601 lines (3230 loc) · 250 KB
/
Path.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<TypeName="Path"FullName="System.IO.Path">
<TypeSignatureLanguage="C#"Value="public static class Path"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<TypeSignatureLanguage="ILAsm"Value=".class public auto ansi abstract sealed beforefieldinit Path extends System.Object"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<TypeSignatureLanguage="DocId"Value="T:System.IO.Path" />
<TypeSignatureLanguage="VB.NET"Value="Public Class Path"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<TypeSignatureLanguage="F#"Value="type Path = class" />
<TypeSignatureLanguage="C++ CLI"Value="public ref class Path abstract sealed"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<TypeSignatureLanguage="C#"Value="public sealed class Path"FrameworkAlternate="netframework-1.1" />
<TypeSignatureLanguage="ILAsm"Value=".class public auto ansi sealed beforefieldinit Path extends System.Object"FrameworkAlternate="netframework-1.1" />
<TypeSignatureLanguage="VB.NET"Value="Public NotInheritable Class Path"FrameworkAlternate="netframework-1.1" />
<TypeSignatureLanguage="C++ CLI"Value="public ref class Path sealed"FrameworkAlternate="netframework-1.1" />
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwardingFrom="mscorlib"FromVersion="4.0.0.0"To="System.Runtime.Extensions"ToVersion="0.0.0.0"FrameworkAlternate="dotnet-uwp-10.0" />
<TypeForwardingFrom="netstandard"FromVersion="2.1.0.0"To="System.Runtime"ToVersion="10.0.0.0"FrameworkAlternate="net-10.0" />
<TypeForwardingFrom="System.Runtime.Extensions"FromVersion="10.0.0.0"To="System.Runtime"ToVersion="10.0.0.0"FrameworkAlternate="net-10.0" />
<TypeForwardingFrom="netstandard"FromVersion="2.1.0.0"To="System.Runtime"ToVersion="5.0.0.0"FrameworkAlternate="net-5.0" />
<TypeForwardingFrom="System.Runtime.Extensions"FromVersion="5.0.0.0"To="System.Runtime"ToVersion="5.0.0.0"FrameworkAlternate="net-5.0" />
<TypeForwardingFrom="netstandard"FromVersion="2.1.0.0"To="System.Runtime"ToVersion="6.0.0.0"FrameworkAlternate="net-6.0" />
<TypeForwardingFrom="System.Runtime.Extensions"FromVersion="6.0.0.0"To="System.Runtime"ToVersion="6.0.0.0"FrameworkAlternate="net-6.0" />
<TypeForwardingFrom="netstandard"FromVersion="2.1.0.0"To="System.Runtime"ToVersion="7.0.0.0"FrameworkAlternate="net-7.0" />
<TypeForwardingFrom="System.Runtime.Extensions"FromVersion="7.0.0.0"To="System.Runtime"ToVersion="7.0.0.0"FrameworkAlternate="net-7.0" />
<TypeForwardingFrom="netstandard"FromVersion="2.1.0.0"To="System.Runtime"ToVersion="8.0.0.0"FrameworkAlternate="net-8.0" />
<TypeForwardingFrom="System.Runtime.Extensions"FromVersion="8.0.0.0"To="System.Runtime"ToVersion="8.0.0.0"FrameworkAlternate="net-8.0" />
<TypeForwardingFrom="netstandard"FromVersion="2.1.0.0"To="System.Runtime"ToVersion="9.0.0.0"FrameworkAlternate="net-9.0" />
<TypeForwardingFrom="System.Runtime.Extensions"FromVersion="9.0.0.0"To="System.Runtime"ToVersion="9.0.0.0"FrameworkAlternate="net-9.0" />
<TypeForwardingFrom="System.Runtime.Extensions"FromVersion="4.1.1.1"To="mscorlib"ToVersion="4.0.0.0"FrameworkAlternate="netframework-4.6.2-pp" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<AttributeFrameworkAlternate="net-10.0;net-9.0">
<AttributeNameLanguage="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeNameLanguage="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
<AttributeFrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeNameLanguage="C#">[System.Runtime.InteropServices.ComVisible(true)]</AttributeName>
<AttributeNameLanguage="F#">[<System.Runtime.InteropServices.ComVisible(true)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Performs operations on <seecref="T:System.String" /> instances that contain file or directory path information. These operations are performed in a cross-platform manner.</summary>
<remarks>
<formattype="text/markdown"><.
Most members of the `Path` class do not interact with the file system and do not verify the existence of the file specified by a path string. `Path` class members that modify a path string, such as <xref:System.IO.Path.ChangeExtension%2A>, have no effect on names of files in the file system.
Some `Path` members do validate the contents of a specified path string, and throw an <xref:System.ArgumentException> if the string contains characters that are not valid in path strings, as defined in the characters returned from the <xref:System.IO.Path.GetInvalidPathChars%2A> method. For example, on Windows-based desktop platforms, invalid path characters might include quote ("), less than (\<), greater than (>), pipe (|), backspace (\\b), null (\\0), and Unicode characters 16 through 18 and 20 through 25. This validation behavior varies between .NET versions:
- On .NET Framework and .NET Core versions older than 2.1: All `Path` members that take a path as an argument throw an <xref:System.ArgumentException> if they detect invalid path characters.
- On .NET Core 2.1 and later versions: <xref:System.IO.Path.GetFullPath%2A> is the only member that throws an <xref:System.ArgumentException> if the string contains invalid path characters.
The members of the `Path` class enable you to quickly and easily perform common operations such as determining whether a file name extension is part of a path, and combining two strings into one path name.
All members of the `Path` class are static and can therefore be called without having an instance of a path.
> [!NOTE]
> In members that accept a path as an input string, that path must be well-formed or an exception is raised. For example, if a path is fully qualified but begins with a space, the path is not trimmed in methods of the class. Therefore, the path is malformed and an exception is raised. Similarly, a path or a combination of paths cannot be fully qualified twice. For example, "c:\\temp c:\\windows" also raises an exception in most cases. Ensure that your paths are well-formed when using methods that accept a path string.
In members that accept a path, the path can refer to a file or just a directory. The specified path can also refer to a relative path or a Universal Naming Convention (UNC) path for a server and share name. For example, all the following are acceptable paths:
- "c:\\\\MyDir\\\\MyFile.txt" in C#, or "c:\\MyDir\\MyFile.txt" in Visual Basic.
- "c:\\\\MyDir" in C#, or "c:\\MyDir" in Visual Basic.
- "MyDir\\\\MySubdir" in C#, or "MyDir\\MySubDir" in Visual Basic.
- "\\\\\\\\MyServer\\\\MyShare" in C#, or "\\\\MyServer\\MyShare" in Visual Basic.
Because all these operations are performed on strings, it is impossible to verify that the results are valid in all scenarios. For example, the <xref:System.IO.Path.GetExtension%2A> method parses a string that you pass to it and returns the extension from that string. However, this does not mean that a file with that extension exists on the disk.
For a list of common I/O tasks, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
## Examples
The following example demonstrates some of the main members of the `Path` class.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Overview/path class.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Path Class/VB/path class.vb" id="Snippet1":::
]]></format>
</remarks>
<relatedtype="Article"href="/dotnet/standard/io/">File and Stream I/O</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-read-and-write-to-a-newly-created-data-file">How to: Read and Write to a Newly Created Data File</related>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
</Docs>
<Members>
<MemberMemberName="AltDirectorySeparatorChar">
<MemberSignatureLanguage="C#"Value="public static readonly char AltDirectorySeparatorChar;" />
<MemberSignatureLanguage="ILAsm"Value=".field public static initonly char AltDirectorySeparatorChar" />
<MemberSignatureLanguage="DocId"Value="F:System.IO.Path.AltDirectorySeparatorChar" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared ReadOnly AltDirectorySeparatorChar As Char " />
<MemberSignatureLanguage="F#"Value=" staticval mutable AltDirectorySeparatorChar : char"Usage="System.IO.Path.AltDirectorySeparatorChar" />
<MemberSignatureLanguage="C++ CLI"Value="public: static initonly char AltDirectorySeparatorChar;" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Char</ReturnType>
</ReturnValue>
<Docs>
<summary>Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.</summary>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
This field can have the same value as <xref:System.IO.Path.DirectorySeparatorChar>. `AltDirectorySeparatorChar` and <xref:System.IO.Path.DirectorySeparatorChar> are both valid for separating directory levels in a path string.
The value of this field is a slash ('/') on both Windows and Unix-based operating systems.
## Examples
The following example displays <xref:System.IO.Path> field values on Windows and on Unix-based systems. Note that Windows supports either the forward slash (which is returned by the <xref:System.IO.Path.AltDirectorySeparatorChar> field) or the backslash (which is returned by the <xref:System.IO.Path.DirectorySeparatorChar> field) as path separator characters, while Unix-based systems support only the forward slash.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/DirectorySeparatorChar/Program.cs":::
:::code language="vb" source="~/snippets/visualbasic/api/system.io/path/directoryseparatorchar/program.vb":::
]]></format>
</remarks>
<relatedtype="Article"href="/dotnet/standard/io/">File and Stream I/O</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
</Docs>
</Member>
<MemberMemberName="ChangeExtension">
<MemberSignatureLanguage="C#"Value="public static string ChangeExtension (string path, string extension);"FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig string ChangeExtension(string path, string extension) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.ChangeExtension(System.String,System.String)" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function ChangeExtension (path As String, extension As String) As String" />
<MemberSignatureLanguage="F#"Value="static member ChangeExtension : string * string -> string"Usage="System.IO.Path.ChangeExtension (path, extension)" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static System::String ^ ChangeExtension(System::String ^ path, System::String ^ extension);" />
<MemberSignatureLanguage="C#"Value="public static string? ChangeExtension (string? path, string? extension);"FrameworkAlternate="net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-3.0;netcore-3.1;netframework-4.6.2-pp" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path"Type="System.String" />
<ParameterName="extension"Type="System.String" />
</Parameters>
<Docs>
<paramname="path">The path information to modify.</param>
<paramname="extension">The new extension (with or without a leading period). Specify <seelangword="null" /> to remove an existing extension from <paramrefname="path" />.</param>
<summary>Changes the extension of a path string.</summary>
<returns>The modified path information.
On Windows-based desktop platforms, if <paramrefname="path" /> is <seelangword="null" /> or an empty string (""), the path information is returned unmodified. If <paramrefname="extension" /> is <seelangword="null" />, the returned string contains the specified path with its extension removed. If <paramrefname="path" /> has no extension, and <paramrefname="extension" /> is not <seelangword="null" />, the returned path string contains <paramrefname="extension" /> appended to the end of <paramrefname="path" />.</returns>
<remarks>
<formattype="text/markdown"><.
## Examples
The following example demonstrates a use of the `ChangeExtension` method.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/ChangeExtension/pathmembers.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Path Members/VB/pathmembers.vb" id="Snippet1":::
]]></format>
</remarks>
<exceptioncref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: <paramrefname="path" /> contains one or more of the invalid characters defined in <seecref="M:System.IO.Path.GetInvalidPathChars" />.</exception>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
<relatedtype="Article"href="/dotnet/standard/io/">File and Stream I/O</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
</Docs>
</Member>
<MemberGroupMemberName="Combine">
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Combines strings into a path.</summary>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
This method is intended to concatenate individual strings into a single string that represents a file path. However, if an argument other than the first contains a rooted path, any previous path components are ignored, and the returned string begins with that rooted path component. As an alternative to the `Combine` method, consider using the <xref:System.IO.Path.Join%2A> or <xref:System.IO.Path.TryJoin%2A> methods (not available in .NET Framework).
> [!IMPORTANT]
> This method assumes that the first argument is an absolute path and that the following argument or arguments are relative paths. If this is not the case, and particularly if any subsequent arguments are strings input by the user, call the <xref:System.IO.Path.Join%2A> or <xref:System.IO.Path.TryJoin%2A> method instead.
]]></format>
</remarks>
</Docs>
</MemberGroup>
<MemberMemberName="Combine">
<MemberSignatureLanguage="C#"Value="public static string Combine (scoped ReadOnlySpan<string> paths);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig string Combine(valuetype System.ReadOnlySpan`1<string> paths) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.Combine(System.ReadOnlySpan{System.String})" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function Combine (paths As ReadOnlySpan(Of String)) As String" />
<MemberSignatureLanguage="F#"Value="static member Combine : ReadOnlySpan<string> -> string"Usage="System.IO.Path.Combine paths" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static System::String ^ Combine(ReadOnlySpan<System::String ^> paths);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="paths"Type="System.ReadOnlySpan<System.String>"Index="0"FrameworkAlternate="net-9.0;net-10.0">
<Attributes>
<Attribute>
<AttributeNameLanguage="C#">[System.Runtime.CompilerServices.Nullable(new System.Byte[] { 0, 1 })]</AttributeName>
<AttributeNameLanguage="F#">[<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 0, 1 })>]</AttributeName>
</Attribute>
<Attribute>
<AttributeNameLanguage="C#">[System.Runtime.CompilerServices.ParamCollection]</AttributeName>
<AttributeNameLanguage="F#">[<System.Runtime.CompilerServices.ParamCollection>]</AttributeName>
</Attribute>
<Attribute>
<AttributeNameLanguage="C#">[System.Runtime.CompilerServices.ScopedRef]</AttributeName>
<AttributeNameLanguage="F#">[<System.Runtime.CompilerServices.ScopedRef>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<paramname="paths">A span of parts of the path.</param>
<summary>Combines a span of strings into a path.</summary>
<returns>The combined paths.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<MemberMemberName="Combine">
<MemberSignatureLanguage="C#"Value="public static string Combine (params string[] paths);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig string Combine(string[] paths) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.Combine(System.String[])" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function Combine (ParamArray paths As String()) As String" />
<MemberSignatureLanguage="F#"Value="static member Combine : string[] -> string"Usage="System.IO.Path.Combine paths" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static System::String ^ Combine(... cli::array <System::String ^> ^ paths);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="paths"Type="System.String[]"Index="0"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1">
<Attributes>
<Attribute>
<AttributeNameLanguage="C#">[System.ParamArray]</AttributeName>
<AttributeNameLanguage="F#">[<System.ParamArray>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<paramname="paths">An array of parts of the path.</param>
<summary>Combines an array of strings into a path.</summary>
<returns>The combined paths.</returns>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
`paths` should be an array of the parts of the path to combine. If the one of the subsequent paths is an absolute path, then the combine operation resets starting with that absolute path, discarding all previous combined paths.
If any element in `paths` but the last one is not a drive and does not end with either the <xref:System.IO.Path.DirectorySeparatorChar> or the <xref:System.IO.Path.AltDirectorySeparatorChar> character, the `Combine` method adds a <xref:System.IO.Path.DirectorySeparatorChar> character between that element and the next one. Note that, if the element ends in a path separator character that is not appropriate for the target platform, the `Combine` method preserves the original path separator character and appends a supported one. The following example compares the result on Windows and Unix-based systems when the backslash is used as a path separator character.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Combine/Program.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/api/system.io/path/combine/program.vb" id="Snippet1":::
Zero-length strings are omitted from the combined path.
The parameters are not parsed if they have white space.
.NET Framework and .NET Core versions older than 2.1: Not all invalid characters for directory and file names are interpreted as unacceptable by the `Combine` method, because you can use these characters for search wildcard characters. For example, while `Path.Combine("c:\\", "*.txt")` might be invalid if you were to create a file from it, it is valid as a search string. It is therefore successfully interpreted by the `Combine` method.
## Examples
The following example combines an array of strings into a path.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Combine/program1.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.io.path.combine/vb/program.vb" id="Snippet3":::
]]></format>
</remarks>
<exceptioncref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: One of the strings in the array contains one or more of the invalid characters defined in <seecref="M:System.IO.Path.GetInvalidPathChars" />.</exception>
<exceptioncref="T:System.ArgumentNullException">One of the strings in the array is <seelangword="null" />.</exception>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
</Docs>
</Member>
<MemberMemberName="Combine">
<MemberSignatureLanguage="C#"Value="public static string Combine (string path1, string path2);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig string Combine(string path1, string path2) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.Combine(System.String,System.String)" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function Combine (path1 As String, path2 As String) As String" />
<MemberSignatureLanguage="F#"Value="static member Combine : string * string -> string"Usage="System.IO.Path.Combine (path1, path2)" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static System::String ^ Combine(System::String ^ path1, System::String ^ path2);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path1"Type="System.String"Index="0"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<ParameterName="path2"Type="System.String"Index="1"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
</Parameters>
<Docs>
<paramname="path1">The first path to combine.</param>
<paramname="path2">The second path to combine.</param>
<summary>Combines two strings into a path.</summary>
<returns>The combined paths. If one of the specified paths is a zero-length string, this method returns the other path. If <paramrefname="path2" /> contains an absolute path, this method returns <paramrefname="path2" />.</returns>
<remarks>
<formattype="text/markdown"><.
## Examples
The following example demonstrates using the `Combine` method on Windows.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Combine/pathcombine.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/pathcombine/VB/pathcombine.vb" id="Snippet1":::
]]></format>
</remarks>
<exceptioncref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: <paramrefname="path1" /> or <paramrefname="path2" /> contains one or more of the invalid characters defined in <seecref="M:System.IO.Path.GetInvalidPathChars" />.</exception>
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="path1" /> or <paramrefname="path2" /> is <seelangword="null" />.</exception>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
<relatedtype="Article"href="/dotnet/standard/io/">File and Stream I/O</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
</Docs>
</Member>
<MemberMemberName="Combine">
<MemberSignatureLanguage="C#"Value="public static string Combine (string path1, string path2, string path3);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig string Combine(string path1, string path2, string path3) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.Combine(System.String,System.String,System.String)" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function Combine (path1 As String, path2 As String, path3 As String) As String" />
<MemberSignatureLanguage="F#"Value="static member Combine : string * string * string -> string"Usage="System.IO.Path.Combine (path1, path2, path3)" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static System::String ^ Combine(System::String ^ path1, System::String ^ path2, System::String ^ path3);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path1"Type="System.String"Index="0"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<ParameterName="path2"Type="System.String"Index="1"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<ParameterName="path3"Type="System.String"Index="2"FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.6.2-pp;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
</Parameters>
<Docs>
<paramname="path1">The first path to combine.</param>
<paramname="path2">The second path to combine.</param>
<paramname="path3">The third path to combine.</param>
<summary>Combines three strings into a path.</summary>
<returns>The combined paths.</returns>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
`path1` should be an absolute path (for example, "d:\\archives" or "\\\\archives\\public"). If `path2` or `path3` is also an absolute path, the combine operation discards all previously combined paths and resets to that absolute path.
Zero-length strings are omitted from the combined path.
If `path1` or `path2` is not a drive reference (that is, "C:" or "D:") and does not end with a valid separator character as defined in <xref:System.IO.Path.DirectorySeparatorChar>, <xref:System.IO.Path.AltDirectorySeparatorChar>, or <xref:System.IO.Path.VolumeSeparatorChar>, <xref:System.IO.Path.DirectorySeparatorChar> is appended to `path1` or `path2` before concatenation. Note that if `path1` or `path2` ends in a path separator character that is not appropriate for the target platform, the `Combine` method preserves the original path separator character and appends a supported one. The following example compares the result on Windows and Unix-based systems when the backslash is used as a path separator character.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Combine/Program.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/api/system.io/path/combine/program.vb" id="Snippet3":::
If `path2` does not include a root (for example, if `path2` does not start with a separator character or a drive specification), the result is a concatenation of the two paths, with an intervening separator character. If `path2` includes a root, `path2` is returned.
The parameters are not parsed if they have white space. Therefore, if `path2` includes white space (for example, " \\file.txt "), the <xref:System.IO.Path.Combine%2A> method appends `path2` to `path1`.
.NET Framework and .NET Core versions older than 2.1: Not all invalid characters for directory and file names are interpreted as unacceptable by the `Combine` method, because you can use these characters for search wildcard characters. For example, while `Path.Combine("c:\\", "*.txt")` might be invalid if you were to create a file from it, it is valid as a search string. It is therefore successfully interpreted by the `Combine` method.
## Examples
The following example combines three paths.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Combine/program1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.io.path.combine/vb/program.vb" id="Snippet1":::
]]></format>
</remarks>
<exceptioncref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: <paramrefname="path1" />, <paramrefname="path2" />, or <paramrefname="path3" /> contains one or more of the invalid characters defined in <seecref="M:System.IO.Path.GetInvalidPathChars" />.</exception>
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="path1" />, <paramrefname="path2" />, or <paramrefname="path3" /> is <seelangword="null" />.</exception>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
</Docs>
</Member>
<MemberMemberName="Combine">
<MemberSignatureLanguage="C#"Value="public static string Combine (string path1, string path2, string path3, string path4);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig string Combine(string path1, string path2, string path3, string path4) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.Combine(System.String,System.String,System.String,System.String)" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function Combine (path1 As String, path2 As String, path3 As String, path4 As String) As String" />
<MemberSignatureLanguage="F#"Value="static member Combine : string * string * string * string -> string"Usage="System.IO.Path.Combine (path1, path2, path3, path4)" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static System::String ^ Combine(System::String ^ path1, System::String ^ path2, System::String ^ path3, System::String ^ path4);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path1"Type="System.String"Index="0"FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.7-pp;netframework-4.8-pp;netframework-4.8.1-pp;net-10.0;netframework-4.6.2-pp" />
<ParameterName="path2"Type="System.String"Index="1"FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.7-pp;netframework-4.8-pp;netframework-4.8.1-pp;net-10.0;netframework-4.6.2-pp" />
<ParameterName="path3"Type="System.String"Index="2"FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.7-pp;netframework-4.8-pp;netframework-4.8.1-pp;net-10.0;netframework-4.6.2-pp" />
<ParameterName="path4"Type="System.String"Index="3"FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.7-pp;netframework-4.8-pp;netframework-4.8.1-pp;net-10.0;netframework-4.6.2-pp" />
</Parameters>
<Docs>
<paramname="path1">The first path to combine.</param>
<paramname="path2">The second path to combine.</param>
<paramname="path3">The third path to combine.</param>
<paramname="path4">The fourth path to combine.</param>
<summary>Combines four strings into a path.</summary>
<returns>The combined paths.</returns>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
`path1` should be an absolute path (for example, "d:\\archives" or "\\\\archives\\public"). If one of the subsequent paths is also an absolute path, the combine operation discards all previously combined paths and resets to that absolute path.
Zero-length strings are omitted from the combined path.
If `path1`, `path2`, or `path3` is not a drive reference (that is, "C:" or "D:") and does not end with a valid separator character as defined in <xref:System.IO.Path.DirectorySeparatorChar>, <xref:System.IO.Path.AltDirectorySeparatorChar>, or <xref:System.IO.Path.VolumeSeparatorChar>, <xref:System.IO.Path.DirectorySeparatorChar> is appended to it before concatenation. Note that if `path1`, `path2`, or `path3` ends in a path separator character that is not appropriate for the target platform, the `Combine` method preserves the original path separator character and appends a supported one. The following example compares the result on Windows and Unix-based systems when the backslash is used as a path separator character.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Combine/Program.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/api/system.io/path/combine/program.vb" id="Snippet4":::
If `path2` does not include a root (for example, if `path2` does not start with a separator character or a drive specification), the result is a concatenation of the two paths, with an intervening separator character. If `path2` includes a root, `path2` is returned.
The parameters are not parsed if they have white space. Therefore, if `path2` includes white space (for example, " \\file.txt "), the <xref:System.IO.Path.Combine%2A> method appends `path2` to `path1`.
.NET Framework and .NET Core versions older than 2.1: Not all invalid characters for directory and file names are interpreted as unacceptable by the `Combine` method, because you can use these characters for search wildcard characters. For example, while `Path.Combine("c:\\", "*.txt")` might be invalid if you were to create a file from it, it is valid as a search string. It is therefore successfully interpreted by the `Combine` method.
## Examples
The following example combines four paths.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/Combine/program1.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.io.path.combine/vb/program.vb" id="Snippet2":::
]]></format>
</remarks>
<exceptioncref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: <paramrefname="path1" />, <paramrefname="path2" />, <paramrefname="path3" />, or <paramrefname="path4" /> contains one or more of the invalid characters defined in <seecref="M:System.IO.Path.GetInvalidPathChars" />.</exception>
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="path1" />, <paramrefname="path2" />, <paramrefname="path3" />, or <paramrefname="path4" /> is <seelangword="null" />.</exception>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
</Docs>
</Member>
<MemberMemberName="DirectorySeparatorChar">
<MemberSignatureLanguage="C#"Value="public static readonly char DirectorySeparatorChar;" />
<MemberSignatureLanguage="ILAsm"Value=".field public static initonly char DirectorySeparatorChar" />
<MemberSignatureLanguage="DocId"Value="F:System.IO.Path.DirectorySeparatorChar" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared ReadOnly DirectorySeparatorChar As Char " />
<MemberSignatureLanguage="F#"Value=" staticval mutable DirectorySeparatorChar : char"Usage="System.IO.Path.DirectorySeparatorChar" />
<MemberSignatureLanguage="C++ CLI"Value="public: static initonly char DirectorySeparatorChar;" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Char</ReturnType>
</ReturnValue>
<Docs>
<summary>Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.</summary>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
<xref:System.IO.Path.AltDirectorySeparatorChar> and `DirectorySeparatorChar` are both valid for separating directory levels in a path string.
When you are using .NET Core to develop applications that run on multiple platforms:
- If you prefer to hard-code the directory separator character, you should use the forward slash (`/`) character. It is the only recognized directory separator character on Unix systems, as the output from the example shows, and is the <xref:System.IO.Path.AltDirectorySeparatorChar> on Windows.
- Use string concatenation to dynamically retrieve the path separator character at runtime and incorporate it into file system paths. For example,
```csharp
separator = Path.DirectorySeparatorChar;
path = $"{separator}users{separator}user1{separator}";
```
```vb
separator = Path.DirectorySeparatorChar
path = $"{separator}users{separator}user1{separator}"
```
You can also retrieve the value from the <xref:System.IO.Path.AltDirectorySeparatorChar> property, since it is the same on both Windows and Unix-based systems.
- Retrieve the <xref:System.IO.Path.AltDirectorySeparatorChar> property
If your application is not cross-platform, you can use the separator appropriate for your system.
## Examples
The following example displays <xref:System.IO.Path> field values on Windows and on Unix-based systems. Note that Windows supports either the forward slash (which is returned by the <xref:System.IO.Path.AltDirectorySeparatorChar> field) or the backslash (which is returned by the <xref:System.IO.Path.DirectorySeparatorChar> field) as path separator characters, while Unix-based systems support only the forward slash.
:::code language="csharp" source="~/snippets/csharp/System.IO/Path/DirectorySeparatorChar/Program.cs":::
:::code language="vb" source="~/snippets/visualbasic/api/system.io/path/directoryseparatorchar/program.vb":::
]]></format>
</remarks>
<relatedtype="Article"href="/dotnet/standard/io/">File and Stream I/O</related>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<relatedtype="Article"href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
</Docs>
</Member>
<MemberMemberName="EndsInDirectorySeparator">
<MemberSignatureLanguage="C#"Value="public static bool EndsInDirectorySeparator (ReadOnlySpan<char> path);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig bool EndsInDirectorySeparator(valuetype System.ReadOnlySpan`1<char> path) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.EndsInDirectorySeparator(System.ReadOnlySpan{System.Char})" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function EndsInDirectorySeparator (path As ReadOnlySpan(Of Char)) As Boolean" />
<MemberSignatureLanguage="F#"Value="static member EndsInDirectorySeparator : ReadOnlySpan<char> -> bool"Usage="System.IO.Path.EndsInDirectorySeparator path" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static bool EndsInDirectorySeparator(ReadOnlySpan<char> path);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path"Type="System.ReadOnlySpan<System.Char>"Index="0"FrameworkAlternate="netcore-3.0;netcore-3.1;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.7-pp;netframework-4.8-pp;netframework-4.8.1-pp;net-10.0;netframework-4.6.2-pp" />
</Parameters>
<Docs>
<paramname="path">The path to analyze.</param>
<summary>Returns a value that indicates whether the path, specified as a read-only span, ends in a directory separator.</summary>
<returns>
<seelangword="true" /> if the path ends in a directory separator; otherwise, <seelangword="false" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<MemberMemberName="EndsInDirectorySeparator">
<MemberSignatureLanguage="C#"Value="public static bool EndsInDirectorySeparator (string? path);"FrameworkAlternate="net-10.0;net-8.0;net-9.0" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig bool EndsInDirectorySeparator(string path) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.EndsInDirectorySeparator(System.String)" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function EndsInDirectorySeparator (path As String) As Boolean" />
<MemberSignatureLanguage="F#"Value="static member EndsInDirectorySeparator : string -> bool"Usage="System.IO.Path.EndsInDirectorySeparator path" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static bool EndsInDirectorySeparator(System::String ^ path);" />
<MemberSignatureLanguage="C#"Value="public static bool EndsInDirectorySeparator (string path);"FrameworkAlternate="net-5.0;net-6.0;net-7.0;netcore-3.0;netcore-3.1;netframework-4.6.2-pp" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path"Type="System.String"Index="0"FrameworkAlternate="netcore-3.0;netcore-3.1;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.7-pp;netframework-4.8-pp;netframework-4.8.1-pp;net-10.0;netframework-4.6.2-pp">
<Attributes>
<AttributeFrameworkAlternate="net-10.0;net-8.0;net-9.0">
<AttributeNameLanguage="C#">[System.Diagnostics.CodeAnalysis.NotNullWhen(true)]</AttributeName>
<AttributeNameLanguage="F#">[<System.Diagnostics.CodeAnalysis.NotNullWhen(true)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<paramname="path">The path to analyze.</param>
<summary>Returns a value that indicates whether the specified path ends in a directory separator.</summary>
<returns>
<seelangword="true" /> if the path ends in a directory separator; otherwise, <seelangword="false" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<MemberMemberName="Exists">
<MemberSignatureLanguage="C#"Value="public static bool Exists (string? path);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig bool Exists(string path) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.Exists(System.String)" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function Exists (path As String) As Boolean" />
<MemberSignatureLanguage="F#"Value="static member Exists : string -> bool"Usage="System.IO.Path.Exists path" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static bool Exists(System::String ^ path);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path"Type="System.String"Index="0"FrameworkAlternate="net-7.0;net-8.0;net-9.0;net-10.0">
<Attributes>
<Attribute>
<AttributeNameLanguage="C#">[System.Diagnostics.CodeAnalysis.NotNullWhen(true)]</AttributeName>
<AttributeNameLanguage="F#">[<System.Diagnostics.CodeAnalysis.NotNullWhen(true)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<paramname="path">The path to check</param>
<summary>Determines whether the specified file or directory exists.</summary>
<returns>
<seelangword="true" /> if the caller has the required permissions and <paramrefname="path" /> contains the name of an existing file or directory; otherwise, <seelangword="false" />.
This method also returns <seelangword="false" /> if <paramrefname="path" /> is <seelangword="null" />, an invalid path, or a zero-length string. If the caller does not have sufficient permissions to read the specified path, no exception is thrown and the method returns <seelangword="false" /> regardless of the existence of <paramrefname="path" />.</returns>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
Unlike <xref:System.IO.File.Exists(System.String)>, this method returns `true` for existing, non-regular files like pipes.
If the path targets an existing link, but the target of the link does not exist, it returns `true`.
]]></format>
</remarks>
</Docs>
</Member>
<MemberMemberName="GetDirectoryName">
<MemberSignatureLanguage="C#"Value="public static ReadOnlySpan<char> GetDirectoryName (ReadOnlySpan<char> path);" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig valuetype System.ReadOnlySpan`1<char> GetDirectoryName(valuetype System.ReadOnlySpan`1<char> path) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.GetDirectoryName(System.ReadOnlySpan{System.Char})" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function GetDirectoryName (path As ReadOnlySpan(Of Char)) As ReadOnlySpan(Of Char)" />
<MemberSignatureLanguage="F#"Value="static member GetDirectoryName : ReadOnlySpan<char> -> ReadOnlySpan<char>"Usage="System.IO.Path.GetDirectoryName path" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static ReadOnlySpan<char> GetDirectoryName(ReadOnlySpan<char> path);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ReadOnlySpan<System.Char></ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="path"Type="System.ReadOnlySpan<System.Char>"Index="0"FrameworkAlternate="netcore-2.1;netcore-2.2;netcore-3.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.7-pp;netframework-4.8-pp;netframework-4.8.1-pp;net-10.0;netframework-4.6.2-pp" />
</Parameters>
<Docs>
<paramname="path">The path to retrieve the directory information from.</param>
<summary>Returns the directory information for the specified path represented by a character span.</summary>
<returns>Directory information for <paramrefname="path" />, or an empty span if <paramrefname="path" /> is <seelangword="null" />, an empty span, or a root (such as \\, C:, or \\\\server\\share).</returns>
<remarks>
<formattype="text/markdown"><![CDATA[
## Remarks
Unlike the string overload, this method doesn't normalize directory separators.
]]></format>
</remarks>
<relatedtype="Article"href="/dotnet/standard/io/file-path-formats">File path formats on Windows systems</related>
</Docs>
</Member>
<MemberMemberName="GetDirectoryName">
<MemberSignatureLanguage="C#"Value="public static string GetDirectoryName (string path);"FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig string GetDirectoryName(string path) cil managed" />
<MemberSignatureLanguage="DocId"Value="M:System.IO.Path.GetDirectoryName(System.String)" />
<MemberSignatureLanguage="VB.NET"Value="Public Shared Function GetDirectoryName (path As String) As String" />
<MemberSignatureLanguage="F#"Value="static member GetDirectoryName : string -> string"Usage="System.IO.Path.GetDirectoryName path" />
<MemberSignatureLanguage="C++ CLI"Value="public:
 static System::String ^ GetDirectoryName(System::String ^ path);" />
<MemberSignatureLanguage="C#"Value="public static string? GetDirectoryName (string? path);"FrameworkAlternate="net-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-3.0;netcore-3.1;netframework-4.6.2-pp" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>