This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $dir = dir *.zip | |
| #go through each zip file in the directory variable | |
| foreach($item in $dir) | |
| { | |
| Expand-Archive -Path $item -DestinationPath ($item -replace '.zip','') -Force | |
| } | |
| /* unzip all files in a directory and then do some work!! */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static string GetXmlValue(string id, string getData, XDocument xdoc) | |
| { | |
| return xdoc.Root.Descendants("girl").Elements(). | |
| Where(node => node.Name == "id" && node.Value == id). | |
| Single<XElement>().NodesAfterSelf(). | |
| Where(values => ((XElement)values).Name == getData). | |
| Cast<XElement>().Single<XElement>().Value; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Team<T> : IEnumerable<T> // enumerable collection | |
| { | |
| private T[] workers; | |
| private const byte DEFAULTSIZE = 5; | |
| public Team() { | |
| this.workers = new T[DEFAULTSIZE]; | |
| } | |
| private int i = 0; | |
| public void Add(T param) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void DuffsDevice(uint count, int[] A, int[] B) | |
| { | |
| uint i = 0; | |
| uint n = (count + 7) / 8; | |
| switch (count % 8) { | |
| case 0: A[i] = B[i++]; goto case 7; | |
| case 7: A[i] = B[i++]; goto case 6; | |
| case 6: A[i] = B[i++]; goto case 5; | |
| case 5: A[i] = B[i++]; goto case 4; | |
| case 4: A[i] = B[i++]; goto case 3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| &array[0] | |
| [DllImport("kernel32", SetLastError = true)] | |
| static extern unsafe IntPtr CreateFile( | |
| string FileName, | |
| uint DesiredAccess, | |
| uint ShareMode, | |
| uint SecurityAttributes, | |
| uint CreationDisposition, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void Main() | |
| { | |
| var store = new NumberStore(); | |
| WriteLine($"Исходная последовательность: {store.ToString()}"); | |
| ref var value = ref store.FindNumber(16); | |
| value *= 2; | |
| WriteLine($"Новая последовательность: {store.ToString()}"); | |
| //: 1 3 7 15 31 63 127 255 511 1023 | |
| //: 1 3 7 15 62 63 127 255 511 1023 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Example : IDisposable | |
| { | |
| private IntPtr buffer; // неуправляемый буфер памяти | |
| private SafeHandle resource; // управляемый ресурс | |
| public Example() // конструктор | |
| { | |
| this.buffer = ... | |
| this.resource = ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void M(int x, int y) { } | |
| void M<T>(T y, int x) { } | |
| void M2() | |
| { | |
| M(3, 4); | |
| M(y: 3, x: 4); // Invokes M(int, int) | |
| M(y: 3, 4); // Invokes M<T>(T, int) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Application app = new Application { Visible = true }; | |
| Document doc = app.Documents.Add*(; | |
| Paragraph para = doc.Paragraphs.Add(); | |
| para.Range.Text = "Simple new code"; | |
| doc.SaveAs2<-->(FileName: "demo2.docx"); | |
| doc.Close(); | |
| app.Application.Quit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Dynamic typing supports custom behavior via IDynamicMetaObjectProvider and the DynamicObject class | |
| Dynamic typing is implemented with both compiler and framework features. The framework optimizes and caches for efficiency. |
OlderNewer