Skip to content

Commit 9529430

Browse files
author
ahotko
committed
Added Span<T> Snippet (not complete yet)
1 parent b9ffc19 commit 9529430

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
55
</startup>
66
</configuration>

CSharp Code Samples/CodeSamples/CodeSamples.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<OutputType>Exe</OutputType>
99
<RootNamespace>CodeSamples</RootNamespace>
1010
<AssemblyName>CodeSamples</AssemblyName>
11-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<Deterministic>true</Deterministic>
@@ -105,6 +105,7 @@
105105
<Compile Include="TupleDeconstruction\TupleDeconstruction.cs" />
106106
<Compile Include="UsefulClasses\Dictionaries.cs" />
107107
<Compile Include="UsefulClasses\ObjectPoolSample.cs" />
108+
<Compile Include="UsefulClasses\SpanSample.cs" />
108109
<Compile Include="Useful\GarbageCollectionSample.cs" />
109110
<Compile Include="Useful\LinqSample.cs" />
110111
<Compile Include="Classes\ClassAndMethodNamesSample.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
3+
namespace CodeSamples.UsefulClasses
4+
{
5+
public class SpanSample : SampleExecute
6+
{
7+
private void SpanOverArray()
8+
{
9+
//var arrayOfInt = new int[100];
10+
//var span = new Span<int>(arrayOfInt);
11+
12+
//byte data = 0;
13+
//for (int ctr = 0; ctr < arraySpan.Length; ctr++)
14+
// arraySpan[ctr] = data++;
15+
}
16+
17+
private void SpanOverNativeMemory()
18+
{
19+
//var native = Marshal.AllocHGlobal(100);
20+
//Span<byte> nativeSpan;
21+
//unsafe
22+
//{
23+
// nativeSpan = new Span<byte>(native.ToPointer(), 100);
24+
//}
25+
}
26+
27+
public override void Execute()
28+
{
29+
throw new NotImplementedException();
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)