-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathFileInfo.xml
More file actions
2559 lines (2315 loc) · 156 KB
/
FileInfo.xml
File metadata and controls
2559 lines (2315 loc) · 156 KB
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
<Type Name="FileInfo" FullName="System.IO.FileInfo">
<TypeSignature Language="C#" Value="public sealed class FileInfo : System.IO.FileSystemInfo" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit FileInfo extends System.IO.FileSystemInfo" FrameworkAlternate="dotnet-uwp-10.0;net-10.0;net-11.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;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="DocId" Value="T:System.IO.FileInfo" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class FileInfo
Inherits FileSystemInfo" />
<TypeSignature Language="F#" Value="type FileInfo = class
 inherit FileSystemInfo" />
<TypeSignature Language="C++ CLI" Value="public ref class FileInfo sealed : System::IO::FileSystemInfo" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable sealed beforefieldinit FileInfo extends System.IO.FileSystemInfo" FrameworkAlternate="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" />
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="10.0.0.0" FrameworkAlternate="net-10.0" />
<TypeForwarding From="System.IO.FileSystem" FromVersion="10.0.0.0" To="System.Runtime" ToVersion="10.0.0.0" FrameworkAlternate="net-10.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="11.0.0.0" FrameworkAlternate="net-11.0" />
<TypeForwarding From="System.IO.FileSystem" FromVersion="11.0.0.0" To="System.Runtime" ToVersion="11.0.0.0" FrameworkAlternate="net-11.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.IO.FileSystem" ToVersion="5.0.0.0" FrameworkAlternate="net-5.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="System.IO.FileSystem" FromVersion="6.0.0.0" To="System.Runtime" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="System.IO.FileSystem" FromVersion="7.0.0.0" To="System.Runtime" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="System.IO.FileSystem" FromVersion="8.0.0.0" To="System.Runtime" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
<TypeForwarding From="System.IO.FileSystem" FromVersion="9.0.0.0" To="System.Runtime" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.IO.FileSystemInfo</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="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">
<AttributeName Language="C#">[System.Serializable]</AttributeName>
<AttributeName Language="F#">[<System.Serializable>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="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">
<AttributeName Language="C#">[System.Runtime.InteropServices.ComVisible(true)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.InteropServices.ComVisible(true)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.IO.FileInfo> class for typical operations such as copying, moving, renaming, creating, opening, deleting, and appending to files.
If you are performing multiple operations on the same file, it can be more efficient to use <xref:System.IO.FileInfo> instance methods instead of the corresponding static methods of the <xref:System.IO.File> class, because a security check will not always be necessary.
Many of the <xref:System.IO.FileInfo> methods return other I/O types when you create or open files. You can use these other types to further manipulate a file. For more information, see specific <xref:System.IO.FileInfo> members such as <xref:System.IO.FileInfo.Open*>, <xref:System.IO.FileInfo.OpenRead*>, <xref:System.IO.FileInfo.OpenText*>, <xref:System.IO.FileInfo.CreateText*>, or <xref:System.IO.FileInfo.Create*>.
By default, full read/write access to new files is granted to all users.
The following table describes the enumerations that are used to customize the behavior of various <xref:System.IO.FileInfo> methods.
|Enumeration|Description|
|-----------------|-----------------|
|<xref:System.IO.FileAccess>|Specifies read and write access to a file.|
|<xref:System.IO.FileShare>|Specifies the level of access permitted for a file that is already in use.|
|<xref:System.IO.FileMode>|Specifies whether the contents of an existing file are preserved or overwritten, and whether requests to create an existing file cause an exception.|
> [!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.
The <xref:System.IO.FileInfo> class provides the following properties that enable you to retrieve information about a file. For an example of how to use each property, see the property pages.
- The <xref:System.IO.FileInfo.Directory> property retrieves an object that represents the parent directory of a file.
- The <xref:System.IO.FileInfo.DirectoryName> property retrieves the full path of the parent directory of a file.
- The <xref:System.IO.FileInfo.Exists> property checks for the presence of a file before operating on it.
- The <xref:System.IO.FileInfo.IsReadOnly> property retrieves or sets a value that specifies whether a file can be modified.
- The <xref:System.IO.FileInfo.Length*> retrieves the size of a file.
- The <xref:System.IO.FileInfo.Name*> retrieves the name of a file.
## Examples
The following example demonstrates some of the main members of the `FileInfo` class.
When the properties are first retrieved, <xref:System.IO.FileInfo> calls the <xref:System.IO.FileSystemInfo.Refresh*> method and caches information about the file. On subsequent calls, you must call <xref:System.IO.FileSystemInfo.Refresh*> to get the latest copy of the information.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/Overview/finfo class.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/Overview/finfo class.vb" id="Snippet1":::
This example produces output similar to the following.
```txt
Hello
And
Welcome
C:\Users\userName\AppData\Local\Temp\tmp70AB.tmp was copied to C:\Users\userName\AppData\Local\Temp\tmp70CB.tmp.
C:\Users\userName\AppData\Local\Temp\tmp70CB.tmp was successfully deleted.
```
]]></format>
</remarks>
<altmember cref="T:System.IO.FileSystemWatcher" />
<altmember cref="T:System.IO.DriveInfo" />
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
<related type="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>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public FileInfo (string fileName);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string fileName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (fileName As String)" />
<MemberSignature Language="F#" Value="new System.IO.FileInfo : string -> System.IO.FileInfo" Usage="new System.IO.FileInfo fileName" />
<MemberSignature Language="C++ CLI" Value="public:
 FileInfo(System::String ^ fileName);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="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">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="fileName" Type="System.String" />
</Parameters>
<Docs>
<param name="fileName">The fully qualified name of the new file, or the relative file name. Do not end the path with the directory separator character.</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.FileInfo" /> class, which acts as a wrapper for a file path.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can specify either the fully qualified or the relative file name, but the security check gets the fully qualified name.
## Examples
The following example uses this constructor to create two files, which are then written to, read from, copied, and deleted.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/.ctor/finfo ctor.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/.ctor/finfo ctor.vb" id="Snippet1":::
The following example opens an existing file or creates a file, appends text to the file, and displays the results.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/.ctor/fileinfomain.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/.ctor/fileinfomain.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="fileName" /> is <see langword="null" />.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<exception cref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: The file name is empty, contains only white spaces, or contains invalid characters.</exception>
<exception cref="T:System.UnauthorizedAccessException">Access to <paramref name="fileName" /> is denied.</exception>
<exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception>
<exception cref="T:System.NotSupportedException">
<paramref name="fileName" /> contains a colon (:) in the middle of the string.</exception>
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="AppendText">
<MemberSignature Language="C#" Value="public System.IO.StreamWriter AppendText ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.IO.StreamWriter AppendText() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.AppendText" />
<MemberSignature Language="VB.NET" Value="Public Function AppendText () As StreamWriter" />
<MemberSignature Language="F#" Value="member this.AppendText : unit -> System.IO.StreamWriter" Usage="fileInfo.AppendText " />
<MemberSignature Language="C++ CLI" Value="public:
 System::IO::StreamWriter ^ AppendText();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.StreamWriter</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a <see cref="T:System.IO.StreamWriter" /> that appends text to the file represented by this instance of the <see cref="T:System.IO.FileInfo" />.</summary>
<returns>A new <see langword="StreamWriter" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example appends text to a file and reads from the file.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/AppendText/finfo appendtext.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/AppendText/finfo appendtext.vb" id="Snippet1":::
The following example demonstrates appending text to the end of a file and also displays the result of the append operation to the console. The first time this routine is called, the file is created if it does not exist. After that, the specified text is appended to the file.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/AppendText/fileinfoappendtext.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/AppendText/fileinfoappendtext.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.IO.StreamWriter" />
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
<related type="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>
</Docs>
</Member>
<MemberGroup MemberName="CopyTo">
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Copies an existing file to a new file.</summary>
</Docs>
</MemberGroup>
<Member MemberName="CopyTo">
<MemberSignature Language="C#" Value="public System.IO.FileInfo CopyTo (string destFileName);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.IO.FileInfo CopyTo(string destFileName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.CopyTo(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Function CopyTo (destFileName As String) As FileInfo" />
<MemberSignature Language="F#" Value="member this.CopyTo : string -> System.IO.FileInfo" Usage="fileInfo.CopyTo destFileName" />
<MemberSignature Language="C++ CLI" Value="public:
 System::IO::FileInfo ^ CopyTo(System::String ^ destFileName);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.FileInfo</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="destFileName" Type="System.String" />
</Parameters>
<Docs>
<param name="destFileName">The name of the new file to copy to.</param>
<summary>Copies an existing file to a new file, disallowing the overwriting of an existing file.</summary>
<returns>A new file with a fully qualified path.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.IO.FileInfo.CopyTo(System.String,System.Boolean)> method to allow overwriting of an existing file.
> [!CAUTION]
> Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method. If two files have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior
## Examples
The following example demonstrates both overloads of the `CopyTo` method.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/CopyTo/program.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/CopyTo/program.vb" id="Snippet1":::
The following example demonstrates copying one file to another file, throwing an exception if the destination file already exists.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/CopyTo/fileinfocopyto1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/CopyTo/fileinfocopyto1.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: <paramref name="destFileName" /> is empty, contains only white spaces, or contains invalid characters.</exception>
<exception cref="T:System.IO.IOException">An error occurs, or the destination file already exists.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="destFileName" /> is <see langword="null" />.</exception>
<exception cref="T:System.UnauthorizedAccessException">A directory path is passed in, or the file is being moved to a different drive.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">The directory specified in <paramref name="destFileName" /> does not exist.</exception>
<exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception>
<exception cref="T:System.NotSupportedException">
<paramref name="destFileName" /> contains a colon (:) within the string but does not specify the volume.</exception>
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
<related type="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>
</Docs>
</Member>
<Member MemberName="CopyTo">
<MemberSignature Language="C#" Value="public System.IO.FileInfo CopyTo (string destFileName, bool overwrite);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.IO.FileInfo CopyTo(string destFileName, bool overwrite) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.CopyTo(System.String,System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Function CopyTo (destFileName As String, overwrite As Boolean) As FileInfo" />
<MemberSignature Language="F#" Value="member this.CopyTo : string * bool -> System.IO.FileInfo" Usage="fileInfo.CopyTo (destFileName, overwrite)" />
<MemberSignature Language="C++ CLI" Value="public:
 System::IO::FileInfo ^ CopyTo(System::String ^ destFileName, bool overwrite);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.FileInfo</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="destFileName" Type="System.String" />
<Parameter Name="overwrite" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="destFileName">The name of the new file to copy to.</param>
<param name="overwrite">
<see langword="true" /> to allow an existing file to be overwritten; otherwise, <see langword="false" />.</param>
<summary>Copies an existing file to a new file, allowing the overwriting of an existing file.</summary>
<returns>A new file, or an overwrite of an existing file if <paramref name="overwrite" /> is <see langword="true" />. If the file exists and <paramref name="overwrite" /> is <see langword="false" />, an <see cref="T:System.IO.IOException" /> is thrown.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method to allow or prevent overwriting of an existing file. Use the <xref:System.IO.FileInfo.CopyTo(System.String)> method to prevent overwriting of an existing file by default.
> [!CAUTION]
> Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method. If two files have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior
## Examples
The following example demonstrates both overloads of the `CopyTo` method.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/CopyTo/program.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/CopyTo/program.vb" id="Snippet1":::
The following example demonstrates copying one file to another file, specifying whether to overwrite a file that already exists.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/CopyTo/fileinfocopyto.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/CopyTo/fileinfocopyto.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">.NET Framework and .NET Core versions older than 2.1: <paramref name="destFileName" /> is empty, contains only white spaces, or contains invalid characters.</exception>
<exception cref="T:System.IO.IOException">An error occurs, or the destination file already exists and <paramref name="overwrite" /> is <see langword="false" />.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="destFileName" /> is <see langword="null" />.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">The directory specified in <paramref name="destFileName" /> does not exist.</exception>
<exception cref="T:System.UnauthorizedAccessException">A directory path is passed in, or the file is being moved to a different drive.</exception>
<exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception>
<exception cref="T:System.NotSupportedException">
<paramref name="destFileName" /> contains a colon (:) in the middle of the string.</exception>
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
<related type="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>
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public System.IO.FileStream Create ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.IO.FileStream Create() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.Create" />
<MemberSignature Language="VB.NET" Value="Public Function Create () As FileStream" />
<MemberSignature Language="F#" Value="member this.Create : unit -> System.IO.FileStream" Usage="fileInfo.Create " />
<MemberSignature Language="C++ CLI" Value="public:
 System::IO::FileStream ^ Create();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.FileStream</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a file.</summary>
<returns>A new file.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, full read/write access to new files is granted to all users.
This method is a wrapper for the functionality provided by <xref:System.IO.File.Create*?displayProperty=nameWithType>.
## Examples
The following example creates a reference to a file, and then creates the file on disk using `FileInfo.Create()`.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/Create/fileinfodelete.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/Create/fileinfodelete.vb" id="Snippet1":::
The following example creates a file, adds some text to it, and reads from the file.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/Create/finfo create.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/Create/finfo create.vb" id="Snippet1":::
]]></format>
</remarks>
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
<related type="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>
</Docs>
</Member>
<Member MemberName="CreateAsHardLink">
<MemberSignature Language="C#" Value="public void CreateAsHardLink (string pathToTarget);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void CreateAsHardLink(string pathToTarget) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.CreateAsHardLink(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub CreateAsHardLink (pathToTarget As String)" />
<MemberSignature Language="F#" Value="member this.CreateAsHardLink : string -> unit" Usage="fileInfo.CreateAsHardLink pathToTarget" />
<MemberSignature Language="C++ CLI" Value="public:
 void CreateAsHardLink(System::String ^ pathToTarget);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="pathToTarget" Type="System.String" Index="0" FrameworkAlternate="net-11.0" />
</Parameters>
<Docs>
<param name="pathToTarget">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CreateText">
<MemberSignature Language="C#" Value="public System.IO.StreamWriter CreateText ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.IO.StreamWriter CreateText() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.CreateText" />
<MemberSignature Language="VB.NET" Value="Public Function CreateText () As StreamWriter" />
<MemberSignature Language="F#" Value="member this.CreateText : unit -> System.IO.StreamWriter" Usage="fileInfo.CreateText " />
<MemberSignature Language="C++ CLI" Value="public:
 System::IO::StreamWriter ^ CreateText();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.StreamWriter</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a <see cref="T:System.IO.StreamWriter" /> that writes a new text file.</summary>
<returns>A new <see langword="StreamWriter" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, full read/write access to new files is granted to all users.
## Examples
The following example demonstrates the `CreateText` method.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/CreateText/finfo createtext.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/CreateText/finfo createtext.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.UnauthorizedAccessException">The file name is a directory.</exception>
<exception cref="T:System.IO.IOException">The disk is read-only.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<altmember cref="T:System.IO.StreamWriter" />
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
<related type="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>
</Docs>
</Member>
<Member MemberName="Decrypt">
<MemberSignature Language="C#" Value="public void Decrypt ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Decrypt() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.Decrypt" />
<MemberSignature Language="VB.NET" Value="Public Sub Decrypt ()" />
<MemberSignature Language="F#" Value="member this.Decrypt : unit -> unit" Usage="fileInfo.Decrypt " />
<MemberSignature Language="C++ CLI" Value="public:
 void Decrypt();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.Versioning.SupportedOSPlatform("windows")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="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">
<AttributeName Language="C#">[System.Runtime.InteropServices.ComVisible(false)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.InteropServices.ComVisible(false)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Decrypts a file that was encrypted by the current account using the <see cref="M:System.IO.FileInfo.Encrypt" /> method.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.IO.FileInfo.Decrypt*> method allows you to decrypt a file that was encrypted using the <xref:System.IO.FileInfo.Encrypt*> method. The <xref:System.IO.FileInfo.Decrypt*> method can decrypt only files that were encrypted using the current user account.
Both the <xref:System.IO.FileInfo.Encrypt*> method and the <xref:System.IO.FileInfo.Decrypt*> method use the cryptographic service provider (CSP) installed on the computer and the file encryption keys of the process calling the method.
The current file system must be formatted as NTFS and the current operating system must be Microsoft Windows NT or later.
## Examples
The following code example uses the <xref:System.IO.FileInfo.Encrypt*> method and the <xref:System.IO.FileInfo.Decrypt*> method to encrypt and then decrypt a file.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/Decrypt/sample.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/Decrypt/sample.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.IO.DriveNotFoundException">An invalid drive was specified.</exception>
<exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.</exception>
<exception cref="T:System.NotSupportedException">The file system is not NTFS.</exception>
<exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
<exception cref="T:System.UnauthorizedAccessException">The file described by the current <see cref="T:System.IO.FileInfo" /> object is read-only.
-or-
This operation is not supported on the current platform.
-or-
The caller does not have the required permission.</exception>
</Docs>
</Member>
<Member MemberName="Delete">
<MemberSignature Language="C#" Value="public override void Delete ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void Delete() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.FileInfo.Delete" />
<MemberSignature Language="VB.NET" Value="Public Overrides Sub Delete ()" />
<MemberSignature Language="F#" Value="override this.Delete : unit -> unit" Usage="fileInfo.Delete " />
<MemberSignature Language="C++ CLI" Value="public:
 override void Delete();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="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">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Permanently deletes a file.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the file does not exist, this method does nothing.
## Examples
The following example demonstrates the `Delete` method.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/Delete/finfo delete.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/Delete/finfo delete.vb" id="Snippet1":::
The following example creates, closes, and deletes a file.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/Create/fileinfodelete.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/Create/fileinfodelete.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The target file is open or memory-mapped on a computer running Microsoft Windows NT.
-or-
There is an open handle on the file, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see <see href="/dotnet/standard/io/how-to-enumerate-directories-and-files">How to: Enumerate Directories and Files</see>.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<exception cref="T:System.UnauthorizedAccessException">The path is a directory.</exception>
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="Directory">
<MemberSignature Language="C#" Value="public System.IO.DirectoryInfo Directory { get; }" FrameworkAlternate="dotnet-uwp-10.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.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".property instance class System.IO.DirectoryInfo Directory" />
<MemberSignature Language="DocId" Value="P:System.IO.FileInfo.Directory" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Directory As DirectoryInfo" />
<MemberSignature Language="F#" Value="member this.Directory : System.IO.DirectoryInfo" Usage="System.IO.FileInfo.Directory" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::IO::DirectoryInfo ^ Directory { System::IO::DirectoryInfo ^ get(); };" />
<MemberSignature Language="C#" Value="public System.IO.DirectoryInfo? Directory { get; }" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<get: System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.DirectoryInfo</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets an instance of the parent directory.</summary>
<value>A <see cref="T:System.IO.DirectoryInfo" /> object representing the parent directory of this file.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
To get the parent directory as a string, use the <xref:System.IO.FileInfo.DirectoryName> property.
## Examples
The following example opens or creates a file, determines its full path, and determines and displays the full contents of the directory.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/Directory/fileinfodirectory.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.IO/FileInfo/Directory/fileinfodirectory.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
<related type="Article" href="/dotnet/standard/io/how-to-write-text-to-a-file">How to: Write Text to a File</related>
</Docs>
</Member>
<Member MemberName="DirectoryName">
<MemberSignature Language="C#" Value="public string DirectoryName { get; }" FrameworkAlternate="dotnet-uwp-10.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.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-1.3;netstandard-1.4;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<MemberSignature Language="ILAsm" Value=".property instance string DirectoryName" />
<MemberSignature Language="DocId" Value="P:System.IO.FileInfo.DirectoryName" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property DirectoryName As String" />
<MemberSignature Language="F#" Value="member this.DirectoryName : string" Usage="System.IO.FileInfo.DirectoryName" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ DirectoryName { System::String ^ get(); };" />
<MemberSignature Language="C#" Value="public string? DirectoryName { get; }" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.IO.FileSystem</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion>4.1.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.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>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>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="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">
<AttributeName Language="C#">[get: System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<get: System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a string representing the directory's full path.</summary>
<value>A string representing the directory's full path.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
To get the parent directory as a <xref:System.IO.DirectoryInfo> object, use the <xref:System.IO.FileInfo.Directory> property.
When first called, <xref:System.IO.FileInfo> calls <xref:System.IO.FileSystemInfo.Refresh*> and caches information about the file. On subsequent calls, you must call <xref:System.IO.FileSystemInfo.Refresh*> to get the latest copy of the information.
## Examples
The following example retrieves the full path of the specified file.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileInfo/DirectoryName/fileinfomembers.cs" id="Snippet3":::
]]></format>