Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
//<snippet1>

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Diagnostics;

public class App {

public class App
{
private static PerformanceCounter avgCounter64Sample;
private static PerformanceCounter avgCounter64SampleBase;

public static void Main()
{

ArrayList samplesList = new ArrayList();

// If the category does not exist, create the category and exit.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//<Snippet1>

using System;
using System.Diagnostics;
using System.Globalization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class App
{
private static PerformanceCounter PC;


public static void Main()
{
ArrayList samplesList = new ArrayList();
Expand All @@ -26,12 +25,10 @@ public static void Main()
CollectSamples(samplesList);
}


private static bool SetupCategory()
{
if ( !PerformanceCounterCategory.Exists("ElapsedTimeSampleCategory") )
{

CounterCreationDataCollection CCDC = new CounterCreationDataCollection();

// Add the counter.
Expand Down Expand Up @@ -60,12 +57,10 @@ private static void CreateCounters()
PC = new PerformanceCounter("ElapsedTimeSampleCategory",
"ElapsedTimeSample",
false);

}

private static void CollectSamples(ArrayList samplesList)
{

long pcValue;
DateTime Start;

Expand Down Expand Up @@ -98,7 +93,6 @@ private static void CollectSamples(ArrayList samplesList)

Console.WriteLine("Elapsed time = " + DateTime.Now.Subtract(Start).ToString());
}


private static void OutputSample(CounterSample s)
{
Expand All @@ -115,7 +109,6 @@ private static void OutputSample(CounterSample s)
Console.WriteLine("++++++++++++++++++++++");
}


// Reads the counter information to enable setting the RawValue.
[DllImport("Kernel32.dll")]
public static extern bool QueryPerformanceCounter(out long value);
Expand All @@ -126,7 +119,6 @@ private static void OutputSample(CounterSample s)
// Build sample for Whidbey or higher.

//<Snippet2>

using System;
using System.Collections;
using System.Collections.Specialized;
Expand All @@ -135,7 +127,6 @@ private static void OutputSample(CounterSample s)

public class App
{

public static void Main()
{
CollectSamples();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// The sort command results are displayed to the user on the console.

// <Snippet1>

using System;
using System.IO;
using System.Diagnostics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//<snippet1>

using System;
using System.Windows.Forms;
using System.Drawing;
Expand Down
2 changes: 0 additions & 2 deletions snippets/csharp/System.IO/FileInfo/MoveTo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//<SNIPPET1>

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand All @@ -12,7 +11,6 @@

namespace Microsoft.Samples.MoveTo.CS
{

class Program
{
private static string sourcePath = Environment.GetFolderPath
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <snippet0>

using System;
using System.Messaging;

Expand Down Expand Up @@ -38,5 +37,4 @@ public static void UseQueue()
// </snippet1>
}
}

// </snippet0>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <snippet0>

using System;
using System.Messaging;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <snippet0>

using System;
using System.Messaging;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <snippet0>

using System;
using System.Messaging;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// available.

// <Snippet1>

using System;
using System.Net;
using System.Net.Sockets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ input string into the correct internal format.
*/

// <Snippet1>

using System;
using System.Net;
using System.Net.Sockets;

class IsLoopbackTest
{

private static void Main(string[] args)
{

if (args.Length == 0)
{
// No parameters entered. Display program usage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
// <Snippet1>
// <Snippet2>

using System;
using System.Net;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <Snippet1>

using System;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -296,7 +295,4 @@ public static void Main() {
new object[0]);
}
}



// </Snippet1>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ in the main method. */
// <Snippet3>
// <Snippet4>
// <Snippet5>

using System;
using System.Collections;
using System.Threading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ custom attributes of the Enum type and displays its contents on the console.
*/

// <Snippet1>

using System;
using System.Threading;
using System.Reflection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// <Snippet1>

using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;

class DynamicJumpTableDemo

{

public static Type BuildMyType()
{
AppDomain myDomain = Thread.GetDomain();
Expand Down Expand Up @@ -110,5 +107,4 @@ public static void Main()
new object[] {theValue}));
}
}

// </Snippet1>
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
using System.Reflection.Emit;

class MyDynamicAssembly

{

public static void BuildDynamicMethod(TypeBuilder myTypeBuilder,
Type[] mthdParamTypes,
Type returnType,
int addrOfLegacyNumberObject)

{
// <Snippet1>
MethodBuilder myMthdBuilder = myTypeBuilder.DefineMethod("MyMethod",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// <Snippet1>

using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;

class TestILGenerator {

public static Type DynamicDotProductGen() {

class TestILGenerator
{
public static Type DynamicDotProductGen()
{
Type ivType = null;
Type[] ctorParams = new Type[] { typeof(int),
typeof(int),
Expand Down Expand Up @@ -179,5 +178,4 @@ public static void Main() {
// (10, 10, 10) . (20, 20, 20) = 600
}
}

// </Snippet1>
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// <Snippet1>

using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;

class PropertyBuilderDemo

{

public static Type BuildDynamicTypeWithProperties()
{
AppDomain myDomain = Thread.GetDomain();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <Snippet1>

using System;
using System.Reflection;
using System.Reflection.Emit;
Expand Down Expand Up @@ -96,5 +95,4 @@ public Assembly ResolveEvent(Object sender, ResolveEventArgs args)
return m_Module.Assembly;
}
}

// </Snippet1>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ assembly is also saved to a file named 'MyAssembly.exe'.
// <Snippet1>
// <Snippet2>
// <Snippet3>

using System;
using System.Reflection;
using System.Threading;
Expand Down Expand Up @@ -54,7 +53,6 @@ public static void MakeAssembly(AssemblyName myAssemblyName, string fileName)

public static void Main()
{

// Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'.
AssemblyName myAssemblyName = new AssemblyName();
myAssemblyName.Name = "MyAssembly";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// <Snippet1>

using System;
using System.Reflection;

//Make two fields, one public and one read-only.
//Make two fields, one public and one read-only.
public class Myfielda
{
public string field = "A - public modifiable field";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <Snippet1>

using System;
using System.Reflection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ then the attributes of all the parameters of the method named 'MyMethod' is
// <Snippet1>
// <Snippet2>
// <Snippet3>

using System;
using System.Reflection;
using System.Threading;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//<snippet1>

using System;
using System.Runtime.InteropServices;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// System.Runtime.InteropServices.TypeLibVarAttribute
// System.Runtime.InteropServices.TypeLibVarFlags
// <Snippet1>

using System;
using System.Reflection;
using System.Runtime.InteropServices;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ interface. It then adds a few headers to the header list and displays them.
*/

// <Snippet1>

using System;
using System.Collections;
using System.Runtime.Remoting;
Expand Down Expand Up @@ -88,5 +87,4 @@ public static void Main()
// </Snippet3>
// </Snippet2>
}

// </Snippet1>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <Snippet2>

using System;
using System.Collections;
using System.Runtime.Remoting;
Expand Down Expand Up @@ -31,5 +30,4 @@ public static void Main() {
}
}
}

// </Snippet2>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <Snippet3>

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
//
//-----------------------------------------------------------------------------
//<Snippet1>

using System;

namespace ClaimsAuthorizationLibrary
Expand Down
Loading