diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp
deleted file mode 100644
index 23f9d8bfc08..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Text;
-
-public ref class SomeType
-{
-public:
- void DoSomething(int x)
- {
- Console::WriteLine("100 / {0} = {1}", x, 100 / x);
- }
-};
-
-void main()
-{
- //
- // Create an instance of the StringBuilder type using
- // Activator.CreateInstance.
- Object^ o = Activator::CreateInstance(StringBuilder::typeid);
-
- // Append a string into the StringBuilder object and display the
- // StringBuilder.
- StringBuilder^ sb = (StringBuilder^) o;
- sb->Append("Hello, there.");
- Console::WriteLine(sb);
- //
-
- //
- // Create an instance of the SomeType class that is defined in this
- // assembly.
- System::Runtime::Remoting::ObjectHandle^ oh =
- Activator::CreateInstanceFrom(Assembly::GetEntryAssembly()->CodeBase,
- SomeType::typeid->FullName);
-
- // Call an instance method defined by the SomeType type using this object.
- SomeType^ st = (SomeType^) oh->Unwrap();
-
- st->DoSomething(5);
- //
-};
-
-/* This code produces the following output:
-
-Hello, there.
-100 / 5 = 20
- */
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp
deleted file mode 100644
index d02d7ca37f0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-using namespace System;
-
-ref class DynamicInstanceList
-{
-private:
- static String^ instanceSpec = "System.EventArgs;System.Random;" +
- "System.Exception;System.Object;System.Version";
-
-public:
- static void Main()
- {
- array^ instances = instanceSpec->Split(';');
- Array^ instlist = Array::CreateInstance(Object::typeid, instances->Length);
- Object^ item;
-
- for (int i = 0; i < instances->Length; i++)
- {
- // create the object from the specification string
- Console::WriteLine("Creating instance of: {0}", instances[i]);
- item = Activator::CreateInstance(Type::GetType(instances[i]));
- instlist->SetValue(item, i);
- }
- Console::WriteLine("\nObjects and their default values:\n");
- for each (Object^ o in instlist)
- {
- Console::WriteLine("Type: {0}\nValue: {1}\nHashCode: {2}\n",
- o->GetType()->FullName, o->ToString(), o->GetHashCode());
- }
- }
-};
-
-int main()
-{
- DynamicInstanceList::Main();
-}
-
-// This program will display output similar to the following:
-//
-// Creating instance of: System.EventArgs
-// Creating instance of: System.Random
-// Creating instance of: System.Exception
-// Creating instance of: System.Object
-// Creating instance of: System.Version
-//
-// Objects and their default values:
-//
-// Type: System.EventArgs
-// Value: System.EventArgs
-// HashCode: 46104728
-//
-// Type: System.Random
-// Value: System.Random
-// HashCode: 12289376
-//
-// Type: System.Exception
-// Value: System.Exception: Exception of type 'System.Exception' was thrown.
-// HashCode: 55530882
-//
-// Type: System.Object
-// Value: System.Object
-// HashCode: 30015890
-//
-// Type: System.Version
-// Value: 0.0
-// HashCode: 1048575
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp b/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp
deleted file mode 100644
index 46b9455a618..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// An enumeration of animals. Start at 1 (0 = uninitialized).
-public enum class Animal
-{
- // Pets.
- Dog = 1,
- Cat, Bird
-};
-
-// A custom attribute to allow a target to have a pet.
-public ref class AnimalTypeAttribute: public Attribute
-{
-public:
-
- // The constructor is called when the attribute is set.
- AnimalTypeAttribute( Animal pet )
- {
- thePet = pet;
- }
-
-
-protected:
-
- // Keep a variable internally ...
- Animal thePet;
-
-public:
-
- property Animal Pet
- {
- // .. and show a copy to the outside world.
- Animal get()
- {
- return thePet;
- }
-
- void set( Animal value )
- {
- thePet = value;
- }
- }
-};
-
-// A test class where each method has its own pet.
-ref class AnimalTypeTestClass
-{
-public:
-
- [AnimalType(Animal::Dog)]
- void DogMethod(){}
-
-
- [AnimalType(Animal::Cat)]
- void CatMethod(){}
-
- [AnimalType(Animal::Bird)]
- void BirdMethod(){}
-
-};
-
-int main()
-{
- AnimalTypeTestClass^ testClass = gcnew AnimalTypeTestClass;
- Type^ type = testClass->GetType();
-
- // Iterate through all the methods of the class.
- System::Collections::IEnumerator^ myEnum =
- type->GetMethods()->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- MethodInfo^ mInfo = safe_cast(myEnum->Current);
-
- // Iterate through all the Attributes for each method.
- System::Collections::IEnumerator^ myEnum1 =
- Attribute::GetCustomAttributes( mInfo )->GetEnumerator();
- while ( myEnum1->MoveNext() )
- {
- Attribute^ attr = safe_cast(myEnum1->Current);
-
- // Check for the AnimalType attribute.
- if ( attr->GetType() == AnimalTypeAttribute::typeid )
- Console::WriteLine( "Method {0} has a pet {1} attribute.",
- mInfo->Name, (dynamic_cast(attr))->Pet );
- }
- }
-}
-
-/*
- * Output:
- * Method DogMethod has a pet Dog attribute.
- * Method CatMethod has a pet Cat attribute.
- * Method BirdMethod has a pet Bird attribute.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp
deleted file mode 100644
index 34a424f0c5f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Types:System.ArgumentException
-//
-using namespace System;
-
-//
-int DivideByTwo(int num)
-{
- // If num is an odd number, throw an ArgumentException.
- if ((num & 1) == 1)
- {
- throw gcnew ArgumentException("Number must be even", "num");
- }
- // num is even, return half of its value.
- return num / 2;
-}
-//
-
-int main()
-{
- // ArgumentException is not thrown because 10 is an even number.
- Console::WriteLine("10 divided by 2 is {0}", DivideByTwo(10));
- try
- {
- // ArgumentException is thrown because 7 is not an even number.
- Console::WriteLine("7 divided by 2 is {0}", DivideByTwo(7));
- }
- catch (ArgumentException^)
- {
- // Show the user that 7 cannot be divided by 2.
- Console::WriteLine("7 is not divided by 2 integrally.");
- }
-}
-
-// This code produces the following output.
-//
-// 10 divided by 2 is 5
-// 7 is not divided by 2 integrally.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp
deleted file mode 100644
index 63ffdbb6142..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-using namespace System;
-
-static int DivideByTwo(int num)
-{
- // If num is an odd number, throw an ArgumentException.
- if ((num & 1) == 1)
- throw gcnew ArgumentException(String::Format("{0} is not an even number", num),
- "num");
-
- // num is even, return half of its value.
- return num / 2;
-}
-
-void main()
-{
- // Define some integers for a division operation.
- array^ values = { 10, 7 };
- for each (int value in values) {
- try {
- Console::WriteLine("{0} divided by 2 is {1}", value, DivideByTwo(value));
- }
- catch (ArgumentException^ e) {
- Console::WriteLine("{0}: {1}", e->GetType()->Name, e->Message);
- }
- Console::WriteLine();
- }
-}
-// This example displays the following output:
-// 10 divided by 2 is 5
-//
-// ArgumentException: 7 is not an even number
-// Parameter name: num
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp
deleted file mode 100644
index dfe97aa75c8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-
-//
-ref class ReverseStringComparer: public IComparer
-{
-public:
- virtual int Compare( Object^ x, Object^ y )
- {
- String^ s1 = dynamic_cast(x);
- String^ s2 = dynamic_cast(y);
-
- //negate the return value to get the reverse order
- return -String::Compare( s1, s2 );
- }
-
-};
-//
-
-//
-void PrintValues( String^ title, IEnumerable^ myList )
-{
- Console::Write( "{0,10}: ", title );
- StringBuilder^ sb = gcnew StringBuilder;
- {
- IEnumerator^ en = myList->GetEnumerator();
- String^ s;
- while ( en->MoveNext() )
- {
- s = en->Current->ToString();
- sb->AppendFormat( "{0}, ", s );
- }
- }
- sb->Remove( sb->Length - 2, 2 );
- Console::WriteLine( sb );
-}
-//
-
-void main()
-{
- //
- // Creates and initializes a new ArrayList.
- ArrayList^ myAL = gcnew ArrayList;
- myAL->Add( "Eric" );
- myAL->Add( "Mark" );
- myAL->Add( "Lance" );
- myAL->Add( "Rob" );
- myAL->Add( "Kris" );
- myAL->Add( "Brad" );
- myAL->Add( "Kit" );
- myAL->Add( "Bradley" );
- myAL->Add( "Keith" );
- myAL->Add( "Susan" );
-
- // Displays the properties and values of the ArrayList.
- Console::WriteLine( "Count: {0}", myAL->Count.ToString() );
- //
-
- PrintValues( "Unsorted", myAL );
-
- //
- myAL->Sort();
- PrintValues( "Sorted", myAL );
- //
-
- //
- myAL->Sort( gcnew ReverseStringComparer );
- PrintValues( "Reverse", myAL );
- //
-
- //
- array^names = dynamic_cast^>(myAL->ToArray( String::typeid ));
- //
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp
deleted file mode 100644
index 3bd578173ee..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// System::ArrayTypeMismatchException::ArrayTypeMismatchException
-/*
- * The following example demonstrates the 'ArrayTypeMismatchException()' constructor of class
- * ArrayTypeMismatchException class. It creates a function which takes two arrays as arguments.
- * It checks whether the two arrays are of same type or not. If two arrays are not of same type
- * then a new 'ArrayTypeMismatchException' object is created and thrown. That exception is caught
- * in the calling method.
- */
-//
-using namespace System;
-public ref class ArrayTypeMisMatchConst
-{
-public:
- void CopyArray( Array^ myArray, Array^ myArray1 )
- {
- String^ typeArray1 = myArray->GetType()->ToString();
- String^ typeArray2 = myArray1->GetType()->ToString();
-
- // Check whether the two arrays are of same type or not.
- if ( typeArray1 == typeArray2 )
- {
-
- // Copy the values from one array to another.
- myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 );
- myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 );
- }
- else
- {
-
- // Throw an exception of type 'ArrayTypeMismatchException'.
- throw gcnew ArrayTypeMismatchException;
- }
- }
-
-};
-
-int main()
-{
- try
- {
- array^myStringArray = gcnew array(2);
- myStringArray->SetValue( "Jones", 0 );
- myStringArray->SetValue( "John", 1 );
- array^myIntArray = gcnew array(2);
- ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst;
- myArrayType->CopyArray( myStringArray, myIntArray );
- }
- catch ( ArrayTypeMismatchException^ e )
- {
- Console::WriteLine( "The Exception is : {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp
deleted file mode 100644
index d83f12c18e3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-
-// System::ArrayTypeMismatchException::ArrayTypeMismatchException
-/*
- The following example demonstrates the 'ArrayTypeMismatchException(String*)'
- constructor of class ArrayTypeMismatchException class. A function has been
- created which takes two arrays as arguments. It checks whether the two arrays
- are of same type or not. If two arrays are of not same type then a new
- 'ArrayTypeMismatchException' object is created and thrown. That exception is
- caught in the calling method.
- */
-//
-using namespace System;
-public ref class ArrayTypeMisMatchConst
-{
-public:
- void CopyArray( Array^ myArray, Array^ myArray1 )
- {
- String^ typeArray1 = myArray->GetType()->ToString();
- String^ typeArray2 = myArray1->GetType()->ToString();
-
- // Check whether the two arrays are of same type or not.
- if ( typeArray1 == typeArray2 )
- {
-
- // Copies the values from one array to another.
- myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 );
- myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 );
- }
- else
- {
-
- // Throw an exception of type 'ArrayTypeMismatchException' with a message String* as parameter.
- throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are not of same type." );
- }
- }
-
-};
-
-int main()
-{
- try
- {
- array^myStringArray = gcnew array(2);
- myStringArray->SetValue( "Jones", 0 );
- myStringArray->SetValue( "John", 1 );
- array^myIntArray = gcnew array(2);
- ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst;
- myArrayType->CopyArray( myStringArray, myIntArray );
- }
- catch ( ArrayTypeMismatchException^ e )
- {
- Console::WriteLine( "The Exception Message is : {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp
deleted file mode 100644
index 83d9a347667..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// System::ArrayTypeMismatchException::ArrayTypeMismatchException
-/*
- The following example demonstrates the 'ArrayTypeMismatchException(String*, innerException)'
- constructor of class ArrayTypeMismatchException class. It creates a
- function which takes two arrays as arguments. It copies elements of
- one array to another array. If two arrays are of not same type then
- an exception has been thrown. In the 'Catch' block a new 'WebException'
- object is created and thrown to the caller. That exception is caught
- in the calling method and the error message is displayed to the console.
- */
-//
-using namespace System;
-public ref class ArrayTypeMisMatchConst
-{
-public:
- void CopyArray( Array^ myArray, Array^ myArray1 )
- {
- try
- {
-
- // Copies the value of one array into another array.
- myArray->SetValue( myArray1->GetValue( 0 ), 0 );
- myArray->SetValue( myArray1->GetValue( 1 ), 1 );
- }
- catch ( Exception^ e )
- {
-
- // Throw an exception of with a message and innerexception.
- throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are of not same type.",e );
- }
-
- }
-
-};
-
-int main()
-{
- try
- {
- array^myStringArray = gcnew array(2);
- myStringArray->SetValue( "Jones", 0 );
- myStringArray->SetValue( "John", 1 );
- array^myIntArray = gcnew array(2);
- ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst;
- myArrayType->CopyArray( myStringArray, myIntArray );
- }
- catch ( ArrayTypeMismatchException^ e )
- {
- Console::WriteLine( "The Exception Message is : {0}", e->Message );
- Console::WriteLine( "The Inner exception is : {0}", e->InnerException );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp
deleted file mode 100644
index 6ea5b937007..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Drawing;
-using namespace System::Collections::Generic;
-
-Point PointFToPoint(PointF pf)
-{
- return Point((int) pf.X, (int) pf.Y);
-};
-
-void main()
-{
- // Create an array of PointF objects.
- array^ apf = {
- PointF(27.8F, 32.62F),
- PointF(99.3F, 147.273F),
- PointF(7.5F, 1412.2F) };
-
-
- // Display each element in the PointF array.
- Console::WriteLine();
- for each(PointF p in apf)
- {
- Console::WriteLine(p);
- }
-
- // Convert each PointF element to a Point object.
- array^ ap =
- Array::ConvertAll(apf,
- gcnew Converter(PointFToPoint)
- );
-
- // Display each element in the Point array.
- Console::WriteLine();
- for each(Point p in ap)
- {
- Console::WriteLine(p);
- }
-}
-
-/* This code example produces the following output:
-
-{X=27.8, Y=32.62}
-{X=99.3, Y=147.273}
-{X=7.5, Y=1412.2}
-
-{X=27,Y=32}
-{X=99,Y=147}
-{X=7,Y=1412}
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp
deleted file mode 100644
index 61bb710737e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-//
-using namespace System;
-
-public ref class DinoDiscoverySet
-{
-public:
- static void Main()
- {
- array^ dinosaurs =
- {
- "Compsognathus", "Amargasaurus", "Oviraptor",
- "Velociraptor", "Deinonychus", "Dilophosaurus",
- "Gallimimus", "Triceratops"
- };
-
- DinoDiscoverySet^ GoMesozoic = gcnew DinoDiscoverySet(dinosaurs);
-
- GoMesozoic->DiscoverAll();
- GoMesozoic->DiscoverByEnding("saurus");
- }
-
- DinoDiscoverySet(array^ items)
- {
- dinosaurs = items;
- }
-
- void DiscoverAll()
- {
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
- }
-
- void DiscoverByEnding(String^ Ending)
- {
- Predicate^ dinoType;
-
- if (Ending->ToLower() == "raptor")
- {
- dinoType =
- gcnew Predicate(&DinoDiscoverySet::EndsWithRaptor);
- }
- else if (Ending->ToLower() == "tops")
- {
- dinoType =
- gcnew Predicate(&DinoDiscoverySet::EndsWithTops);
- }
- else if (Ending->ToLower() == "saurus")
- {
- dinoType =
- gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus);
- }
- else
- {
- dinoType =
- gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus);
- }
-
- Console::WriteLine(
- "\nArray::Exists(dinosaurs, \"{0}\"): {1}",
- Ending,
- Array::Exists(dinosaurs, dinoType));
-
- Console::WriteLine(
- "\nArray::TrueForAll(dinosaurs, \"{0}\"): {1}",
- Ending,
- Array::TrueForAll(dinosaurs, dinoType));
-
- Console::WriteLine(
- "\nArray::Find(dinosaurs, \"{0}\"): {1}",
- Ending,
- Array::Find(dinosaurs, dinoType));
-
- Console::WriteLine(
- "\nArray::FindLast(dinosaurs, \"{0}\"): {1}",
- Ending,
- Array::FindLast(dinosaurs, dinoType));
-
- Console::WriteLine(
- "\nArray::FindAll(dinosaurs, \"{0}\"):", Ending);
-
- array^ subArray =
- Array::FindAll(dinosaurs, dinoType);
-
- for each(String^ dinosaur in subArray)
- {
- Console::WriteLine(dinosaur);
- }
- }
-
-private:
- array^ dinosaurs;
-
- // Search predicate returns true if a string ends in "saurus".
- static bool EndsWithSaurus(String^ s)
- {
- if ((s->Length > 5) &&
- (s->Substring(s->Length - 6)->ToLower() == "saurus"))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- // Search predicate returns true if a string ends in "raptor".
- static bool EndsWithRaptor(String^ s)
- {
- if ((s->Length > 5) &&
- (s->Substring(s->Length - 6)->ToLower() == "raptor"))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- // Search predicate returns true if a string ends in "tops".
- static bool EndsWithTops(String^ s)
- {
- if ((s->Length > 3) &&
- (s->Substring(s->Length - 4)->ToLower() == "tops"))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-};
-
-int main()
-{
- DinoDiscoverySet::Main();
-}
-
-/* This code example produces the following output:
-
-Compsognathus
-Amargasaurus
-Oviraptor
-Velociraptor
-Deinonychus
-Dilophosaurus
-Gallimimus
-Triceratops
-
-Array.Exists(dinosaurs, "saurus"): True
-
-Array.TrueForAll(dinosaurs, "saurus"): False
-
-Array.Find(dinosaurs, "saurus"): Amargasaurus
-
-Array.FindLast(dinosaurs, "saurus"): Dilophosaurus
-
-Array.FindAll(dinosaurs, "saurus"):
-Amargasaurus
-Dilophosaurus
-*/
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp
deleted file mode 100644
index da0510c1de8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-using namespace System;
-
-// Search predicate returns true if a string ends in "saurus".
-bool EndsWithSaurus(String^ s)
-{
- if ((s->Length > 5) &&
- (s->Substring(s->Length - 6)->ToLower() == "saurus"))
- {
- return true;
- }
- else
- {
- return false;
- }
-};
-
-void main()
-{
- array^ dinosaurs = { "Compsognathus",
- "Amargasaurus", "Oviraptor", "Velociraptor",
- "Deinonychus", "Dilophosaurus", "Gallimimus",
- "Triceratops" };
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nArray::FindIndex(dinosaurs, EndsWithSaurus): {0}",
- Array::FindIndex(dinosaurs, gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, EndsWithSaurus): {0}",
- Array::FindIndex(dinosaurs, 2, gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): {0}",
- Array::FindIndex(dinosaurs, 2, 3, gcnew Predicate(EndsWithSaurus)));
-}
-
-/* This code example produces the following output:
-
-Compsognathus
-Amargasaurus
-Oviraptor
-Velociraptor
-Deinonychus
-Dilophosaurus
-Gallimimus
-Triceratops
-
-Array::FindIndex(dinosaurs, EndsWithSaurus): 1
-
-Array::FindIndex(dinosaurs, 2, EndsWithSaurus): 5
-
-Array::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): -1
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp
deleted file mode 100644
index 2ce93684dce..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-using namespace System;
-
-// Search predicate returns true if a string ends in "saurus".
-bool EndsWithSaurus(String^ s)
-{
- if ((s->Length > 5) &&
- (s->Substring(s->Length - 6)->ToLower() == "saurus"))
- {
- return true;
- }
- else
- {
- return false;
- }
-};
-
-void main()
-{
- array^ dinosaurs = { "Compsognathus",
- "Amargasaurus", "Oviraptor", "Velociraptor",
- "Deinonychus", "Dilophosaurus", "Gallimimus",
- "Triceratops" };
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nArray::FindLastIndex(dinosaurs, EndsWithSaurus): {0}",
- Array::FindLastIndex(dinosaurs, gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, EndsWithSaurus): {0}",
- Array::FindLastIndex(dinosaurs, 4, gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): {0}",
- Array::FindLastIndex(dinosaurs, 4, 3, gcnew Predicate(EndsWithSaurus)));
-}
-
-/* This code example produces the following output:
-
-Compsognathus
-Amargasaurus
-Oviraptor
-Velociraptor
-Deinonychus
-Dilophosaurus
-Gallimimus
-Triceratops
-
-Array::FindLastIndex(dinosaurs, EndsWithSaurus): 5
-
-Array::FindLastIndex(dinosaurs, 4, EndsWithSaurus): 1
-
-Array::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): -1
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp
deleted file mode 100644
index 946551d8cde..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-using namespace System;
-
-void main()
-{
- array^ dinosaurs = { "Tyrannosaurus",
- "Amargasaurus",
- "Mamenchisaurus",
- "Brachiosaurus",
- "Deinonychus",
- "Tyrannosaurus",
- "Compsognathus" };
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\"): {0}",
- Array::IndexOf(dinosaurs, "Tyrannosaurus"));
-
- Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}",
- Array::IndexOf(dinosaurs, "Tyrannosaurus", 3));
-
- Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 2, 2): {0}",
- Array::IndexOf(dinosaurs, "Tyrannosaurus", 2, 2));
-}
-
-/* This code example produces the following output:
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Brachiosaurus
-Deinonychus
-Tyrannosaurus
-Compsognathus
-
-Array.IndexOf(dinosaurs, "Tyrannosaurus"): 0
-
-Array.IndexOf(dinosaurs, "Tyrannosaurus", 3): 5
-
-Array.IndexOf(dinosaurs, "Tyrannosaurus", 2, 2): -1
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp
deleted file mode 100644
index 2f297639c6a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-using namespace System;
-
-void main()
-{
- array^ dinosaurs = { "Tyrannosaurus",
- "Amargasaurus",
- "Mamenchisaurus",
- "Brachiosaurus",
- "Deinonychus",
- "Tyrannosaurus",
- "Compsognathus" };
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine(
- "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\"): {0}",
- Array::LastIndexOf(dinosaurs, "Tyrannosaurus"));
-
- Console::WriteLine(
- "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}",
- Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 3));
-
- Console::WriteLine(
- "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 4, 4): {0}",
- Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4));
-}
-
-/* This code example produces the following output:
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Brachiosaurus
-Deinonychus
-Tyrannosaurus
-Compsognathus
-
-Array.LastIndexOf(dinosaurs, "Tyrannosaurus"): 5
-
-Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 3): 0
-
-Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4): -1
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp
deleted file mode 100644
index 0eece7d8c34..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class ReverseComparer: IComparer
-{
-public:
- virtual int Compare(String^ x, String^ y)
- {
- // Compare y and x in reverse order.
- return y->CompareTo(x);
- }
-};
-
-void main()
-{
- array^ dinosaurs = {
- "Seismosaurus",
- "Chasmosaurus",
- "Coelophysis",
- "Mamenchisaurus",
- "Caudipteryx",
- "Cetiosaurus" };
-
- array^ dinosaurSizes = { 40, 5, 3, 22, 1, 18 };
-
- Console::WriteLine();
- for (int i = 0; i < dinosaurs->Length; i++)
- {
- Console::WriteLine("{0}: up to {1} meters long.",
- dinosaurs[i], dinosaurSizes[i]);
- }
-
- Console::WriteLine("\nSort(dinosaurs, dinosaurSizes)");
- Array::Sort(dinosaurs, dinosaurSizes);
-
- Console::WriteLine();
- for (int i = 0; i < dinosaurs->Length; i++)
- {
- Console::WriteLine("{0}: up to {1} meters long.",
- dinosaurs[i], dinosaurSizes[i]);
- }
-
- ReverseComparer^ rc = gcnew ReverseComparer();
-
- Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, rc)");
- Array::Sort(dinosaurs, dinosaurSizes, rc);
-
- Console::WriteLine();
- for (int i = 0; i < dinosaurs->Length; i++)
- {
- Console::WriteLine("{0}: up to {1} meters long.",
- dinosaurs[i], dinosaurSizes[i]);
- }
-
- Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3)");
- Array::Sort(dinosaurs, dinosaurSizes, 3, 3);
-
- Console::WriteLine();
- for (int i = 0; i < dinosaurs->Length; i++)
- {
- Console::WriteLine("{0}: up to {1} meters long.",
- dinosaurs[i], dinosaurSizes[i]);
- }
-
- Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3, rc)");
- Array::Sort(dinosaurs, dinosaurSizes, 3, 3, rc);
-
- Console::WriteLine();
- for (int i = 0; i < dinosaurs->Length; i++)
- {
- Console::WriteLine("{0}: up to {1} meters long.",
- dinosaurs[i], dinosaurSizes[i]);
- }
-}
-
-/* This code example produces the following output:
-
-Seismosaurus: up to 40 meters long.
-Chasmosaurus: up to 5 meters long.
-Coelophysis: up to 3 meters long.
-Mamenchisaurus: up to 22 meters long.
-Caudipteryx: up to 1 meters long.
-Cetiosaurus: up to 18 meters long.
-
-Sort(dinosaurs, dinosaurSizes)
-
-Caudipteryx: up to 1 meters long.
-Cetiosaurus: up to 18 meters long.
-Chasmosaurus: up to 5 meters long.
-Coelophysis: up to 3 meters long.
-Mamenchisaurus: up to 22 meters long.
-Seismosaurus: up to 40 meters long.
-
-Sort(dinosaurs, dinosaurSizes, rc)
-
-Seismosaurus: up to 40 meters long.
-Mamenchisaurus: up to 22 meters long.
-Coelophysis: up to 3 meters long.
-Chasmosaurus: up to 5 meters long.
-Cetiosaurus: up to 18 meters long.
-Caudipteryx: up to 1 meters long.
-
-Sort(dinosaurs, dinosaurSizes, 3, 3)
-
-Seismosaurus: up to 40 meters long.
-Mamenchisaurus: up to 22 meters long.
-Coelophysis: up to 3 meters long.
-Caudipteryx: up to 1 meters long.
-Cetiosaurus: up to 18 meters long.
-Chasmosaurus: up to 5 meters long.
-
-Sort(dinosaurs, dinosaurSizes, 3, 3, rc)
-
-Seismosaurus: up to 40 meters long.
-Mamenchisaurus: up to 22 meters long.
-Coelophysis: up to 3 meters long.
-Chasmosaurus: up to 5 meters long.
-Cetiosaurus: up to 18 meters long.
-Caudipteryx: up to 1 meters long.
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp
deleted file mode 100644
index 8570582fcc3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-int CompareDinosByLength(String^ x, String^ y)
-{
- if (x == nullptr)
- {
- if (y == nullptr)
- {
- // If x is null and y is null, they're
- // equal.
- return 0;
- }
- else
- {
- // If x is null and y is not null, y
- // is greater.
- return -1;
- }
- }
- else
- {
- // If x is not null...
- //
- if (y == nullptr)
- // ...and y is null, x is greater.
- {
- return 1;
- }
- else
- {
- // ...and y is not null, compare the
- // lengths of the two strings.
- //
- int retval = x->Length.CompareTo(y->Length);
-
- if (retval != 0)
- {
- // If the strings are not of equal length,
- // the longer string is greater.
- //
- return retval;
- }
- else
- {
- // If the strings are of equal length,
- // sort them with ordinary string comparison.
- //
- return x->CompareTo(y);
- }
- }
- }
-};
-
-void Display(array^ arr)
-{
- Console::WriteLine();
- for each(String^ s in arr)
- {
- if (s == nullptr)
- Console::WriteLine("(null)");
- else
- Console::WriteLine("\"{0}\"", s);
- }
-};
-
-void main()
-{
- array^ dinosaurs = {
- "Pachycephalosaurus",
- "Amargasaurus",
- "",
- nullptr,
- "Mamenchisaurus",
- "Deinonychus" };
- Display(dinosaurs);
-
- Console::WriteLine("\nSort with generic Comparison delegate:");
- Array::Sort(dinosaurs,
- gcnew Comparison(CompareDinosByLength));
- Display(dinosaurs);
-
-}
-
-/* This code example produces the following output:
-
-"Pachycephalosaurus"
-"Amargasaurus"
-""
-(null)
-"Mamenchisaurus"
-"Deinonychus"
-
-Sort with generic Comparison delegate:
-
-(null)
-""
-"Deinonychus"
-"Amargasaurus"
-"Mamenchisaurus"
-"Pachycephalosaurus"
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp
deleted file mode 100644
index d51b2194310..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class ReverseComparer: IComparer
-{
-public:
- virtual int Compare(String^ x, String^ y)
- {
- // Compare y and x in reverse order.
- return y->CompareTo(x);
- }
-};
-
-void main()
-{
- array^ dinosaurs = {"Pachycephalosaurus",
- "Amargasaurus",
- "Mamenchisaurus",
- "Tarbosaurus",
- "Tyrannosaurus",
- "Albertasaurus"};
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nSort(dinosaurs, 3, 3)");
- Array::Sort(dinosaurs, 3, 3);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- ReverseComparer^ rc = gcnew ReverseComparer();
-
- Console::WriteLine("\nSort(dinosaurs, 3, 3, rc)");
- Array::Sort(dinosaurs, 3, 3, rc);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-}
-
-/* This code example produces the following output:
-
-Pachycephalosaurus
-Amargasaurus
-Mamenchisaurus
-Tarbosaurus
-Tyrannosaurus
-Albertasaurus
-
-Sort(dinosaurs, 3, 3)
-
-Pachycephalosaurus
-Amargasaurus
-Mamenchisaurus
-Albertasaurus
-Tarbosaurus
-Tyrannosaurus
-
-Sort(dinosaurs, 3, 3, rc)
-
-Pachycephalosaurus
-Amargasaurus
-Mamenchisaurus
-Tyrannosaurus
-Tarbosaurus
-Albertasaurus
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp
deleted file mode 100644
index 1d9c96cc967..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-generic void ShowWhere(array^ arr, int index)
-{
- if (index<0)
- {
- // If the index is negative, it represents the bitwise
- // complement of the next larger element in the array.
- //
- index = ~index;
-
- Console::Write("Not found. Sorts between: ");
-
- if (index == 0)
- Console::Write("beginning of array and ");
- else
- Console::Write("{0} and ", arr[index-1]);
-
- if (index == arr->Length)
- Console::WriteLine("end of array.");
- else
- Console::WriteLine("{0}.", arr[index]);
- }
- else
- {
- Console::WriteLine("Found at index {0}.", index);
- }
-};
-
-void main()
-{
- array^ dinosaurs = {"Pachycephalosaurus",
- "Amargasaurus",
- "Tyrannosaurus",
- "Mamenchisaurus",
- "Deinonychus",
- "Edmontosaurus"};
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nSort");
- Array::Sort(dinosaurs);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nBinarySearch for 'Coelophysis':");
- int index = Array::BinarySearch(dinosaurs, "Coelophysis");
- ShowWhere(dinosaurs, index);
-
- Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':");
- index = Array::BinarySearch(dinosaurs, "Tyrannosaurus");
- ShowWhere(dinosaurs, index);
-}
-
-/* This code example produces the following output:
-
-Pachycephalosaurus
-Amargasaurus
-Tyrannosaurus
-Mamenchisaurus
-Deinonychus
-Edmontosaurus
-
-Sort
-
-Amargasaurus
-Deinonychus
-Edmontosaurus
-Mamenchisaurus
-Pachycephalosaurus
-Tyrannosaurus
-
-BinarySearch for 'Coelophysis':
-Not found. Sorts between: Amargasaurus and Deinonychus.
-
-BinarySearch for 'Tyrannosaurus':
-Found at index 5.
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp
deleted file mode 100644
index d19063bd802..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class ReverseComparer: IComparer
-{
-public:
- virtual int Compare(String^ x, String^ y)
- {
- // Compare y and x in reverse order.
- return y->CompareTo(x);
- }
-};
-
-generic void ShowWhere(array^ arr, int index)
-{
- if (index<0)
- {
- // If the index is negative, it represents the bitwise
- // complement of the next larger element in the array.
- //
- index = ~index;
-
- Console::Write("Not found. Sorts between: ");
-
- if (index == 0)
- Console::Write("beginning of array and ");
- else
- Console::Write("{0} and ", arr[index-1]);
-
- if (index == arr->Length)
- Console::WriteLine("end of array.");
- else
- Console::WriteLine("{0}.", arr[index]);
- }
- else
- {
- Console::WriteLine("Found at index {0}.", index);
- }
-};
-
-void main()
-{
- array^ dinosaurs = {"Pachycephalosaurus",
- "Amargasaurus",
- "Tyrannosaurus",
- "Mamenchisaurus",
- "Deinonychus",
- "Edmontosaurus"};
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- ReverseComparer^ rc = gcnew ReverseComparer();
-
- Console::WriteLine("\nSort");
- Array::Sort(dinosaurs, rc);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nBinarySearch for 'Coelophysis':");
- int index = Array::BinarySearch(dinosaurs, "Coelophysis", rc);
- ShowWhere(dinosaurs, index);
-
- Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':");
- index = Array::BinarySearch(dinosaurs, "Tyrannosaurus", rc);
- ShowWhere(dinosaurs, index);
-}
-
-/* This code example produces the following output:
-
-Pachycephalosaurus
-Amargasaurus
-Tyrannosaurus
-Mamenchisaurus
-Deinonychus
-Edmontosaurus
-
-Sort
-
-Tyrannosaurus
-Pachycephalosaurus
-Mamenchisaurus
-Edmontosaurus
-Deinonychus
-Amargasaurus
-
-BinarySearch for 'Coelophysis':
-Not found. Sorts between: Deinonychus and Amargasaurus.
-
-BinarySearch for 'Tyrannosaurus':
-Found at index 0.
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp b/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp
deleted file mode 100644
index 41f69f4f144..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-//
-using namespace System;
-
-namespace AttTargsCS
-{
-
- // This attribute is only valid on a class.
-
- [AttributeUsage(AttributeTargets::Class)]
- public ref class ClassTargetAttribute: public Attribute{};
-
-
- // This attribute is only valid on a method.
-
- [AttributeUsage(AttributeTargets::Method)]
- public ref class MethodTargetAttribute: public Attribute{};
-
-
- // This attribute is only valid on a constructor.
-
- [AttributeUsage(AttributeTargets::Constructor)]
- public ref class ConstructorTargetAttribute: public Attribute{};
-
-
- // This attribute is only valid on a field.
-
- [AttributeUsage(AttributeTargets::Field)]
- public ref class FieldTargetAttribute: public Attribute{};
-
-
- // This attribute is valid on a class or a method.
-
- [AttributeUsage(AttributeTargets::Class|AttributeTargets::Method)]
- public ref class ClassMethodTargetAttribute: public Attribute{};
-
-
- // This attribute is valid on any target.
-
- [AttributeUsage(AttributeTargets::All)]
- public ref class AllTargetsAttribute: public Attribute{};
-
-
- [ClassTarget]
- [ClassMethodTarget]
- [AllTargets]
- public ref class TestClassAttribute
- {
- private:
-
- [ConstructorTarget]
- [AllTargets]
- TestClassAttribute(){}
-
-
- public:
-
- [MethodTarget]
- [ClassMethodTarget]
- [AllTargets]
- void Method1(){}
-
-
- [FieldTarget]
- [AllTargets]
- int myInt;
- static void Main(){}
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp
deleted file mode 100644
index cafb9d2dab4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeArgumentReferenceExpressionExample
- {
- public:
- CodeArgumentReferenceExpressionExample()
- {
-
- //
- // Declare a method that accepts a string parameter named text.
- CodeMemberMethod^ cmm = gcnew CodeMemberMethod;
- cmm->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","text" ) );
- cmm->Name = "WriteString";
- cmm->ReturnType = gcnew CodeTypeReference( "System::Void" );
- array^ce = {gcnew CodeArgumentReferenceExpression( "test1" )};
-
- // Create a method invoke statement to output the string passed to the method.
- CodeMethodInvokeExpression^ cmie = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "Console" ),"WriteLine",ce );
-
- // Add the method invoke expression to the method's statements collection.
- cmm->Statements->Add( cmie );
-
- // A C++ code generator produces the following source code for the preceeding example code:
- // private:
- // void WriteString(String text) {
- // Console::WriteLine(text);
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp
deleted file mode 100644
index ba586aa0cf3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-//
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Drawing;
-using namespace System::Collections;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-using namespace System::Data;
-using namespace System::IO;
-using namespace Microsoft::CSharp;
-using namespace Microsoft::VisualBasic;
-using namespace Microsoft::JScript;
-
-///
-/// Provides a wrapper for CodeDOM samples.
-///
-public ref class Form1: public System::Windows::Forms::Form
-{
-private:
- System::CodeDom::CodeCompileUnit^ cu;
- System::Windows::Forms::TextBox^ textBox1;
- System::Windows::Forms::Button^ button1;
- System::Windows::Forms::Button^ button2;
- System::Windows::Forms::GroupBox^ groupBox1;
- System::Windows::Forms::RadioButton^ radioButton1;
- System::Windows::Forms::RadioButton^ radioButton2;
- System::Windows::Forms::RadioButton^ radioButton3;
- int language;
- System::ComponentModel::Container^ components;
-
-public:
- Form1()
- {
- language = 1; // 1 = Csharp 2 = VB 3 = JScript
- components = nullptr;
- InitializeComponent();
- cu = CreateGraph();
- }
-
- //
-public:
- CodeCompileUnit^ CreateGraph()
- {
- // Create a compile unit to contain a CodeDOM graph
- CodeCompileUnit^ cu = gcnew CodeCompileUnit;
-
- // Create a namespace named "TestSpace"
- CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" );
-
- // Create a new type named "TestClass"
- CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" );
-
- // Create a new entry point method
- CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod;
-
- //
- // Create an initialization expression for a new array of type Int32 with 10 indices
- CodeArrayCreateExpression^ ca1 = gcnew CodeArrayCreateExpression( "System.Int32",10 );
-
- // Declare an array of type Int32, using the CodeArrayCreateExpression ca1 as the initialization expression
- CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32[]","x",ca1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // int[] x = new int[10];
- //
-
- // Add the variable declaration and initialization statement to the entry point method
- cm->Statements->Add( cv1 );
-
- // Add the entry point method to the "TestClass" type
- cd->Members->Add( cm );
-
- // Add the "TestClass" type to the namespace
- cn->Types->Add( cd );
-
- // Add the "TestSpace" namespace to the compile unit
- cu->Namespaces->Add( cn );
- return cu;
- }
- //
-
-private:
- void OutputGraph()
- {
- // Create string writer to output to textbox
- StringWriter^ sw = gcnew StringWriter;
-
- // Create appropriate CodeProvider
- System::CodeDom::Compiler::CodeDomProvider^ cp;
- switch ( language )
- {
- case 2:
- // VB
- cp = CodeDomProvider::CreateProvider("VisualBasic");
- break;
-
- case 3:
- // JScript
- cp = CodeDomProvider::CreateProvider("JScript");
- break;
-
- default:
- // CSharp
- cp = CodeDomProvider::CreateProvider("CSharp");
- break;
- }
-
- // Create a code generator that will output to the string writer
- ICodeGenerator^ cg = cp->CreateGenerator( sw );
-
- // Generate code from the compile unit and outputs it to the string writer
- cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions );
-
- // Output the contents of the string writer to the textbox
- this->textBox1->Text = sw->ToString();
- }
-
-public:
- ~Form1()
- {
- if ( components != nullptr )
- {
- delete components;
- }
- }
-
-private:
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- void InitializeComponent()
- {
- this->textBox1 = gcnew System::Windows::Forms::TextBox;
- this->button1 = gcnew System::Windows::Forms::Button;
- this->button2 = gcnew System::Windows::Forms::Button;
- this->groupBox1 = gcnew System::Windows::Forms::GroupBox;
- this->radioButton1 = gcnew System::Windows::Forms::RadioButton;
- this->radioButton2 = gcnew System::Windows::Forms::RadioButton;
- this->radioButton3 = gcnew System::Windows::Forms::RadioButton;
- this->groupBox1->SuspendLayout();
- this->SuspendLayout();
-
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point( 16, 112 );
- this->textBox1->Multiline = true;
- this->textBox1->Name = "textBox1";
- this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both;
- this->textBox1->Size = System::Drawing::Size( 664, 248 );
- this->textBox1->TabIndex = 0;
- this->textBox1->Text = "";
- this->textBox1->WordWrap = false;
-
- //
- // button1
- //
- this->button1->BackColor = System::Drawing::Color::Aquamarine;
- this->button1->Location = System::Drawing::Point( 16, 16 );
- this->button1->Name = "button1";
- this->button1->TabIndex = 1;
- this->button1->Text = "Generate";
- this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
-
- //
- // button2
- //
- this->button2->BackColor = System::Drawing::Color::MediumTurquoise;
- this->button2->Location = System::Drawing::Point( 112, 16 );
- this->button2->Name = "button2";
- this->button2->TabIndex = 2;
- this->button2->Text = "Show Code";
- this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click );
-
- //
- // groupBox1
- //
- array^temp0 = {this->radioButton3,this->radioButton2,this->radioButton1};
- this->groupBox1->Controls->AddRange( temp0 );
- this->groupBox1->Location = System::Drawing::Point( 16, 48 );
- this->groupBox1->Name = "groupBox1";
- this->groupBox1->Size = System::Drawing::Size( 384, 56 );
- this->groupBox1->TabIndex = 3;
- this->groupBox1->TabStop = false;
- this->groupBox1->Text = "Language selection";
-
- //
- // radioButton1
- //
- this->radioButton1->Checked = true;
- this->radioButton1->Location = System::Drawing::Point( 16, 24 );
- this->radioButton1->Name = "radioButton1";
- this->radioButton1->TabIndex = 0;
- this->radioButton1->TabStop = true;
- this->radioButton1->Text = "CSharp";
- this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged );
-
- //
- // radioButton2
- //
- this->radioButton2->Location = System::Drawing::Point( 144, 24 );
- this->radioButton2->Name = "radioButton2";
- this->radioButton2->TabIndex = 1;
- this->radioButton2->Text = "Visual Basic";
- this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged );
-
- //
- // radioButton3
- //
- this->radioButton3->Location = System::Drawing::Point( 272, 24 );
- this->radioButton3->Name = "radioButton3";
- this->radioButton3->TabIndex = 2;
- this->radioButton3->Text = "JScript";
- this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged );
-
- //
- // Form1
- //
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 714, 367 );
- array^temp1 = {this->groupBox1,this->button2,this->button1,this->textBox1};
- this->Controls->AddRange( temp1 );
- this->Name = "Form1";
- this->Text = "CodeDOM Samples Framework";
- this->groupBox1->ResumeLayout( false );
- this->ResumeLayout( false );
- }
-
- void ShowCode()
- {
- this->textBox1->Text = "";
- }
-
- // Show code button
- void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- ShowCode();
- }
-
- // Generate and show code button
- void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- OutputGraph();
- }
-
- // Csharp language selection button
- void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = true;
- radioButton2->Checked = false;
- radioButton3->Checked = false;
- language = 1;
- }
-
- // Visual Basic language selection button
- void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = false;
- radioButton2->Checked = true;
- radioButton3->Checked = false;
- language = 2;
- }
-
- // JScript language selection button
- void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = false;
- radioButton2->Checked = false;
- radioButton3->Checked = true;
- language = 3;
- }
-
-};
-
-[STAThread]
-int main()
-{
- Application::Run( gcnew Form1 );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp
deleted file mode 100644
index e565079d0a3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-//
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Drawing;
-using namespace System::Collections;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-using namespace System::Data;
-using namespace System::IO;
-using namespace Microsoft::CSharp;
-using namespace Microsoft::VisualBasic;
-using namespace Microsoft::JScript;
-
-///
-/// Provides a wrapper for CodeDOM samples.
-///
-public ref class Form1: public System::Windows::Forms::Form
-{
-private:
- System::CodeDom::CodeCompileUnit^ cu;
- System::Windows::Forms::TextBox^ textBox1;
- System::Windows::Forms::Button^ button1;
- System::Windows::Forms::Button^ button2;
- System::Windows::Forms::GroupBox^ groupBox1;
- System::Windows::Forms::RadioButton^ radioButton1;
- System::Windows::Forms::RadioButton^ radioButton2;
- System::Windows::Forms::RadioButton^ radioButton3;
- int language;
- System::ComponentModel::Container^ components;
-
-public:
- Form1()
- {
- language = 1; // 1 = Csharp 2 = VB 3 = JScript
- components = nullptr;
- InitializeComponent();
- cu = CreateGraph();
- }
-
- //
-public:
- CodeCompileUnit^ CreateGraph()
- {
- // Create a compile unit to contain a CodeDOM graph
- CodeCompileUnit^ cu = gcnew CodeCompileUnit;
-
- // Create a namespace named "TestSpace"
- CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" );
-
- // Create a new type named "TestClass"
- CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" );
-
- // Create an entry point method
- CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod;
-
- // Create the initialization expression for an array of type Int32 with 10 indices
- CodeArrayCreateExpression^ ca1 = gcnew CodeArrayCreateExpression( "System.Int32",10 );
-
- // Declare an array of type Int32, using the CodeArrayCreateExpression ca1 as the initialization expression
- CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32[]","x",ca1 );
-
- // Add the array declaration and initialization statement to the entry point method class member
- cm->Statements->Add( cv1 );
- //
-
- // Create an array indexer expression that references index 5 of array "x"
- array^temp = {gcnew CodePrimitiveExpression( 5 )};
- CodeArrayIndexerExpression^ ci1 = gcnew CodeArrayIndexerExpression( gcnew CodeVariableReferenceExpression( "x" ),temp );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // x[5]
- //
- // Declare a variable of type Int32 and adds it to the entry point method
- CodeVariableDeclarationStatement^ cv2 = gcnew CodeVariableDeclarationStatement( "System.Int32","y" );
- cm->Statements->Add( cv2 );
-
- // Assign the value of the array indexer ci1 to variable "y"
- CodeAssignStatement^ as1 = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "y" ),ci1 );
-
- // Add the assignment statement to the entry point method
- cm->Statements->Add( as1 );
-
- // Add the entry point method to the "TestClass" type
- cd->Members->Add( cm );
-
- // Add the "TestClass" type to the namespace
- cn->Types->Add( cd );
-
- // Add the "TestSpace" namespace to the compile unit
- cu->Namespaces->Add( cn );
- return cu;
- }
- //
-
-private:
- void OutputGraph()
- {
- // Create string writer to output to textbox
- StringWriter^ sw = gcnew StringWriter;
-
- // Create appropriate CodeProvider
- System::CodeDom::Compiler::CodeDomProvider^ cp;
- switch ( language )
- {
- case 2:
- // VB
- cp = CodeDomProvider::CreateProvider("VisualBasic");
- break;
-
- case 3:
- // JScript
- cp = CodeDomProvider::CreateProvider("JScript");
- break;
-
- default:
- // CSharp
- cp = CodeDomProvider::CreateProvider("CSharp");
- break;
- }
-
- // Create a code generator that will output to the string writer
- ICodeGenerator^ cg = cp->CreateGenerator( sw );
-
- // Generate code from the compile unit and outputs it to the string writer
- cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions );
-
- // Output the contents of the string writer to the textbox
- this->textBox1->Text = sw->ToString();
- }
-
-public:
- ~Form1()
- {
- if ( components != nullptr )
- {
- delete components;
- }
- }
-
-private:
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- void InitializeComponent()
- {
- this->textBox1 = gcnew System::Windows::Forms::TextBox;
- this->button1 = gcnew System::Windows::Forms::Button;
- this->button2 = gcnew System::Windows::Forms::Button;
- this->groupBox1 = gcnew System::Windows::Forms::GroupBox;
- this->radioButton1 = gcnew System::Windows::Forms::RadioButton;
- this->radioButton2 = gcnew System::Windows::Forms::RadioButton;
- this->radioButton3 = gcnew System::Windows::Forms::RadioButton;
- this->groupBox1->SuspendLayout();
- this->SuspendLayout();
-
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point( 16, 112 );
- this->textBox1->Multiline = true;
- this->textBox1->Name = "textBox1";
- this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both;
- this->textBox1->Size = System::Drawing::Size( 664, 248 );
- this->textBox1->TabIndex = 0;
- this->textBox1->Text = "";
- this->textBox1->WordWrap = false;
-
- //
- // button1
- //
- this->button1->BackColor = System::Drawing::Color::Aquamarine;
- this->button1->Location = System::Drawing::Point( 16, 16 );
- this->button1->Name = "button1";
- this->button1->TabIndex = 1;
- this->button1->Text = "Generate";
- this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
-
- //
- // button2
- //
- this->button2->BackColor = System::Drawing::Color::MediumTurquoise;
- this->button2->Location = System::Drawing::Point( 112, 16 );
- this->button2->Name = "button2";
- this->button2->TabIndex = 2;
- this->button2->Text = "Show Code";
- this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click );
-
- //
- // groupBox1
- //
- array^temp2 = {this->radioButton3,this->radioButton2,this->radioButton1};
- this->groupBox1->Controls->AddRange( temp2 );
- this->groupBox1->Location = System::Drawing::Point( 16, 48 );
- this->groupBox1->Name = "groupBox1";
- this->groupBox1->Size = System::Drawing::Size( 384, 56 );
- this->groupBox1->TabIndex = 3;
- this->groupBox1->TabStop = false;
- this->groupBox1->Text = "Language selection";
-
- //
- // radioButton1
- //
- this->radioButton1->Checked = true;
- this->radioButton1->Location = System::Drawing::Point( 16, 24 );
- this->radioButton1->Name = "radioButton1";
- this->radioButton1->TabIndex = 0;
- this->radioButton1->TabStop = true;
- this->radioButton1->Text = "CSharp";
- this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged );
-
- //
- // radioButton2
- //
- this->radioButton2->Location = System::Drawing::Point( 144, 24 );
- this->radioButton2->Name = "radioButton2";
- this->radioButton2->TabIndex = 1;
- this->radioButton2->Text = "Visual Basic";
- this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged );
-
- //
- // radioButton3
- //
- this->radioButton3->Location = System::Drawing::Point( 272, 24 );
- this->radioButton3->Name = "radioButton3";
- this->radioButton3->TabIndex = 2;
- this->radioButton3->Text = "JScript";
- this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged );
-
- //
- // Form1
- //
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 714, 367 );
- array^temp3 = {this->groupBox1,this->button2,this->button1,this->textBox1};
- this->Controls->AddRange( temp3 );
- this->Name = "Form1";
- this->Text = "CodeDOM Samples Framework";
- this->groupBox1->ResumeLayout( false );
- this->ResumeLayout( false );
- }
-
- void ShowCode()
- {
- this->textBox1->Text = "";
- }
-
- // Show code button
- void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- ShowCode();
- }
-
- // Generate and show code button
- void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- OutputGraph();
- }
-
- // Csharp language selection button
- void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = true;
- radioButton2->Checked = false;
- radioButton3->Checked = false;
- language = 1;
- }
-
- // Visual Basic language selection button
- void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = false;
- radioButton2->Checked = true;
- radioButton3->Checked = false;
- language = 2;
- }
-
- // JScript language selection button
- void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = false;
- radioButton2->Checked = false;
- radioButton3->Checked = true;
- language = 3;
- }
-};
-
-[STAThread]
-int main()
-{
- Application::Run( gcnew Form1 );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp
deleted file mode 100644
index a94dc0b0c36..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-//
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Drawing;
-using namespace System::Collections;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-using namespace System::Data;
-using namespace System::IO;
-using namespace Microsoft::CSharp;
-using namespace Microsoft::VisualBasic;
-using namespace Microsoft::JScript;
-
-///
-/// Provides a wrapper for CodeDOM samples.
-///
-public ref class Form1: public System::Windows::Forms::Form
-{
-private:
- System::CodeDom::CodeCompileUnit^ cu;
- System::Windows::Forms::TextBox^ textBox1;
- System::Windows::Forms::Button^ button1;
- System::Windows::Forms::Button^ button2;
- System::Windows::Forms::GroupBox^ groupBox1;
- System::Windows::Forms::RadioButton^ radioButton1;
- System::Windows::Forms::RadioButton^ radioButton2;
- System::Windows::Forms::RadioButton^ radioButton3;
- int language;
- System::ComponentModel::Container^ components;
-
-public:
- Form1()
- {
- language = 1; // 1 = Csharp 2 = VB 3 = JScript
- components = nullptr;
- InitializeComponent();
- cu = CreateGraph();
- }
-
- //
- CodeCompileUnit^ CreateGraph()
- {
- // Create a compile unit to contain a CodeDOM graph
- CodeCompileUnit^ cu = gcnew CodeCompileUnit;
-
- // Create a namespace named "TestSpace"
- CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" );
-
- // Create a new type named "TestClass"
- CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" );
-
- // Create a new entry point method
- CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod;
-
- // Declare a variable of type Int32 named "i"
- CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32","i" );
-
- // Add the variable declaration statement to the entry point method
- cm->Statements->Add( cv1 );
-
- //
- // Assigns the value of the 10 to the integer variable "i".
- CodeAssignStatement^ as1 = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "i" ),gcnew CodePrimitiveExpression( 10 ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // i=10;
- //
- // Add the assignment statement to the entry point method
- cm->Statements->Add( as1 );
-
- // Add the entry point method to the "TestClass" type
- cd->Members->Add( cm );
-
- // Add the "TestClass" type to the namespace
- cn->Types->Add( cd );
-
- // Add the "TestSpace" namespace to the compile unit
- cu->Namespaces->Add( cn );
- return cu;
- }
- //
-
-private:
- void OutputGraph()
- {
- // Create string writer to output to textbox
- StringWriter^ sw = gcnew StringWriter;
-
- // Create appropriate CodeProvider
- System::CodeDom::Compiler::CodeDomProvider^ cp;
- switch ( language )
- {
- case 2:
- // VB
- cp = CodeDomProvider::CreateProvider("VisualBasic");
- break;
-
- case 3:
- // JScript
- cp = CodeDomProvider::CreateProvider("JScript");
- break;
-
- default:
- // CSharp
- cp = CodeDomProvider::CreateProvider("CSharp");
- break;
- }
-
- // Create a code generator that will output to the string writer
- ICodeGenerator^ cg = cp->CreateGenerator( sw );
-
- // Generate code from the compile unit and outputs it to the string writer
- cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions );
-
- // Output the contents of the string writer to the textbox
- this->textBox1->Text = sw->ToString();
- }
-
-public:
- ~Form1()
- {
- if ( components != nullptr )
- {
- delete components;
- }
- }
-
-private:
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- void InitializeComponent()
- {
- this->textBox1 = gcnew System::Windows::Forms::TextBox;
- this->button1 = gcnew System::Windows::Forms::Button;
- this->button2 = gcnew System::Windows::Forms::Button;
- this->groupBox1 = gcnew System::Windows::Forms::GroupBox;
- this->radioButton1 = gcnew System::Windows::Forms::RadioButton;
- this->radioButton2 = gcnew System::Windows::Forms::RadioButton;
- this->radioButton3 = gcnew System::Windows::Forms::RadioButton;
- this->groupBox1->SuspendLayout();
- this->SuspendLayout();
-
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point( 16, 112 );
- this->textBox1->Multiline = true;
- this->textBox1->Name = "textBox1";
- this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both;
- this->textBox1->Size = System::Drawing::Size( 664, 248 );
- this->textBox1->TabIndex = 0;
- this->textBox1->Text = "";
- this->textBox1->WordWrap = false;
-
- //
- // button1
- //
- this->button1->BackColor = System::Drawing::Color::Aquamarine;
- this->button1->Location = System::Drawing::Point( 16, 16 );
- this->button1->Name = "button1";
- this->button1->TabIndex = 1;
- this->button1->Text = "Generate";
- this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
-
- //
- // button2
- //
- this->button2->BackColor = System::Drawing::Color::MediumTurquoise;
- this->button2->Location = System::Drawing::Point( 112, 16 );
- this->button2->Name = "button2";
- this->button2->TabIndex = 2;
- this->button2->Text = "Show Code";
- this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click );
-
- //
- // groupBox1
- //
- array^temp0 = {this->radioButton3,this->radioButton2,this->radioButton1};
- this->groupBox1->Controls->AddRange( temp0 );
- this->groupBox1->Location = System::Drawing::Point( 16, 48 );
- this->groupBox1->Name = "groupBox1";
- this->groupBox1->Size = System::Drawing::Size( 384, 56 );
- this->groupBox1->TabIndex = 3;
- this->groupBox1->TabStop = false;
- this->groupBox1->Text = "Language selection";
-
- //
- // radioButton1
- //
- this->radioButton1->Checked = true;
- this->radioButton1->Location = System::Drawing::Point( 16, 24 );
- this->radioButton1->Name = "radioButton1";
- this->radioButton1->TabIndex = 0;
- this->radioButton1->TabStop = true;
- this->radioButton1->Text = "CSharp";
- this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged );
-
- //
- // radioButton2
- //
- this->radioButton2->Location = System::Drawing::Point( 144, 24 );
- this->radioButton2->Name = "radioButton2";
- this->radioButton2->TabIndex = 1;
- this->radioButton2->Text = "Visual Basic";
- this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged );
-
- //
- // radioButton3
- //
- this->radioButton3->Location = System::Drawing::Point( 272, 24 );
- this->radioButton3->Name = "radioButton3";
- this->radioButton3->TabIndex = 2;
- this->radioButton3->Text = "JScript";
- this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged );
-
- //
- // Form1
- //
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 714, 367 );
- array^temp1 = {this->groupBox1,this->button2,this->button1,this->textBox1};
- this->Controls->AddRange( temp1 );
- this->Name = "Form1";
- this->Text = "CodeDOM Samples Framework";
- this->groupBox1->ResumeLayout( false );
- this->ResumeLayout( false );
- }
-
- void ShowCode()
- {
- this->textBox1->Text = "";
- }
-
- // Show code button
- void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- ShowCode();
- }
-
- // Generate and show code button
- void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- OutputGraph();
- }
-
- // Csharp language selection button
- void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = true;
- radioButton2->Checked = false;
- radioButton3->Checked = false;
- language = 1;
- }
-
- // Visual Basic language selection button
- void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = false;
- radioButton2->Checked = true;
- radioButton3->Checked = false;
- language = 2;
- }
-
- // JScript language selection button
- void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- radioButton1->Checked = false;
- radioButton2->Checked = false;
- radioButton3->Checked = true;
- language = 3;
- }
-};
-
-[STAThread]
-int main()
-{
- Application::Run( gcnew Form1 );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp
deleted file mode 100644
index bf0e69c601b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeAttachEventStatementExample
- {
- public:
- CodeAttachEventStatementExample()
- {
-
- //
- // Declares a type to contain the delegate and constructor method.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "AttachEventTest" );
-
- // Declares an event that needs no custom event arguments class.
- CodeMemberEvent^ event1 = gcnew CodeMemberEvent;
- event1->Name = "TestEvent";
- event1->Type = gcnew CodeTypeReference( "System.EventHandler" );
-
- // Adds the event to the type members.
- type1->Members->Add( event1 );
-
- // Declares a method that matches the System.EventHandler method signature.
- CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
- method1->Name = "TestMethod";
- method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) );
- method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) );
-
- // Adds the method to the type members.
- type1->Members->Add( method1 );
-
- // Defines a constructor that attaches a TestDelegate delegate pointing to
- // the TestMethod method to the TestEvent event.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
-
- //
- // Defines a delegate creation expression that creates an EventHandler delegate pointing to a method named TestMethod.
- CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "System.EventHandler" ),gcnew CodeThisReferenceExpression,"TestMethod" );
-
- // Attaches an EventHandler delegate pointing to TestMethod to the TestEvent event.
- CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestEvent += new System.EventHandler(this.TestMethod);
- //
- // Adds the constructor statements to the construtor.
- constructor1->Statements->Add( attachStatement1 );
-
- // Adds the construtor to the type members.
- type1->Members->Add( constructor1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class AttachEventTest
- // {
- //
- // public AttachEventTest()
- // {
- // this.TestEvent += new System.EventHandler(this.TestMethod);
- // }
- //
- // private event System.EventHandler TestEvent;
- //
- // private void TestMethod(object sender, System.EventArgs e)
- // {
- // }
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp
deleted file mode 100644
index 0e04788981c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-namespace CodeAttributeArgumentCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
-
- // CodeAttributeArgumentCollection
- void CodeAttributeArgumentCollectionExample()
- {
-
- //
- //
- // Creates an empty CodeAttributeArgumentCollection.
- CodeAttributeArgumentCollection^ collection = gcnew CodeAttributeArgumentCollection;
- //
-
- //
- // Adds a CodeAttributeArgument to the collection.
- collection->Add( gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ) );
- //
-
- //
- // Adds an array of CodeAttributeArgument objects to the collection.
- array^arguments = {gcnew CodeAttributeArgument,gcnew CodeAttributeArgument};
- collection->AddRange( arguments );
-
- // Adds a collection of CodeAttributeArgument objects to
- // the collection.
- CodeAttributeArgumentCollection^ argumentsCollection = gcnew CodeAttributeArgumentCollection;
- argumentsCollection->Add( gcnew CodeAttributeArgument( "TestBooleanArgument",gcnew CodePrimitiveExpression( true ) ) );
- argumentsCollection->Add( gcnew CodeAttributeArgument( "TestIntArgument",gcnew CodePrimitiveExpression( 1 ) ) );
- collection->AddRange( argumentsCollection );
- //
-
- //
- // Tests for the presence of a CodeAttributeArgument
- // within the collection, and retrieves its index if it is found.
- CodeAttributeArgument^ testArgument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) );
- int itemIndex = -1;
- if ( collection->Contains( testArgument ) )
- itemIndex = collection->IndexOf( testArgument );
- //
-
- //
- // Copies the contents of the collection beginning at index 0,
- // to the specified CodeAttributeArgument array.
- // 'arguments' is a CodeAttributeArgument array.
- collection->CopyTo( arguments, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeAttributeArgument at index 0 of the collection.
- collection->Insert( 0, gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ) );
- //
-
- //
- // Removes the specified CodeAttributeArgument from the collection.
- CodeAttributeArgument^ argument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) );
- collection->Remove( argument );
- //
-
- //
- // Removes the CodeAttributeArgument at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp
deleted file mode 100644
index cfcbb80230e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Collections;
-
-namespace CodeAttributeDeclarationCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeAttributeDeclarationCollection
- void CodeAttributeDeclarationCollectionExample()
- {
-
- //
- //
- // Creates an empty CodeAttributeDeclarationCollection.
- CodeAttributeDeclarationCollection^ collection = gcnew CodeAttributeDeclarationCollection;
- //
-
- //
- // Adds a CodeAttributeDeclaration to the collection.
- array^temp = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
- collection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp ) );
- //
-
- //
- // Adds an array of CodeAttributeDeclaration objects
- // to the collection.
- array^declarations = {gcnew CodeAttributeDeclaration,gcnew CodeAttributeDeclaration};
- collection->AddRange( declarations );
-
- // Adds a collection of CodeAttributeDeclaration objects
- // to the collection.
- CodeAttributeDeclarationCollection^ declarationsCollection = gcnew CodeAttributeDeclarationCollection;
- array^temp1 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
- declarationsCollection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp1 ) );
- array^temp2 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( true ) )};
- declarationsCollection->Add( gcnew CodeAttributeDeclaration( "BrowsableAttribute",temp2 ) );
- collection->AddRange( declarationsCollection );
- //
-
- //
- // Tests for the presence of a CodeAttributeDeclaration in
- // the collection, and retrieves its index if it is found.
- array^temp3 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
- CodeAttributeDeclaration^ testdeclaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp3 );
- int itemIndex = -1;
- if ( collection->Contains( testdeclaration ) )
- itemIndex = collection->IndexOf( testdeclaration );
- //
-
- //
- // Copies the contents of the collection, beginning at index 0,
- // to the specified CodeAttributeDeclaration array.
- // 'declarations' is a CodeAttributeDeclaration array.
- collection->CopyTo( declarations, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeAttributeDeclaration at index 0 of the collection.
- array^temp4 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
- collection->Insert( 0, gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp4 ) );
- //
-
- //
- // Removes the specified CodeAttributeDeclaration from
- // the collection.
- array^temp5 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
- CodeAttributeDeclaration^ declaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp5 );
- collection->Remove( declaration );
- //
-
- //
- // Removes the CodeAttributeDeclaration at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp
deleted file mode 100644
index 636d5881825..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-public ref class CodeBaseReferenceExpressionExample
-{
-public:
- CodeBaseReferenceExpressionExample()
- {
-
- //
- // Example method invoke expression uses CodeBaseReferenceExpression to produce
- // a base.Dispose method call
- CodeMethodInvokeExpression^ methodInvokeExpression =
- gcnew CodeMethodInvokeExpression( // Creates a method invoke expression
- gcnew CodeBaseReferenceExpression, // targetObjectparameter can be a base class reference
- "Dispose",gcnew array{} ); // Method name and method parameter arguments
-
- // A C# code generator produces the following source code for the preceeding example code:
- // base.Dispose();
- //
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp
deleted file mode 100644
index 5acadb676c2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeBinaryOperatorExpressionExample
- {
- public:
- CodeBinaryOperatorExpressionExample()
- {
-
- //
- // This CodeBinaryOperatorExpression represents the addition of 1 and 2.
-
- // Right operand.
- CodeBinaryOperatorExpression^ addMethod = gcnew CodeBinaryOperatorExpression( gcnew CodePrimitiveExpression( 1 ),CodeBinaryOperatorType::Add,gcnew CodePrimitiveExpression( 2 ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // (1 + 2)
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp
deleted file mode 100644
index 6bcd05541f1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeCastExpressionExample
- {
- public:
- CodeCastExpressionExample()
- {
-
- //
- // This CodeCastExpression casts an Int32 of 1000 to an Int64.
-
- // targetType parameter indicating the target type of the cast.
- // The CodeExpression to cast, here an Int32 value of 1000.
- CodeCastExpression^ castExpression = gcnew CodeCastExpression( "System.Int64",gcnew CodePrimitiveExpression( 1000 ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // ((long)(1000));
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp
deleted file mode 100644
index b1f1d3cb90e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-namespace CodeCatchClauseCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeCatchClauseCollection
- void CodeCatchClauseCollectionExample()
- {
- //
- //
- // Creates an empty CodeCatchClauseCollection.
- CodeCatchClauseCollection^ collection = gcnew CodeCatchClauseCollection;
- //
-
- //
- // Adds a CodeCatchClause to the collection.
- collection->Add( gcnew CodeCatchClause( "e" ) );
- //
-
- //
- // Adds an array of CodeCatchClause objects to the collection.
- array^clauses = {gcnew CodeCatchClause,gcnew CodeCatchClause};
- collection->AddRange( clauses );
-
- // Adds a collection of CodeCatchClause objects to the collection.
- CodeCatchClauseCollection^ clausesCollection = gcnew CodeCatchClauseCollection;
- clausesCollection->Add( gcnew CodeCatchClause( "e",gcnew CodeTypeReference( System::ArgumentOutOfRangeException::typeid ) ) );
- clausesCollection->Add( gcnew CodeCatchClause( "e" ) );
- collection->AddRange( clausesCollection );
- //
-
- //
- // Tests for the presence of a CodeCatchClause in the
- // collection, and retrieves its index if it is found.
- CodeCatchClause^ testClause = gcnew CodeCatchClause( "e" );
- int itemIndex = -1;
- if ( collection->Contains( testClause ) )
- itemIndex = collection->IndexOf( testClause );
- //
-
- //
- // Copies the contents of the collection beginning at index 0 to the specified CodeCatchClause array.
- // 'clauses' is a CodeCatchClause array.
- collection->CopyTo( clauses, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeCatchClause at index 0 of the collection.
- collection->Insert( 0, gcnew CodeCatchClause( "e" ) );
- //
-
- //
- // Removes the specified CodeCatchClause from the collection.
- CodeCatchClause^ clause = gcnew CodeCatchClause( "e" );
- collection->Remove( clause );
- //
-
- //
- // Removes the CodeCatchClause at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp
deleted file mode 100644
index f4f7099d6a3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeCommentExample
- {
- public:
- CodeCommentExample()
- {
-
- //
- // Create a CodeComment with some example comment text.
-
- // The text of the comment.
- // Whether the comment is a comment intended for documentation purposes.
- CodeComment^ comment = gcnew CodeComment( "This comment was generated from a System.CodeDom.CodeComment",false );
-
- // Create a CodeCommentStatement that contains the comment, in order
- // to add the comment to a CodeTypeDeclaration Members collection.
- CodeCommentStatement^ commentStatement = gcnew CodeCommentStatement( comment );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // // This comment was generated from a System.CodeDom.CodeComment
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp
deleted file mode 100644
index c779ba5e491..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-namespace CodeCommentStatementCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeCommentStatementCollection
- void CodeCommentStatementCollectionExample()
- {
-
- //
- //
- // Creates an empty CodeCommentStatementCollection.
- CodeCommentStatementCollection^ collection = gcnew CodeCommentStatementCollection;
- //
-
- //
- // Adds a CodeCommentStatement to the collection.
- collection->Add( gcnew CodeCommentStatement( "Test comment" ) );
- //
-
- //
- // Adds an array of CodeCommentStatement objects to the collection.
- array^comments = {gcnew CodeCommentStatement( "Test comment" ),gcnew CodeCommentStatement( "Another test comment" )};
- collection->AddRange( comments );
-
- // Adds a collection of CodeCommentStatement objects to the collection.
- CodeCommentStatementCollection^ commentsCollection = gcnew CodeCommentStatementCollection;
- commentsCollection->Add( gcnew CodeCommentStatement( "Test comment" ) );
- commentsCollection->Add( gcnew CodeCommentStatement( "Another test comment" ) );
- collection->AddRange( commentsCollection );
- //
-
- //
- // Tests for the presence of a CodeCommentStatement in the
- // collection, and retrieves its index if it is found.
- CodeCommentStatement^ testComment = gcnew CodeCommentStatement( "Test comment" );
- int itemIndex = -1;
- if ( collection->Contains( testComment ) )
- itemIndex = collection->IndexOf( testComment );
- //
-
- //
- // Copies the contents of the collection, beginning at index 0,
- // to the specified CodeCommentStatement array.
- // 'comments' is a CodeCommentStatement array.
- collection->CopyTo( comments, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeCommentStatement at index 0 of the collection.
- collection->Insert( 0, gcnew CodeCommentStatement( "Test comment" ) );
- //
-
- //
- // Removes the specified CodeCommentStatement from the collection.
- CodeCommentStatement^ comment = gcnew CodeCommentStatement( "Test comment" );
- collection->Remove( comment );
- //
-
- //
- // Removes the CodeCommentStatement at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp
deleted file mode 100644
index 9209d6fd754..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeConditionStatementExample
- {
- public:
- CodeConditionStatementExample()
- {
-
- //
- // Create a CodeConditionStatement that tests a boolean value named boolean.
- array^temp0 = {gcnew CodeCommentStatement( "If condition is true, execute these statements." )};
- array^temp1 = {gcnew CodeCommentStatement( "Else block. If condition is false, execute these statements." )};
-
- // The statements to execute if the condition evalues to false.
- CodeConditionStatement^ conditionalStatement = gcnew CodeConditionStatement( gcnew CodeVariableReferenceExpression( "boolean" ),temp0,temp1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // if (boolean)
- // {
- // // If condition is true, execute these statements.
- // }
- // else {
- // // Else block. If condition is false, execute these statements.
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp
deleted file mode 100644
index f222b742baf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::Reflection;
-
-namespace CodeDomSamples
-{
- public ref class CodeConstructorExample
- {
- public:
- CodeConstructorExample()
- {
-
- //
- // This example declares two types, one of which inherits from another,
- // and creates a set of different styles of constructors using CodeConstructor.
- // Creates a new CodeCompileUnit to contain the program graph.
- CodeCompileUnit^ CompileUnit = gcnew CodeCompileUnit;
-
- // Declares a new namespace object and names it.
- CodeNamespace^ Samples = gcnew CodeNamespace( "Samples" );
-
- // Adds the namespace object to the compile unit.
- CompileUnit->Namespaces->Add( Samples );
-
- // Adds a new namespace import for the System namespace.
- Samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) );
-
- // Declares a new type and names it.
- CodeTypeDeclaration^ BaseType = gcnew CodeTypeDeclaration( "BaseType" );
-
- // Adds the new type to the namespace object's type collection.
- Samples->Types->Add( BaseType );
-
- // Declares a default constructor that takes no arguments.
- CodeConstructor^ defaultConstructor = gcnew CodeConstructor;
- defaultConstructor->Attributes = MemberAttributes::Public;
-
- // Adds the constructor to the Members collection of the BaseType.
- BaseType->Members->Add( defaultConstructor );
-
- // Declares a constructor that takes a string argument.
- CodeConstructor^ stringConstructor = gcnew CodeConstructor;
- stringConstructor->Attributes = MemberAttributes::Public;
-
- // Declares a parameter of type string named "TestStringParameter".
- stringConstructor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","TestStringParameter" ) );
-
- // Adds the constructor to the Members collection of the BaseType.
- BaseType->Members->Add( stringConstructor );
-
- // Declares a type that derives from BaseType and names it.
- CodeTypeDeclaration^ DerivedType = gcnew CodeTypeDeclaration( "DerivedType" );
-
- // The DerivedType class inherits from the BaseType class.
- DerivedType->BaseTypes->Add( gcnew CodeTypeReference( "BaseType" ) );
-
- // Adds the new type to the namespace object's type collection.
- Samples->Types->Add( DerivedType );
-
- // Declare a constructor that takes a string argument and calls the base class constructor with it.
- CodeConstructor^ baseStringConstructor = gcnew CodeConstructor;
- baseStringConstructor->Attributes = MemberAttributes::Public;
-
- // Declares a parameter of type string named "TestStringParameter".
- baseStringConstructor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","TestStringParameter" ) );
-
- // Calls a base class constructor with the TestStringParameter parameter.
- baseStringConstructor->BaseConstructorArgs->Add( gcnew CodeVariableReferenceExpression( "TestStringParameter" ) );
-
- // Adds the constructor to the Members collection of the DerivedType.
- DerivedType->Members->Add( baseStringConstructor );
-
- // Declares a constructor overload that calls another constructor for the type with a predefined argument.
- CodeConstructor^ overloadConstructor = gcnew CodeConstructor;
- overloadConstructor->Attributes = MemberAttributes::Public;
-
- // Sets the argument to pass to a base constructor method.
- overloadConstructor->ChainedConstructorArgs->Add( gcnew CodePrimitiveExpression( "Test" ) );
-
- // Adds the constructor to the Members collection of the DerivedType.
- DerivedType->Members->Add( overloadConstructor );
-
- // Declares a constructor overload that calls the default constructor for the type.
- CodeConstructor^ overloadConstructor2 = gcnew CodeConstructor;
- overloadConstructor2->Attributes = MemberAttributes::Public;
- overloadConstructor2->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Int32","TestIntParameter" ) );
-
- // Sets the argument to pass to a base constructor method.
- overloadConstructor2->ChainedConstructorArgs->Add( gcnew CodeSnippetExpression( "" ) );
-
- // Adds the constructor to the Members collection of the DerivedType.
- DerivedType->Members->Add( overloadConstructor2 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class BaseType {
- //
- // public BaseType() {
- // }
- //
- // public BaseType(string TestStringParameter) {
- // }
- // }
- //
- // public class DerivedType : BaseType {
- //
- // public DerivedType(string TestStringParameter) :
- // base(TestStringParameter) {
- // }
- //
- // public DerivedType() :
- // this("Test") {
- // }
- //
- // public DerivedType(int TestIntParameter) :
- // this() {
- // }
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp
deleted file mode 100644
index 7e7167c2f2c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeDelegateInvokeExpressionExample
- {
- public:
- CodeDelegateInvokeExpressionExample()
- {
-
- //
- // Declares a type to contain the delegate and constructor method.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "DelegateInvokeTest" );
-
- // Declares an event that accepts a custom delegate type of "TestDelegate".
- CodeMemberEvent^ event1 = gcnew CodeMemberEvent;
- event1->Name = "TestEvent";
- event1->Type = gcnew CodeTypeReference( "DelegateInvokeTest.TestDelegate" );
- type1->Members->Add( event1 );
-
- // Declares a delegate type called TestDelegate with an EventArgs parameter.
- CodeTypeDelegate^ delegate1 = gcnew CodeTypeDelegate( "TestDelegate" );
- delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) );
- delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) );
- type1->Members->Add( delegate1 );
-
- // Declares a method that matches the "TestDelegate" method signature.
- CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
- method1->Name = "TestMethod";
- method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) );
- method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) );
- type1->Members->Add( method1 );
-
- // Defines a constructor that attaches a TestDelegate delegate pointing to the TestMethod method
- // to the TestEvent event.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- constructor1->Statements->Add( gcnew CodeCommentStatement( "Attaches a delegate to the TestEvent event." ) );
-
- // Creates and attaches a delegate to the TestEvent.
- CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "DelegateInvokeTest.TestDelegate" ),gcnew CodeThisReferenceExpression,"TestMethod" );
- CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 );
- constructor1->Statements->Add( attachStatement1 );
- constructor1->Statements->Add( gcnew CodeCommentStatement( "Invokes the TestEvent event." ) );
-
- // Invokes the TestEvent.
- array^temp0 = {gcnew CodeThisReferenceExpression,gcnew CodeObjectCreateExpression( "System.EventArgs", nullptr )};
- CodeDelegateInvokeExpression^ invoke1 = gcnew CodeDelegateInvokeExpression( gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ),temp0 );
- constructor1->Statements->Add( invoke1 );
- type1->Members->Add( constructor1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class DelegateInvokeTest
- // {
- //
- // public DelegateInvokeTest()
- // {
- // // Attaches a delegate to the TestEvent event.
- // this.TestEvent += new DelegateInvokeTest.TestDelegate(this.TestMethod);
- // // Invokes the TestEvent event.
- // this.TestEvent(this, new System.EventArgs());
- // }
- //
- // private event DelegateInvokeTest.TestDelegate TestEvent;
- //
- // private void TestMethod(object sender, System.EventArgs e)
- // {
- // }
- //
- // public delegate void TestDelegate(object sender, System.EventArgs e);
- // }
- //
- }
-
- void DelegateInvokeOnlyType()
- {
-
- //
- // Invokes the delegates for an event named TestEvent, passing a local object reference and a new System.EventArgs.
- array^temp1 = {gcnew CodeThisReferenceExpression,gcnew CodeObjectCreateExpression( "System.EventArgs", nullptr )};
- CodeDelegateInvokeExpression^ invoke1 = gcnew CodeDelegateInvokeExpression( gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ),temp1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestEvent(this, new System.EventArgs());
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp
deleted file mode 100644
index 2f548be0a78..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
-// CodeDOMExample_CPP.cpp : main project file.
-
-#include "stdafx.h"
-
-using namespace System;
-
-int main(array ^args)
-{
- Console::WriteLine(L"Hello World");
- return 0;
-}
-*/
-
-//
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Collections;
-using namespace System::ComponentModel;
-using namespace System::Diagnostics;
-using namespace System::Drawing;
-using namespace System::IO;
-using namespace System::Windows::Forms;
-using namespace Microsoft::CSharp;
-using namespace Microsoft::VisualBasic;
-using namespace Microsoft::JScript;
-using namespace System::Security::Permissions;
-
-// This example demonstrates building a Hello World program graph
-// using System.CodeDom elements. It calls code generator and
-// code compiler methods to build the program using CSharp, VB, or
-// JScript. A Windows Forms interface is included. Note: Code
-// must be compiled and linked with the Microsoft.JScript assembly.
-namespace CodeDOMExample
-{
- [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
- public ref class CodeDomExample
- {
- public:
- //
- // Build a Hello World program graph using
- // System::CodeDom types.
- static CodeCompileUnit^ BuildHelloWorldGraph()
- {
- // Create a new CodeCompileUnit to contain
- // the program graph.
- CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit;
-
- // Declare a new namespace called Samples.
- CodeNamespace^ samples = gcnew CodeNamespace( "Samples" );
-
- // Add the new namespace to the compile unit.
- compileUnit->Namespaces->Add( samples );
-
- // Add the new namespace import for the System namespace.
- samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) );
-
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration( "Class1" );
-
- // Add the new type to the namespace's type collection.
- samples->Types->Add( class1 );
-
- // Declare a new code entry point method.
- CodeEntryPointMethod^ start = gcnew CodeEntryPointMethod;
-
- // Create a type reference for the System::Console class.
- CodeTypeReferenceExpression^ csSystemConsoleType = gcnew CodeTypeReferenceExpression( "System.Console" );
-
- // Build a Console::WriteLine statement.
- CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew CodePrimitiveExpression("Hello World!") );
-
- // Add the WriteLine call to the statement collection.
- start->Statements->Add( cs1 );
-
- // Build another Console::WriteLine statement.
- CodeMethodInvokeExpression^ cs2 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) );
-
- // Add the WriteLine call to the statement collection.
- start->Statements->Add( cs2 );
-
- // Build a call to System::Console::ReadLine.
- CodeMethodReferenceExpression^ csReadLine = gcnew CodeMethodReferenceExpression( csSystemConsoleType, "ReadLine" );
- CodeMethodInvokeExpression^ cs3 = gcnew CodeMethodInvokeExpression( csReadLine, gcnew array(0) );
-
- // Add the ReadLine statement.
- start->Statements->Add( cs3 );
-
- // Add the code entry point method to
- // the Members collection of the type.
- class1->Members->Add( start );
- return compileUnit;
- }
- //
-
- //
- static void GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileunit )
- {
- // Build the source file name with the appropriate
- // language extension.
- String^ sourceFile;
- if ( provider->FileExtension->StartsWith( "." ) )
- {
- sourceFile = String::Concat( "TestGraph", provider->FileExtension );
- }
- else
- {
- sourceFile = String::Concat( "TestGraph.", provider->FileExtension );
- }
-
- // Create an IndentedTextWriter, constructed with
- // a StreamWriter to the source file.
- IndentedTextWriter^ tw = gcnew IndentedTextWriter( gcnew StreamWriter( sourceFile,false )," " );
-
- // Generate source code using the code generator.
- provider->GenerateCodeFromCompileUnit( compileunit, tw, gcnew CodeGeneratorOptions );
-
- // Close the output file.
- tw->Close();
- }
- //
-
- //
- static CompilerResults^ CompileCode( CodeDomProvider^ provider, String^ sourceFile, String^ exeFile )
- {
- // Configure a CompilerParameters that links System.dll
- // and produces the specified executable file.
- array^referenceAssemblies = {"System.dll"};
- CompilerParameters^ cp = gcnew CompilerParameters( referenceAssemblies,exeFile,false );
-
- // Generate an executable rather than a DLL file.
- cp->GenerateExecutable = true;
-
- // Invoke compilation.
- CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile );
-
- // Return the results of compilation.
- return cr;
- }
- //
- };
-
- public ref class CodeDomExampleForm: public System::Windows::Forms::Form
- {
- private:
- static System::Windows::Forms::Button^ run_button = gcnew System::Windows::Forms::Button;
- static System::Windows::Forms::Button^ compile_button = gcnew System::Windows::Forms::Button;
- static System::Windows::Forms::Button^ generate_button = gcnew System::Windows::Forms::Button;
- static System::Windows::Forms::TextBox^ textBox1 = gcnew System::Windows::Forms::TextBox;
- static System::Windows::Forms::ComboBox^ comboBox1 = gcnew System::Windows::Forms::ComboBox;
- static System::Windows::Forms::Label^ label1 = gcnew System::Windows::Forms::Label;
- void generate_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- CodeDomProvider^ provider = GetCurrentProvider();
- CodeDomExample::GenerateCode( provider, CodeDomExample::BuildHelloWorldGraph() );
-
- // Build the source file name with the appropriate
- // language extension.
- String^ sourceFile;
- if ( provider->FileExtension->StartsWith( "." ) )
- {
- sourceFile = String::Concat( "TestGraph", provider->FileExtension );
- }
- else
- {
- sourceFile = String::Concat( "TestGraph.", provider->FileExtension );
- }
-
-
- // Read in the generated source file and
- // display the source text.
- StreamReader^ sr = gcnew StreamReader( sourceFile );
- textBox1->Text = sr->ReadToEnd();
- sr->Close();
- }
-
- CodeDomProvider^ GetCurrentProvider()
- {
- CodeDomProvider^ provider;
- if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "CSharp" ) == 0 )
- provider = CodeDomProvider::CreateProvider("CSharp");
- else
- if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "Visual Basic" ) == 0 )
- provider = CodeDomProvider::CreateProvider("VisualBasic");
- else
- if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "JScript" ) == 0 )
- provider = CodeDomProvider::CreateProvider("JScript");
- else
- provider = CodeDomProvider::CreateProvider("CSharp");
-
- return provider;
- }
-
- void compile_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- CodeDomProvider^ provider = GetCurrentProvider();
-
- // Build the source file name with the appropriate
- // language extension.
- String^ sourceFile = String::Concat( "TestGraph.", provider->FileExtension );
-
- // Compile the source file into an executable output file.
- CompilerResults^ cr = CodeDomExample::CompileCode( provider, sourceFile, "TestGraph.exe" );
- if ( cr->Errors->Count > 0 )
- {
- // Display compilation errors.
- textBox1->Text = String::Concat( "Errors encountered while building ", sourceFile, " into ", cr->PathToAssembly, ": \r\n\n" );
- System::CodeDom::Compiler::CompilerError^ ce;
- for ( int i = 0; i < cr->Errors->Count; i++ )
- {
- ce = cr->Errors[i];
- textBox1->AppendText( String::Concat( ce->ToString(), "\r\n" ) );
-
- }
- run_button->Enabled = false;
- }
- else
- {
- textBox1->Text = String::Concat( "Source ", sourceFile, " built into ", cr->PathToAssembly, " with no errors." );
- run_button->Enabled = true;
- }
- }
-
- void run_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- Process::Start( "TestGraph.exe" );
- }
-
- public:
- CodeDomExampleForm()
- {
- this->SuspendLayout();
-
- // Set properties for label1.
- this->label1->Location = System::Drawing::Point( 395, 20 );
- this->label1->Size = System::Drawing::Size( 180, 22 );
- this->label1->Text = "Select a programming language:";
-
- // Set properties for comboBox1.
- this->comboBox1->Location = System::Drawing::Point( 560, 16 );
- this->comboBox1->Size = System::Drawing::Size( 190, 23 );
- this->comboBox1->Name = "comboBox1";
- array^temp1 = {"CSharp","Visual Basic","JScript"};
- this->comboBox1->Items->AddRange( temp1 );
- this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right | System::Windows::Forms::AnchorStyles::Top);
- this->comboBox1->SelectedIndex = 0;
-
- // Set properties for generate_button.
- this->generate_button->Location = System::Drawing::Point( 8, 16 );
- this->generate_button->Name = "generate_button";
- this->generate_button->Size = System::Drawing::Size( 120, 23 );
- this->generate_button->Text = "Generate Code";
- this->generate_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::generate_button_Click );
-
- // Set properties for compile_button.
- this->compile_button->Location = System::Drawing::Point( 136, 16 );
- this->compile_button->Name = "compile_button";
- this->compile_button->Size = System::Drawing::Size( 120, 23 );
- this->compile_button->Text = "Compile";
- this->compile_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::compile_button_Click );
-
- // Set properties for run_button.
- this->run_button->Enabled = false;
- this->run_button->Location = System::Drawing::Point( 264, 16 );
- this->run_button->Name = "run_button";
- this->run_button->Size = System::Drawing::Size( 120, 23 );
- this->run_button->Text = "Run";
- this->run_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::run_button_Click );
-
- // Set properties for textBox1.
- this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right);
- this->textBox1->Location = System::Drawing::Point( 8, 48 );
- this->textBox1->Multiline = true;
- this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
- this->textBox1->Name = "textBox1";
- this->textBox1->Size = System::Drawing::Size( 744, 280 );
- this->textBox1->Text = "";
-
- // Set properties for the CodeDomExampleForm.
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 768, 340 );
- this->MinimumSize = System::Drawing::Size( 750, 340 );
- array^myControl = {this->textBox1,this->run_button,this->compile_button,this->generate_button,this->comboBox1,this->label1};
- this->Controls->AddRange( myControl );
- this->Name = "CodeDomExampleForm";
- this->Text = "CodeDom Hello World Example";
- this->ResumeLayout( false );
- }
-
- public:
- ~CodeDomExampleForm()
- {
- }
- };
-
-}
-
-[STAThread]
-int main()
-{
- Application::Run( gcnew CodeDOMExample::CodeDomExampleForm );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp
deleted file mode 100644
index 080c30b3d2c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-
-// The following example builds a CodeDom source graph for a simple
-// class that represents document properties. The source for the
-// graph is generated, saved to a file, compiled into an executable,
-// and run.
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Collections;
-using namespace System::ComponentModel;
-using namespace System::IO;
-using namespace System::Diagnostics;
-
-//
-// Build the source graph using System.CodeDom types.
-CodeCompileUnit^ DocumentPropertyGraphBase()
-{
- // Create a new CodeCompileUnit for the source graph.
- CodeCompileUnit^ docPropUnit = gcnew CodeCompileUnit;
-
- // Declare a new namespace called DocumentSamples.
- CodeNamespace^ sampleSpace = gcnew CodeNamespace( "DocumentSamples" );
-
- // Add the new namespace to the compile unit.
- docPropUnit->Namespaces->Add( sampleSpace );
-
- // Add an import statement for the System namespace.
- sampleSpace->Imports->Add( gcnew CodeNamespaceImport( "System" ) );
-
- // Declare a new class called DocumentProperties.
- //
- CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties" );
- baseClass->IsPartial = true;
- baseClass->IsClass = true;
- baseClass->Attributes = MemberAttributes::Public;
- baseClass->BaseTypes->Add( gcnew CodeTypeReference( System::Object::typeid ) );
-
- // Add the DocumentProperties class to the namespace.
- sampleSpace->Types->Add( baseClass );
- //
-
- // ------Build the DocumentProperty.Main method------
- // Declare the Main method of the class.
- CodeEntryPointMethod^ mainMethod = gcnew CodeEntryPointMethod;
- mainMethod->Comments->Add( gcnew CodeCommentStatement( " Perform a simple test of the class methods." ) );
-
- // Add the code entry point method to the Members
- // collection of the type.
- baseClass->Members->Add( mainMethod );
- mainMethod->Statements->Add( gcnew CodeCommentStatement( "Initialize a class instance and display it." ) );
-
- //
- // Initialize a local DocumentProperty instance, named myDoc.
- // Use the DocumentProperty constructor to set the author,
- // title, and date. Set the publish date to DateTime.Now.
- CodePrimitiveExpression^ docTitlePrimitive = gcnew CodePrimitiveExpression( "Cubicle Survival Strategies" );
- CodePrimitiveExpression^ docAuthorPrimitive = gcnew CodePrimitiveExpression( "John Smith" );
-
- // Store the value of DateTime.Now in a local variable, to re-use
- // the same value later.
- CodeTypeReferenceExpression^ docDateClass = gcnew CodeTypeReferenceExpression( "DateTime" );
- CodePropertyReferenceExpression^ docDateNow = gcnew CodePropertyReferenceExpression( docDateClass,"Now" );
- CodeVariableDeclarationStatement^ publishNow = gcnew CodeVariableDeclarationStatement( DateTime::typeid,"publishNow",docDateNow );
- mainMethod->Statements->Add( publishNow );
- CodeVariableReferenceExpression^ publishNowRef = gcnew CodeVariableReferenceExpression( "publishNow" );
- array^ctorParams = {docTitlePrimitive,docAuthorPrimitive,publishNowRef};
- CodeObjectCreateExpression^ initDocConstruct = gcnew CodeObjectCreateExpression( "DocumentProperties",ctorParams );
- CodeVariableDeclarationStatement^ myDocDeclare = gcnew CodeVariableDeclarationStatement( "DocumentProperties","myDoc",initDocConstruct );
- mainMethod->Statements->Add( myDocDeclare );
- //
-
- // Create a variable reference for the myDoc instance.
- CodeVariableReferenceExpression^ myDocInstance = gcnew CodeVariableReferenceExpression( "myDoc" );
-
- // Create a type reference for the System.Console class.
- CodeTypeReferenceExpression^ csSystemConsoleType = gcnew CodeTypeReferenceExpression( "System.Console" );
-
- // Build Console.WriteLine statement.
- CodeMethodInvokeExpression^ consoleWriteLine0 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "** Document properties test **" ) );
-
- // Add the WriteLine call to the statement collection.
- mainMethod->Statements->Add( consoleWriteLine0 );
-
- // Build Console.WriteLine("First document:").
- CodeMethodInvokeExpression^ consoleWriteLine1 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "First document:" ) );
-
- // Add the WriteLine call to the statement collection.
- mainMethod->Statements->Add( consoleWriteLine1 );
-
- // Add a statement to display the myDoc instance properties.
- CodeMethodInvokeExpression^ myDocToString = gcnew CodeMethodInvokeExpression( myDocInstance,"ToString" );
- CodeMethodInvokeExpression^ consoleWriteLine2 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",myDocToString );
- mainMethod->Statements->Add( consoleWriteLine2 );
-
- // Add a statement to display the myDoc instance hashcode property.
- CodeMethodInvokeExpression^ myDocHashCode = gcnew CodeMethodInvokeExpression( myDocInstance,"GetHashCode" );
- array^writeHashCodeParams = {gcnew CodePrimitiveExpression( " Hash code: {0}" ),myDocHashCode};
- CodeMethodInvokeExpression^ consoleWriteLine3 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",writeHashCodeParams );
- mainMethod->Statements->Add( consoleWriteLine3 );
-
- // Add statements to create another instance.
- mainMethod->Statements->Add( gcnew CodeCommentStatement( "Create another instance." ) );
- CodeVariableDeclarationStatement^ myNewDocDeclare = gcnew CodeVariableDeclarationStatement( "DocumentProperties","myNewDoc",initDocConstruct );
- mainMethod->Statements->Add( myNewDocDeclare );
-
- // Create a variable reference for the myNewDoc instance.
- CodeVariableReferenceExpression^ myNewDocInstance = gcnew CodeVariableReferenceExpression( "myNewDoc" );
-
- // Build Console.WriteLine("Second document:").
- CodeMethodInvokeExpression^ consoleWriteLine5 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Second document:" ) );
-
- // Add the WriteLine call to the statement collection.
- mainMethod->Statements->Add( consoleWriteLine5 );
-
- // Add a statement to display the myNewDoc instance properties.
- CodeMethodInvokeExpression^ myNewDocToString = gcnew CodeMethodInvokeExpression( myNewDocInstance,"ToString" );
- CodeMethodInvokeExpression^ consoleWriteLine6 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",myNewDocToString );
- mainMethod->Statements->Add( consoleWriteLine6 );
-
- // Add a statement to display the myNewDoc instance hashcode property.
- CodeMethodInvokeExpression^ myNewDocHashCode = gcnew CodeMethodInvokeExpression( myNewDocInstance,"GetHashCode" );
- array^writeNewHashCodeParams = {gcnew CodePrimitiveExpression( " Hash code: {0}" ),myNewDocHashCode};
- CodeMethodInvokeExpression^ consoleWriteLine7 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",writeNewHashCodeParams );
- mainMethod->Statements->Add( consoleWriteLine7 );
-
- //
- // Build a compound statement to compare the two instances.
- mainMethod->Statements->Add( gcnew CodeCommentStatement( "Compare the two instances." ) );
- CodeMethodInvokeExpression^ myDocEquals = gcnew CodeMethodInvokeExpression( myDocInstance,"Equals",myNewDocInstance );
- CodePrimitiveExpression^ equalLine = gcnew CodePrimitiveExpression( "Second document is equal to the first." );
- CodePrimitiveExpression^ notEqualLine = gcnew CodePrimitiveExpression( "Second document is not equal to the first." );
- CodeMethodInvokeExpression^ equalWriteLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",equalLine );
- CodeMethodInvokeExpression^ notEqualWriteLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",notEqualLine );
- array^equalStatements = {gcnew CodeExpressionStatement( equalWriteLine )};
- array^notEqualStatements = {gcnew CodeExpressionStatement( notEqualWriteLine )};
- CodeConditionStatement^ docCompare = gcnew CodeConditionStatement( myDocEquals,equalStatements,notEqualStatements );
- mainMethod->Statements->Add( docCompare );
- //
-
- //
- // Add a statement to change the myDoc.Author property:
- mainMethod->Statements->Add( gcnew CodeCommentStatement( "Change the author of the original instance." ) );
- CodePropertyReferenceExpression^ myDocAuthor = gcnew CodePropertyReferenceExpression( myDocInstance,"Author" );
- CodePrimitiveExpression^ newDocAuthor = gcnew CodePrimitiveExpression( "Jane Doe" );
- CodeAssignStatement^ myDocAuthorAssign = gcnew CodeAssignStatement( myDocAuthor,newDocAuthor );
- mainMethod->Statements->Add( myDocAuthorAssign );
- //
-
- // Add a statement to display the modified instance.
- CodeMethodInvokeExpression^ consoleWriteLine8 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Modified original document:" ) );
- mainMethod->Statements->Add( consoleWriteLine8 );
-
- // Reuse the myDoc.ToString statement built earlier.
- mainMethod->Statements->Add( consoleWriteLine2 );
-
- // Reuse the comparison block built earlier.
- mainMethod->Statements->Add( gcnew CodeCommentStatement( "Compare the two instances again." ) );
- mainMethod->Statements->Add( docCompare );
-
- // Add a statement to prompt the user to hit a key.
-
- // Build another call to System.WriteLine.
- // Add string parameter to the WriteLine method.
- CodeMethodInvokeExpression^ consoleWriteLine9 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) );
- mainMethod->Statements->Add( consoleWriteLine9 );
-
- // Build a call to System.ReadLine.
- CodeMethodInvokeExpression^ consoleReadLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"ReadLine" );
- mainMethod->Statements->Add( consoleReadLine );
-
- // Define a few common expressions for the class methods.
- CodePropertyReferenceExpression^ thisTitle = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" );
- CodePropertyReferenceExpression^ thisAuthor = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" );
- CodePropertyReferenceExpression^ thisDate = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" );
- CodeTypeReferenceExpression^ stringType = gcnew CodeTypeReferenceExpression( String::typeid );
- CodePrimitiveExpression^ trueConst = gcnew CodePrimitiveExpression( true );
- CodePrimitiveExpression^ falseConst = gcnew CodePrimitiveExpression( false );
-
- // ------Build the DocumentProperty.Equals method------
- CodeMemberMethod^ baseEquals = gcnew CodeMemberMethod;
- baseEquals->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override | MemberAttributes::Overloaded);
- baseEquals->ReturnType = gcnew CodeTypeReference( bool::typeid );
- baseEquals->Name = "Equals";
- baseEquals->Parameters->Add( gcnew CodeParameterDeclarationExpression( Object::typeid,"obj" ) );
- baseEquals->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.Equals method." ) );
- CodeVariableReferenceExpression^ objVar = gcnew CodeVariableReferenceExpression( "obj" );
- CodeCastExpression^ objCast = gcnew CodeCastExpression( "DocumentProperties",objVar );
- CodePropertyReferenceExpression^ objTitle = gcnew CodePropertyReferenceExpression( objCast,"Title" );
- CodePropertyReferenceExpression^ objAuthor = gcnew CodePropertyReferenceExpression( objCast,"Author" );
- CodePropertyReferenceExpression^ objDate = gcnew CodePropertyReferenceExpression( objCast,"PublishDate" );
- CodeMethodInvokeExpression^ objTitleEquals = gcnew CodeMethodInvokeExpression( objTitle,"Equals",thisTitle );
- CodeMethodInvokeExpression^ objAuthorEquals = gcnew CodeMethodInvokeExpression( objAuthor,"Equals",thisAuthor );
- CodeMethodInvokeExpression^ objDateEquals = gcnew CodeMethodInvokeExpression( objDate,"Equals",thisDate );
- CodeBinaryOperatorExpression^ andEquals1 = gcnew CodeBinaryOperatorExpression( objTitleEquals,CodeBinaryOperatorType::BooleanAnd,objAuthorEquals );
- CodeBinaryOperatorExpression^ andEquals2 = gcnew CodeBinaryOperatorExpression( andEquals1,CodeBinaryOperatorType::BooleanAnd,objDateEquals );
- array^returnTrueStatements = {gcnew CodeMethodReturnStatement( trueConst )};
- array^returnFalseStatements = {gcnew CodeMethodReturnStatement( falseConst )};
- CodeConditionStatement^ objEquals = gcnew CodeConditionStatement( andEquals2,returnTrueStatements,returnFalseStatements );
- baseEquals->Statements->Add( objEquals );
- baseClass->Members->Add( baseEquals );
-
- // ------Build the DocumentProperty.GetHashCode method------
- CodeMemberMethod^ baseHash = gcnew CodeMemberMethod;
- baseHash->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override);
- baseHash->ReturnType = gcnew CodeTypeReference( int::typeid );
- baseHash->Name = "GetHashCode";
- baseHash->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.GetHashCode method." ) );
- CodeMethodInvokeExpression^ hashTitle = gcnew CodeMethodInvokeExpression( thisTitle,"GetHashCode" );
- CodeMethodInvokeExpression^ hashAuthor = gcnew CodeMethodInvokeExpression( thisAuthor,"GetHashCode" );
- CodeMethodInvokeExpression^ hashDate = gcnew CodeMethodInvokeExpression( thisDate,"GetHashCode" );
- CodeBinaryOperatorExpression^ orHash1 = gcnew CodeBinaryOperatorExpression( hashTitle,CodeBinaryOperatorType::BitwiseOr,hashAuthor );
- CodeBinaryOperatorExpression^ andHash = gcnew CodeBinaryOperatorExpression( orHash1,CodeBinaryOperatorType::BitwiseAnd,hashDate );
- baseHash->Statements->Add( gcnew CodeMethodReturnStatement( andHash ) );
- baseClass->Members->Add( baseHash );
-
- // ------Build the DocumentProperty.ToString method------
- CodeMemberMethod^ docToString = gcnew CodeMemberMethod;
- docToString->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override);
- docToString->ReturnType = gcnew CodeTypeReference( String::typeid );
- docToString->Name = "ToString";
- docToString->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.ToString method." ) );
- CodeMethodInvokeExpression^ baseToString = gcnew CodeMethodInvokeExpression( gcnew CodeBaseReferenceExpression,"ToString" );
- CodePrimitiveExpression^ formatString = gcnew CodePrimitiveExpression( "{0} ({1} by {2}, {3})" );
- array^formatParams = {formatString,baseToString,thisTitle,thisAuthor,thisDate};
- CodeMethodInvokeExpression^ stringFormat = gcnew CodeMethodInvokeExpression( stringType,"Format",formatParams );
- docToString->Statements->Add( gcnew CodeMethodReturnStatement( stringFormat ) );
- baseClass->Members->Add( docToString );
- return docPropUnit;
-}
-//
-
-void DocumentPropertyGraphExpand( interior_ptr docPropUnit )
-{
- // Expand on the DocumentProperties class,
- // adding the constructor and property implementation.
- //
- CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties" );
- baseClass->IsPartial = true;
- baseClass->IsClass = true;
- baseClass->Attributes = MemberAttributes::Public;
-
- // Extend the DocumentProperties class in the unit namespace.
- ( *docPropUnit)->Namespaces[ 0 ]->Types->Add( baseClass );
- //
-
- // ------Declare the internal class fields------
- baseClass->Members->Add( gcnew CodeMemberField( "String","docTitle" ) );
- baseClass->Members->Add( gcnew CodeMemberField( "String","docAuthor" ) );
- baseClass->Members->Add( gcnew CodeMemberField( "DateTime","docDate" ) );
-
- // ------Build the DocumentProperty constructor------
- CodeConstructor^ docPropCtor = gcnew CodeConstructor;
- docPropCtor->Attributes = MemberAttributes::Public;
- docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","title" ) );
- docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","author" ) );
- docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "DateTime","publishDate" ) );
- CodeFieldReferenceExpression^ myTitle = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" );
- CodeVariableReferenceExpression^ inTitle = gcnew CodeVariableReferenceExpression( "title" );
- CodeAssignStatement^ myDocTitleAssign = gcnew CodeAssignStatement( myTitle,inTitle );
- docPropCtor->Statements->Add( myDocTitleAssign );
- CodeFieldReferenceExpression^ myAuthor = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" );
- CodeVariableReferenceExpression^ inAuthor = gcnew CodeVariableReferenceExpression( "author" );
- CodeAssignStatement^ myDocAuthorAssign = gcnew CodeAssignStatement( myAuthor,inAuthor );
- docPropCtor->Statements->Add( myDocAuthorAssign );
- CodeFieldReferenceExpression^ myDate = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" );
- CodeVariableReferenceExpression^ inDate = gcnew CodeVariableReferenceExpression( "publishDate" );
- CodeAssignStatement^ myDocDateAssign = gcnew CodeAssignStatement( myDate,inDate );
- docPropCtor->Statements->Add( myDocDateAssign );
- baseClass->Members->Add( docPropCtor );
-
- // ------Build the DocumentProperty properties------
- CodeMemberProperty^ docTitleProp = gcnew CodeMemberProperty;
- docTitleProp->HasGet = true;
- docTitleProp->HasSet = true;
- docTitleProp->Name = "Title";
- docTitleProp->Type = gcnew CodeTypeReference( "String" );
- docTitleProp->Attributes = MemberAttributes::Public;
- docTitleProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ) ) );
- docTitleProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ),gcnew CodePropertySetValueReferenceExpression ) );
- baseClass->Members->Add( docTitleProp );
- CodeMemberProperty^ docAuthorProp = gcnew CodeMemberProperty;
- docAuthorProp->HasGet = true;
- docAuthorProp->HasSet = true;
- docAuthorProp->Name = "Author";
- docAuthorProp->Type = gcnew CodeTypeReference( "String" );
- docAuthorProp->Attributes = MemberAttributes::Public;
- docAuthorProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ) ) );
- docAuthorProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ),gcnew CodePropertySetValueReferenceExpression ) );
- baseClass->Members->Add( docAuthorProp );
- CodeMemberProperty^ docDateProp = gcnew CodeMemberProperty;
- docDateProp->HasGet = true;
- docDateProp->HasSet = true;
- docDateProp->Name = "PublishDate";
- docDateProp->Type = gcnew CodeTypeReference( "DateTime" );
- docDateProp->Attributes = MemberAttributes::Public;
- docDateProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ) ) );
- docDateProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ),gcnew CodePropertySetValueReferenceExpression ) );
- baseClass->Members->Add( docDateProp );
-}
-
-String^ GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileUnit )
-{
- // Build the source file name with the language
- // extension (vb, cs, js).
- String^ sourceFile = "";
-
- // Write the source out in the selected language if
- // the code generator supports partial type declarations.
- if ( provider->Supports( GeneratorSupport::PartialTypes ) )
- {
- if ( provider->FileExtension[ 0 ] == '.' )
- {
- sourceFile = String::Format( "DocProp{0}", provider->FileExtension );
- }
- else
- {
- sourceFile = String::Format( "DocProp.{0}", provider->FileExtension );
- }
-
- // Create a TextWriter to a StreamWriter to an output file.
- IndentedTextWriter^ outWriter = gcnew IndentedTextWriter( gcnew StreamWriter( sourceFile,false )," " );
-
- // Generate source code using the code generator.
- provider->GenerateCodeFromCompileUnit( compileUnit, outWriter, nullptr );
-
- // Close the output file.
- outWriter->Close();
- }
-
- return sourceFile;
-}
-
-//
-bool CompileCode( CodeDomProvider^ provider, String^ sourceFile, String^ exeFile )
-{
- CompilerParameters^ cp = gcnew CompilerParameters;
-
- // Generate an executable instead of
- // a class library.
- cp->GenerateExecutable = true;
-
- // Set the assembly file name to generate.
- cp->OutputAssembly = exeFile;
-
- // Save the assembly as a physical file.
- cp->GenerateInMemory = false;
-
- // Generate debug information.
- cp->IncludeDebugInformation = true;
-
- // Add an assembly reference.
- cp->ReferencedAssemblies->Add( "System.dll" );
-
- // Set the warning level at which
- // the compiler should abort compilation
- // if a warning of this level occurs.
- cp->WarningLevel = 3;
-
- // Set whether to treat all warnings as errors.
- cp->TreatWarningsAsErrors = false;
- if ( provider->Supports( GeneratorSupport::EntryPointMethod ) )
- {
- // Specify the class that contains
- // the main method of the executable.
- cp->MainClass = "DocumentSamples.DocumentProperties";
- }
-
- // Invoke compilation.
- CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile );
- if ( cr->Errors->Count > 0 )
- {
- // Display compilation errors.
- Console::WriteLine( "Errors building {0} into {1}", sourceFile, cr->PathToAssembly );
- IEnumerator^ myEnum = cr->Errors->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- CompilerError^ ce = safe_cast(myEnum->Current);
- Console::WriteLine( " {0}", ce );
- Console::WriteLine();
- }
- }
- else
- {
- Console::WriteLine( "Source {0} built into {1} successfully.", sourceFile, cr->PathToAssembly );
- }
-
- // Return the results of compilation.
- if ( cr->Errors->Count > 0 )
- {
- return false;
- }
- else
- {
- return true;
- }
-}
-//
-
-[STAThread]
-int main()
-{
- CodeDomProvider^ provider = nullptr;
- String^ exeName = "DocProp.exe";
- Console::WriteLine( "Enter the source language for DocumentProperties class (cs, vb, etc):" );
- String^ inputLang = Console::ReadLine();
- Console::WriteLine();
- if ( CodeDomProvider::IsDefinedLanguage( inputLang ) )
- {
- provider = CodeDomProvider::CreateProvider( inputLang );
- }
-
- if ( provider == nullptr )
- {
- Console::WriteLine( "There is no CodeDomProvider for the input language." );
- }
- else
- {
- CodeCompileUnit^ docPropertyUnit = DocumentPropertyGraphBase();
- DocumentPropertyGraphExpand( &docPropertyUnit );
- String^ sourceFile = GenerateCode( provider, docPropertyUnit );
- if ( !String::IsNullOrEmpty( sourceFile ) )
- {
- Console::WriteLine( "Document property class code generated." );
- if ( CompileCode( provider, sourceFile, exeName ) )
- {
- Console::WriteLine( "Starting DocProp executable." );
- Process::Start( exeName );
- }
- }
- else
- {
- Console::WriteLine( "Could not generate source file." );
- Console::WriteLine( "Target language code generator might not support partial type declarations." );
- }
- }
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp
deleted file mode 100644
index 1cc24bf7789..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSampleBatch
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- static CodeCompileUnit^ CreateCompileUnit()
- {
- CodeCompileUnit^ cu = gcnew CodeCompileUnit;
-
- //
- // Creates a code expression for a CodeExpressionStatement to contain.
- array^ temp = {gcnew CodePrimitiveExpression( "Example string" )};
- CodeExpression^ invokeExpression = gcnew CodeMethodInvokeExpression(
- gcnew CodeTypeReferenceExpression( "Console" ),"Write",temp );
-
- // Creates a statement using a code expression.
- CodeExpressionStatement^ expressionStatement;
- expressionStatement = gcnew CodeExpressionStatement( invokeExpression );
-
- // A C++ code generator produces the following source code for the preceeding example code:
-
- // Console::Write( "Example string" );
- //
-
- //
- // Creates a CodeLinePragma that references line 100 of the file "example.cs".
- CodeLinePragma^ pragma = gcnew CodeLinePragma( "example.cs",100 );
- //
-
- //
- // Creates a CodeSnippetExpression that represents a literal string that
- // can be used as an expression in a CodeDOM graph.
- CodeSnippetExpression^ literalExpression =
- gcnew CodeSnippetExpression( "Literal expression" );
- //
-
- //
- // Creates a statement using a literal string.
- CodeSnippetStatement^ literalStatement =
- gcnew CodeSnippetStatement( "Console.Write(\"Test literal statement output\")" );
- //
-
- //
- // Creates a type member using a literal string.
- CodeSnippetTypeMember^ literalMember =
- gcnew CodeSnippetTypeMember( "public static void TestMethod() {}" );
- //
- return cu;
- }
-
- static CodeCompileUnit^ CreateSnippetCompileUnit()
- {
- //
- // Creates a compile unit using a literal sring;
- String^ literalCode;
- literalCode = "using System; namespace TestLiteralCode " +
- "{ public class TestClass { public TestClass() {} } }";
- CodeSnippetCompileUnit^ csu = gcnew CodeSnippetCompileUnit( literalCode );
- //
- return csu;
- }
-
- // CodeNamespaceImportCollection
- void CodeNamespaceImportCollectionExample()
- {
- //
- //
- // Creates an empty CodeNamespaceImportCollection.
- CodeNamespaceImportCollection^ collection =
- gcnew CodeNamespaceImportCollection;
- //
-
- //
- // Adds a CodeNamespaceImport to the collection.
- collection->Add( gcnew CodeNamespaceImport( "System" ) );
- //
-
- //
- // Adds an array of CodeNamespaceImport objects to the collection.
- array^ Imports = {
- gcnew CodeNamespaceImport( "System" ),
- gcnew CodeNamespaceImport( "System.Drawing" )};
- collection->AddRange( Imports );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp
deleted file mode 100644
index 6d0058c9957..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-
-
-// System.CodeDom.Compiler.CompilerInfo
-//
-// Requires .NET Framework version 2.0 or higher.
-//
-// The following example displays compiler configuration settings.
-// Command-line arguments are used to specify a compiler language,
-// file extension, or provider type. For the given input, the
-// example determines the corresponding code compiler settings.
-//
-//
-// Command-line argument examples:
-//
-// - Displays Visual Basic, C#, and JScript compiler settings.
-// Language CSharp
-// - Displays the compiler settings for C#.
-// All
-// - Displays settings for all configured compilers.
-// Config Pascal
-// - Displays settings for configured Pascal language provider,
-// if one exists.
-// Extension .vb
-// - Displays settings for the compiler associated with the .vb
-// file extension.
-#using
-#using
-
-using namespace System;
-using namespace System::Globalization;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace Microsoft::CSharp;
-using namespace Microsoft::VisualBasic;
-using namespace System::Configuration;
-using namespace System::Security::Permissions;
-
-namespace CodeDomCompilerInfoSample
-{
- [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
- public ref class CompilerInfoSample
- {
- public:
- static void Main( array^args )
- {
- String^ queryCommand = "";
- String^ queryArg = "";
- int iNumArguments = args->Length;
-
- // Get input command-line arguments.
- if ( iNumArguments > 0 )
- {
- queryCommand = args[ 0 ]->ToUpper( CultureInfo::InvariantCulture );
- if ( iNumArguments > 1 )
- queryArg = args[ 1 ];
- }
-
- // Determine which method to call.
- Console::WriteLine();
- if ( queryCommand->Equals( "LANGUAGE" ) )
- DisplayCompilerInfoForLanguage( queryArg ); // Display compiler information for input language.
- else if ( queryCommand->Equals( "EXTENSION" ) )
- DisplayCompilerInfoUsingExtension( queryArg ); // Display compiler information for input file extension.
- else if ( queryCommand->Equals( "CONFIG" ) )
- DisplayCompilerInfoForConfigLanguage( queryArg ); // Display settings for the configured language provider.
- else if ( queryCommand->Equals( "ALL" ) )
- DisplayAllCompilerInfo(); // Display compiler information for all configured language providers.
- else
- {
- // There was no command-line argument, or the
- // command-line argument was not recognized.
- // Display the C#, Visual Basic and JScript
- // compiler information.
- DisplayCSharpCompilerInfo();
- DisplayVBCompilerInfo();
- DisplayJScriptCompilerInfo();
- }
- }
-
-
- private:
- static void DisplayCSharpCompilerInfo()
- {
- //
- // Get the provider for Microsoft.CSharp
-// CodeDomProvider^ provider = CodeDomProvider.CreateProvider("CSharp");
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- if ( provider )
- {
- // Display the C# language provider information.
- Console::WriteLine( "CSharp provider is {0}", provider->ToString() );
- Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() );
- Console::WriteLine( " Default file extension: {0}", provider->FileExtension );
- }
-
- //
- Console::WriteLine();
- }
-
- static void DisplayVBCompilerInfo()
- {
- //
- // Get the provider for Microsoft.VisualBasic
-// CodeDomProvider^ provider = CodeDomProvider.CreateProvider("VisualBasic");
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("VisualBasic");
- if ( provider ) // Display the Visual Basic language provider information.
- {
- Console::WriteLine( "Visual Basic provider is {0}", provider->ToString() );
- Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() );
- Console::WriteLine( " Default file extension: {0}", provider->FileExtension );
- }
-
- //
- Console::WriteLine();
- }
-
- static void DisplayJScriptCompilerInfo()
- {
- //
- // Get the provider for JScript.
- CodeDomProvider^ provider;
- try
- {
-// provider = CodeDomProvider.CreateProvider("JScript");
- provider = CodeDomProvider::CreateProvider("JScript");
- if ( provider )
- {
- // Display the JScript language provider information.
- Console::WriteLine( "JScript language provider is {0}", provider->ToString() );
- Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() );
- Console::WriteLine( " Default file extension: {0}", provider->FileExtension );
- Console::WriteLine();
- }
- }
- catch ( ConfigurationException^ e )
- {
- // The JScript language provider was not found.
- Console::WriteLine( "There is no configured JScript language provider." );
- }
-
- //
- }
-
- static void DisplayCompilerInfoUsingExtension( String^ fileExtension )
- {
- //
- if ( !fileExtension->StartsWith( "." ) )
- fileExtension = String::Concat( ".", fileExtension );
-
- // Get the language associated with the file extension.
- CodeDomProvider^ provider = nullptr;
- if ( CodeDomProvider::IsDefinedExtension( fileExtension ) )
- {
- String^ language = CodeDomProvider::GetLanguageFromExtension( fileExtension );
- if ( language )
- Console::WriteLine( "The language \"{0}\" is associated with file extension \"{1}\"\n",
- language, fileExtension );
-
- // Check for a corresponding language provider.
- if ( language && CodeDomProvider::IsDefinedLanguage( language ) )
- {
- provider = CodeDomProvider::CreateProvider( language );
- if ( provider )
- {
- // Display information about this language provider.
- Console::WriteLine( "Language provider: {0}\n", provider->ToString() );
-
- // Get the compiler settings for this language.
- CompilerInfo^ langCompilerInfo = CodeDomProvider::GetCompilerInfo( language );
- if ( langCompilerInfo )
- {
- CompilerParameters^ langCompilerConfig = langCompilerInfo->CreateDefaultCompilerParameters();
- if ( langCompilerConfig )
- {
- Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions );
- Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() );
- }
- }
- }
- }
- }
-
- if ( provider == nullptr ) // Tell the user that the language provider was not found.
- Console::WriteLine( "There is no language provider associated with input file extension \"{0}\".", fileExtension );
-
- //
- }
-
- static void DisplayCompilerInfoForLanguage( String^ language )
- {
- //
- CodeDomProvider^ provider = nullptr;
-
- // Check for a provider corresponding to the input language.
- if ( CodeDomProvider::IsDefinedLanguage( language ) )
- {
- provider = CodeDomProvider::CreateProvider( language );
- if ( provider )
- {
- // Display information about this language provider.
- Console::WriteLine( "Language provider: {0}", provider->ToString() );
- Console::WriteLine();
- Console::WriteLine( " Default file extension: {0}", provider->FileExtension );
- Console::WriteLine();
-
- // Get the compiler settings for this language.
- CompilerInfo^ langCompilerInfo = CodeDomProvider::GetCompilerInfo( language );
- if ( langCompilerInfo )
- {
- CompilerParameters^ langCompilerConfig = langCompilerInfo->CreateDefaultCompilerParameters();
- if ( langCompilerConfig )
- {
- Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions );
- Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() );
- }
- }
- }
- }
-
- if ( provider == nullptr ) // Tell the user that the language provider was not found.
- Console::WriteLine( "There is no provider configured for input language \"{0}\".", language );
-
- //
- }
-
- static void DisplayCompilerInfoForConfigLanguage( String^ configLanguage )
- {
- //
- CodeDomProvider^ provider = nullptr;
- CompilerInfo^ info = CodeDomProvider::GetCompilerInfo( configLanguage );
-
- // Check whether there is a provider configured for this language.
- if ( info->IsCodeDomProviderTypeValid )
- {
- // Get a provider instance using the configured type information.
- provider = dynamic_cast(Activator::CreateInstance( info->CodeDomProviderType ));
- if ( provider )
- {
- // Display information about this language provider.
- Console::WriteLine( "Language provider: {0}", provider->ToString() );
- Console::WriteLine();
- Console::WriteLine( " Default file extension: {0}", provider->FileExtension );
- Console::WriteLine();
-
- // Get the compiler settings for this language.
- CompilerParameters^ langCompilerConfig = info->CreateDefaultCompilerParameters();
- if ( langCompilerConfig )
- {
- Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions );
- Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() );
- }
- }
- }
-
- if ( provider == nullptr ) // Tell the user that the language provider was not found.
- Console::WriteLine( "There is no provider configured for input language \"{0}\".", configLanguage );
-
- //
- }
-
- static void DisplayAllCompilerInfo()
- {
- //
- array^allCompilerInfo = CodeDomProvider::GetAllCompilerInfo();
- for ( int i = 0; i < allCompilerInfo->Length; i++ )
- {
- String^ defaultLanguage;
- String^ defaultExtension;
- CompilerInfo^ info = allCompilerInfo[ i ];
- CodeDomProvider^ provider = nullptr;
- if ( info )
- provider = info->CreateProvider();
-
- if ( provider )
- {
- // Display information about this configured provider.
- Console::WriteLine( "Language provider: {0}", provider->ToString() );
- Console::WriteLine();
- Console::WriteLine( " Supported file extension(s):" );
- array^extensions = info->GetExtensions();
- for ( int i = 0; i < extensions->Length; i++ )
- Console::WriteLine( " {0}", extensions[ i ] );
-
- defaultExtension = provider->FileExtension;
- if ( !defaultExtension->StartsWith( "." ) )
- defaultExtension = String::Concat( ".", defaultExtension );
-
- Console::WriteLine( " Default file extension: {0}\n", defaultExtension );
- Console::WriteLine( " Supported language(s):" );
- array^languages = info->GetLanguages();
- for ( int i = 0; i < languages->Length; i++ )
- Console::WriteLine( " {0}", languages[ i ] );
-
- defaultLanguage = CodeDomProvider::GetLanguageFromExtension( defaultExtension );
- Console::WriteLine( " Default language: {0}", defaultLanguage );
- Console::WriteLine();
-
- // Get the compiler settings for this provider.
- CompilerParameters^ langCompilerConfig = info->CreateDefaultCompilerParameters();
- if ( langCompilerConfig )
- {
- Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions );
- Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() );
- }
- }
-
- }
- //
- }
-
- };
-
-}
-
-
-// The main entry point for the application.
-
-[STAThread]
-int main( int argc, char *argv[] )
-{
- CodeDomCompilerInfoSample::CompilerInfoSample::Main( Environment::GetCommandLineArgs() );
- Console::WriteLine("\n\nPress ENTER to return");
- Console::ReadLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp
deleted file mode 100644
index 98d30708b47..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeEntryPointMethodExample
- {
- public:
-
- //
- // Builds a Hello World Program Graph using System.CodeDom objects
- static CodeCompileUnit^ BuildHelloWorldGraph()
- {
-
- // Create a new CodeCompileUnit to contain the program graph
- CodeCompileUnit^ CompileUnit = gcnew CodeCompileUnit;
-
- // Declare a new namespace object and name it
- CodeNamespace^ Samples = gcnew CodeNamespace( "Samples" );
-
- // Add the namespace object to the compile unit
- CompileUnit->Namespaces->Add( Samples );
-
- // Add a new namespace import for the System namespace
- Samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) );
-
- // Declare a new type object and name it
- CodeTypeDeclaration^ Class1 = gcnew CodeTypeDeclaration( "Class1" );
-
- // Add the new type to the namespace object's type collection
- Samples->Types->Add( Class1 );
-
- // Declare a new code entry point method
- CodeEntryPointMethod^ Start = gcnew CodeEntryPointMethod;
-
- // Create a new method invoke expression
- array^temp = {gcnew CodePrimitiveExpression( "Hello World!" )};
- CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp );
-
- // Add the new method code statement
- Start->Statements->Add( gcnew CodeExpressionStatement( cs1 ) );
-
- // Add the code entry point method to the type's members collection
- Class1->Members->Add( Start );
- return CompileUnit;
-
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp
deleted file mode 100644
index 8a1f531f50a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeExpressionCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeExpressionCollection
- void CodeExpressionCollectionExample()
- {
- //
- //
- // Creates an empty CodeExpressionCollection.
- CodeExpressionCollection^ collection = gcnew CodeExpressionCollection;
- //
-
- //
- // Adds a CodeExpression to the collection.
- collection->Add( gcnew CodePrimitiveExpression( true ) );
- //
-
- //
- // Adds an array of CodeExpression objects to the collection.
- array^expressions = {gcnew CodePrimitiveExpression( true ),gcnew CodePrimitiveExpression( true )};
- collection->AddRange( expressions );
-
- // Adds a collection of CodeExpression objects to the collection.
- CodeExpressionCollection^ expressionsCollection = gcnew CodeExpressionCollection;
- expressionsCollection->Add( gcnew CodePrimitiveExpression( true ) );
- expressionsCollection->Add( gcnew CodePrimitiveExpression( true ) );
- collection->AddRange( expressionsCollection );
- //
-
- //
- // Tests for the presence of a CodeExpression in the
- // collection, and retrieves its index if it is found.
- CodeExpression^ testComment = gcnew CodePrimitiveExpression( true );
- int itemIndex = -1;
- if ( collection->Contains( testComment ) )
- itemIndex = collection->IndexOf( testComment );
- //
-
- //
- // Copies the contents of the collection beginning at index 0 to the specified CodeExpression array.
- // 'expressions' is a CodeExpression array.
- collection->CopyTo( expressions, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeExpression at index 0 of the collection.
- collection->Insert( 0, gcnew CodePrimitiveExpression( true ) );
- //
-
- //
- // Removes the specified CodeExpression from the collection.
- CodeExpression^ expression = gcnew CodePrimitiveExpression( true );
- collection->Remove( expression );
- //
-
- //
- // Removes the CodeExpression at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp
deleted file mode 100644
index be4a228d29c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-[STAThread]
-int main()
-{
- //
- // Creates a new CodeGeneratorOptions.
- CodeGeneratorOptions^ genOptions = gcnew CodeGeneratorOptions;
-
- // Sets a value indicating that the code generator should insert blank lines between type members.
- genOptions->BlankLinesBetweenMembers = true;
-
- // Sets the style of bracing format to use: either S"Block" to start a
- // bracing block on the same line as the declaration of its container, or
- // S"C" to start the bracing for the block on the following line.
- genOptions->BracingStyle = "C";
-
- // Sets a value indicating that the code generator should not append an else,
- // catch or finally block, including brackets, at the closing line of a preceeding if or try block.
- genOptions->ElseOnClosing = false;
-
- // Sets the String* to indent each line with.
- genOptions->IndentString = " ";
-
- // Uses the CodeGeneratorOptions indexer property to set an
- // example Object* to the type's String*-keyed ListDictionary.
- // Custom ICodeGenerator* implementations can use objects
- // in this dictionary to customize process behavior.
- genOptions[ "CustomGeneratorOptionStringExampleID" ] = "BuildFlags: /A /B /C /D /E";
- //
-
- Console::WriteLine( genOptions );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp
deleted file mode 100644
index cab34001736..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeGotoStatementExample
- {
- public:
- CodeGotoStatementExample()
- {
-
- //
- // Declares a type to contain the example code.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" );
-
- // Declares an entry point method.
- CodeEntryPointMethod^ entry1 = gcnew CodeEntryPointMethod;
- type1->Members->Add( entry1 );
-
- // Adds a goto statement to continue program flow at the "JumpToLabel" label.
- CodeGotoStatement^ goto1 = gcnew CodeGotoStatement( "JumpToLabel" );
- entry1->Statements->Add( goto1 );
-
- // Invokes Console.WriteLine to print "Test Output", which is skipped by the goto statement.
- array^temp = {gcnew CodePrimitiveExpression( "Test Output." )};
- CodeMethodInvokeExpression^ method1 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp );
- entry1->Statements->Add( method1 );
-
- // Declares a label named "JumpToLabel" associated with a method to output a test string using Console.WriteLine.
- array^temp2 = {gcnew CodePrimitiveExpression( "Output from labeled statement." )};
- CodeMethodInvokeExpression^ method2 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp2 );
- CodeLabeledStatement^ label1 = gcnew CodeLabeledStatement( "JumpToLabel",gcnew CodeExpressionStatement( method2 ) );
- entry1->Statements->Add( label1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class Type1
- // {
- //
- // public static void Main()
- // {
- // goto JumpToLabel;
- // System.Console.WriteLine("Test Output");
- // JumpToLabel:
- // System.Console.WriteLine("Output from labeled statement.");
- // }
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp
deleted file mode 100644
index c3a1463a6e3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeIterationStatementExample
- {
- public:
- CodeIterationStatementExample()
- {
- //
- // Declares and initializes an integer variable named testInt.
- CodeVariableDeclarationStatement^ testInt = gcnew CodeVariableDeclarationStatement( int::typeid,"testInt",gcnew CodePrimitiveExpression( (int^)0 ) );
- array^writelineparams = {gcnew CodeMethodInvokeExpression( gcnew CodeVariableReferenceExpression( "testInt" ),"ToString",nullptr )};
- array^codestatements = {gcnew CodeExpressionStatement( gcnew CodeMethodInvokeExpression( gcnew CodeMethodReferenceExpression( gcnew CodeTypeReferenceExpression( "Console" ),"WriteLine" ),writelineparams ) )};
-
- // Creates a for loop that sets testInt to 0 and continues incrementing testInt by 1 each loop until testInt is not less than 10.
-
- // Each loop iteration the value of the integer is output using the Console.WriteLine method.
- CodeIterationStatement^ forLoop = gcnew CodeIterationStatement( gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "testInt" ),gcnew CodePrimitiveExpression( 1 ) ),gcnew CodeBinaryOperatorExpression( gcnew CodeVariableReferenceExpression( "testInt" ),CodeBinaryOperatorType::LessThan,gcnew CodePrimitiveExpression( 10 ) ),gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "testInt" ),gcnew CodeBinaryOperatorExpression( gcnew CodeVariableReferenceExpression( "testInt" ),CodeBinaryOperatorType::Add,gcnew CodePrimitiveExpression( 1 ) ) ),codestatements );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // int testInt = 0;
- // for (testInt = 1; (testInt < 10); testInt = (testInt + 1)) {
- // Console.WriteLine(testInt.ToString());
- //
- }
- };
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp
deleted file mode 100644
index 26b6cf744fb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeMemberEventExample
- {
- public:
- CodeMemberEventExample()
- {
-
- //
- // Declares a type to contain an event and constructor method.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "EventTest" );
-
- //
- // Declares an event that accepts a delegate type of System.EventHandler.
- CodeMemberEvent^ event1 = gcnew CodeMemberEvent;
-
- // Sets a name for the event.
- event1->Name = "TestEvent";
-
- // Sets the type of event.
- event1->Type = gcnew CodeTypeReference( "System.EventHandler" );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // private event System.EventHandler TestEvent;
- //
- // Adds the event to the type members collection.
- type1->Members->Add( event1 );
-
- // Declares an empty type constructor.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- type1->Members->Add( constructor1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class EventTest
- // {
- //
- // public EventTest()
- // {
- // }
- //
- // private event System.EventHandler TestEvent;
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp
deleted file mode 100644
index a6523e8e7f4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeMemberFieldExample
- {
- public:
- CodeMemberFieldExample()
- {
-
- //
- // Declares a type to contain a field and a constructor method.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "FieldTest" );
-
- // Declares a field of type String named testStringField.
- CodeMemberField^ field1 = gcnew CodeMemberField( "System.String","TestStringField" );
- type1->Members->Add( field1 );
-
- // Declares an empty type constructor.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- type1->Members->Add( constructor1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class FieldTest
- // {
- // private string testStringField;
- //
- // public FieldTest()
- // {
- // }
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp
deleted file mode 100644
index 85f2cca6311..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeMemberField_PublicConst_Example
-{
- public ref class Class1
- {
- private:
- static CodeCompileUnit^ GetCompileUnit()
- {
- CodeCompileUnit^ cu = gcnew CodeCompileUnit;
- CodeNamespace^ nsp = gcnew CodeNamespace( "TestNamespace" );
- cu->Namespaces->Add( nsp );
- CodeTypeDeclaration^ testType = gcnew CodeTypeDeclaration( "testType" );
- nsp->Types->Add( testType );
-
- //
- // This example demonstrates declaring a public constant type member field.
-
- // When declaring a public constant type member field, you must set a particular
- // access and scope mask to the member attributes of the field in order for the
- // code generator to properly generate the field as a constant field.
-
- // Declares an integer field using a CodeMemberField
- CodeMemberField^ constPublicField = gcnew CodeMemberField( int::typeid,"testConstPublicField" );
-
- // Resets the access and scope mask bit flags of the member attributes of the field
- // before setting the member attributes of the field to public and constant.
- constPublicField->Attributes = (MemberAttributes)((constPublicField->Attributes & ~MemberAttributes::AccessMask & ~MemberAttributes::ScopeMask) | MemberAttributes::Public | MemberAttributes::Const);
- //
-
- testType->Members->Add( constPublicField );
- return cu;
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp
deleted file mode 100644
index 8175a5921e6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeMemberMethodExample
- {
- public:
- CodeMemberMethodExample()
- {
-
- //
- // Defines a method that returns a string passed to it.
- CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
- method1->Name = "ReturnString";
- method1->ReturnType = gcnew CodeTypeReference( "System.String" );
- method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","text" ) );
- method1->Statements->Add( gcnew CodeMethodReturnStatement( gcnew CodeArgumentReferenceExpression( "text" ) ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // private string ReturnString(string text)
- // {
- // return text;
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp
deleted file mode 100644
index 7e2bc0cca2b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeMemberPropertyExample
- {
- public:
- CodeMemberPropertyExample()
- {
-
- //
- // Declares a type to contain a field and a constructor method.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "PropertyTest" );
-
- // Declares a field of type String named testStringField.
- CodeMemberField^ field1 = gcnew CodeMemberField( "System.String","testStringField" );
- type1->Members->Add( field1 );
-
- // Declares a property of type String named StringProperty.
- CodeMemberProperty^ property1 = gcnew CodeMemberProperty;
- property1->Name = "StringProperty";
- property1->Type = gcnew CodeTypeReference( "System.String" );
- property1->Attributes = MemberAttributes::Public;
- property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ) ) );
- property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ),gcnew CodePropertySetValueReferenceExpression ) );
- type1->Members->Add( property1 );
-
- // Declares an empty type constructor.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- type1->Members->Add( constructor1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class PropertyTest
- // {
- //
- // private string testStringField;
- //
- // public PropertyTest()
- // {
- // }
- //
- // public virtual string StringProperty
- // {
- // get
- // {
- // return this.testStringField;
- // }
- // set
- // {
- // this.testStringField = value;
- // }
- // }
- // }
- //
- }
-
- void SpecificExample()
- {
-
- //
- // Declares a property of type String named StringProperty.
- CodeMemberProperty^ property1 = gcnew CodeMemberProperty;
- property1->Name = "StringProperty";
- property1->Type = gcnew CodeTypeReference( "System.String" );
- property1->Attributes = MemberAttributes::Public;
- property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ) ) );
- property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ),gcnew CodePropertySetValueReferenceExpression ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public virtual string StringProperty
- // {
- // get
- // {
- // return this.testStringField;
- // }
- // set
- // {
- // this.testStringField = value;
- // }
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp
deleted file mode 100644
index e6f645922d9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeMethodInvokeExpressionExample
- {
- public:
- CodeMethodInvokeExpressionExample()
- {
-
- //
- array^temp0 = {gcnew CodePrimitiveExpression( true )};
-
- // parameters array contains the parameters for the method.
- CodeMethodInvokeExpression^ methodInvoke = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"Dispose",temp0 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.Dispose(true);
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp
deleted file mode 100644
index 5bb3d9a74c0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-public ref class CodeMethodReferenceExample
-{
-public:
- CodeMethodReferenceExample()
- {
-
- //
- // Declares a type to contain the example code.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" );
-
- // Declares a method.
- CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
- method1->Name = "TestMethod";
- type1->Members->Add( method1 );
-
- // Declares a type constructor that calls a method.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- type1->Members->Add( constructor1 );
-
- // Invokes the TestMethod method of the current type object.
- CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" );
- array^temp0;
- CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp0 );
- constructor1->Statements->Add( invoke1 );
-
- //
- }
-
- void InvokeExample()
- {
-
- //
- // Invokes the TestMethod method of the current type object.
- CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" );
- array^temp1;
- CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestMethod();
- //
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp
deleted file mode 100644
index 038d748adc7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-public ref class CodeMultiExample
-{
-public:
- CodeMultiExample(){}
-
- void CodeEventReferenceExample()
- {
-
- //
- // Represents a reference to an event.
- CodeEventReferenceExpression^ eventRef1 = gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestEvent
- //
- }
-
- void CodeIndexerExample()
- {
-
- //
- array^temp1 = {gcnew CodePrimitiveExpression( 1 )};
- System::CodeDom::CodeIndexerExpression^ indexerExpression = gcnew CodeIndexerExpression( gcnew CodeThisReferenceExpression,temp1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this[1];
- //
- }
-
- void CodeDirectionExample()
- {
-
- //
- // Declares a parameter passed by reference using a CodeDirectionExpression.
- array^param1 = {gcnew CodeDirectionExpression( FieldDirection::Ref,gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestParameter" ) )};
-
- // Invokes a method on this named TestMethod using the direction expression as a parameter.
- CodeMethodInvokeExpression^ methodInvoke1 = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"TestMethod",param1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestMethod(ref TestParameter);
- //
- }
-
- void CreateExpressionExample()
- {
-
- //
- array^temp0 = gcnew array(0);
- CodeObjectCreateExpression^ objectCreate1 = gcnew CodeObjectCreateExpression( "System.DateTime",temp0 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // new System.DateTime();
- //
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp
deleted file mode 100644
index 1fa3cdbea7d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeNamespaceCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeNamespaceCollection
- void CodeNamespaceCollectionExample()
- {
- //
- //
- // Creates an empty CodeNamespaceCollection.
- CodeNamespaceCollection^ collection = gcnew CodeNamespaceCollection;
- //
-
- //
- // Adds a CodeNamespace to the collection.
- collection->Add( gcnew CodeNamespace( "TestNamespace" ) );
- //
-
- //
- // Adds an array of CodeNamespace objects to the collection.
- array^namespaces = {gcnew CodeNamespace( "TestNamespace1" ),gcnew CodeNamespace( "TestNamespace2" )};
- collection->AddRange( namespaces );
-
- // Adds a collection of CodeNamespace objects to the collection.
- CodeNamespaceCollection^ namespacesCollection = gcnew CodeNamespaceCollection;
- namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace1" ) );
- namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace2" ) );
- collection->AddRange( namespacesCollection );
- //
-
- //
- // Tests for the presence of a CodeNamespace in the collection,
- // and retrieves its index if it is found.
- CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" );
- int itemIndex = -1;
- if ( collection->Contains( testNamespace ) )
- itemIndex = collection->IndexOf( testNamespace );
- //
-
- //
- // Copies the contents of the collection beginning at index 0,
- // to the specified CodeNamespace array.
- // 'namespaces' is a CodeNamespace array.
- collection->CopyTo( namespaces, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeNamespace at index 0 of the collection.
- collection->Insert( 0, gcnew CodeNamespace( "TestNamespace" ) );
- //
-
- //
- // Removes the specified CodeNamespace from the collection.
- CodeNamespace^ namespace_ = gcnew CodeNamespace( "TestNamespace" );
- collection->Remove( namespace_ );
- //
-
- //
- // Removes the CodeNamespace at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp
deleted file mode 100644
index e2d0cf27fab..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeMemberEventExample
- {
- public:
- CodeMemberEventExample()
- {
-
- //
- CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit;
- CodeNamespace^ namespace1 = gcnew CodeNamespace( "TestNamespace" );
- compileUnit->Namespaces->Add( namespace1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // namespace TestNamespace {
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp
deleted file mode 100644
index ac420b30839..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeNamespaceImportExample
- {
- public:
- CodeNamespaceImportExample()
- {
-
- //
- // Declares a compile unit to contain a namespace.
- CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit;
-
- // Declares a namespace named TestNamespace.
- CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" );
-
- // Adds the namespace to the namespace collection of the compile unit.
- compileUnit->Namespaces->Add( testNamespace );
-
- // Declares a namespace import of the System namespace.
- CodeNamespaceImport^ import1 = gcnew CodeNamespaceImport( "System" );
-
- // Adds the namespace import to the namespace imports collection of the namespace.
- testNamespace->Imports->Add( import1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // namespace TestNamespace {
- // using System;
- //
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp
deleted file mode 100644
index 8e07b2222f8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeParameterDeclarationExample
- {
- public:
- CodeParameterDeclarationExample()
- {
-
- //
- // Declares a new type to contain the example methods.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" );
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- type1->Members->Add( constructor1 );
-
- //
- // Declares a method.
- CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
- method1->Name = "TestMethod";
-
- // Declares a string parameter passed by reference.
- CodeParameterDeclarationExpression^ param1 = gcnew CodeParameterDeclarationExpression( "System.String","stringParam" );
- param1->Direction = FieldDirection::Ref;
- method1->Parameters->Add( param1 );
-
- // Declares a Int32 parameter passed by incoming field.
- CodeParameterDeclarationExpression^ param2 = gcnew CodeParameterDeclarationExpression( "System.Int32","intParam" );
- param2->Direction = FieldDirection::Out;
- method1->Parameters->Add( param2 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // private void TestMethod(ref string stringParam, out int intParam) {
- // }
- //
- type1->Members->Add( method1 );
-
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp
deleted file mode 100644
index 3b66a3fe5b6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeParameterDeclarationExpressionCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeParameterDeclarationExpressionCollection
- void CodeParameterDeclarationExpressionCollectionExample()
- {
- //
- //
- // Creates an empty CodeParameterDeclarationExpressionCollection.
- CodeParameterDeclarationExpressionCollection^ collection = gcnew CodeParameterDeclarationExpressionCollection;
- //
-
- //
- // Adds a CodeParameterDeclarationExpression to the collection.
- collection->Add( gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) );
- //
-
- //
- // Adds an array of CodeParameterDeclarationExpression objects
- // to the collection.
- array^parameters = {gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ),gcnew CodeParameterDeclarationExpression( bool::typeid,"testBoolArgument" )};
- collection->AddRange( parameters );
-
- // Adds a collection of CodeParameterDeclarationExpression objects
- // to the collection.
- CodeParameterDeclarationExpressionCollection^ parametersCollection = gcnew CodeParameterDeclarationExpressionCollection;
- parametersCollection->Add( gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) );
- parametersCollection->Add( gcnew CodeParameterDeclarationExpression( bool::typeid,"testBoolArgument" ) );
- collection->AddRange( parametersCollection );
- //
-
- //
- // Tests for the presence of a CodeParameterDeclarationExpression
- // in the collection, and retrieves its index if it is found.
- CodeParameterDeclarationExpression^ testParameter = gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" );
- int itemIndex = -1;
- if ( collection->Contains( testParameter ) )
- itemIndex = collection->IndexOf( testParameter );
- //
-
- //
- // Copies the contents of the collection beginning at index 0 to the specified CodeParameterDeclarationExpression array.
- // 'parameters' is a CodeParameterDeclarationExpression array.
- collection->CopyTo( parameters, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeParameterDeclarationExpression at index 0
- // of the collection.
- collection->Insert( 0, gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) );
- //
-
- //
- // Removes the specified CodeParameterDeclarationExpression
- // from the collection.
- CodeParameterDeclarationExpression^ parameter = gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" );
- collection->Remove( parameter );
- //
-
- //
- // Removes the CodeParameterDeclarationExpression at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp
deleted file mode 100644
index 9056a9d5683..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodePrimitiveExpressionExample
- {
- public:
- CodePrimitiveExpressionExample()
- {
-
- //
- // Represents a string.
- CodePrimitiveExpression^ stringPrimitive = gcnew CodePrimitiveExpression( "Test String" );
-
- // Represents an integer.
- CodePrimitiveExpression^ intPrimitive = gcnew CodePrimitiveExpression( 10 );
-
- // Represents a floating point number.
- CodePrimitiveExpression^ floatPrimitive = gcnew CodePrimitiveExpression( 1.03189 );
-
- // Represents a null value expression.
- CodePrimitiveExpression^ nullPrimitive = gcnew CodePrimitiveExpression( 0 );
-
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp
deleted file mode 100644
index 6a937caac58..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodePropertySetValueExample
- {
- public:
- CodePropertySetValueExample()
- {
-
- //
- // Declares a type.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" );
-
- // Declares a constructor.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- type1->Members->Add( constructor1 );
-
- // Declares an integer field.
- CodeMemberField^ field1 = gcnew CodeMemberField( "System.Int32","integerField" );
- type1->Members->Add( field1 );
-
- // Declares a property.
- CodeMemberProperty^ property1 = gcnew CodeMemberProperty;
-
- // Declares a property get statement to return the value of the integer field.
- property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"integerField" ) ) );
-
- // Declares a property set statement to set the value to the integer field.
- // The CodePropertySetValueReferenceExpression represents the value argument passed to the property set statement.
- property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"integerField" ),gcnew CodePropertySetValueReferenceExpression ) );
- type1->Members->Add( property1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class Type1
- // {
- //
- // private int integerField;
- //
- // public Type1()
- // {
- // }
- //
- // private int integerProperty
- // {
- // get
- // {
- // return this.integerField;
- // }
- // set
- // {
- // this.integerField = value;
- // }
- // }
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp
deleted file mode 100644
index b6dcd099dd2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeReferenceExample
- {
- public:
- CodeReferenceExample(){}
-
- void CodeFieldReferenceExample()
- {
-
- //
- CodeFieldReferenceExpression^ fieldRef1 = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestField" );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestField
- //
- }
-
- void CodePropertyReferenceExample()
- {
-
- //
- CodePropertyReferenceExpression^ propertyRef1 = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"TestProperty" );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestProperty
- //
- }
-
- void CodeVariableReferenceExample()
- {
-
- //
- CodeVariableReferenceExpression^ variableRef1 = gcnew CodeVariableReferenceExpression( "TestVariable" );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // TestVariable
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp
deleted file mode 100644
index 4f5f9c70446..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeRemoveEventExample
- {
- public:
- CodeRemoveEventExample()
- {
-
- //
- // Creates a delegate of type System.EventHandler pointing to a method named OnMouseEnter.
- CodeDelegateCreateExpression^ mouseEnterDelegate = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "System.EventHandler" ),gcnew CodeThisReferenceExpression,"OnMouseEnter" );
-
- // Creates a remove event statement that removes the delegate from the TestEvent event.
- CodeRemoveEventStatement^ removeEvent1 = gcnew CodeRemoveEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",mouseEnterDelegate );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // this.TestEvent -= new System.EventHandler(this.OnMouseEnter);
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp
deleted file mode 100644
index 03265e75e7f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeStatementCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeStatementCollection
- void CodeStatementCollectionExample()
- {
-
- //
- //
- // Creates an empty CodeStatementCollection.
- CodeStatementCollection^ collection = gcnew CodeStatementCollection;
- //
-
- //
- // Adds a CodeStatement to the collection.
- collection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
- //
-
- //
- // Adds an array of CodeStatement objects to the collection.
- array^statements = {gcnew CodeCommentStatement( "Test comment statement" ),gcnew CodeCommentStatement( "Test comment statement" )};
- collection->AddRange( statements );
-
- // Adds a collection of CodeStatement objects to the collection.
- CodeStatement^ testStatement = gcnew CodeCommentStatement( "Test comment statement" );
- CodeStatementCollection^ statementsCollection = gcnew CodeStatementCollection;
- statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
- statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
- statementsCollection->Add( testStatement );
- collection->AddRange( statementsCollection );
- //
-
- //
- // Tests for the presence of a CodeStatement in the
- // collection, and retrieves its index if it is found.
- int itemIndex = -1;
- if ( collection->Contains( testStatement ) )
- itemIndex = collection->IndexOf( testStatement );
- //
-
- //
- // Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
- // 'statements' is a CodeStatement array.
- collection->CopyTo( statements, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeStatement at index 0 of the collection.
- collection->Insert( 0, gcnew CodeCommentStatement( "Test comment statement" ) );
- //
-
- //
- // Removes the specified CodeStatement from the collection.
- collection->Remove( testStatement );
- //
-
- //
- // Removes the CodeStatement at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp
deleted file mode 100644
index 54009857661..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-public ref class CodeThrowExceptionStatementExample
-{
-public:
- CodeThrowExceptionStatementExample()
- {
- //
- // This CodeThrowExceptionStatement throws a new System.Exception.
- array^temp0;
- CodeThrowExceptionStatement^ throwException = gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( gcnew CodeTypeReference( System::Exception::typeid ),temp0 ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // throw new System.Exception();
- //
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp
deleted file mode 100644
index cb97225e885..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-public ref class CodeTryCatchFinallyExample
-{
-public:
- CodeTryCatchFinallyExample()
- {
-
- //
- // Declares a type to contain a try...catch block.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "TryCatchTest" );
-
- // Defines a method that throws an exception of type System.ApplicationException.
- CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
- method1->Name = "ThrowApplicationException";
- array^temp = {gcnew CodePrimitiveExpression( "Test Application Exception" )};
- method1->Statements->Add( gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( "System.ApplicationException",temp ) ) );
- type1->Members->Add( method1 );
-
- // Defines a constructor that calls the ThrowApplicationException method from a try block.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- type1->Members->Add( constructor1 );
-
- // Defines a try statement that calls the ThrowApplicationException method.
- CodeTryCatchFinallyStatement^ try1 = gcnew CodeTryCatchFinallyStatement;
- try1->TryStatements->Add( gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"ThrowApplicationException", nullptr ) );
- constructor1->Statements->Add( try1 );
-
- // Defines a catch clause for exceptions of type ApplicationException.
- CodeCatchClause^ catch1 = gcnew CodeCatchClause( "ex",gcnew CodeTypeReference( "System.ApplicationException" ) );
- catch1->Statements->Add( gcnew CodeCommentStatement( "Handle any System.ApplicationException here." ) );
- try1->CatchClauses->Add( catch1 );
-
- // Defines a catch clause for any remaining unhandled exception types.
- CodeCatchClause^ catch2 = gcnew CodeCatchClause( "ex" );
- catch2->Statements->Add( gcnew CodeCommentStatement( "Handle any other exception type here." ) );
- try1->CatchClauses->Add( catch2 );
-
- // Defines a finally block by adding to the FinallyStatements collection.
- try1->FinallyStatements->Add( gcnew CodeCommentStatement( "Handle any finally block statements." ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class TryCatchTest
- // {
- //
- // public TryCatchTest()
- // {
- // try
- // {
- // this.ThrowApplicationException();
- // }
- // catch (System.ApplicationException ex)
- // {
- // // Handle any System.ApplicationException here.
- // }
- // catch (System.Exception ex)
- // {
- // // Handle any other exception type here.
- // }
- // finally {
- // // Handle any finally block statements.
- // }
- // }
- //
- // private void ThrowApplicationException()
- // {
- // throw new System.ApplicationException("Test Application Exception");
- // }
- // }
- //
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp
deleted file mode 100644
index aefa0b83158..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeTypeConstructorExample
- {
- public:
- CodeTypeConstructorExample()
- {
-
- //
- // Declares a new type for a static constructor.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" );
-
- // Declares a static constructor.
- CodeTypeConstructor^ constructor2 = gcnew CodeTypeConstructor;
-
- // Adds the static constructor to the type.
- type1->Members->Add( constructor2 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class Type1
- // {
- //
- // static Type1()
- // {
- // }
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp
deleted file mode 100644
index eb0a71bdaee..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeTypeDeclarationCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeTypeDeclarationCollection
- void CodeTypeDeclarationCollectionExample()
- {
-
- //
- //
- // Creates an empty CodeTypeDeclarationCollection.
- CodeTypeDeclarationCollection^ collection = gcnew CodeTypeDeclarationCollection;
- //
-
- //
- // Adds a CodeTypeDeclaration to the collection.
- collection->Add( gcnew CodeTypeDeclaration( "TestType" ) );
- //
-
- //
- // Adds an array of CodeTypeDeclaration objects to the collection.
- array^declarations = {gcnew CodeTypeDeclaration( "TestType1" ),gcnew CodeTypeDeclaration( "TestType2" )};
- collection->AddRange( declarations );
-
- // Adds a collection of CodeTypeDeclaration objects to the
- // collection.
- CodeTypeDeclarationCollection^ declarationsCollection = gcnew CodeTypeDeclarationCollection;
- declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType1" ) );
- declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType2" ) );
- collection->AddRange( declarationsCollection );
- //
-
- //
- // Tests for the presence of a CodeTypeDeclaration in the
- // collection, and retrieves its index if it is found.
- CodeTypeDeclaration^ testDeclaration = gcnew CodeTypeDeclaration( "TestType" );
- int itemIndex = -1;
- if ( collection->Contains( testDeclaration ) )
- itemIndex = collection->IndexOf( testDeclaration );
- //
-
- //
- // Copies the contents of the collection, beginning at index 0,
- // to the specified CodeTypeDeclaration array.
- // 'declarations' is a CodeTypeDeclaration array.
- collection->CopyTo( declarations, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeTypeDeclaration at index 0 of the collection.
- collection->Insert( 0, gcnew CodeTypeDeclaration( "TestType" ) );
- //
-
- //
- // Removes the specified CodeTypeDeclaration from the collection.
- CodeTypeDeclaration^ declaration = gcnew CodeTypeDeclaration( "TestType" );
- collection->Remove( declaration );
- //
-
- //
- // Removes the CodeTypeDeclaration at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp
deleted file mode 100644
index ac817d9918f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::Reflection;
-
-namespace CodeDomSamples
-{
- public ref class CodeTypeDeclarationExample
- {
- public:
- CodeTypeDeclarationExample()
- {
-
- //
- // Creates a new type declaration.
-
- // name parameter indicates the name of the type.
- CodeTypeDeclaration^ newType = gcnew CodeTypeDeclaration( "TestType" );
-
- // Sets the member attributes for the type to private.
- newType->Attributes = MemberAttributes::Private;
-
- // Sets a base class which the type inherits from.
- newType->BaseTypes->Add( "BaseType" );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // class TestType : BaseType
- // {
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp
deleted file mode 100644
index 79266531f92..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeTypeDelegateExample
- {
- public:
- CodeTypeDelegateExample()
- {
-
- //
- // Declares a type to contain the delegate and constructor method.
- CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "DelegateTest" );
-
- // Declares an event that accepts a custom delegate type of "TestDelegate".
- CodeMemberEvent^ event1 = gcnew CodeMemberEvent;
- event1->Name = "TestEvent";
- event1->Type = gcnew CodeTypeReference( "DelegateTest.TestDelegate" );
- type1->Members->Add( event1 );
-
- //
- // Declares a delegate type called TestDelegate with an EventArgs parameter.
- CodeTypeDelegate^ delegate1 = gcnew CodeTypeDelegate( "TestDelegate" );
- delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) );
- delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public delegate void TestDelegate(object sender, System.EventArgs e);
- //
- type1->Members->Add( delegate1 );
-
- // Declares a method that matches the "TestDelegate" method signature.
- CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
- method1->Name = "TestMethod";
- method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) );
- method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) );
- type1->Members->Add( method1 );
-
- // Defines a constructor that attaches a TestDelegate delegate pointing to the TestMethod method
- // to the TestEvent event.
- CodeConstructor^ constructor1 = gcnew CodeConstructor;
- constructor1->Attributes = MemberAttributes::Public;
- CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "DelegateTest.TestDelegate" ),gcnew CodeThisReferenceExpression,"TestMethod" );
- CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 );
- constructor1->Statements->Add( attachStatement1 );
- type1->Members->Add( constructor1 );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // public class DelegateTest
- // {
- //
- // public DelegateTest()
- // {
- // this.TestEvent += new DelegateTest.TestDelegate(this.TestMethod);
- // }
- //
- // private event DelegateTest.TestDelegate TestEvent;
- //
- // private void TestMethod(object sender, System.EventArgs e)
- // {
- // }
- //
- // public delegate void TestDelegate(object sender, System.EventArgs e);
- // }
- //
- }
-
- };
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp
deleted file mode 100644
index 764de1a8a1d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeTypeMemberCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeTypeMemberCollection
- void CodeTypeMemberCollectionExample()
- {
-
- //
- //
- // Creates an empty CodeTypeMemberCollection.
- CodeTypeMemberCollection^ collection = gcnew CodeTypeMemberCollection;
- //
-
- //
- // Adds a CodeTypeMember to the collection.
- collection->Add( gcnew CodeMemberField( "System.String","TestStringField" ) );
- //
-
- //
- // Adds an array of CodeTypeMember objects to the collection.
- array^members = {gcnew CodeMemberField( "System.String","TestStringField1" ),gcnew CodeMemberField( "System.String","TestStringField2" )};
- collection->AddRange( members );
-
- // Adds a collection of CodeTypeMember objects to the collection.
- CodeTypeMemberCollection^ membersCollection = gcnew CodeTypeMemberCollection;
- membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField1" ) );
- membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField2" ) );
- collection->AddRange( membersCollection );
- //
-
- //
- // Tests for the presence of a CodeTypeMember in the collection,
- // and retrieves its index if it is found.
- CodeTypeMember^ testMember = gcnew CodeMemberField( "System.String","TestStringField" );
- int itemIndex = -1;
- if ( collection->Contains( testMember ) )
- itemIndex = collection->IndexOf( testMember );
- //
-
- //
- // Copies the contents of the collection, beginning at index 0,
- // to the specified CodeTypeMember array.
- // 'members' is a CodeTypeMember array.
- collection->CopyTo( members, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeTypeMember at index 0 of the collection.
- collection->Insert( 0, gcnew CodeMemberField( "System.String","TestStringField" ) );
- //
-
- //
- // Removes the specified CodeTypeMember from the collection.
- CodeTypeMember^ member = gcnew CodeMemberField( "System.String","TestStringField" );
- collection->Remove( member );
- //
-
- //
- // Removes the CodeTypeMember at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp
deleted file mode 100644
index c1b459722a5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-namespace CodeDomSamples
-{
- public ref class CodeTypeOfExample
- {
- public:
- static void Main()
- {
- ShowTypeReference();
- Console::WriteLine();
- ShowTypeReferenceExpression();
- }
-
- static void ShowTypeReference()
- {
- //
- // Creates a reference to the System.DateTime type.
- CodeTypeReference^ typeRef1 = gcnew CodeTypeReference("System.DateTime");
-
- // Creates a typeof expression for the specified type reference.
- CodeTypeOfExpression^ typeof1 = gcnew CodeTypeOfExpression(typeRef1);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromExpression(typeof1, Console::Out, gcnew CodeGeneratorOptions());
- // The code generator produces the following source code for the preceeding example code:
- // typeof(System.DateTime)
- //
- }
-
- static void ShowTypeReferenceExpression()
- {
- //
- // Creates an expression referencing the System.DateTime type.
- CodeTypeReferenceExpression^ typeRef1 = gcnew CodeTypeReferenceExpression("System.DateTime");
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromExpression(typeRef1, Console::Out, gcnew CodeGeneratorOptions());
- // The code generator produces the following source code for the preceeding example code:
-
- // System.DateTime
-
- //
- }
- };
-}
-
-int main()
-{
- CodeDomSamples::CodeTypeOfExample::Main();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp
deleted file mode 100644
index ab613ec0d11..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeTypeReferenceCollectionExample
-{
- public ref class Class1
- {
- public:
- Class1(){}
-
- // CodeTypeReferenceCollection
- void CodeTypeReferenceCollectionExample()
- {
- //
- //
- // Creates an empty CodeTypeReferenceCollection.
- CodeTypeReferenceCollection^ collection = gcnew CodeTypeReferenceCollection;
- //
-
- //
- // Adds a CodeTypeReference to the collection.
- collection->Add( gcnew CodeTypeReference( bool::typeid ) );
- //
-
- //
- // Adds an array of CodeTypeReference objects to the collection.
- array^references = {gcnew CodeTypeReference( bool::typeid ),gcnew CodeTypeReference( bool::typeid )};
- collection->AddRange( references );
-
- // Adds a collection of CodeTypeReference objects to the collection.
- CodeTypeReferenceCollection^ referencesCollection = gcnew CodeTypeReferenceCollection;
- referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) );
- referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) );
- collection->AddRange( referencesCollection );
- //
-
- //
- // Tests for the presence of a CodeTypeReference in the
- // collection, and retrieves its index if it is found.
- CodeTypeReference^ testReference = gcnew CodeTypeReference( bool::typeid );
- int itemIndex = -1;
- if ( collection->Contains( testReference ) )
- itemIndex = collection->IndexOf( testReference );
- //
-
- //
- // Copies the contents of the collection, beginning at index 0,
- // to the specified CodeTypeReference array.
- // 'references' is a CodeTypeReference array.
- collection->CopyTo( references, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CodeTypeReference at index 0 of the collection.
- collection->Insert( 0, gcnew CodeTypeReference( bool::typeid ) );
- //
-
- //
- // Removes the specified CodeTypeReference from the collection.
- CodeTypeReference^ reference = gcnew CodeTypeReference( bool::typeid );
- collection->Remove( reference );
- //
-
- //
- // Removes the CodeTypeReference at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
- };
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp
deleted file mode 100644
index a97b2b691ab..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-
-namespace CodeDomSamples
-{
- public ref class CodeVariableDeclarationStatementExample
- {
- public:
- CodeVariableDeclarationStatementExample()
- {
- //
- // Type of the variable to declare.
- // Name of the variable to declare.
- // Optional initExpression parameter initializes the variable.
- CodeVariableDeclarationStatement^ variableDeclaration = gcnew CodeVariableDeclarationStatement( String::typeid,"TestString",gcnew CodePrimitiveExpression( "Testing" ) );
-
- // A C# code generator produces the following source code for the preceeding example code:
- // string TestString = "Testing";
- //
- }
- };
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp
deleted file mode 100644
index 8a41cb9003d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-public ref class Class1
-{
-public:
- Class1(){}
-
- // CompilerErrorCollection
- void CompilerErrorCollectionExample()
- {
-
- //
- //
- // Creates an empty CompilerErrorCollection.
- CompilerErrorCollection^ collection = gcnew CompilerErrorCollection;
- //
-
- //
- // Adds a CompilerError to the collection.
- collection->Add( gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" ) );
- //
-
- //
- // Adds an array of CompilerError objects to the collection.
- array^errors = {gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ),gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" )};
- collection->AddRange( errors );
-
- // Adds a collection of CompilerError objects to the collection.
- CompilerErrorCollection^ errorsCollection = gcnew CompilerErrorCollection;
- errorsCollection->Add( gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) );
- errorsCollection->Add( gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) );
- collection->AddRange( errorsCollection );
- //
-
- //
- // Tests for the presence of a CompilerError in the
- // collection, and retrieves its index if it is found.
- CompilerError^ testError = gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" );
- int itemIndex = -1;
- if ( collection->Contains( testError ) )
- itemIndex = collection->IndexOf( testError );
- //
-
- //
- // Copies the contents of the collection, beginning at index 0,
- // to the specified CompilerError array.
- // 'errors' is a CompilerError array.
- collection->CopyTo( errors, 0 );
- //
-
- //
- // Retrieves the count of the items in the collection.
- int collectionCount = collection->Count;
- //
-
- //
- // Inserts a CompilerError at index 0 of the collection.
- collection->Insert( 0, gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) );
- //
-
- //
- // Removes the specified CompilerError from the collection.
- CompilerError^ error = gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" );
- collection->Remove( error );
- //
-
- //
- // Removes the CompilerError at index 0.
- collection->RemoveAt( 0 );
- //
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp
deleted file mode 100644
index 2ee1d38b759..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-// The following example builds a CodeDom source graph for a simple
-// Hello World program. The source is then saved to a file,
-// compiled into an executable, and run.
-
-// This example is based loosely on the CodeDom example, but its
-// primary intent is to illustrate the CompilerParameters class.
-
-// Notice that the snippet is conditionally compiled for Everett vs.
-// Whidbey builds. Whidbey introduced new APIs that are not available
-// in Everett. Snippet IDs do not overlap between Whidbey and Everett;
-// Snippet #1 is Everett, Snippet #2 is Whidbey.
-#using
-//
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Collections;
-using namespace System::ComponentModel;
-using namespace System::IO;
-using namespace System::Diagnostics;
-
-// Build a Hello World program graph using System.CodeDom types.
-static CodeCompileUnit^ BuildHelloWorldGraph()
-{
- // Create a new CodeCompileUnit to contain the program graph.
- CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit;
-
- // Declare a new namespace called Samples.
- CodeNamespace^ samples = gcnew CodeNamespace( "Samples" );
- // Add the new namespace to the compile unit.
- compileUnit->Namespaces->Add( samples );
-
- // Add the new namespace import for the System namespace.
- samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) );
-
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration( "Class1" );
- // Add the new type to the namespace's type collection.
- samples->Types->Add( class1 );
-
- // Declare a new code entry point method
- CodeEntryPointMethod^ start = gcnew CodeEntryPointMethod;
-
- // Create a type reference for the System::Console class.
- CodeTypeReferenceExpression^ csSystemConsoleType =
- gcnew CodeTypeReferenceExpression( "System.Console" );
-
- // Build a Console::WriteLine statement.
- CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression(
- csSystemConsoleType, "WriteLine",
- gcnew CodePrimitiveExpression( "Hello World!" ) );
-
- // Add the WriteLine call to the statement collection.
- start->Statements->Add( cs1 );
-
- // Build another Console::WriteLine statement.
- CodeMethodInvokeExpression^ cs2 = gcnew CodeMethodInvokeExpression(
- csSystemConsoleType, "WriteLine",
- gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) );
- // Add the WriteLine call to the statement collection.
- start->Statements->Add( cs2 );
-
- // Build a call to System::Console::ReadLine.
- CodeMethodReferenceExpression^ csReadLine = gcnew CodeMethodReferenceExpression(
- csSystemConsoleType, "ReadLine" );
- CodeMethodInvokeExpression^ cs3 = gcnew CodeMethodInvokeExpression(
- csReadLine,gcnew array(0) );
-
- // Add the ReadLine statement.
- start->Statements->Add( cs3 );
-
- // Add the code entry point method to the Members collection
- // of the type.
- class1->Members->Add( start );
-
- return compileUnit;
-}
-
-static String^ GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileunit )
-{
- // Build the source file name with the language extension (vb, cs, js).
- String^ sourceFile = String::Empty;
-
- if ( provider->FileExtension->StartsWith( "." ) )
- {
- sourceFile = String::Concat( "HelloWorld", provider->FileExtension );
- }
- else
- {
- sourceFile = String::Concat( "HelloWorld.", provider->FileExtension );
- }
-
- // Create a TextWriter to a StreamWriter to an output file.
- IndentedTextWriter^ tw = gcnew IndentedTextWriter(
- gcnew StreamWriter( sourceFile,false )," " );
- // Generate source code using the code generator.
- provider->GenerateCodeFromCompileUnit( compileunit, tw, gcnew CodeGeneratorOptions );
- // Close the output file.
- tw->Close();
- return sourceFile;
-}
-
-//
-static bool CompileCode( CodeDomProvider^ provider,
- String^ sourceFile,
- String^ exeFile )
-{
-
- CompilerParameters^ cp = gcnew CompilerParameters;
- if ( !cp)
- {
- return false;
- }
-
- // Generate an executable instead of
- // a class library.
- cp->GenerateExecutable = true;
-
- // Set the assembly file name to generate.
- cp->OutputAssembly = exeFile;
-
- // Generate debug information.
- cp->IncludeDebugInformation = true;
-
- // Add an assembly reference.
- cp->ReferencedAssemblies->Add( "System.dll" );
-
- // Save the assembly as a physical file.
- cp->GenerateInMemory = false;
-
- // Set the level at which the compiler
- // should start displaying warnings.
- cp->WarningLevel = 3;
-
- // Set whether to treat all warnings as errors.
- cp->TreatWarningsAsErrors = false;
-
- // Set compiler argument to optimize output.
- cp->CompilerOptions = "/optimize";
-
- // Set a temporary files collection.
- // The TempFileCollection stores the temporary files
- // generated during a build in the current directory,
- // and does not delete them after compilation.
- cp->TempFiles = gcnew TempFileCollection( ".",true );
-
- if ( provider->Supports( GeneratorSupport::EntryPointMethod ) )
- {
- // Specify the class that contains
- // the main method of the executable.
- cp->MainClass = "Samples.Class1";
- }
-
- if ( Directory::Exists( "Resources" ) )
- {
- if ( provider->Supports( GeneratorSupport::Resources ) )
- {
- // Set the embedded resource file of the assembly.
- // This is useful for culture-neutral resources,
- // or default (fallback) resources.
- cp->EmbeddedResources->Add( "Resources\\Default.resources" );
-
- // Set the linked resource reference files of the assembly.
- // These resources are included in separate assembly files,
- // typically localized for a specific language and culture.
- cp->LinkedResources->Add( "Resources\\nb-no.resources" );
- }
- }
-
- // Invoke compilation.
- CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile );
-
- if ( cr->Errors->Count > 0 )
- {
- // Display compilation errors.
- Console::WriteLine( "Errors building {0} into {1}",
- sourceFile, cr->PathToAssembly );
- for each ( CompilerError^ ce in cr->Errors )
- {
- Console::WriteLine( " {0}", ce->ToString() );
- Console::WriteLine();
- }
- }
- else
- {
- Console::WriteLine( "Source {0} built into {1} successfully.",
- sourceFile, cr->PathToAssembly );
- }
-
- // Return the results of compilation.
- if ( cr->Errors->Count > 0 )
- {
- return false;
- }
- else
- {
- return true;
- }
-}
-//
-
-[STAThread]
-void main()
-{
- String^ exeName = "HelloWorld.exe";
- CodeDomProvider^ provider = nullptr;
-
- Console::WriteLine( "Enter the source language for Hello World (cs, vb, etc):" );
- String^ inputLang = Console::ReadLine();
- Console::WriteLine();
-
- if ( CodeDomProvider::IsDefinedLanguage( inputLang ) )
- {
- CodeCompileUnit^ helloWorld = BuildHelloWorldGraph();
- provider = CodeDomProvider::CreateProvider( inputLang );
- if ( helloWorld && provider )
- {
- String^ sourceFile = GenerateCode( provider, helloWorld );
- Console::WriteLine( "HelloWorld source code generated." );
- if ( CompileCode( provider, sourceFile, exeName ) )
- {
- Console::WriteLine( "Starting HelloWorld executable." );
- Process::Start( exeName );
- }
- }
- }
-
- if ( provider == nullptr )
- {
- Console::WriteLine( "There is no CodeDomProvider for the input language." );
- }
-}
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp
deleted file mode 100644
index 89f9230ed7d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::Collections;
-using namespace System::Security::Permissions;
-
-public ref class Class1
-{
-public:
- Class1(){}
-
- //
- // Displays information from a CompilerResults.
- [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
- static void DisplayCompilerResults( System::CodeDom::Compiler::CompilerResults^ cr )
- {
-
- // If errors occurred during compilation, output the compiler output and errors.
- if ( cr->Errors->Count > 0 )
- {
- for ( int i = 0; i < cr->Output->Count; i++ )
- Console::WriteLine( cr->Output[ i ] );
- for ( int i = 0; i < cr->Errors->Count; i++ )
- Console::WriteLine( String::Concat( i, ": ", cr->Errors[ i ] ) );
- }
- else
- {
-
- // Display information ab->Item[Out] the* compiler's exit code and the generated assembly.
- Console::WriteLine( "Compiler returned with result code: {0}", cr->NativeCompilerReturnValue );
- Console::WriteLine( "Generated assembly name: {0}", cr->CompiledAssembly->FullName );
- if ( cr->PathToAssembly == nullptr )
- Console::WriteLine( "The assembly has been generated in memory." );
- else
- Console::WriteLine( "Path to assembly: {0}", cr->PathToAssembly );
-
- // Display temporary files information.
- if ( !cr->TempFiles->KeepFiles )
- Console::WriteLine( "Temporary build files were deleted." );
- else
- {
- Console::WriteLine( "Temporary build files were not deleted." );
-
- // Display a list of the temporary build files
- IEnumerator^ enu = cr->TempFiles->GetEnumerator();
- for ( int i = 0; enu->MoveNext(); i++ )
- Console::WriteLine("TempFile " + i.ToString() + ": " + (String^)(enu->Current) );
- }
- }
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp b/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp
deleted file mode 100644
index 3c72773fc05..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-// This sample takes a given input and replaces each
-// occurence of the tab character with 4 space characters.
-// It also takes two command-line arguements: input file name, & output file name.
-// Usage:
-// EXPANDTABS inputfile.txt outputfile.txt
-// System.Console.Read
-// System.Console.WriteLine
-// System.Console.Write
-// System.Console.SetIn
-// System.Console.SetOut
-// System.Console.Error
-// System.Console.Out
-//
-using namespace System;
-using namespace System::IO;
-
-void main()
-{
- const int tabSize = 4;
- array^args = Environment::GetCommandLineArgs();
- String^ usageText = "Usage: EXPANDTABSEX inputfile.txt outputfile.txt";
- StreamWriter^ writer = nullptr;
-
- if ( args->Length < 3 )
- {
- Console::WriteLine( usageText );
- return;
- }
-
- try
- {
- writer = gcnew StreamWriter( args[ 2 ] );
- Console::SetOut( writer );
- Console::SetIn( gcnew StreamReader( args[ 1 ] ) );
- }
- catch ( IOException^ e )
- {
- TextWriter^ errorWriter = Console::Error;
- errorWriter->WriteLine( e->Message );
- errorWriter->WriteLine( usageText );
- return;
- }
-
- int i;
- while ( (i = Console::Read()) != -1 )
- {
- Char c = (Char)i;
- if ( c == '\t' )
- Console::Write( ((String^)"")->PadRight( tabSize, ' ' ) );
- else
- Console::Write( c );
- }
-
- writer->Close();
-
- // Recover the standard output stream so that a
- // completion message can be displayed.
- StreamWriter^ standardOutput = gcnew StreamWriter(Console::OpenStandardOutput());
- standardOutput->AutoFlush = true;
- Console::SetOut(standardOutput);
- Console::WriteLine( "EXPANDTABSEX has completed the processing of {0}.", args[ 0 ] );
- return;
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp
deleted file mode 100644
index f1d7dc04657..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security::Cryptography;
-using namespace System::Text;
-using namespace System::IO;
-
-array^ EncryptTextToMemory(String^ text, array^ key, array^ iv);
-String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv);
-
-int main()
-{
- try
- {
- array^ key;
- array^ iv;
-
- // Create a new TripleDES object to generate a random key
- // and initialization vector (IV).
- {
- TripleDES^ tripleDes;
-
- try
- {
- tripleDes = TripleDES::Create();
- key = tripleDes->Key;
- iv = tripleDes->IV;
- }
- finally
- {
- delete tripleDes;
- }
- }
-
- // Create a string to encrypt.
- String^ original = "Here is some data to encrypt.";
-
- // Encrypt the string to an in-memory buffer.
- array^ encrypted = EncryptTextToMemory(original, key, iv);
-
- // Decrypt the buffer back to a string.
- String^ decrypted = DecryptTextFromMemory(encrypted, key, iv);
-
- // Display the decrypted string to the console.
- Console::WriteLine(decrypted);
- }
- catch (Exception^ e)
- {
- Console::WriteLine(e->Message);
- }
-}
-
-array^ EncryptTextToMemory(String^ text, array^ key, array^ iv)
-{
- MemoryStream^ mStream = nullptr;
-
- try
- {
- // Create a MemoryStream.
- mStream = gcnew MemoryStream;
-
- TripleDES^ tripleDes = nullptr;
- ICryptoTransform^ encryptor = nullptr;
- CryptoStream^ cStream = nullptr;
-
- try
- {
- // Create a new TripleDES object.
- tripleDes = TripleDES::Create();
- // Create a TripleDES encryptor from the key and IV
- encryptor = tripleDes->CreateEncryptor(key, iv);
- // Create a CryptoStream using the MemoryStream and encryptor
- cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write);
-
- // Convert the provided string to a byte array.
- array^ toEncrypt = Encoding::UTF8->GetBytes(text);
-
- // Write the byte array to the crypto stream.
- cStream->Write(toEncrypt, 0, toEncrypt->Length);
-
- // Disposing the CryptoStream completes the encryption and flushes the stream.
- delete cStream;
-
- // Get an array of bytes from the MemoryStream that holds the encrypted data.
- array^ ret = mStream->ToArray();
-
- // Return the encrypted buffer.
- return ret;
- }
- finally
- {
- if (cStream != nullptr)
- delete cStream;
-
- if (encryptor != nullptr)
- delete encryptor;
-
- if (tripleDes != nullptr)
- delete tripleDes;
- }
- }
- catch (CryptographicException^ e)
- {
- Console::WriteLine("A Cryptographic error occurred: {0}", e->Message);
- throw;
- }
- finally
- {
- if (mStream != nullptr)
- delete mStream;
- }
-}
-
-String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv)
-{
- MemoryStream^ mStream = nullptr;
- TripleDES^ tripleDes = nullptr;
- ICryptoTransform^ decryptor = nullptr;
- CryptoStream^ cStream = nullptr;
-
- try
- {
- // Create buffer to hold the decrypted data.
- // TripleDES-encrypted data will always be slightly bigger than the decrypted data.
- array^ decrypted = gcnew array(encrypted->Length);
- Int32 offset = 0;
-
- // Create a new MemoryStream using the provided array of encrypted data.
- mStream = gcnew MemoryStream(encrypted);
- // Create a new TripleDES object.
- tripleDes = TripleDES::Create();
- // Create a TripleDES decryptor from the key and IV
- decryptor = tripleDes->CreateDecryptor(key, iv);
- // Create a CryptoStream using the MemoryStream and decryptor
- cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read);
-
- // Keep reading from the CryptoStream until it finishes (returns 0).
- Int32 read = 1;
-
- while (read > 0)
- {
- read = cStream->Read(decrypted, offset, decrypted->Length - offset);
- offset += read;
- }
-
- // Convert the buffer into a string and return it.
- return Encoding::UTF8->GetString(decrypted, 0, offset);
- }
- catch (CryptographicException^ e)
- {
- Console::WriteLine("A Cryptographic error occurred: {0}", e->Message);
- throw;
- }
- finally
- {
- if (cStream != nullptr)
- delete cStream;
-
- if (decryptor != nullptr)
- delete decryptor;
-
- if (tripleDes != nullptr)
- delete tripleDes;
-
- if (mStream != nullptr)
- delete mStream;
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp
deleted file mode 100644
index e1bc418aedf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-using namespace System;
-
-int main()
-{
- // Addition operator
- //
- System::DateTime dTime( 1980, 8, 5 );
-
- // tSpan is 17 days, 4 hours, 2 minutes and 1 second.
- System::TimeSpan tSpan( 17, 4, 2, 1 );
-
- // Result gets 8/22/1980 4:02:01 AM.
- System::DateTime result = dTime + tSpan;
- //
-
- System::Console::WriteLine( result );
-
- // Equality operator.
- //
- System::DateTime april19( 2001, 4, 19 );
- System::DateTime otherDate( 1991, 6, 5 );
-
- // areEqual gets false.
- bool areEqual = april19 == otherDate;
-
- otherDate = DateTime( 2001, 4, 19 );
- // areEqual gets true.
- areEqual = april19 == otherDate;
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp
deleted file mode 100644
index 8d23921d77c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-using namespace System;
-
-int main()
-{
- //
- // Calculate what day of the week is 36 days from this instant.
- System::DateTime today = System::DateTime::Now;
- System::TimeSpan duration( 36, 0, 0, 0 );
- System::DateTime answer = today.Add( duration );
- System::Console::WriteLine( " {0:dddd}", answer );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp
deleted file mode 100644
index 0cd42a84a60..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-using namespace System;
-
-int main()
-{
- // Calculate what day of the week is 36 days from this instant.
- DateTime today = System::DateTime::Now;
- DateTime answer = today.AddDays( 36 );
- Console::WriteLine("Today: {0:dddd}", today);
- Console::WriteLine("36 days from today: {0:dddd}", answer);
-}
-// The example displays output like the following:
-// Today: Wednesday
-// 36 days from today: Thursday
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp
deleted file mode 100644
index 90e6be09498..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-using namespace System;
-void main()
-{
-
-
- System::DateTime theDay(System::DateTime::Today.Year,7,28);
- int compareValue;
- try
- {
- compareValue = theDay.CompareTo( System::DateTime::Today );
- }
- catch ( ArgumentException^ )
- {
- System::Console::WriteLine( "Value is not a DateTime" );
- return;
- }
-
- if ( compareValue < 0 )
- {
- System::Console::WriteLine( "{0:d} is in the past.", theDay );
- }
- else
- if ( compareValue == 0 )
- {
- System::Console::WriteLine( "{0:d} is today!", theDay );
- }
- else
- // compareValue > 0
- {
- System::Console::WriteLine( "{0:d} has not come yet.", theDay );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp
deleted file mode 100644
index 9c3486e2cfa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-// This example demonstrates the DateTime.DayOfWeek property
-using namespace System;
-int main()
-{
-
- // Assume the current culture is en-US.
- // Create a DateTime for the first of May, 2003.
- DateTime dt = DateTime(2003,5,1);
- Console::WriteLine( "Is Thursday the day of the week for {0:d}?: {1}", dt, dt.DayOfWeek == DayOfWeek::Thursday );
- Console::WriteLine( "The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek );
-}
-
-/*
-This example produces the following results:
-
-Is Thursday the day of the week for 5/1/2003?: True
-The day of the week for 5/1/2003 is Thursday.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp
deleted file mode 100644
index 4cd3cdc577f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-using namespace System;
-
-int main()
-{
- const int July = 7;
- const int Feb = 2;
-
- int daysInJuly = System::DateTime::DaysInMonth( 2001, July );
- Console::WriteLine(daysInJuly);
- // daysInFeb gets 28 because the year 1998 was not a leap year.
- int daysInFeb = System::DateTime::DaysInMonth( 1998, Feb );
- Console::WriteLine(daysInFeb);
- // daysInFebLeap gets 29 because the year 1996 was a leap year.
- int daysInFebLeap = System::DateTime::DaysInMonth( 1996, Feb );
- Console::WriteLine(daysInFebLeap);
-}
-// The example displays the following output:
-// 31
-// 28
-// 29
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp
deleted file mode 100644
index 3bccccac024..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-using namespace System;
-
-int main()
-{
- //
- System::DateTime today1 = System::DateTime(
- System::DateTime::Today.Ticks );
- System::DateTime today2 = System::DateTime(
- System::DateTime::Today.Ticks );
- System::DateTime tomorrow = System::DateTime(
- System::DateTime::Today.AddDays( 1 ).Ticks );
-
- // todayEqualsToday gets true.
- bool todayEqualsToday = System::DateTime::Equals( today1, today2 );
-
- // todayEqualsTomorrow gets false.
- bool todayEqualsTomorrow = System::DateTime::Equals( today1, tomorrow );
- //
-
- System::Console::WriteLine( todayEqualsToday );
- System::Console::WriteLine( todayEqualsTomorrow );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp
deleted file mode 100644
index 6e94f44f925..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-using namespace System;
-using namespace System::IO;
-
-// This function takes a file's creation time as an unsigned long,
-// and returns its age.
-//
-System::TimeSpan FileAge( long fileCreationTime )
-{
- System::DateTime now = System::DateTime::Now;
- try
- {
- System::DateTime fCreationTime =
- System::DateTime::FromFileTime( fileCreationTime );
- System::TimeSpan fileAge = now.Subtract( fCreationTime );
- return fileAge;
- }
- catch ( ArgumentOutOfRangeException^ )
- {
- // fileCreationTime is not valid, so re-throw the exception.
- throw;
- }
-}
-//
-
-void main()
-{
- System::Console::WriteLine( "Enter a file's path" );
- String^ filePath = System::Console::ReadLine();
- System::IO::FileInfo^ fInfo;
- try
- {
- fInfo = gcnew System::IO::FileInfo( filePath );
- }
- catch ( Exception^ )
- {
- System::Console::WriteLine( "Error opening {0}", filePath );
- return;
- }
-
- long fileTime = System::Convert::ToInt64(
- fInfo->CreationTime.ToFileTime() );
- System::TimeSpan fileAge = FileAge( fileTime );
- System::Console::WriteLine( " {0}", fileAge );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp
deleted file mode 100644
index 436ff3e6d0e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-using namespace System;
-
-int main()
-{
- //
- DateTime july28 = DateTime(2009, 7, 28, 5, 23, 15, 16);
- array^july28Formats = july28.GetDateTimeFormats();
-
- // Print [Out] july28* in all DateTime formats using the default culture.
- System::Collections::IEnumerator^ myEnum = july28Formats->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- String^ format = safe_cast(myEnum->Current);
- System::Console::WriteLine( format );
- }
- //
-
- //
- DateTime juil28 = DateTime(2009, 7, 28, 5, 23, 15, 16);
- IFormatProvider^ culture = gcnew System::Globalization::CultureInfo("fr-FR", true );
-
- // Get the short date formats using the S"fr-FR" culture.
- array^frenchJuly28Formats = juil28.GetDateTimeFormats(culture );
-
- // Print [Out] july28* in all DateTime formats using fr-FR culture.
- System::Collections::IEnumerator^ myEnum2 = frenchJuly28Formats->GetEnumerator();
- while ( myEnum2->MoveNext() )
- {
- String^ format = safe_cast(myEnum2->Current);
- System::Console::WriteLine(format );
- }
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp
deleted file mode 100644
index d3d290772b1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-using namespace System;
-
-int main()
-{
- //
- System::DateTime date1 = System::DateTime( 1996, 6, 3, 22, 15, 0 );
- System::DateTime date2 = System::DateTime( 1996, 12, 6, 13, 2, 0 );
- System::DateTime date3 = System::DateTime( 1996, 10, 12, 8, 42, 0 );
-
- // diff1 gets 185 days, 14 hours, and 47 minutes.
- System::TimeSpan diff1 = date2.Subtract( date1 );
-
- // date4 gets 4/9/1996 5:55:00 PM.
- System::DateTime date4 = date3.Subtract( diff1 );
-
- // diff2 gets 55 days 4 hours and 20 minutes.
- System::TimeSpan diff2 = date2 - date3;
-
- // date5 gets 4/9/1996 5:55:00 PM.
- System::DateTime date5 = date1 - diff2;
- //
-
- System::Console::WriteLine( diff1 );
- System::Console::WriteLine( date4 );
- System::Console::WriteLine( diff2 );
- System::Console::WriteLine( date4 );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp
deleted file mode 100644
index fd732ab14d0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-using namespace System;
-
-//
-int main()
-{
- System::Console::WriteLine( "Enter the file path:" );
- String^ filePath = System::Console::ReadLine();
- if ( System::IO::File::Exists( filePath ) )
- {
- System::DateTime fileCreationDateTime = System::IO::File::GetCreationTime( filePath );
- __int64 fileCreationFileTime = fileCreationDateTime.ToFileTime();
- System::Console::WriteLine( "{0} in file time is {1}.", fileCreationDateTime, fileCreationFileTime );
- }
- else
- {
- System::Console::WriteLine( "{0} is an invalid file", filePath );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp
deleted file mode 100644
index 9b140cbb13e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-using namespace System;
-
-void main()
-{
- Console::WriteLine("Enter a date and time.");
- String^ strDateTime = Console::ReadLine();
-
- DateTime localDateTime, univDateTime;
- try
- {
- localDateTime = DateTime::Parse(strDateTime);
- univDateTime = localDateTime.ToUniversalTime();
-
- Console::WriteLine("{0} local time is {1} universal time.",
- localDateTime, univDateTime );
- }
- catch (FormatException^)
- {
- Console::WriteLine("Invalid format.");
- return;
- }
-
- Console::WriteLine("Enter a date and time in universal time.");
- strDateTime = Console::ReadLine();
-
- try
- {
- univDateTime = DateTime::Parse(strDateTime);
- localDateTime = univDateTime.ToLocalTime();
-
- Console::WriteLine("{0} universal time is {1} local time.",
- univDateTime, localDateTime );
- }
- catch (FormatException^)
- {
- Console::WriteLine("Invalid format.");
- return;
- }
-}
-// The example displays output like the following when run on a
-// computer whose culture is en-US in the Pacific Standard Time zone:
-// Enter a date and time.
-// 12/10/2015 6:18 AM
-// 12/10/2015 6:18:00 AM local time is 12/10/2015 2:18:00 PM universal time.
-// Enter a date and time in universal time.
-// 12/20/2015 6:42:00
-// 12/20/2015 6:42:00 AM universal time is 12/19/2015 10:42:00 PM local time.
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp
deleted file mode 100644
index 1d76e0d1879..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-using namespace System;
-
-namespace Snippets
-{
-//
- ///
- /// Keeping my fortune in Decimals to avoid the round-off errors.
- ///
- public ref class PiggyBank
- {
- protected:
- Decimal MyFortune;
-
- public:
- void AddPenny()
- {
- MyFortune = System::Decimal::Add( MyFortune, Decimal(.01) );
- }
-
- System::Decimal Capacity()
- {
- return MyFortune.MaxValue;
- }
-
- Decimal Dollars()
- {
- return Decimal::Floor( MyFortune );
- }
-
- Decimal Cents()
- {
- return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) );
- }
-
- virtual System::String^ ToString() override
- {
- return MyFortune.ToString("C")+" in piggy bank";
- }
- };
-}
-//
-
-using namespace Snippets;
-int main( void )
-{
- PiggyBank ^ pb = gcnew PiggyBank;
- for ( Int32 i = 0; i < 378; i++ )
- {
- pb->AddPenny();
-
- }
- Console::WriteLine( pb );
-}
-
-
-namespace Snippets2
-{
- //
- public ref class PiggyBank
- {
- public:
- Decimal Capacity()
- {
- return MyFortune.MaxValue;
- }
-
- void AddPenny()
- {
- MyFortune = Decimal::Add(MyFortune, (Decimal).01);
- }
-
- protected:
- Decimal MyFortune;
- };
-
-}
-//
-
-namespace Snippets3
-{
- //
- public ref class PiggyBank
- {
- public:
- Decimal Dollars()
- {
- return Decimal::Floor( MyFortune );
- }
-
- void AddPenny()
- {
- MyFortune = Decimal::Add(MyFortune, (Decimal).01);
- }
-
- protected:
- Decimal MyFortune;
- };
-
-}
-//
-
-namespace Snippets4
-{
-//
- public ref class PiggyBank
- {
- public:
- Decimal Cents()
- {
- return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) );
- }
-
- void AddPenny()
- {
- MyFortune = Decimal::Add(MyFortune, (Decimal).01);
- }
-
- protected:
- Decimal MyFortune;
- };
-}
-//
-
-namespace Snippets5
-{
-//
- public ref class PiggyBank
- {
- public:
- void AddPenny()
- {
- MyFortune = Decimal::Add( MyFortune, (Decimal).01 );
- }
-
- virtual System::String^ ToString() override
- {
- return MyFortune.ToString("C")+" in piggy bank";
- }
-
- protected:
- Decimal MyFortune;
- };
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp
deleted file mode 100644
index e8b0c924c07..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define two classes to use in the demonstration, a base class and
-// a class that derives from it.
-//
-public ref class Base {};
-
-public ref class Derived : Base
-{
- // Define a static method to use in the demonstration. The method
- // takes an instance of Base and returns an instance of Derived.
- // For the purposes of the demonstration, it is not necessary for
- // the method to do anything useful.
- //
-public:
- static Derived^ MyMethod(Base^ arg)
- {
- Base^ dummy = arg;
- return gcnew Derived();
- }
-};
-
-// Define a delegate that takes an instance of Derived and returns an
-// instance of Base.
-//
-public delegate Base^ Example(Derived^ arg);
-
-void main()
-{
- // The binding flags needed to retrieve MyMethod.
- BindingFlags flags = BindingFlags::Public | BindingFlags::Static;
-
- // Get a MethodInfo that represents MyMethod.
- MethodInfo^ minfo = Derived::typeid->GetMethod("MyMethod", flags);
-
- // Demonstrate contravariance of parameter types and covariance
- // of return types by using the delegate Example to represent
- // MyMethod. The delegate binds to the method because the
- // parameter of the delegate is more restrictive than the
- // parameter of the method (that is, the delegate accepts an
- // instance of Derived, which can always be safely passed to
- // a parameter of type Base), and the return type of MyMethod
- // is more restrictive than the return type of Example (that
- // is, the method returns an instance of Derived, which can
- // always be safely cast to type Base).
- //
- Example^ ex =
- (Example^) Delegate::CreateDelegate(Example::typeid, minfo);
-
- // Execute MyMethod using the delegate Example.
- //
- Base^ b = ex(gcnew Derived());
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp
deleted file mode 100644
index 550cc864617..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Specify the directory you want to manipulate.
- String^ path = "c:\\MyDir";
- try
- {
-
- // Determine whether the directory exists.
- if ( Directory::Exists( path ) )
- {
- Console::WriteLine( "That path exists already." );
- return 0;
- }
-
- // Try to create the directory.
- DirectoryInfo^ di = Directory::CreateDirectory( path );
- Console::WriteLine( "The directory was created successfully at {0}.", Directory::GetCreationTime( path ) );
-
- // Delete the directory.
- di->Delete();
- Console::WriteLine( "The directory was deleted successfully." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp
deleted file mode 100644
index 95b5dde57f4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-using namespace System;
-using namespace System::Globalization;
-
-namespace Snippets
-{
- //
- // The Temperature class stores the temperature as a Double
- // and delegates most of the functionality to the Double
- // implementation.
- public ref class Temperature: public IComparable, public IFormattable
- {
- // IComparable.CompareTo implementation.
- public:
- virtual int CompareTo( Object^ obj )
- {
- if (obj == nullptr) return 1;
-
- if (dynamic_cast(obj) )
- {
- Temperature^ temp = (Temperature^)(obj);
- return m_value.CompareTo( temp->m_value );
- }
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
- // IFormattable.ToString implementation.
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr )
- {
- if ( format->Equals( "F" ) )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- if ( format->Equals( "C" ) )
- {
- return String::Format( "{0}'C", this->Celsius.ToString() );
- }
- }
- return m_value.ToString( format, provider );
- }
-
- // Parses the temperature from a string in the form
- // [ws][sign]digits['F|'C][ws]
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) )
- {
- temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) )
- {
- temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = Double::Parse( s, styles, provider );
- }
- return temp;
- }
-
- protected:
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
-
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
-
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
- //
-
- ref class Launcher
- {
- public:
- static void Main()
- {
- Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Float, nullptr );
- Console::WriteLine( t1->ToString( "F", nullptr ) );
-
- String^ str1 = t1->ToString( "C", nullptr );
- Console::WriteLine( str1 );
-
- Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Float, nullptr );
- Console::WriteLine( t2->ToString( "F", nullptr ) );
-
- Console::WriteLine( t1->CompareTo( t2 ) );
-
- Temperature^ t3 = Temperature::Parse( "20'C", NumberStyles::Float, nullptr );
- Console::WriteLine( t3->ToString( "F", nullptr ) );
-
- Console::WriteLine( t1->CompareTo( t3 ) );
-
- Console::ReadLine();
- }
- };
-}
-
-namespace Snippets2
-{
- //
- public ref class Temperature
- {
- public:
- static property double MinValue
- {
- double get()
- {
- return Double::MinValue;
- }
- }
-
- static property double MaxValue
- {
- double get()
- {
- return Double::MaxValue;
- }
- }
-
- protected:
- // The value holder
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
-//
-}
-
-namespace Snippets3
-{
- //
- public ref class Temperature: public IComparable
- {
- // IComparable.CompareTo implementation.
- public:
- virtual int CompareTo( Object^ obj )
- {
- if (obj == nullptr) return 1;
-
- if ( dynamic_cast(obj) )
- {
- Temperature^ temp = dynamic_cast(obj);
-
- return m_value.CompareTo( temp->m_value );
- }
-
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
- protected:
- // The value holder
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
-//
-}
-
-namespace Snippets4
-{
- //
- public ref class Temperature: public IFormattable
- {
- // IFormattable.ToString implementation.
- public:
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr )
- {
- if ( format->Equals( "F" ) )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- if ( format->Equals( "C" ) )
- {
- return String::Format( "{0}'C", this->Celsius.ToString() );
- }
- }
-
- return m_value.ToString( format, provider );
- }
-
- protected:
- // The value holder
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
-//
-}
-
-namespace Snippets5
-{
- //
- public ref class Temperature
- {
- // Parses the temperature from a string in form
- // [ws][sign]digits['F|'C][ws]
- public:
- static Temperature^ Parse( String^ s )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) )
- {
- temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) );
- }
- else
- if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) )
- {
- temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) );
- }
- else
- {
- temp->Value = Double::Parse( s );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
-//
-}
-
-namespace Snippets6
-{
- //
- public ref class Temperature
- {
- // Parses the temperature from a string in form
- // [ws][sign]digits['F|'C][ws]
- public:
- static Temperature^ Parse( String^ s, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) )
- {
- temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider );
- }
- else
- if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) )
- {
- temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider );
- }
- else
- {
- temp->Value = Double::Parse( s, provider );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
-//
-}
-
-namespace Snippets7
-{
- //
- public ref class Temperature
- {
- // Parses the temperature from a string in form
- // [ws][sign]digits['F|'C][ws]
- public:
- static Temperature^ Parse( String^ s, NumberStyles styles )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) )
- {
- temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles );
- }
- else
- if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) )
- {
- temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles );
- }
- else
- {
- temp->Value = Double::Parse( s, styles );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
-//
-}
-
-namespace Snippets8
-{
- //
- public ref class Temperature
- {
- // Parses the temperature from a string in the form
- // [ws][sign]digits['F|'C][ws]
- public:
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) )
- {
- temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) )
- {
- temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = Double::Parse( s, styles, provider );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- double m_value;
-
- public:
- property double Value
- {
- double get()
- {
- return m_value;
- }
- void set( double value )
- {
- m_value = value;
- }
- }
-
- property double Celsius
- {
- double get()
- {
- return (m_value - 32.0) / 1.8;
- }
- void set( double value )
- {
- m_value = 1.8 * value + 32.0;
- }
- }
- };
-//
-}
-
-int main()
-{
- Snippets::Launcher::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp
deleted file mode 100644
index 6ee946709cf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-using namespace System;
-
-public ref class MyBaseClass {};
-
-public ref class MyDerivedClass: MyBaseClass{};
-
-int main()
-{
- MyBaseClass^ myBase = gcnew MyBaseClass;
- MyDerivedClass^ myDerived = gcnew MyDerivedClass;
- Object^ o = myDerived;
- MyBaseClass^ b = myDerived;
- Console::WriteLine( "mybase: Type is {0}", myBase->GetType() );
- Console::WriteLine( "myDerived: Type is {0}", myDerived->GetType() );
- Console::WriteLine( "object o = myDerived: Type is {0}", o->GetType() );
- Console::WriteLine( "MyBaseClass b = myDerived: Type is {0}", b->GetType() );
-}
-
-/*
-
-This code produces the following output.
-
-mybase: Type is MyBaseClass
-myDerived: Type is MyDerivedClass
-object o = myDerived: Type is MyDerivedClass
-MyBaseClass b = myDerived: Type is MyDerivedClass
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp
deleted file mode 100644
index 994eab40042..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- Object^ o = nullptr;
- Object^ p = nullptr;
- Object^ q = gcnew Object;
- Console::WriteLine( Object::ReferenceEquals( o, p ) );
- p = q;
- Console::WriteLine( Object::ReferenceEquals( p, q ) );
- Console::WriteLine( Object::ReferenceEquals( o, p ) );
-}
-
-/*
-
-This code produces the following output.
-
-True
-True
-False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp
deleted file mode 100644
index 91579bc8326..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
- Console::WriteLine();
-
- // Invoke this sample with an arbitrary set of command line arguments.
- array^ arguments = Environment::GetCommandLineArgs();
- Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) );
-}
-/*
-This example produces output like the following:
-
- C:\>GetCommandLineArgs ARBITRARY TEXT
-
- GetCommandLineArgs: GetCommandLineArgs, ARBITRARY, TEXT
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp
deleted file mode 100644
index e99e9275e62..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Collections;
-
-int main()
-{
- Console::WriteLine( "GetEnvironmentVariables: " );
- for each (DictionaryEntry^ de in Environment::GetEnvironmentVariables())
- Console::WriteLine( " {0} = {1}", de->Key, de->Value );
-}
-// Output from the example is not shown, since it is:
-// Lengthy.
-// Specific to the machine on which the example is run.
-// May reveal information that should remain secure.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp
deleted file mode 100644
index 724d32024ff..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-// Sample for the Environment::GetFolderPath method
-using namespace System;
-int main()
-{
- Console::WriteLine();
- Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) );
-}
-
-/*
-This example produces the following results:
-
-GetFolderPath: C:\WINNT\System32
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp
deleted file mode 100644
index 214308f0a70..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-
-//
-// Sample for the Environment::GetLogicalDrives method
-using namespace System;
-int main()
-{
- Console::WriteLine();
- array^drives = Environment::GetLogicalDrives();
- Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) );
-}
-
-/*
-This example produces the following results:
-
-GetLogicalDrives: A:\, C:\, D:\
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp
deleted file mode 100644
index 344e571ae41..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-//
-// Sample for the Environment::MachineName property
-using namespace System;
-int main()
-{
- Console::WriteLine();
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "MachineName: {0}", Environment::MachineName );
-}
-
-/*
-This example produces the following results:
-(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".)
-
-MachineName: !---OMITTED---!
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp
deleted file mode 100644
index f1681245632..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//
-// Sample for the Environment::NewLine property
-using namespace System;
-
-int main()
-{
- Console::WriteLine();
- Console::WriteLine("NewLine: {0} first line {0} second line", Environment::NewLine);
-}
-
-/*
-This example produces the following results:
-
-NewLine:
-first line
-second line
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp
deleted file mode 100644
index b6f0511a800..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-//
-// Sample for the Environment::StackTrace property
-using namespace System;
-int main()
-{
- Console::WriteLine();
- Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace );
-}
-
-/*
-This example produces the following results:
-
-StackTrace: ' at System::Environment::GetStackTrace(Exception e)
-at System::Environment::GetStackTrace(Exception e)
-at System::Environment::get_StackTrace()
-at Sample::Main()'
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp
deleted file mode 100644
index 687b4f85405..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-// Sample for the Environment::SystemDirectory property
-using namespace System;
-int main()
-{
- Console::WriteLine();
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory );
-}
-
-/*
-This example produces the following results:
-
-SystemDirectory: C:\WINNT\System32
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp
deleted file mode 100644
index 009bcb3a1d1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-// Sample for the Environment::TickCount property
-// TickCount cycles between Int32::MinValue, which is a negative
-// number, and Int32::MaxValue once every 49.8 days. This sample
-// removes the sign bit to yield a nonnegative number that cycles
-// between zero and Int32::MaxValue once every 24.9 days.
-using namespace System;
-int main()
-{
- int result = Environment::TickCount & Int32::MaxValue;
- Console::WriteLine( "TickCount: {0}", result );
-}
-
-/*
-This example produces an output similar to the following:
-
-TickCount: 101931139
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp
deleted file mode 100644
index b3fe458162d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-// Sample for the Environment::UserInteractive property
-using namespace System;
-int main()
-{
- Console::WriteLine();
- Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive );
-}
-
-/*
-This example produces the following results:
-
-UserInteractive: True
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp
deleted file mode 100644
index 9fd924b3c30..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-// Sample for the Environment::UserName property
-using namespace System;
-int main()
-{
- Console::WriteLine();
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "UserName: {0}", Environment::UserName );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp
deleted file mode 100644
index cba784628bf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-
-//
-// Sample for the Environment::Version property
-using namespace System;
-int main()
-{
- Console::WriteLine();
- Console::WriteLine( "Version: {0}", Environment::Version );
-}
-
-/*
-This example produces the following results:
-(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".)
-
-Version: !---OMITTED---!
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp
deleted file mode 100644
index 10d59ac8fe5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-//
-// Sample for the Environment::WorkingSet property
-using namespace System;
-int main()
-{
- Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet );
-}
-
-/*
-This example produces the following results:
-
-WorkingSet: 5038080
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp b/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp
deleted file mode 100644
index c94bc78e16b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-using namespace System;
-
-public ref class TestClass{};
-
-int main()
-{
- TestClass^ test = gcnew TestClass;
- array
diff --git a/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp
deleted file mode 100644
index 44aa0f37782..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-//
-//
-using namespace System;
-using namespace System::Collections::Generic;
-using namespace System::Threading;
-
-namespace GCNotify
-{
- ref class Program
- {
- private:
- // Variable for continual checking in the
- // While loop in the WaitForFullGCProc method.
- static bool checkForNotify = false;
-
- // Variable for suspending work
- // (such servicing allocated server requests)
- // after a notification is received and then
- // resuming allocation after inducing a garbage collection.
- static bool bAllocate = false;
-
- // Variable for ending the example.
- static bool finalExit = false;
-
- // Collection for objects that
- // simulate the server request workload.
- static List^>^ load = gcnew List^>();
-
-
- public:
- static void Main()
- {
- try
- {
- // Register for a notification.
- GC::RegisterForFullGCNotification(10, 10);
- Console::WriteLine("Registered for GC notification.");
-
- checkForNotify = true;
- bAllocate = true;
-
- // Start a thread using WaitForFullGCProc.
- Thread^ thWaitForFullGC = gcnew Thread(gcnew ThreadStart(&WaitForFullGCProc));
- thWaitForFullGC->Start();
-
- // While the thread is checking for notifications in
- // WaitForFullGCProc, create objects to simulate a server workload.
- try
- {
- int lastCollCount = 0;
- int newCollCount = 0;
-
-
- while (true)
- {
- if (bAllocate)
- {
- load->Add(gcnew array(1000));
- newCollCount = GC::CollectionCount(2);
- if (newCollCount != lastCollCount)
- {
- // Show collection count when it increases:
- Console::WriteLine("Gen 2 collection count: {0}", GC::CollectionCount(2).ToString());
- lastCollCount = newCollCount;
- }
-
- // For ending the example (arbitrary).
- if (newCollCount == 500)
- {
- finalExit = true;
- checkForNotify = false;
- break;
- }
- }
- }
-
- }
- catch (OutOfMemoryException^)
- {
- Console::WriteLine("Out of memory.");
- }
-
-
- //
- finalExit = true;
- checkForNotify = false;
- GC::CancelFullGCNotification();
- //
-
- }
- catch (InvalidOperationException^ invalidOp)
- {
-
- Console::WriteLine("GC Notifications are not supported while concurrent GC is enabled.\n"
- + invalidOp->Message);
- }
- }
-
- //
- public:
- static void OnFullGCApproachNotify()
- {
- Console::WriteLine("Redirecting requests.");
-
- // Method that tells the request queuing
- // server to not direct requests to this server.
- RedirectRequests();
-
- // Method that provides time to
- // finish processing pending requests.
- FinishExistingRequests();
-
- // This is a good time to induce a GC collection
- // because the runtime will induce a full GC soon.
- // To be very careful, you can check precede with a
- // check of the GC.GCCollectionCount to make sure
- // a full GC did not already occur since last notified.
- GC::Collect();
- Console::WriteLine("Induced a collection.");
-
- }
- //
-
-
- //
- public:
- static void OnFullGCCompleteEndNotify()
- {
- // Method that informs the request queuing server
- // that this server is ready to accept requests again.
- AcceptRequests();
- Console::WriteLine("Accepting requests again.");
- }
- //
-
- //
- public:
- static void WaitForFullGCProc()
- {
- while (true)
- {
- // CheckForNotify is set to true and false in Main.
- while (checkForNotify)
- {
- //
- // Check for a notification of an approaching collection.
- GCNotificationStatus s = GC::WaitForFullGCApproach();
- if (s == GCNotificationStatus::Succeeded)
- {
- Console::WriteLine("GC Notifiction raised.");
- OnFullGCApproachNotify();
- }
- else if (s == GCNotificationStatus::Canceled)
- {
- Console::WriteLine("GC Notification cancelled.");
- break;
- }
- else
- {
- // This can occur if a timeout period
- // is specified for WaitForFullGCApproach(Timeout)
- // or WaitForFullGCComplete(Timeout)
- // and the time out period has elapsed.
- Console::WriteLine("GC Notification not applicable.");
- break;
- }
- //
-
- //
- // Check for a notification of a completed collection.
- s = GC::WaitForFullGCComplete();
- if (s == GCNotificationStatus::Succeeded)
- {
- Console::WriteLine("GC Notification raised.");
- OnFullGCCompleteEndNotify();
- }
- else if (s == GCNotificationStatus::Canceled)
- {
- Console::WriteLine("GC Notification cancelled.");
- break;
- }
- else
- {
- // Could be a time out.
- Console::WriteLine("GC Notification not applicable.");
- break;
- }
- //
- }
-
-
- Thread::Sleep(500);
- // FinalExit is set to true right before
- // the main thread cancelled notification.
- if (finalExit)
- {
- break;
- }
- }
- }
- //
-
- //
- private:
- static void RedirectRequests()
- {
- // Code that sends requests
- // to other servers.
-
- // Suspend work.
- bAllocate = false;
-
- }
-
- static void FinishExistingRequests()
- {
- // Code that waits a period of time
- // for pending requests to finish.
-
- // Clear the simulated workload.
- load->Clear();
-
- }
-
- static void AcceptRequests()
- {
- // Code that resumes processing
- // requests on this server.
-
- // Resume work.
- bAllocate = true;
- }
- //
- };
-}
-
-int main()
-{
- GCNotify::Program::Main();
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp
deleted file mode 100644
index d3c27fc9117..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-[assembly:AssemblyTitle("CustAttrs1CPP")];
-[assembly:AssemblyDescription("GetCustomAttributes() Demo")];
-[assembly:AssemblyCompany("Microsoft")];
-
-ref class Example
-{};
-
-static void main()
-{
- Type^ clsType = Example::typeid;
-
- // Get the Assembly type to access its metadata.
- Assembly^ assy = clsType->Assembly;
-
- // Iterate through the attributes for the assembly.
- System::Collections::IEnumerator^ myEnum = Attribute::GetCustomAttributes( assy )->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Attribute^ attr = safe_cast(myEnum->Current);
-
- // Check for the AssemblyTitle attribute.
- if ( attr->GetType() == AssemblyTitleAttribute::typeid )
- Console::WriteLine( "Assembly title is \"{0}\".", (dynamic_cast(attr))->Title );
- // Check for the AssemblyDescription attribute.
- else
- // Check for the AssemblyDescription attribute.
- if ( attr->GetType() == AssemblyDescriptionAttribute::typeid )
- Console::WriteLine( "Assembly description is \"{0}\".", (dynamic_cast(attr))->Description );
- // Check for the AssemblyCompany attribute.
- else if ( attr->GetType() == AssemblyCompanyAttribute::typeid )
- Console::WriteLine( "Assembly company is {0}.", (dynamic_cast(attr))->Company );
- }
-}
-// The example displays the following output:
-// Assembly description is "GetCustomAttributes() Demo".
-// Assembly company is Microsoft.
-// Assembly title is "CustAttrs1CPP".
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp
deleted file mode 100644
index 1756e0d976f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::ComponentModel;
-
-// Assign some attributes to the module.
-// Set the module's CLSCompliant attribute to false
-// The CLSCompliant attribute is applicable for /target:module.
-[module:Description("A sample description")];
-[module:CLSCompliant(false)];
-namespace CustAttrs2CS
-{
- ref class DemoClass
- {
- public:
- static void Main()
- {
- Type^ clsType = DemoClass::typeid;
-
- // Get the Module type to access its metadata.
- Module^ module = clsType->Module;
-
- // Iterate through all the attributes for the module.
- System::Collections::IEnumerator^ myEnum1 = Attribute::GetCustomAttributes( module )->GetEnumerator();
- while ( myEnum1->MoveNext() )
- {
- Attribute^ attr = safe_cast(myEnum1->Current);
-
- // Check for the Description attribute.
- if ( attr->GetType() == DescriptionAttribute::typeid )
- Console::WriteLine( "Module {0} has the description \"{1}\".", module->Name, (dynamic_cast(attr))->Description );
- // Check for the CLSCompliant attribute.
- else
-
- // Check for the CLSCompliant attribute.
- if ( attr->GetType() == CLSCompliantAttribute::typeid )
- Console::WriteLine( "Module {0} {1} CLSCompliant.", module->Name, (dynamic_cast(attr))->IsCompliant ? (String^)"is" : "is not" );
- }
- }
- };
-}
-
-
-/*
- * Output:
- * Module CustAttrs2CS.exe is not CLSCompliant.
- * Module CustAttrs2CS.exe has the description "A sample description".
- */
-//
-//
-using namespace System;
-using namespace System::Runtime::InteropServices;
-
-namespace CustAttrs3CS
-{
- // Set a GUID and ProgId attribute for this class.
-
- [Guid("BF235B41-52D1-46CC-9C55-046793DB363F")]
- [ProgId("CustAttrs3CS.ClassWithGuidAndProgId")]
- public ref class ClassWithGuidAndProgId{};
-
- ref class DemoClass
- {
- public:
- static void Main()
- {
- // Get the Class type to access its metadata.
- Type^ clsType = ClassWithGuidAndProgId::typeid;
-
- // Iterate through all the attributes for the class.
- System::Collections::IEnumerator^ myEnum2 = Attribute::GetCustomAttributes( clsType )->GetEnumerator();
- while ( myEnum2->MoveNext() )
- {
- Attribute^ attr = safe_cast(myEnum2->Current);
-
- // Check for the Guid attribute.
- if ( attr->GetType() == GuidAttribute::typeid )
- {
- // Display the GUID.
- Console::WriteLine( "Class {0} has a GUID.", clsType->Name );
- Console::WriteLine( "GUID: {{0}}.", (dynamic_cast(attr))->Value );
- }
- // Check for the ProgId attribute.
- else
-
- // Check for the ProgId attribute.
- if ( attr->GetType() == ProgIdAttribute::typeid )
- {
- // Display the ProgId.
- Console::WriteLine( "Class {0} has a ProgId.", clsType->Name );
- Console::WriteLine( "ProgId: \"{0}\".", (dynamic_cast(attr))->Value );
- }
- }
- }
- };
-}
-
-
-/*
- * Output:
- * Class ClassWithGuidAndProgId has a GUID.
- * GUID: {BF235B41-52D1-46CC-9C55-046793DB363F}.
- * Class ClassWithGuidAndProgId has a ProgId.
- * ProgId: "CustAttrs3CS.ClassWithGuidAndProgId".
- */
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-using namespace System::Runtime::InteropServices;
-
-namespace CustAttrs4CS
-{
- // Create a class for Win32 imported unmanaged functions.
- public ref class Win32
- {
- public:
-
- [DllImport("user32.dll", CharSet = CharSet::Unicode)]
- static int MessageBox( int hWnd, String^ text, String^ caption, UInt32 type );
- };
-
- public ref class AClass
- {
- public:
-
- // Add some attributes to the Win32CallMethod.
-
- [Obsolete("This method is obsolete. Use managed MsgBox instead.")]
- void Win32CallMethod()
- {
- Win32::MessageBox( 0, "This is an unmanaged call.", "Be Careful!", 0 );
- }
-
- };
-
- ref class DemoClass
- {
- public:
- static void Main()
- {
- // Get the Class type to access its metadata.
- Type^ clsType = AClass::typeid;
-
- // Get the type information for the Win32CallMethod.
- MethodInfo^ mInfo = clsType->GetMethod( "Win32CallMethod" );
- if ( mInfo != nullptr )
- {
- // Iterate through all the attributes for the method.
- System::Collections::IEnumerator^ myEnum3 = Attribute::GetCustomAttributes( mInfo )->GetEnumerator();
- while ( myEnum3->MoveNext() )
- {
- Attribute^ attr = safe_cast(myEnum3->Current);
-
- // Check for the Obsolete attribute.
- if ( attr->GetType() == ObsoleteAttribute::typeid )
- {
- Console::WriteLine( "Method {0} is obsolete. "
- "The message is:", mInfo->Name );
- Console::WriteLine( (dynamic_cast(attr))->Message );
- }
- // Check for the SuppressUnmanagedCodeSecurity attribute.
- else
-
- // Check for the SuppressUnmanagedCodeSecurity attribute.
- if ( attr->GetType() == SuppressUnmanagedCodeSecurityAttribute::typeid )
- {
- Console::WriteLine( "This method calls unmanaged code "
- "with no security check." );
- Console::WriteLine( "Please do not use unless absolutely necessary." );
- AClass^ myCls = gcnew AClass;
- myCls->Win32CallMethod();
- }
- }
- }
- }
- };
-}
-
-
-/*
- * Output:
- * Method Win32CallMethod is obsolete. The message is:
- * This method is obsolete. Use managed MsgBox instead.
- * This method calls unmanaged code with no security check.
- * Please do not use unless absolutely necessary.
- */
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::ComponentModel;
-
-namespace CustAttrs5CS
-{
- public ref class AClass
- {
- public:
- void ParamArrayAndDesc(
- // Add ParamArray and Description attributes.
- [Description("This argument is a ParamArray")]
- array^args )
- {}
- };
-
- ref class DemoClass
- {
- public:
- static void Main()
- {
- // Get the Class type to access its metadata.
- Type^ clsType = AClass::typeid;
-
- // Get the type information for the method.
- MethodInfo^ mInfo = clsType->GetMethod( "ParamArrayAndDesc" );
- if ( mInfo != nullptr )
- {
- // Get the parameter information.
- array^pInfo = mInfo->GetParameters();
- if ( pInfo != nullptr )
- {
- // Iterate through all the attributes for the parameter.
- System::Collections::IEnumerator^ myEnum4 = Attribute::GetCustomAttributes( pInfo[ 0 ] )->GetEnumerator();
- while ( myEnum4->MoveNext() )
- {
- Attribute^ attr = safe_cast(myEnum4->Current);
-
- // Check for the ParamArray attribute.
- if ( attr->GetType() == ParamArrayAttribute::typeid )
- Console::WriteLine( "Parameter {0} for method {1} "
- "has the ParamArray attribute.", pInfo[ 0 ]->Name, mInfo->Name );
- // Check for the Description attribute.
- else
-
- // Check for the Description attribute.
- if ( attr->GetType() == DescriptionAttribute::typeid )
- {
- Console::WriteLine( "Parameter {0} for method {1} "
- "has a description attribute.", pInfo[ 0 ]->Name, mInfo->Name );
- Console::WriteLine( "The description is: \"{0}\"", (dynamic_cast(attr))->Description );
- }
- }
- }
- }
- }
- };
-}
-
-/*
- * Output:
- * Parameter args for method ParamArrayAndDesc has the ParamArray attribute.
- * Parameter args for method ParamArrayAndDesc has a description attribute.
- * The description is: "This argument is a ParamArray"
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp
deleted file mode 100644
index b421c5517db..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// IComparableExample.cpp : main project file.
-
-//
-using namespace System;
-using namespace System::Collections;
-
-public ref class Temperature: public IComparable {
- ///
- /// IComparable.CompareTo implementation.
- ///
-protected:
- // The value holder
- Double m_value;
-
-public:
- virtual Int32 CompareTo( Object^ obj ) {
-
- if (obj == nullptr) return 1;
-
- if ( obj->GetType() == Temperature::typeid ) {
- Temperature^ temp = dynamic_cast(obj);
-
- return m_value.CompareTo( temp->m_value );
- }
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
- property Double Value {
- Double get() {
- return m_value;
- }
- void set( Double value ) {
- m_value = value;
- }
- }
-
- property Double Celsius {
- Double get() {
- return (m_value - 32) / 1.8;
- }
- void set( Double value ) {
- m_value = (value * 1.8) + 32;
- }
- }
-};
-
-int main()
-{
- ArrayList^ temperatures = gcnew ArrayList;
- // Initialize random number generator.
- Random^ rnd = gcnew Random;
-
- // Generate 10 temperatures between 0 and 100 randomly.
- for (int ctr = 1; ctr <= 10; ctr++)
- {
- int degrees = rnd->Next(0, 100);
- Temperature^ temp = gcnew Temperature;
- temp->Value = degrees;
- temperatures->Add(temp);
- }
-
- // Sort ArrayList.
- temperatures->Sort();
-
- for each (Temperature^ temp in temperatures)
- Console::WriteLine(temp->Value);
- return 0;
-}
-// The example displays the following output to the console (individual
-// values may vary because they are randomly generated):
-// 2
-// 7
-// 16
-// 17
-// 31
-// 37
-// 58
-// 66
-// 72
-// 95
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp
deleted file mode 100644
index 8c4f0f164e3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class Temperature: public IComparable {
-
-protected:
- // The underlying temperature value.
- Double m_value;
-
-public:
- // Implement the generic CompareTo method with the Temperature class
- // as the Type parameter.
- virtual Int32 CompareTo( Temperature^ other ) {
-
- // If other is not a valid object reference, this instance
- // is greater.
- if (other == nullptr) return 1;
-
- // The temperature comparison depends on the comparison of the
- // the underlying Double values.
- return m_value.CompareTo( other->m_value );
- }
-
- // Define the is greater than operator.
- bool operator>= (Temperature^ other)
- {
- return CompareTo(other) >= 0;
- }
-
- // Define the is less than operator.
- bool operator< (Temperature^ other)
- {
- return CompareTo(other) < 0;
- }
-
- // Define the is greater than or equal to operator.
- bool operator> (Temperature^ other)
- {
- return CompareTo(other) > 0;
- }
-
- // Define the is less than or equal to operator.
- bool operator<= (Temperature^ other)
- {
- return CompareTo(other) <= 0;
- }
-
- property Double Celsius {
- Double get() {
- return m_value + 273.15;
- }
- }
-
- property Double Kelvin {
- Double get() {
- return m_value;
- }
- void set( Double value ) {
- if (value < 0)
- throw gcnew ArgumentException("Temperature cannot be less than absolute zero.");
- else
- m_value = value;
- }
- }
-
- Temperature(Double kelvins) {
- this->Kelvin = kelvins;
- }
-};
-
-int main() {
- SortedList^ temps =
- gcnew SortedList();
-
- // Add entries to the sorted list, out of order.
- temps->Add(gcnew Temperature(2017.15), "Boiling point of Lead");
- temps->Add(gcnew Temperature(0), "Absolute zero");
- temps->Add(gcnew Temperature(273.15), "Freezing point of water");
- temps->Add(gcnew Temperature(5100.15), "Boiling point of Carbon");
- temps->Add(gcnew Temperature(373.15), "Boiling point of water");
- temps->Add(gcnew Temperature(600.65), "Melting point of Lead");
-
- for each( KeyValuePair^ kvp in temps )
- {
- Console::WriteLine("{0} is {1} degrees Celsius.", kvp->Value, kvp->Key->Celsius);
- }
-}
-/* The example displays the following output:
- Absolute zero is 273.15 degrees Celsius.
- Freezing point of water is 546.3 degrees Celsius.
- Boiling point of water is 646.3 degrees Celsius.
- Melting point of Lead is 873.8 degrees Celsius.
- Boiling point of Lead is 2290.3 degrees Celsius.
- Boiling point of Carbon is 5373.3 degrees Celsius.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp
deleted file mode 100644
index 5bd01722472..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Security::AccessControl;
-
-// Adds an ACL entry on the specified file for the specified account.
-
-void AddFileSecurity(String^ fileName, String^ account,
- FileSystemRights rights, AccessControlType controlType)
-{
- // Get a FileSecurity object that represents the
- // current security settings.
- FileSecurity^ fSecurity = File::GetAccessControl(fileName);
-
- // Add the FileSystemAccessRule to the security settings.
- fSecurity->AddAccessRule(gcnew FileSystemAccessRule
- (account,rights, controlType));
-
- // Set the new access settings.
- File::SetAccessControl(fileName, fSecurity);
-}
-
-// Removes an ACL entry on the specified file for the specified account.
-
-void RemoveFileSecurity(String^ fileName, String^ account,
- FileSystemRights rights, AccessControlType controlType)
-{
-
- // Get a FileSecurity object that represents the
- // current security settings.
- FileSecurity^ fSecurity = File::GetAccessControl(fileName);
-
- // Remove the FileSystemAccessRule from the security settings.
- fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule
- (account,rights, controlType));
-
- // Set the new access settings.
- File::SetAccessControl(fileName, fSecurity);
-}
-
-int main()
-{
- try
- {
- String^ fileName = "test.xml";
-
- Console::WriteLine("Adding access control entry for " + fileName);
-
- // Add the access control entry to the file.
- AddFileSecurity(fileName, "MYDOMAIN\\MyAccount",
- FileSystemRights::ReadData, AccessControlType::Allow);
-
- Console::WriteLine("Removing access control entry from " + fileName);
-
- // Remove the access control entry from the file.
- RemoveFileSecurity(fileName, "MYDOMAIN\\MyAccount",
- FileSystemRights::ReadData, AccessControlType::Allow);
-
- Console::WriteLine("Done.");
- }
- catch (Exception^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp
deleted file mode 100644
index f485421aac8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-
-//System::Runtime::InteropServices::IDispatchImplAttribute*
-//System::Runtime::InteropServices::IDispatchImplType*
-//
-using namespace System;
-using namespace System::Runtime::InteropServices;
-
-// by default all classes in this assembly will use COM implementaion
-// // But this class will use runtime implementaion
-
-[assembly:IDispatchImpl(IDispatchImplType::CompatibleImpl)];
-[IDispatchImpl(IDispatchImplType::InternalImpl)]
-ref class MyClass{};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp b/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp
deleted file mode 100644
index b75ca626687..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-//
-using namespace System;
-
-public ref class AppException: public Exception
-{
-public:
- AppException(String^ message ) : Exception(message)
- {}
-
- AppException(String^ message, Exception^ inner) : Exception(message, inner)
- {}
-};
-
-public ref class Example
-{
-public:
- void ThrowInner()
- {
- throw gcnew AppException("Exception in ThrowInner method.");
- }
-
- void CatchInner()
- {
- try {
- this->ThrowInner();
- }
- catch (AppException^ e) {
- throw gcnew AppException("Error in CatchInner caused by calling the ThrowInner method.", e);
- }
- }
-};
-
-int main()
-{
- Example^ ex = gcnew Example();
- try {
- ex->CatchInner();
- }
- catch (AppException^ e) {
- Console::WriteLine("In catch block of Main method.");
- Console::WriteLine("Caught: {0}", e->Message);
- if (e->InnerException != nullptr)
- Console::WriteLine("Inner exception: {0}", e->InnerException);
- }
-}
-// The example displays the following output:
-// In catch block of Main method.
-// Caught: Error in CatchInner caused by calling the ThrowInner method.
-// Inner exception: AppException: Exception in ThrowInner method.
-// at Example.ThrowInner()
-// at Example.CatchInner()
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp
deleted file mode 100644
index 0d107fe1e0e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-
-// System::Int16::Equals(Object)
-/*
-The following program demonstrates the 'Equals(Object)' method
-of struct 'Int16'. This compares an instance of 'Int16' with the
-passed in Object* and returns true if they are equal.
-*/
-using namespace System;
-int main()
-{
- try
- {
-
- //
- Int16 myVariable1 = 20;
- Int16 myVariable2 = 20;
-
- // Get and display the declaring type.
- Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 );
- Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 );
-
- // Compare 'myVariable1' instance with 'myVariable2' Object.
- if ( myVariable1.Equals( myVariable2 ) )
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" );
- else
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" );
-
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
-
-/* expected return values:
-20'F
--6'C
-20'F
-0
-72'F
--52
-*/
-/*
-namespace Snippets2 {
- //
-
- public __gc class Temperature {
- // The value holder
- protected:
- short m_value;
-
- public:
- __property static short get_MinValue() {
- return Int16.MinValue;
- }
-
- __property static short get_MaxValue() {
- return Int16.MaxValue;
- }
-
- __property short get_Value(){
- return m_value;
- }
- __property void set_Value( short value){
- m_value = value;
- }
-
- __property short get_Celsius(){
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value){
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-
-namespace Snippets3 {
- //
- public __gc class Temperature : IComparable {
- ///
- /// IComparable.CompareTo implementation.
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- Int32 CompareTo(Object* obj) {
- if(obj->GetType() == __typeof(Temperature)) {
- Temperature temp = dynamic_cast(obj);
- return m_value.CompareTo(temp.m_value);
- }
-
- throw new ArgumentException("object is not a Temperature");
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( Int32 value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-
-namespace Snippets4 {
- //
- public __gc class Temperature : IFormattable {
- ///
- /// IFormattable.ToString implementation.
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- String* ToString(String* format, IFormatProvider provider) {
- if( format != NULL ) {
- if( format->Equals("F") ) {
- return String::Format("{0}'F", this->Value->ToString());
- }
- if( format->Equals("C") ) {
- return String::Format("{0}'C", this->Celsius->ToString());
- }
- }
-
- return m_value->ToString(format, provider);
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets5 {
- //
- public __gc class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) );
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) );
- }
- else {
- temp->Value = Int16::Parse(s);
- }
- }
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- }
- //
-}
-namespace Snippets6 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, IFormatProvider provider) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider);
- }
- else {
- temp->Value = Int16::Parse(s, provider);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets7 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, NumberStyles styles) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles);
- }
- else {
- temp->Value = Int16::Parse(s, styles);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets8 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider);
- }
- else {
- temp->Value = Int16::Parse(s, styles, provider);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp
deleted file mode 100644
index a5199f2b75d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-
-// System::Int32::Equals(Object)
-/*
-The following program demonstrates the 'Equals(Object)' method
-of struct 'Int32'. This compares an instance of 'Int32' with the
-passed in object and returns true if they are equal.
-*/
-using namespace System;
-int main()
-{
- try
- {
-
- //
- Int32 myVariable1 = 60;
- Int32 myVariable2 = 60;
-
- // Get and display the declaring type.
- Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 );
- Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 );
-
- // Compare 'myVariable1' instance with 'myVariable2' Object.
- if ( myVariable1.Equals( myVariable2 ) )
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" );
- else
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" );
-
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
-
-/* expected return values:
-20'F
--6'C
-20'F
-0
-72'F
--52
-*/
-/*
-namespace Snippets2 {
- //
-
- public __gc class Temperature {
- // The value holder
- protected:
- short m_value;
-
- public:
- __property static short get_MinValue() {
- return Int32.MinValue;
- }
-
- __property static short get_MaxValue() {
- return Int32.MaxValue;
- }
-
- __property short get_Value(){
- return m_value;
- }
- __property void set_Value( short value){
- m_value = value;
- }
-
- __property short get_Celsius(){
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value){
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-
-namespace Snippets3 {
- //
- public __gc class Temperature : IComparable {
- ///
- /// IComparable.CompareTo implementation.
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- Int32 CompareTo(Object* obj) {
- if(obj->GetType() == __typeof(Temperature)) {
- Temperature temp = dynamic_cast(obj);
- return m_value.CompareTo(temp.m_value);
- }
-
- throw new ArgumentException("object is not a Temperature");
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( Int32 value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-
-namespace Snippets4 {
- //
- public __gc class Temperature : IFormattable {
- ///
- /// IFormattable.ToString implementation.
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- String* ToString(String* format, IFormatProvider provider) {
- if( format != NULL ) {
- if( format->Equals("F") ) {
- return String::Format("{0}'F", this->Value->ToString());
- }
- if( format->Equals("C") ) {
- return String::Format("{0}'C", this->Celsius->ToString());
- }
- }
-
- return m_value->ToString(format, provider);
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets5 {
- //
- public __gc class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) );
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) );
- }
- else {
- temp->Value = Int32::Parse(s);
- }
- }
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- }
- //
-}
-namespace Snippets6 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, IFormatProvider provider) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider);
- }
- else {
- temp->Value = Int32::Parse(s, provider);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets7 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, NumberStyles styles) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles);
- }
- else {
- temp->Value = Int32::Parse(s, styles);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets8 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider);
- }
- else {
- temp->Value = Int32::Parse(s, styles, provider);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp
deleted file mode 100644
index b4f54b5d004..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-
-// System::Int64::Equals(Object)
-/*
-The following program demonstrates the 'Equals(Object)' method
-of struct 'Int64'. This compares an instance of 'Int64' with the
-passed in Object and returns true if they are equal.
-*/
-using namespace System;
-int main()
-{
- try
- {
-
- //
- Int64 myVariable1 = 80;
- Int64 myVariable2 = 80;
-
- // Get and display the declaring type.
- Console::WriteLine( "\nType of 'myVariable1' is ' {0}' and value is : {1}", myVariable1.GetType(), myVariable1 );
- Console::WriteLine( "Type of 'myVariable2' is ' {0}' and value is : {1}", myVariable2.GetType(), myVariable2 );
-
- // Compare 'myVariable1' instance with 'myVariable2' Object.
- if ( myVariable1.Equals( myVariable2 ) )
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" );
- else
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" );
-
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
-
-/* expected return values:
-20'F
--6'C
-20'F
-0
-72'F
--52
-*/
-/*
-namespace Snippets2 {
- //
-
- public __gc class Temperature {
- // The value holder
- protected:
- short m_value;
-
- public:
- __property static short get_MinValue() {
- return Int64.MinValue;
- }
-
- __property static short get_MaxValue() {
- return Int64.MaxValue;
- }
-
- __property short get_Value(){
- return m_value;
- }
- __property void set_Value( short value){
- m_value = value;
- }
-
- __property short get_Celsius(){
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value){
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-
-namespace Snippets3 {
- //
- public __gc class Temperature : IComparable {
- ///
- /// IComparable.CompareTo implementation.
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- Int64 CompareTo(Object* obj) {
- if(obj->GetType() == __typeof(Temperature)) {
- Temperature temp = dynamic_cast(obj);
- return m_value.CompareTo(temp.m_value);
- }
-
- throw new ArgumentException("object is not a Temperature");
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( Int64 value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-
-namespace Snippets4 {
- //
- public __gc class Temperature : IFormattable {
- ///
- /// IFormattable.ToString implementation.
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- String* ToString(String* format, IFormatProvider provider) {
- if( format != NULL ) {
- if( format->Equals("F") ) {
- return String::Format("{0}'F", this->Value->ToString());
- }
- if( format->Equals("C") ) {
- return String::Format("{0}'C", this->Celsius->ToString());
- }
- }
-
- return m_value->ToString(format, provider);
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets5 {
- //
- public __gc class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) );
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) );
- }
- else {
- temp->Value = Int64::Parse(s);
- }
- }
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- }
- //
-}
-namespace Snippets6 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, IFormatProvider provider) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider);
- }
- else {
- temp->Value = Int64::Parse(s, provider);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets7 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, NumberStyles styles) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles);
- }
- else {
- temp->Value = Int64::Parse(s, styles);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-namespace Snippets8 {
- //
- public class Temperature {
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
-
- // The value holder
- protected:
- short m_value;
-
- public:
- static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) {
- Temperature* temp = new Temperature();
-
- if( s->TrimEnd(NULL)->EndsWith("'F") ) {
- temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider);
- }
- else {
- if( s->TrimEnd(NULL)->EndsWith("'C") ) {
- temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider);
- }
- else {
- temp->Value = Int64::Parse(s, styles, provider);
- }
- }
-
- return temp;
- }
-
- __property short get_Value() {
- return m_value;
- }
-
- __property void set_Value( short value) {
- m_value = value;
- }
-
- __property short get_Celsius() {
- return (short)((m_value-32)/2);
- }
-
- __property void set_Celsius( short value) {
- m_value = (short)(value*2+32);
- }
- }
- //
-}
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp b/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp
deleted file mode 100644
index ce2f1b81b12..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// This sample class has a field, constructor, method, and property.
-ref class MyType
-{
-private:
- Int32 myField;
-
-public:
- MyType( interior_ptr x )
- {
- *x *= 5;
- }
-
- virtual String^ ToString() override
- {
- return myField.ToString();
- }
-
- property Int32 MyProp
- {
- Int32 get()
- {
- return myField;
- }
-
- void set( Int32 value )
- {
- if ( value < 1 )
- throw gcnew ArgumentOutOfRangeException( "value",value,"value must be > 0" );
-
- myField = value;
- }
- }
-};
-
-int main()
-{
- Type^ t = MyType::typeid;
-
- // Create an instance of a type.
- array
diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp
deleted file mode 100644
index bbdb493fd1b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// An enumeration of animals. Start at 1 (0 = uninitialized).
-public enum class Animal
-{
- // Pets.
- Dog = 1,
- Cat, Bird
-};
-
-
-// A custom attribute to allow a target to have a pet.
-public ref class AnimalTypeAttribute: public Attribute
-{
-public:
-
- // The constructor is called when the attribute is set.
- AnimalTypeAttribute( Animal pet )
- {
- thePet = pet;
- }
-
- // Provide a default constructor and make Dog the default.
- AnimalTypeAttribute()
- {
- thePet = Animal::Dog;
- }
-
-protected:
-
- // Keep a variable internally ...
- Animal thePet;
-
-public:
-
- property Animal Pet
- {
- // .. and show a copy to the outside world.
- Animal get()
- {
- return thePet;
- }
- void set( Animal value )
- {
- thePet = value;
- }
-
- }
-
- // Override IsDefaultAttribute to return the correct response.
- virtual bool IsDefaultAttribute() override
- {
- return thePet == Animal::Dog;
- }
-};
-
-public ref class TestClass
-{
-public:
-
- // Use the default constructor.
-
- [AnimalType]
- void Method1(){}
-};
-
-int main()
-{
- // Get the class type to access its metadata.
- Type^ clsType = TestClass::typeid;
-
- // Get type information for the method.
- MethodInfo^ mInfo = clsType->GetMethod( "Method1" );
-
- // Get the AnimalType attribute for the method.
- AnimalTypeAttribute^ atAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, AnimalTypeAttribute::typeid ));
-
- // Check to see if the default attribute is applied.
- Console::WriteLine( "The attribute {0} for method {1} in class {2}", atAttr->Pet, mInfo->Name, clsType->Name );
- Console::WriteLine( "{0} the default for the AnimalType attribute.", atAttr->IsDefaultAttribute() ? (String^)"is" : "is not" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp
deleted file mode 100644
index cf2f401b63a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Add an AssemblyDescription attribute
-[assembly:AssemblyDescription("A sample description")];
-namespace IsDef1CS
-{
- ref class DemoClass
- {
- public:
- static void Main()
- {
-
- // Get the class type to access its metadata.
- Type^ clsType = DemoClass::typeid;
-
- // Get the assembly object.
- Assembly^ assy = clsType->Assembly;
-
- // Store the assembly's name.
- String^ assyName = assy->GetName()->Name;
-
- //Type assyType = assy.GetType();
- // See if the Assembly Description is defined.
- bool isdef = Attribute::IsDefined( assy, AssemblyDescriptionAttribute::typeid );
- if ( isdef )
- {
-
- // Affirm that the attribute is defined.
- Console::WriteLine( "The AssemblyDescription attribute "
- "is defined for assembly {0}.", assyName );
-
- // Get the description attribute itself.
- AssemblyDescriptionAttribute^ adAttr = dynamic_cast(Attribute::GetCustomAttribute( assy, AssemblyDescriptionAttribute::typeid ));
-
- // Display the description.
- if ( adAttr != nullptr )
- Console::WriteLine( "The description is \"{0}\".", adAttr->Description );
- else
- Console::WriteLine( "The description could not "
- "be retrieved." );
- }
- else
- Console::WriteLine( "The AssemblyDescription attribute is not "
- "defined for assembly {0}.", assyName );
- }
-
- };
-
-}
-
-
-/*
- * Output:
- * The AssemblyDescription attributeis defined for assembly IsDef1CS.
- * The description is "A sample description".
- */
-//
-//
-using namespace System;
-using namespace System::Diagnostics;
-
-// Add the Debuggable attribute to the module.
-[module:Debuggable(true,false)];
-namespace IsDef2CS
-{
- ref class DemoClass
- {
- public:
- static void Main()
- {
-
- // Get the class type to access its metadata.
- Type^ clsType = DemoClass::typeid;
-
- // See if the Debuggable attribute is defined for this module.
- bool isDef = Attribute::IsDefined( clsType->Module, DebuggableAttribute::typeid );
-
- // Display the result.
- Console::WriteLine( "The Debuggable attribute {0} "
- "defined for Module {1}.", isDef ? (String^)"is" : "is not", clsType->Module->Name );
-
- // If the attribute is defined, display the JIT settings.
- if ( isDef )
- {
-
- // Retrieve the attribute itself.
- DebuggableAttribute^ dbgAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType->Module, DebuggableAttribute::typeid ));
- if ( dbgAttr != nullptr )
- {
- Console::WriteLine( "JITTrackingEnabled is {0}.", dbgAttr->IsJITTrackingEnabled );
- Console::WriteLine( "JITOptimizerDisabled is {0}.", dbgAttr->IsJITOptimizerDisabled );
- }
- else
- Console::WriteLine( "The Debuggable attribute "
- "could not be retrieved." );
- }
- }
-
- };
-
-}
-
-
-/*
- * Output:
- * The Debuggable attribute is defined for Module IsDef2CS.exe.
- * JITTrackingEnabled is True.
- * JITOptimizerDisabled is False.
- */
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-
-namespace IsDef3CS
-{
-
- // Assign a Guid attribute to a class.
-
- [Guid("BF235B41-52D1-46cc-9C55-046793DB363F")]
- public ref class TestClass{};
-
- ref class DemoClass
- {
- public:
- static void Main()
- {
-
- // Get the class type to access its metadata.
- Type^ clsType = TestClass::typeid;
-
- // See if the Guid attribute is defined for the class.
- bool isDef = Attribute::IsDefined( clsType, GuidAttribute::typeid );
-
- // Display the result.
- Console::WriteLine( "The Guid attribute {0} defined for class {1}.", isDef ? (String^)"is" : "is not", clsType->Name );
-
- // If it's defined, display the GUID.
- if ( isDef )
- {
- GuidAttribute^ guidAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType, GuidAttribute::typeid ));
- if ( guidAttr != nullptr )
- Console::WriteLine( "GUID: {{0}}.", guidAttr->Value );
- else
- Console::WriteLine( "The Guid attribute could "
- "not be retrieved." );
- }
- }
-
- };
-
-}
-
-
-/*
- * Output:
- * The Guid attribute is defined for class TestClass.
- * GUID: {BF235B41-52D1-46cc-9C55-046793DB363F}.
- */
-//
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace IsDef4CS
-{
- public ref class TestClass
- {
- public:
-
- // Assign the Obsolete attribute to a method.
-
- [Obsolete("This method is obsolete. Use Method2 instead.")]
- void Method1(){}
-
- void Method2(){}
-
- };
-
- ref class DemoClass
- {
- public:
- static void Main()
- {
-
- // Get the class type to access its metadata.
- Type^ clsType = TestClass::typeid;
-
- // Get the MethodInfo object for Method1.
- MethodInfo^ mInfo = clsType->GetMethod( "Method1" );
-
- // See if the Obsolete attribute is defined for this method.
- bool isDef = Attribute::IsDefined( mInfo, ObsoleteAttribute::typeid );
-
- // Display the result.
- Console::WriteLine( "The Obsolete Attribute {0} defined for {1} of class {2}.", isDef ? (String^)"is" : "is not", mInfo->Name, clsType->Name );
-
- // If it's defined, display the attribute's message.
- if ( isDef )
- {
- ObsoleteAttribute^ obsAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, ObsoleteAttribute::typeid ));
- if ( obsAttr != nullptr )
- Console::WriteLine( "The message is: \"{0}\".", obsAttr->Message );
- else
- Console::WriteLine( "The message could not be retrieved." );
- }
- }
-
- };
-
-}
-
-
-/*
- * Output:
- * The Obsolete Attribute is defined for Method1 of class TestClass.
- * The message is: "This method is obsolete. Use Method2 instead.".
- */
-//
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace IsDef5CS
-{
- public ref class TestClass
- {
- public:
-
- // Assign a ParamArray attribute to the parameter using the keyword.
- void Method1(... array^args ){}
-
- };
-
- ref class DemoClass
- {
- public:
- static void Main()
- {
-
- // Get the class type to access its metadata.
- Type^ clsType = TestClass::typeid;
-
- // Get the MethodInfo object for Method1.
- MethodInfo^ mInfo = clsType->GetMethod( "Method1" );
-
- // Get the ParameterInfo array for the method parameters.
- array^pInfo = mInfo->GetParameters();
- if ( pInfo != nullptr )
- {
-
- // See if the ParamArray attribute is defined.
- bool isDef = Attribute::IsDefined( pInfo[ 0 ], ParamArrayAttribute::typeid );
-
- // Display the result.
- Console::WriteLine( "The ParamArray attribute {0} defined for "
- "parameter {1} of method {2}.", isDef ? (String^)"is" : "is not", pInfo[ 0 ]->Name, mInfo->Name );
- }
- else
- Console::WriteLine( "The parameters information could "
- "not be retrieved for method {0}.", mInfo->Name );
- }
-
- };
-
-}
-
-/*
- * Output:
- * The ParamArray attribute is defined for parameter args of method Method1.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp b/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp
deleted file mode 100644
index b71de67675c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-//
-///
-/// The following class represents simple functionality of the trapezoid.
-///
-using namespace System;
-
-public ref class MathTrapezoidSample
-{
-private:
- double m_longBase;
- double m_shortBase;
- double m_leftLeg;
- double m_rightLeg;
-
-public:
- MathTrapezoidSample( double longbase, double shortbase, double leftLeg, double rightLeg )
- {
- m_longBase = Math::Abs( longbase );
- m_shortBase = Math::Abs( shortbase );
- m_leftLeg = Math::Abs( leftLeg );
- m_rightLeg = Math::Abs( rightLeg );
- }
-
-
-private:
- double GetRightSmallBase()
- {
- return (Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( m_leftLeg, 2.0 ) + Math::Pow( m_longBase, 2.0 ) + Math::Pow( m_shortBase, 2.0 ) - 2 * m_shortBase * m_longBase) / (2 * (m_longBase - m_shortBase));
- }
-
-
-public:
- double GetHeight()
- {
- double x = GetRightSmallBase();
- return Math::Sqrt( Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( x, 2.0 ) );
- }
-
- double GetSquare()
- {
- return GetHeight() * m_longBase / 2.0;
- }
-
- double GetLeftBaseRadianAngle()
- {
- double sinX = GetHeight() / m_leftLeg;
- return Math::Round( Math::Asin( sinX ), 2 );
- }
-
- double GetRightBaseRadianAngle()
- {
- double x = GetRightSmallBase();
- double cosX = (Math::Pow( m_rightLeg, 2.0 ) + Math::Pow( x, 2.0 ) - Math::Pow( GetHeight(), 2.0 )) / (2 * x * m_rightLeg);
- return Math::Round( Math::Acos( cosX ), 2 );
- }
-
- double GetLeftBaseDegreeAngle()
- {
- double x = GetLeftBaseRadianAngle() * 180 / Math::PI;
- return Math::Round( x, 2 );
- }
-
- double GetRightBaseDegreeAngle()
- {
- double x = GetRightBaseRadianAngle() * 180 / Math::PI;
- return Math::Round( x, 2 );
- }
-
-};
-
-int main()
-{
- MathTrapezoidSample^ trpz = gcnew MathTrapezoidSample( 20.0,10.0,8.0,6.0 );
- Console::WriteLine( "The trapezoid's bases are 20.0 and 10.0, the trapezoid's legs are 8.0 and 6.0" );
- double h = trpz->GetHeight();
- Console::WriteLine( "Trapezoid height is: {0}", h.ToString() );
- double dxR = trpz->GetLeftBaseRadianAngle();
- Console::WriteLine( "Trapezoid left base angle is: {0} Radians", dxR.ToString() );
- double dyR = trpz->GetRightBaseRadianAngle();
- Console::WriteLine( "Trapezoid right base angle is: {0} Radians", dyR.ToString() );
- double dxD = trpz->GetLeftBaseDegreeAngle();
- Console::WriteLine( "Trapezoid left base angle is: {0} Degrees", dxD.ToString() );
- double dyD = trpz->GetRightBaseDegreeAngle();
- Console::WriteLine( "Trapezoid right base angle is: {0} Degrees", dyD.ToString() );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp b/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp
deleted file mode 100644
index 5f170354fb3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//Types:System.MissingMethodException
-//Types:System.MissingMemberException
-//Types:System.MissingFieldException
-//
-using namespace System;
-using namespace System::Reflection;
-
-ref class App
-{
-};
-
-int main()
-{
- //
- try
- {
- // Attempt to call a static DoSomething method defined in the App class.
- // However, because the App class does not define this method,
- // a MissingMethodException is thrown.
- App::typeid->InvokeMember("DoSomething", BindingFlags::Static |
- BindingFlags::InvokeMethod, nullptr, nullptr, nullptr);
- }
- catch (MissingMethodException^ ex)
- {
- // Show the user that the DoSomething method cannot be called.
- Console::WriteLine("Unable to call the DoSomething method: {0}",
- ex->Message);
- }
- //
-
- //
- try
- {
- // Attempt to access a static AField field defined in the App class.
- // However, because the App class does not define this field,
- // a MissingFieldException is thrown.
- App::typeid->InvokeMember("AField", BindingFlags::Static |
- BindingFlags::SetField, nullptr, nullptr, gcnew array{5});
- }
- catch (MissingFieldException^ ex)
- {
- // Show the user that the AField field cannot be accessed.
- Console::WriteLine("Unable to access the AField field: {0}",
- ex->Message);
- }
- //
-
- //
- try
- {
- // Attempt to access a static AnotherField field defined in the App class.
- // However, because the App class does not define this field,
- // a MissingFieldException is thrown.
- App::typeid->InvokeMember("AnotherField", BindingFlags::Static |
- BindingFlags::GetField, nullptr, nullptr, nullptr);
- }
- catch (MissingMemberException^ ex)
- {
- // Notice that this code is catching MissingMemberException which is the
- // base class of MissingMethodException and MissingFieldException.
- // Show the user that the AnotherField field cannot be accessed.
- Console::WriteLine("Unable to access the AnotherField field: {0}",
- ex->Message);
- }
- //
-}
-// This code produces the following output.
-//
-// Unable to call the DoSomething method: Method 'App.DoSomething' not found.
-// Unable to access the AField field: Field 'App.AField' not found.
-// Unable to access the AnotherField field: Field 'App.AnotherField' not found.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp b/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp
deleted file mode 100644
index 0017618eb8d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-ref class StringContainer
-{
-private:
- // A generic list object that holds the strings.
- List^ container = gcnew List;
-
-public:
- // Define a delegate to handle string display.
- delegate void CheckAndDisplayDelegate(String^ str);
-
- // A method that adds more strings to the collection.
- void AddString(String^ str)
- {
- container->Add(str);
- }
-
- // Iterate through the strings and invoke the method(s) that the delegate points to.
- void DisplayAllQualified(CheckAndDisplayDelegate^ displayDelegate)
- {
- for each (String^ str in container)
- displayDelegate(str);
-// System::Collections::IEnumerator^ myEnum = container->GetEnumerator();
-// while ( myEnum->MoveNext() )
-// {
-// String^ str = safe_cast(myEnum->Current);
-// displayDelegate(str);
-// }
- }
-};
-
-//end of class StringContainer
-// This class contains a few sample methods
-ref class StringFuncs
-{
-public:
-
- // This method prints a String* that it is passed if the String* starts with a vowel
- static void ConStart(String^ str)
- {
- if ( !(str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') )
- Console::WriteLine( str );
- }
-
- // This method prints a String* that it is passed if the String* starts with a consonant
- static void VowelStart( String^ str )
- {
- if ( (str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') )
- Console::WriteLine( str );
- }
-};
-
-// This function demonstrates using Delegates, including using the Remove and
-// Combine methods to create and modify delegate combinations.
-int main()
-{
- // Declare the StringContainer class and add some strings
- StringContainer^ container = gcnew StringContainer;
- container->AddString( "This" );
- container->AddString( "is" );
- container->AddString( "a" );
- container->AddString( "multicast" );
- container->AddString( "delegate" );
- container->AddString( "example" );
-
-// RETURN HERE.
- // Create two delegates individually using different methods
- StringContainer::CheckAndDisplayDelegate^ conStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::ConStart );
- StringContainer::CheckAndDisplayDelegate^ vowelStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::VowelStart );
-
- // Get the list of all delegates assigned to this MulticastDelegate instance.
- array^ delegateList = conStart->GetInvocationList();
- Console::WriteLine("conStart contains {0} delegate(s).", delegateList->Length);
- delegateList = vowelStart->GetInvocationList();
- Console::WriteLine("vowelStart contains {0} delegate(s).\n", delegateList->Length );
-
- // Determine whether the delegates are System::Multicast delegates
- if ( dynamic_cast(conStart) && dynamic_cast(vowelStart) )
- {
- Console::WriteLine("conStart and vowelStart are derived from MulticastDelegate.\n");
- }
-
- // Execute the two delegates.
- Console::WriteLine("Executing the conStart delegate:" );
- container->DisplayAllQualified(conStart);
- Console::WriteLine();
- Console::WriteLine("Executing the vowelStart delegate:" );
- container->DisplayAllQualified(vowelStart);
-
- // Create a new MulticastDelegate and call Combine to add two delegates.
- StringContainer::CheckAndDisplayDelegate^ multipleDelegates =
- dynamic_cast(Delegate::Combine(conStart, vowelStart));
-
- // How many delegates does multipleDelegates contain?
- delegateList = multipleDelegates->GetInvocationList();
- Console::WriteLine("\nmultipleDelegates contains {0} delegates.\n",
- delegateList->Length );
-
- // // Pass this multicast delegate to DisplayAllQualified.
- Console::WriteLine("Executing the multipleDelegate delegate.");
- container->DisplayAllQualified(multipleDelegates);
- // Call remove and combine to change the contained delegates.
- multipleDelegates = dynamic_cast
- (Delegate::Remove(multipleDelegates, vowelStart));
- multipleDelegates = dynamic_cast
- (Delegate::Combine(multipleDelegates, conStart));
-
- // Pass multipleDelegates to DisplayAllQualified again.
- Console::WriteLine("\nExecuting the multipleDelegate delegate with two conStart delegates:");
- container->DisplayAllQualified(multipleDelegates);
-}
-// The example displays the following output:
-// conStart contains 1 delegate(s).
-// vowelStart contains 1 delegate(s).
-//
-// conStart and vowelStart are derived from MulticastDelegate.
-//
-// Executing the conStart delegate:
-// This
-// multicast
-// delegate
-//
-// Executing the vowelStart delegate:
-// is
-// a
-// example
-//
-//
-// multipleDelegates contains 2 delegates.
-//
-// Executing the multipleDelegate delegate.
-// This
-// is
-// a
-// multicast
-// delegate
-// example
-//
-// Executing the multipleDelegate delegate with two conStart delegates:
-// This
-// This
-// multicast
-// multicast
-// delegate
-// delegate
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp b/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp
deleted file mode 100644
index 90c4a5a1302..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- MemoryStream^ ms = gcnew MemoryStream( 16 );
- ms->Close();
- try
- {
- ms->ReadByte();
- }
- catch ( ObjectDisposedException^ e )
- {
- Console::WriteLine( "Caught: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp b/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp
deleted file mode 100644
index d13e56d248d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-//Types:System.Object
-//
-using namespace System;
-
-// The Point class is derived from System.Object.
-ref class Point
-{
-public:
- int x;
-public:
- int y;
-
-public:
- Point(int x, int y)
- {
- this->x = x;
- this->y = y;
- }
-
- //
-public:
- virtual bool Equals(Object^ obj) override
- {
- // If this and obj do not refer to the same type,
- // then they are not equal.
- if (obj->GetType() != this->GetType())
- {
- return false;
- }
-
- // Return true if x and y fields match.
- Point^ other = (Point^) obj;
- return (this->x == other->x) && (this->y == other->y);
- }
- //
-
- //
- // Return the XOR of the x and y fields.
-public:
- virtual int GetHashCode() override
- {
- return x ^ y;
- }
- //
-
- //
- // Return the point's value as a string.
-public:
- virtual String^ ToString() override
- {
- return String::Format("({0}, {1})", x, y);
- }
- //
-
- //
- // Return a copy of this point object by making a simple
- // field copy.
-public:
- Point^ Copy()
- {
- return (Point^) this->MemberwiseClone();
- }
- //
-};
-
-int main()
-{
- // Construct a Point object.
- Point^ p1 = gcnew Point(1, 2);
-
- // Make another Point object that is a copy of the first.
- Point^ p2 = p1->Copy();
-
- // Make another variable that references the first
- // Point object.
- Point^ p3 = p1;
-
- //
- // The line below displays false because p1 and
- // p2 refer to two different objects.
- Console::WriteLine(
- Object::ReferenceEquals(p1, p2));
- //
-
- //
- // The line below displays true because p1 and p2 refer
- // to two different objects that have the same value.
- Console::WriteLine(Object::Equals(p1, p2));
- //
-
- // The line below displays true because p1 and
- // p3 refer to one object.
- Console::WriteLine(Object::ReferenceEquals(p1, p3));
-
- //
- // The line below displays: p1's value is: (1, 2)
- Console::WriteLine("p1's value is: {0}", p1->ToString());
- //
-}
-
-// This code produces the following output.
-//
-// False
-// True
-// True
-// p1's value is: (1, 2)
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp
deleted file mode 100644
index c2c7e1cf179..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-// This example demonstrates the OperatingSystem.ServicePack property.
-using namespace System;
-int main()
-{
- OperatingSystem^ os = Environment::OSVersion;
- String^ sp = os->ServicePack;
- Console::WriteLine( "Service pack version = \"{0}\"", sp );
-}
-
-/*
-This example produces the following results:
-
-Service pack version = "Service Pack 1"
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp
deleted file mode 100644
index 6c87d9dff1f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-// This example demonstrates the VersionString property.
-using namespace System;
-int main()
-{
- OperatingSystem^ os = Environment::OSVersion;
-
- // Display the value of OperatingSystem.VersionString. By default, this is
- // the same value as OperatingSystem.ToString.
- Console::WriteLine( L"This operating system is {0}", os->VersionString );
- return 0;
-}
-
-/*
-This example produces the following results:
-
-This operating system is Microsoft Windows NT 5.1.2600.0 Service Pack 1
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp
deleted file mode 100644
index 6541e6b0a6e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
- String^ strLow = "abc";
- String^ strCap = "ABC";
- String^ result = "equal to ";
- int x = 0;
- int pos = 1;
-
- // The Unicode codepoint for 'b' is greater than the codepoint for 'B'.
- x = String::CompareOrdinal( strLow, pos, strCap, pos, 1 );
- if ( x < 0 )
- result = "less than";
-
- if ( x > 0 )
- result = "greater than";
-
- Console::WriteLine( "CompareOrdinal(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos );
- Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] );
-
- // In U.S. English culture, 'b' is linguistically less than 'B'.
- x = String::Compare( strLow, pos, strCap, pos, 1, false, gcnew CultureInfo( "en-US" ) );
- if ( x < 0 )
- result = "less than";
- else
- if ( x > 0 )
- result = "greater than";
-
- Console::WriteLine( "Compare(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos );
- Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp
deleted file mode 100644
index 389943d7364..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-using namespace System;
-
-String^ CompareStrings(String^ str1, String^ str2)
-{
- // compare the values, using the CompareTo method on the first string
- int cmpVal = str1->CompareTo(str2);
- if (cmpVal == 0)
- // the values are the same
- return "The strings occur in the same position in the sort order.";
- else if (cmpVal < 0)
- return "The first string precedes the second in the sort order.";
- else
- return "The first string follows the second in the sort order.";
-}
-
-int main()
-{
- String^ strFirst = "Goodbye";
- String^ strSecond = "Hello";
- String^ strThird = "a small String*";
- String^ strFourth = "goodbye";
-
- // Compare a string to itself.
- Console::WriteLine(CompareStrings(strFirst, strFirst));
- Console::WriteLine(CompareStrings(strFirst, strSecond));
- Console::WriteLine(CompareStrings(strFirst, strThird));
-
- // Compare a string to another string that varies only by case.
- Console::WriteLine(CompareStrings(strFirst, strFourth));
- Console::WriteLine(CompareStrings(strFourth, strFirst));
-}
-// The example displays the following output:
-// The strings occur in the same position in the sort order.
-// The first string precedes the second in the sort order.
-// The first string follows the second in the sort order.
-// The first string follows the second in the sort order.
-// The first string precedes the second in the sort order.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp b/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp
deleted file mode 100644
index 10d4eb14002..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-
-//
-// This example demonstrates the two versions of the
-// CompareTo method for several base types.
-// The general version takes a parameter of type Object, while the specific
-// version takes a type-specific parameter, such as Boolean, Int32, or Double.
-using namespace System;
-
-void Show( String^ caption, Object^ var1, Object^ var2, int resultGeneric, int resultNonGeneric )
-{
- String^ relation;
- Console::Write( caption );
- if ( resultGeneric == resultNonGeneric )
- {
- if ( resultGeneric < 0 )
- relation = "less than";
- else
- if ( resultGeneric > 0 )
- relation = "greater than";
- else
- relation = "equal to";
- Console::WriteLine( "{0} is {1} {2}", var1, relation, var2 );
- }
- // The following condition will never occur because the generic and non-generic
- // CompareTo methods are equivalent.
- else
- {
- Console::WriteLine( "Generic CompareTo = {0}; non-generic CompareTo = {1}", resultGeneric, resultNonGeneric );
- }
-}
-
-int main()
-{
- String^ nl = Environment::NewLine;
- String^ msg = "{0}The following is the result of using the generic and non-generic{0}"
- "versions of the CompareTo method for several base types:{0}";
- Object^ obj; // An Object used to insure CompareTo(Object) is called.
-
- DateTime now = DateTime::Now;
-
- // Time span = 11 days, 22 hours, 33 minutes, 44 seconds
- TimeSpan tsX = TimeSpan(11,22,33,44);
-
- // Version = 1.2.333.4
- Version^ versX = gcnew Version( "1.2.333.4" );
-
- // Guid = CA761232-ED42-11CE-BACD-00AA0057B223
- Guid guidX = Guid( "{CA761232-ED42-11CE-BACD-00AA0057B223}");
- Boolean a1 = true,a2 = true;
- Byte b1 = 1,b2 = 1;
- Int16 c1 = -2,c2 = 2;
- Int32 d1 = 3,d2 = 3;
- Int64 e1 = 4,e2 = -4;
- Decimal f1 = Decimal(-5.5), f2 = Decimal(5.5);
- Single g1 = 6.6f,g2 = 6.6f;
- Double h1 = 7.7,h2 = -7.7;
- Char i1 = 'A',i2 = 'A';
- String^ j1 = "abc", ^j2 = "abc";
- DateTime k1 = now,k2 = now;
- TimeSpan l1 = tsX,l2 = tsX;
- Version^ m1 = versX, ^m2 = gcnew Version( "2.0" );
- Guid n1 = guidX,n2 = guidX;
-
- // The following types are not CLS-compliant.
- SByte w1 = 8,w2 = 8;
- UInt16 x1 = 9,x2 = 9;
- UInt32 y1 = 10,y2 = 10;
- UInt64 z1 = 11,z2 = 11;
-
- //
- Console::WriteLine( msg, nl );
- try
- {
- Show( "Boolean: ", a1, a2, a1.CompareTo( a2 ), a1.CompareTo( a2 ) );
- Show( "Byte: ", b1, b2, b1.CompareTo( b2 ), b1.CompareTo( b2 ) );
- Show( "Int16: ", c1, c2, c1.CompareTo( c2 ), c1.CompareTo( c2 ) );
- Show( "Int32: ", d1, d2, d1.CompareTo( d2 ), d1.CompareTo( d2 ) );
- Show( "Int64: ", e1, e2, e1.CompareTo( e2 ), e1.CompareTo( e2 ) );
- Show( "Decimal: ", f1, f2, f1.CompareTo( f2 ), f1.CompareTo( f2 ) );
- Show( "Single: ", g1, g2, g1.CompareTo( g2 ), g1.CompareTo( g2 ) );
- Show( "Double: ", h1, h2, h1.CompareTo( h2 ), h1.CompareTo( h2 ) );
- Show( "Char: ", i1, i2, i1.CompareTo( i2 ), i1.CompareTo( i2 ) );
-
- // Use an anonymous object to hide the String object.
- obj = j2;
- Show( "String: ", j1, j2, j1->CompareTo( j2 ), j1->CompareTo( obj ) );
- Show( "DateTime:", k1, k2, k1.CompareTo( k2 ), k1.CompareTo( k2 ) );
- Show( "TimeSpan: ", l1, l2, l1.CompareTo( l2 ), l1.CompareTo( l2 ) );
-
- // Use an anonymous object to hide the Version object.
- obj = m2;
- Show( "Version: ", m1, m2, m1->CompareTo( m2 ), m1->CompareTo( obj ) );
- Show( "Guid: ", n1, n2, n1.CompareTo( n2 ), n1.CompareTo( n2 ) );
-
- //
- Console::WriteLine( "{0}The following types are not CLS-compliant:", nl );
- Show( "SByte: ", w1, w2, w1.CompareTo( w2 ), w1.CompareTo( w2 ) );
- Show( "UInt16: ", x1, x2, x1.CompareTo( x2 ), x1.CompareTo( x2 ) );
- Show( "UInt32: ", y1, y2, y1.CompareTo( y2 ), y1.CompareTo( y2 ) );
- Show( "UInt64: ", z1, z2, z1.CompareTo( z2 ), z1.CompareTo( z2 ) );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e );
- }
-
-}
-// This example displays the following output:
-//
-// The following is the result of using the generic and non-generic versions of the
-// CompareTo method for several base types:
-//
-// Boolean: True is equal to True
-// Byte: 1 is equal to 1
-// Int16: -2 is less than 2
-// Int32: 3 is equal to 3
-// Int64: 4 is greater than -4
-// Decimal: -5.5 is less than 5.5
-// Single: 6.6 is equal to 6.6
-// Double: 7.7 is greater than -7.7
-// Char: A is equal to A
-// String: abc is equal to abc
-// DateTime: 12/1/2003 5:37:46 PM is equal to 12/1/2003 5:37:46 PM
-// TimeSpan: 11.22:33:44 is equal to 11.22:33:44
-// Version: 1.2.333.4 is less than 2.0
-// Guid: ca761232-ed42-11ce-bacd-00aa0057b223 is equal to ca761232-ed42-11ce-bacd-00
-// aa0057b223
-//
-// The following types are not CLS-compliant:
-// SByte: 8 is equal to 8
-// UInt16: 9 is equal to 9
-// UInt32: 10 is equal to 10
-// UInt64: 11 is equal to 11
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp b/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp
deleted file mode 100644
index cc253499947..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-//
-// This example demonstrates overloads of the TryParse method for
-// several base types, and the TryParseExact method for DateTime.
-// In most cases, this example uses the most complex overload; that is, the overload
-// with the most parameters for a particular type. If a complex overload specifies
-// null (Nothing in Visual Basic) for the IFormatProvider parameter, formatting
-// information is obtained from the culture associated with the current thread.
-// If a complex overload specifies the style parameter, the parameter value is
-// the default value used by the equivalent simple overload.
-using namespace System;
-using namespace System::Globalization;
-
-static void Show( bool parseResult, String^ typeName, String^ parseValue )
-{
- String^ msgSuccess = L"Parse for {0} = {1}";
- String^ msgFailure = L"** Parse for {0} failed. Invalid input.";
-
- //
- if ( parseResult )
- Console::WriteLine( msgSuccess, typeName, parseValue );
- else
- Console::WriteLine( msgFailure, typeName );
-}
-
-void main()
-{
- bool result;
- CultureInfo^ ci;
- String^ nl = Environment::NewLine;
- String^ msg1 = L"This example demonstrates overloads of the TryParse method for{0}"
- L"several base types, as well as the TryParseExact method for DateTime.{0}";
- String^ msg2 = L"Non-numeric types:{0}";
- String^ msg3 = L"{0}Numeric types:{0}";
- String^ msg4 = L"{0}The following types are not CLS-compliant:{0}";
-
- // Non-numeric types.
- Boolean booleanVal;
- Char charVal;
- DateTime datetimeVal;
-
- // Numeric types.
- Byte byteVal;
- Int16 int16Val;
- Int32 int32Val;
- Int64 int64Val;
- Decimal decimalVal;
- Single singleVal;
- Double doubleVal;
-
- // The following types are not CLS-compliant.
- SByte sbyteVal;
- UInt16 uint16Val;
- UInt32 uint32Val;
- UInt64 uint64Val;
-
- //
- Console::WriteLine( msg1, nl );
-
- // Non-numeric types:
- Console::WriteLine( msg2, nl );
-
- // DateTime
- // TryParse:
- // Assume current culture is en-US, and dates of the form: MMDDYYYY.
- result = DateTime::TryParse( L"7/4/2004 12:34:56", datetimeVal );
- Show( result, L"DateTime #1", datetimeVal.ToString() );
-
- // Use fr-FR culture, and dates of the form: DDMMYYYY.
- ci = gcnew CultureInfo( L"fr-FR" );
- result = DateTime::TryParse( L"4/7/2004 12:34:56", ci, DateTimeStyles::None, datetimeVal );
- Show( result, L"DateTime #2", datetimeVal.ToString() );
-
- // TryParseExact:
- // Use fr-FR culture. The format, "G", is short date and long time.
- result = DateTime::TryParseExact( L"04/07/2004 12:34:56", L"G", ci, DateTimeStyles::None, datetimeVal );
- Show( result, L"DateTime #3", datetimeVal.ToString() );
-
- // Assume en-US culture.
- array^dateFormats = {L"f",L"F",L"g",L"G"};
- result = DateTime::TryParseExact( L"7/4/2004 12:34:56 PM", dateFormats, nullptr, DateTimeStyles::None, datetimeVal );
- Show( result, L"DateTime #4", datetimeVal.ToString() );
- Console::WriteLine();
-
- // Boolean
- result = Boolean::TryParse( L"true", booleanVal );
- Show( result, L"Boolean", booleanVal.ToString() );
-
- // Char
- result = Char::TryParse( L"A", charVal );
- Show( result, L"Char", charVal.ToString() );
-
- // Numeric types:
- Console::WriteLine( msg3, nl );
-
- // Byte
- result = Byte::TryParse( L"1", NumberStyles::Integer, nullptr, byteVal );
- Show( result, L"Byte", byteVal.ToString() );
-
- // Int16
- result = Int16::TryParse( L"-2", NumberStyles::Integer, nullptr, int16Val );
- Show( result, L"Int16", int16Val.ToString() );
-
- // Int32
- result = Int32::TryParse( L"3", NumberStyles::Integer, nullptr, int32Val );
- Show( result, L"Int32", int32Val.ToString() );
-
- // Int64
- result = Int64::TryParse( L"4", NumberStyles::Integer, nullptr, int64Val );
- Show( result, L"Int64", int64Val.ToString() );
-
- // Decimal
- result = Decimal::TryParse( L"-5.5", NumberStyles::Number, nullptr, decimalVal );
- Show( result, L"Decimal", decimalVal.ToString() );
-
- // Single
- result = Single::TryParse( L"6.6", static_cast((NumberStyles::Float | NumberStyles::AllowThousands)), nullptr, singleVal );
- Show( result, L"Single", singleVal.ToString() );
-
- // Double
- result = Double::TryParse( L"-7", static_cast(NumberStyles::Float | NumberStyles::AllowThousands), nullptr, doubleVal );
- Show( result, L"Double", doubleVal.ToString() );
-
- // Use the simple Double.TryParse overload, but specify an invalid value.
- result = Double::TryParse( L"abc", doubleVal );
- Show( result, L"Double #2", doubleVal.ToString() );
-
- //
- Console::WriteLine( msg4, nl );
-
- // SByte
- result = SByte::TryParse( L"-8", NumberStyles::Integer, nullptr, sbyteVal );
- Show( result, L"SByte", sbyteVal.ToString() );
-
- // UInt16
- result = UInt16::TryParse( L"9", NumberStyles::Integer, nullptr, uint16Val );
- Show( result, L"UInt16", uint16Val.ToString() );
-
- // UInt32
- result = UInt32::TryParse( L"10", NumberStyles::Integer, nullptr, uint32Val );
- Show( result, L"UInt32", uint32Val.ToString() );
-
- // UInt64
- result = UInt64::TryParse( L"11", NumberStyles::Integer, nullptr, uint64Val );
- Show( result, L"UInt64", uint64Val.ToString() );
-}
-
-/*
-This example produces the following results:
-
-This example demonstrates overloads of the TryParse method for
-several base types, as well as the TryParseExact method for DateTime.
-
-Non-numeric types:
-
-Parse for DateTime #1 = 7/4/2004 12:34:56 PM
-Parse for DateTime #2 = 7/4/2004 12:34:56 PM
-Parse for DateTime #3 = 7/4/2004 12:34:56 PM
-Parse for DateTime #4 = 7/4/2004 12:34:56 PM
-
-Parse for Boolean = True
-Parse for Char = A
-
-Numeric types:
-
-Parse for Byte = 1
-Parse for Int16 = -2
-Parse for Int32 = 3
-Parse for Int64 = 4
-Parse for Decimal = -5.5
-Parse for Single = 6.6
-Parse for Double = -7
-** Parse for Double #2 failed. Invalid input.
-
-The following types are not CLS-compliant:
-
-Parse for SByte = -8
-Parse for UInt16 = 9
-Parse for UInt32 = 10
-Parse for UInt64 = 11
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp b/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp
deleted file mode 100644
index e6f659eaf11..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-
-//
-using namespace System;
-void main()
-{
- Type^ t = int::typeid;
- Console::WriteLine( "{0} inherits from {1}.", t, t->BaseType );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp b/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp
deleted file mode 100644
index 9faf8c82ca5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- Type^ t = Array::typeid;
- Console::WriteLine( "The full name of the Array type is {0}.", t->FullName );
-}
-
-/* This example produces the following output:
-
-The full name of the Array type is System.Array.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp b/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp
deleted file mode 100644
index 801fb6bb503..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-//
-using namespace System;
-public ref class TestGetElementType{};
-
-int main()
-{
- array^array = {1,2,3};
- Type^ t = array->GetType();
- Type^ t2 = t->GetElementType();
- Console::WriteLine( "The element type of {0} is {1}.", array, t2 );
- TestGetElementType^ newMe = gcnew TestGetElementType;
- t = newMe->GetType();
- t2 = t->GetElementType();
- Console::WriteLine( "The element type of {0} is {1}.", newMe, t2 == nullptr ? "null" : t2->ToString() );
-}
-
-/* This code produces the following output:
-
-The element type of System.Int32[] is System.Int32.
-The element type of TestGetElementType is null.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp
deleted file mode 100644
index aea549667ea..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-ref class Room
-{
-};
-
-ref class Kitchen : Room
-{
-};
-
-ref class Bedroom : Room
-{
-};
-
-ref class Guestroom : Bedroom
-{
-};
-
-ref class MasterBedroom : Bedroom
-{
-};
-
-ref class Program
-{
-public:
- static void Main()
- {
- // Demonstrate classes:
- Console::WriteLine("Defined Classes:");
- Room^ room1 = gcnew Room();
- Kitchen^ kitchen1 = gcnew Kitchen();
- Bedroom^ bedroom1 = gcnew Bedroom();
- Guestroom^ guestroom1 = gcnew Guestroom();
- MasterBedroom^ masterbedroom1 = gcnew MasterBedroom();
-
- Type^ room1Type = room1->GetType();
- Type^ kitchen1Type = kitchen1->GetType();
- Type^ bedroom1Type = bedroom1->GetType();
- Type^ guestroom1Type = guestroom1->GetType();
- Type^ masterbedroom1Type = masterbedroom1->GetType();
-
- Console::WriteLine("room assignable from kitchen: {0}", room1Type->IsAssignableFrom(kitchen1Type));
- Console::WriteLine("bedroom assignable from guestroom: {0}", bedroom1Type->IsAssignableFrom(guestroom1Type));
- Console::WriteLine("kitchen assignable from masterbedroom: {0}", kitchen1Type->IsAssignableFrom(masterbedroom1Type));
-
- // Demonstrate arrays:
- Console::WriteLine();
- Console::WriteLine("Integer arrays:");
- array^ array2 = gcnew array(2);
- array^ array10 = gcnew array(10);
- array^ array22 = gcnew array(2, 2);
- array^ array24 = gcnew array(2, 4);
-
- Type^ array2Type = array2->GetType();
- Type^ array10Type = array10->GetType();
- Type^ array22Type = array22->GetType();
- Type^ array24Type = array24->GetType();
-
- Console::WriteLine("Int32[2] assignable from Int32[10]: {0}", array2Type->IsAssignableFrom(array10Type));
- Console::WriteLine("Int32[2] assignable from Int32[2,4]: {0}", array2Type->IsAssignableFrom(array24Type));
- Console::WriteLine("Int32[2,4] assignable from Int32[2,2]: {0}", array24Type->IsAssignableFrom(array22Type));
-
- // Demonstrate generics:
- Console::WriteLine();
- Console::WriteLine("Generics:");
-
- // Note that "int?[]" is the same as "Nullable[]"
- //int?[] arrayNull = new int?[10];
- array^ arrayNull = gcnew array(10);
- List^ genIntList = gcnew List();
- List^ genTList = gcnew List();
-
- Type^ arrayNullType = arrayNull->GetType();
- Type^ genIntListType = genIntList->GetType();
- Type^ genTListType = genTList->GetType();
-
- Console::WriteLine("Int32[10] assignable from Nullable[10]: {0}", array10Type->IsAssignableFrom(arrayNullType));
- Console::WriteLine("List assignable from List: {0}", genIntListType->IsAssignableFrom(genTListType));
- Console::WriteLine("List assignable from List: {0}", genTListType->IsAssignableFrom(genIntListType));
-
- Console::ReadLine();
- }
-};
-
-int main()
-{
- Program::Main();
-}
-
-//This code example produces the following output:
-//
-// Defined Classes:
-// room assignable from kitchen: True
-// bedroom assignable from guestroom: True
-//kitchen assignable from masterbedroom: False
-//
-// Integer arrays:
-// Int32[2] assignable from Int32[10]: True
-// Int32[2] assignable from Int32[2,4]: False
-// Int32[2,4] assignable from Int32[2,2]: True
-//
-// Generics:
-// Int32[10] assignable from Nullable[10]: False
-// List assignable from List: False
-// List assignable from List: False
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp
deleted file mode 100644
index 9c1f8344454..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-enum class Color
-{ Red, Blue, Green };
-
-int main()
-{
- Type^ colorType = Color::typeid;
- Type^ enumType = Enum::typeid;
- Console::WriteLine( "Is Color an enum? {0}.", colorType->IsEnum );
- Console::WriteLine( "Is Color a value type? {0}.", colorType->IsValueType );
- Console::WriteLine( "Is Enum an enum Type? {0}.", enumType->IsEnum );
- Console::WriteLine( "Is Enum a value type? {0}.", enumType->IsValueType );
-}
-// The example displays the following output:
-// Is Color an enum? True.
-// Is Color a value type? True.
-// Is Enum an enum type? False.
-// Is Enum a value type? False.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp
deleted file mode 100644
index b2152ac3fa7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-
-public interface class IExample{};
-
-public ref class BaseClass: IExample{};
-
-public ref class DerivedClass: BaseClass{};
-
-void main()
-{
- Type^ interfaceType = IExample::typeid;
- BaseClass^ base1 = gcnew BaseClass;
- Type^ base1Type = base1->GetType();
- BaseClass^ derived1 = gcnew DerivedClass;
- Type^ derived1Type = derived1->GetType();
- array^ arr = gcnew array(11);
- Type^ arrayType = Array::typeid;
-
- Console::WriteLine("Is Int32[] an instance of the Array class? {0}.",
- arrayType->IsInstanceOfType( arr ) );
- Console::WriteLine("Is myclass an instance of BaseClass? {0}.",
- base1Type->IsInstanceOfType( base1 ) );
- Console::WriteLine("Is myderivedclass an instance of BaseClass? {0}.",
- base1Type->IsInstanceOfType( derived1 ) );
- Console::WriteLine("Is myclass an instance of IExample? {0}.",
- interfaceType->IsInstanceOfType( base1 ) );
- Console::WriteLine("Is myderivedclass an instance of IExample? {0}.",
- interfaceType->IsInstanceOfType( derived1 ) );
-}
-// The example displays the following output:
-// Is int[] an instance of the Array class? True.
-// Is base1 an instance of BaseClass? True.
-// Is derived1 an instance of BaseClass? True.
-// Is base1 an instance of IExample? True.
-// Is derived1 an instance of IExample? True.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp b/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp
deleted file mode 100644
index 29339b956eb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// This example demonstrates the use of the TimeoutException
-// exception in conjunction with the SerialPort class.
-
-#using
-
-using namespace System;
-using namespace System::IO::Ports;
-
-int main()
-{
- String^ input;
- try
- {
- // Set the COM1 serial port to speed = 4800 baud, parity = odd,
- // data bits = 8, stop bits = 1.
- SerialPort^ port = gcnew SerialPort("COM1",
- 4800, Parity::Odd, 8, StopBits::One);
- // Timeout after 2 seconds.
- port->ReadTimeout = 2000;
- port->Open();
-
- // Read until either the default newline termination string
- // is detected or the read operation times out.
- input = port->ReadLine();
-
- port->Close();
-
- // Echo the input.
- Console::WriteLine(input);
- }
-
- // Only catch timeout exceptions.
- catch (TimeoutException^ ex)
- {
- Console::WriteLine(ex);
- }
-};
-/*
-This example produces the following results:
-
-(Data received at the serial port is echoed to the console if the
-read operation completes successfully before the specified timeout period
-expires. Otherwise, a timeout exception like the following is thrown.)
-
-System.TimeoutException: The operation has timed-out.
-at System.IO.Ports.SerialStream.ReadByte(Int32 timeout)
-at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout)
-at System.IO.Ports.SerialPort.ReadTo(String value)
-at System.IO.Ports.SerialPort.ReadLine()
-at Sample.Main()
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp b/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp
deleted file mode 100644
index 813adf57610..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-using namespace System;
-
-// Declare MyTestClass as public.
-public ref class TestClass{};
-
-int main()
-{
- TestClass^ testClassInstance = gcnew TestClass;
-
- // Get the type of myTestClassInstance.
- Type^ testType = testClassInstance->GetType();
-
- // Get the IsPublic property of the myTestClassInstance.
- bool isPublic = testType->IsPublic;
- Console::WriteLine( "Is {0} public? {1}", testType->FullName, isPublic);
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp
deleted file mode 100644
index 3f49f739983..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Runtime::InteropServices;
-value struct Test1
-{
-public:
- Byte B1;
- short S;
- Byte B2;
-};
-
-
-[StructLayout(LayoutKind::Explicit,Pack=1)]
-value struct Test2
-{
-public:
-
- [FieldOffset(0)]
- Byte B1;
-
- [FieldOffset(1)]
- short S;
-
- [FieldOffset(3)]
- Byte B2;
-};
-
-static void DisplayLayoutAttribute( StructLayoutAttribute^ sla )
-{
- Console::WriteLine( L"\r\nCharSet: {0}\r\n Pack: {1}\r\n Size: {2}\r\n Value: {3}", sla->CharSet, sla->Pack, sla->Size, sla->Value );
-}
-
-int main()
-{
- DisplayLayoutAttribute( Test1::typeid->StructLayoutAttribute );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp
deleted file mode 100644
index cb8e0c58917..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-using namespace System;
-
-class TypeLoadExceptionDemoClass
-{
- public:
- static bool GenerateException()
- {
- // Throw a TypeLoadException with a custom message.
- throw gcnew TypeLoadException("This is a custom TypeLoadException error message.");
- }
-};
-
-int main()
-{
- try {
- // Call a method that throws an exception.
- TypeLoadExceptionDemoClass::GenerateException();
- }
- catch ( TypeLoadException^ e ) {
- Console::WriteLine("TypeLoadException:\n {0}", e->Message);
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message );
- }
-
-}
-// The example displays the following output:
-// TypeLoadException:
-// This is a custom TypeLoadException error message.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp
deleted file mode 100644
index 649e2fc5034..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// System::TypeLoadException::TypeLoadException
-/* This program demonstrates the 'TypeLoadException(String*, Exception)'
- constructor of 'TypeLoadException' class. It attempts to call a
- non-existent method located in NonExistentDLL.dll, which will
- throw an exception. A new exception is thrown with this exception
- as an inner exception.
-*/
-//
-using namespace System;
-using namespace System::Runtime::InteropServices;
-ref class TypeLoadExceptionDemoClass
-{
-public:
-
- // A call to this method will raise a TypeLoadException.
-
- [DllImport("NonExistentDLL.DLL",EntryPoint="MethodNotExists")]
- static void NonExistentMethod();
- static void GenerateException()
- {
- try
- {
- NonExistentMethod();
- }
- catch ( TypeLoadException^ e )
- {
-
- // Rethrow exception with the exception as inner exception
- throw gcnew TypeLoadException( "This exception was raised due to a call to an invalid method.",e );
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "Calling a method in a non-existent DLL which triggers a TypeLoadException." );
- try
- {
- TypeLoadExceptionDemoClass::GenerateException();
- }
- catch ( TypeLoadException^ e )
- {
- Console::WriteLine( "TypeLoadException: \n\tError Message = {0}", e->Message );
- Console::WriteLine( "TypeLoadException: \n\tInnerException Message = {0}", e->InnerException->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp
deleted file mode 100644
index 6b8fd92068e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-// System::TypeLoadException::GetObjectData
-// System::TypeLoadException
-/* This program demonstrates the 'GetObjectData' method and the
- protected constructor TypeLoadException(SerializationInfo, StreamingContext)
- of 'TypeLoadException' class. It generates an exception and
- serializes the exception data to a file and then reconstitutes the
- exception.
-*/
-//
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::Serialization;
-using namespace System::Runtime::Serialization::Formatters::Soap;
-using namespace System::IO;
-
-// This class overrides the GetObjectData method and initializes
-// its data with current time.
-
-[Serializable]
-public ref class MyTypeLoadExceptionChild: public TypeLoadException
-{
-public:
- System::DateTime ErrorDateTime;
- MyTypeLoadExceptionChild()
- {
- ErrorDateTime = DateTime::Now;
- }
-
- MyTypeLoadExceptionChild( DateTime myDateTime )
- {
- ErrorDateTime = myDateTime;
- }
-
-
-protected:
- MyTypeLoadExceptionChild( SerializationInfo^ sInfo, StreamingContext * sContext )
- {
-
- // Reconstitute the deserialized information into the instance.
- ErrorDateTime = sInfo->GetDateTime( "ErrorDate" );
- }
-
-
-public:
- void GetObjectData( SerializationInfo^ sInfo, StreamingContext * sContext )
- {
-
- // Add a value to the Serialization information.
- sInfo->AddValue( "ErrorDate", ErrorDateTime );
- }
-
-};
-
-int main()
-{
-
- // Load the mscorlib assembly and get a reference to it.
- // You must supply the fully qualified assembly name for mscorlib.dll here.
- Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" );
- try
- {
- Console::WriteLine( "Attempting to load a type not present in the assembly 'mscorlib'" );
-
- // This loading of invalid type raises a TypeLoadException
- Type^ myType = myAssembly->GetType( "System::NonExistentType", true );
- }
- catch ( TypeLoadException^ )
- {
-
- // Serialize the exception to disk and reconstitute it back again.
- try
- {
- System::DateTime ErrorDatetime = DateTime::Now;
- Console::WriteLine( "A TypeLoadException has been raised." );
-
- // Create MyTypeLoadException instance with current time.
- MyTypeLoadExceptionChild^ myTypeLoadExceptionChild = gcnew MyTypeLoadExceptionChild( ErrorDatetime );
- IFormatter^ myFormatter = gcnew SoapFormatter;
- Stream^ myFileStream = gcnew FileStream( "typeload.xml",FileMode::Create,FileAccess::Write,FileShare::None );
- Console::WriteLine( "Serializing the TypeLoadException with DateTime as {0}", ErrorDatetime );
-
- // Serialize the MyTypeLoadException instance to a file.
- myFormatter->Serialize( myFileStream, myTypeLoadExceptionChild );
- myFileStream->Close();
- Console::WriteLine( "Deserializing the Exception." );
- myFileStream = gcnew FileStream( "typeload.xml",FileMode::Open,FileAccess::Read,FileShare::None );
-
- // Deserialize and reconstitute the instance from file.
- myTypeLoadExceptionChild = safe_cast(myFormatter->Deserialize( myFileStream ));
- myFileStream->Close();
- Console::WriteLine( "Deserialized exception has ErrorDateTime = {0}", myTypeLoadExceptionChild->ErrorDateTime );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
-
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp
deleted file mode 100644
index 102cf32f110..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// System::TypeLoadException::TypeName;System::TypeLoadException::Message
-
-/* This program demonstrates the 'TypeName' and 'Message' properties
- of the 'TypeLoadException' class. It attempts to load a
- non-existent type from the mscorlib assembly which throws an
- exception. This exception is caught and the TypeName and Message
- values are displayed.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-
-int main()
-{
- //
- //
- // Load the mscorlib assembly and get a reference to it.
- // You must supply the fully qualified assembly name for mscorlib.dll here.
- Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" );
- try
- {
- Console::WriteLine( "This program throws an exception upon successful run." );
-
- // Attempt to load a non-existent type from an assembly.
- Type^ myType = myAssembly->GetType( "System.NonExistentType", true );
- }
- catch ( TypeLoadException^ e )
- {
- // Display the name of the Type that was not found.
- Console::WriteLine( "TypeLoadException: \n\tError loading the type '{0}' from the assembly 'mscorlib'", e->TypeName );
- Console::WriteLine( "\tError Message = {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: Error Message = {0}", e->Message );
- }
- //
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp
deleted file mode 100644
index 4ae236700c1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Type^ objType = System::Array::typeid;
-
- // Print the full assembly name.
- Console::WriteLine( "Full assembly name: {0}.", objType->Assembly->FullName );
-
- // Print the qualified assembly name.
- Console::WriteLine( "Qualified assembly name: {0}.", objType->AssemblyQualifiedName );
-}
-// The example displays the following output if run under the .NET Framework 4.5:
-// Full assembly name:
-// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
-// Qualified assembly name:
-// System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp b/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp
deleted file mode 100644
index f9301b87911..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-ref class MyClass
-{
-public:
- void HelloWorld()
- {
- Console::WriteLine( "Hello World" );
- }
-
-};
-
-int main()
-{
- try
- {
- Binder^ defaultBinder = Type::DefaultBinder;
- MyClass^ myClass = gcnew MyClass;
-
- // Invoke the HelloWorld method of MyClass.
- myClass->GetType()->InvokeMember( "HelloWorld", BindingFlags::InvokeMethod, defaultBinder, myClass, nullptr );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp
deleted file mode 100644
index bcb5e2a58a1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Reflection;
-using namespace System::Security;
-int main()
-{
- try
- {
- MemberFilter^ myFilter = Type::FilterAttribute;
- Type^ myType = System::String::typeid;
- array^myMemberInfoArray = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, MethodAttributes::SpecialName );
- IEnumerator^ myEnum = myMemberInfoArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- MemberInfo^ myMemberinfo = safe_cast(myEnum->Current);
- Console::Write( "\n {0}", myMemberinfo->Name );
- Console::Write( " is a {0}", myMemberinfo->MemberType );
- }
- }
- catch ( ArgumentNullException^ e )
- {
- Console::Write( "ArgumentNullException : {0}", e->Message );
- }
- catch ( SecurityException^ e )
- {
- Console::Write( "SecurityException : {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::Write( "Exception : {0}", e->Message );
- }
-
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp
deleted file mode 100644
index 38bf38a1528..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Reflection;
-using namespace System::Security;
-int main()
-{
- try
- {
- MemberFilter^ myFilter = Type::FilterNameIgnoreCase;
- Type^ myType = System::String::typeid;
- array^myMemberinfo1 = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, "C*" );
- IEnumerator^ myEnum = myMemberinfo1->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- MemberInfo^ myMemberinfo2 = safe_cast(myEnum->Current);
- Console::Write( "\n {0}", myMemberinfo2->Name );
- MemberTypes Mymembertypes = myMemberinfo2->MemberType;
- Console::WriteLine( " is a {0}", Mymembertypes );
- }
- }
- catch ( ArgumentNullException^ e )
- {
- Console::Write( "ArgumentNullException : {0}", e->Message );
- }
- catch ( SecurityException^ e )
- {
- Console::Write( "SecurityException : {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::Write( "Exception : {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp
deleted file mode 100644
index 12d2c367f57..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Reflection;
-public ref class MyFindInterfacesSample
-{
-public:
- static bool MyInterfaceFilter(Type^ typeObj, Object^ criteriaObj)
- {
- if(typeObj->ToString()->Equals(criteriaObj->ToString()))
- return true;
- else
- return false;
- }
-};
-
-int main()
-{
- try
- {
- XmlDocument^ myXMLDoc = gcnew XmlDocument;
- myXMLDoc->LoadXml(""
- + "Pride And Prejudice");
- Type^ myType = myXMLDoc->GetType();
-
- // Specify the TypeFilter delegate that compares the interfaces
- // against filter criteria.
- TypeFilter^ myFilter = gcnew TypeFilter(
- MyFindInterfacesSample::MyInterfaceFilter);
- array^myInterfaceList = {"System.Collections.IEnumerable",
- "System.Collections.ICollection"};
- for(int index = 0; index < myInterfaceList->Length; index++)
- {
- array^myInterfaces = myType->FindInterfaces(
- myFilter, myInterfaceList[index]);
- if(myInterfaces->Length > 0)
- {
- Console::WriteLine("\n{0} implements the interface {1}.",
- myType, myInterfaceList[index]);
- for(int j = 0; j < myInterfaces->Length; j++)
- Console::WriteLine("Interfaces supported: {0}.",
- myInterfaces[j]);
- }
- else
- Console::WriteLine(
- "\n{0} does not implement the interface {1}.",
- myType, myInterfaceList[index]);
-
- }
- }
- catch(ArgumentNullException^ e)
- {
- Console::WriteLine("ArgumentNullException: {0}", e->Message);
- }
- catch(TargetInvocationException^ e)
- {
- Console::WriteLine("TargetInvocationException: {0}", e->Message);
- }
- catch(Exception^ e)
- {
- Console::WriteLine("Exception: {0}", e->Message);
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp
deleted file mode 100644
index 759df40e831..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-ref class MyFindMembersClass
-{
-public:
- static void Test()
- {
- Object^ objTest = gcnew Object;
- Type^ objType = objTest->GetType();
- array^arrayMemberInfo;
- try
- {
-
- //Find all static or public methods in the Object class that match the specified name.
- arrayMemberInfo = objType->FindMembers( MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), gcnew MemberFilter( DelegateToSearchCriteria ), "ReferenceEquals" );
- for ( int index = 0; index < arrayMemberInfo->Length; index++ )
- Console::WriteLine( "Result of FindMembers -\t {0}", String::Concat( arrayMemberInfo[ index ], "\n" ) );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e );
- }
-
- }
-
- static bool DelegateToSearchCriteria( MemberInfo^ objMemberInfo, Object^ objSearch )
- {
-
- // Compare the name of the member function with the filter criteria.
- if ( objMemberInfo->Name->Equals( objSearch->ToString() ) )
- return true;
- else
- return false;
- }
-
-};
-
-int main()
-{
- MyFindMembersClass::Test();
-}
-/* The example produces the following output:
-
-Result of FindMembers - Boolean ReferenceEquals(System.Object, System.Object)
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp
deleted file mode 100644
index 0917b237224..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- try
- {
- array^myArray = gcnew array(3,4,5);
- Type^ myType = myArray->GetType();
- Console::WriteLine( "myArray has {0} dimensions.", myType->GetArrayRank() );
- }
- catch ( NotSupportedException^ e )
- {
- Console::WriteLine( "NotSupportedException raised." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception raised." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp
deleted file mode 100644
index b0cdfecb09c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-public ref class MyClass1
-{
-public:
- MyClass1(){}
-
- MyClass1( int i ){}
-
-};
-
-int main()
-{
- try
- {
- Type^ myType = MyClass1::typeid;
- array^types = gcnew array(1);
- types[ 0 ] = int::typeid;
-
- // Get the constructor that takes an integer as a parameter.
- ConstructorInfo^ constructorInfoObj = myType->GetConstructor( types );
- if ( constructorInfoObj != nullptr )
- {
- Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is: " );
- Console::WriteLine( constructorInfoObj );
- }
- else
- {
- Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is not available." );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception caught." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp
deleted file mode 100644
index 66f4064a45d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-public ref class MyClass1
-{
-public:
- MyClass1( int i ){}
-
-};
-
-int main()
-{
- try
- {
- Type^ myType = MyClass1::typeid;
- array^types = gcnew array(1);
- types[ 0 ] = int::typeid;
-
- // Get the constructor that is public and takes an integer parameter.
- ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast(BindingFlags::Instance | BindingFlags::Public), nullptr, types, nullptr );
- if ( constructorInfoObj != nullptr )
- {
- Console::WriteLine( "The constructor of MyClass1 that is public and takes an integer as a parameter is:" );
- Console::WriteLine( constructorInfoObj );
- }
- else
- {
- Console::WriteLine( "The constructor of the MyClass1 that is public and takes an integer as a parameter is not available." );
- }
- }
- catch ( ArgumentNullException^ e )
- {
- Console::WriteLine( "ArgumentNullException: {0}", e->Message );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( "ArgumentException: {0}", e->Message );
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "SecurityException: {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp
deleted file mode 100644
index f6faf3d5c38..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-
-int main()
-{
- try
- {
- Type^ myType = System::Windows::Forms::Button::typeid;
- EventInfo^ myEvent = myType->GetEvent( "Click" );
- if ( myEvent != nullptr )
- {
- Console::WriteLine( "Looking for the Click event in the Button class." );
- Console::WriteLine( myEvent );
- }
- else
- Console::WriteLine( "The Click event is not available in the Button class." );
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Message : {0}", e->Message );
- }
- catch ( ArgumentNullException^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Message : {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following exception was raised : {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp
deleted file mode 100644
index 1921939e115..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-public ref class MyFieldClassA
-{
-public:
- String^ field;
- MyFieldClassA()
- {
- field = "A Field";
- }
-
-
- property String^ Field
- {
- String^ get()
- {
- return field;
- }
-
- void set( String^ value )
- {
- if ( field != value )
- {
- field = value;
- }
- }
-
- }
-
-};
-
-public ref class MyFieldClassB
-{
-public:
- String^ field;
- MyFieldClassB()
- {
- field = "B Field";
- }
-
-
- property String^ Field
- {
- String^ get()
- {
- return field;
- }
-
- void set( String^ value )
- {
- if ( field != value )
- {
- field = value;
- }
- }
-
- }
-
-};
-
-int main()
-{
- try
- {
- MyFieldClassB^ myFieldObjectB = gcnew MyFieldClassB;
- MyFieldClassA^ myFieldObjectA = gcnew MyFieldClassA;
- Type^ myTypeA = Type::GetType( "MyFieldClassA" );
- FieldInfo^ myFieldInfo = myTypeA->GetField( "field" );
- Type^ myTypeB = Type::GetType( "MyFieldClassB" );
- FieldInfo^ myFieldInfo1 = myTypeB->GetField( "field", static_cast(BindingFlags::Public | BindingFlags::Instance) );
- Console::WriteLine( "The value of the field is : {0} ", myFieldInfo->GetValue( myFieldObjectA ) );
- Console::WriteLine( "The value of the field is : {0} ", myFieldInfo1->GetValue( myFieldObjectB ) );
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "Exception Raised!" );
- Console::WriteLine( "Message : {0}", e->Message );
- }
- catch ( ArgumentNullException^ e )
- {
- Console::WriteLine( "Exception Raised!" );
- Console::WriteLine( "Message : {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception Raised!" );
- Console::WriteLine( "Message : {0}", e->Message );
- }
-
-}
-
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp
deleted file mode 100644
index 38a4f53dbdb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Security;
-using namespace System::Reflection;
-
-int main()
-{
- Type^ myType = System::Net::IPAddress::typeid;
- array^myFields = myType->GetFields( static_cast(BindingFlags::Static | BindingFlags::NonPublic) );
- Console::WriteLine( "\nThe IPAddress class has the following nonpublic fields: " );
- System::Collections::IEnumerator^ myEnum = myFields->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- FieldInfo^ myField = safe_cast(myEnum->Current);
- Console::WriteLine( myField );
- }
-
- Type^ myType1 = System::Net::IPAddress::typeid;
- array^myFields1 = myType1->GetFields();
- Console::WriteLine( "\nThe IPAddress class has the following public fields: " );
- System::Collections::IEnumerator^ myEnum2 = myFields1->GetEnumerator();
- while ( myEnum2->MoveNext() )
- {
- FieldInfo^ myField = safe_cast(myEnum2->Current);
- Console::WriteLine( myField );
- }
-
- try
- {
- Console::WriteLine( "The HashCode of the System::Windows::Forms::Button type is: {0}", System::Windows::Forms::Button::typeid->GetHashCode() );
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Message: {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Message: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp
deleted file mode 100644
index 6bd012509e3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-/*
-System::Type::GetInterface(String)
-System::Type::GetInterface(String, bool)
-System::Type::GetInterfaceMap
-
-The following program get the type of Hashtable class and searches for the interface
-with the specified name. Then prints the method name of that interface.
-*/
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections;
-
-//
-//
-//
-int main()
-{
- Hashtable^ hashtableObj = gcnew Hashtable;
- Type^ objType = hashtableObj->GetType();
- array^arrayMemberInfo;
- array^arrayMethodInfo;
- try
- {
- // Get the methods implemented in 'IDeserializationCallback' interface.
- arrayMethodInfo = objType->GetInterface( "IDeserializationCallback" )->GetMethods();
- Console::WriteLine( "\nMethods of 'IDeserializationCallback' Interface :" );
- for ( int index = 0; index < arrayMethodInfo->Length; index++ )
- Console::WriteLine( arrayMethodInfo[ index ] );
-
- // Get FullName for interface by using Ignore case search.
- Console::WriteLine( "\nMethods of 'IEnumerable' Interface" );
- arrayMethodInfo = objType->GetInterface( "ienumerable", true )->GetMethods();
- for ( int index = 0; index < arrayMethodInfo->Length; index++ )
- Console::WriteLine( arrayMethodInfo[ index ] );
-
- //Get the Interface methods for 'IDictionary*' interface
- InterfaceMapping interfaceMappingObj;
- interfaceMappingObj = objType->GetInterfaceMap( IDictionary::typeid );
- arrayMemberInfo = interfaceMappingObj.InterfaceMethods;
- Console::WriteLine( "\nHashtable class Implements the following IDictionary Interface methods :" );
- for ( int index = 0; index < arrayMemberInfo->Length; index++ )
- Console::WriteLine( arrayMemberInfo[ index ] );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e );
- }
-}
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp
deleted file mode 100644
index d6ba8989b72..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- Console::WriteLine("\r\nInterfaces implemented by Dictionary:\r\n");
-
- for each (Type^ tinterface in Dictionary::typeid->GetInterfaces())
- {
- Console::WriteLine(tinterface->ToString());
- }
-
- //Console::ReadLine() // Uncomment this line for Visual Studio.
-}
-
-/* This example produces output similar to the following:
-
-Interfaces implemented by Dictionary:
-
-System.Collections.Generic.IDictionary`2[System.Int32,System.String]
-System.Collections.Generic.ICollection`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]]
-System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]]
-System.Collection.IEnumerable
-System.Collection.IDictionary
-System.Collection.ICollection
-System.Runtime.Serialization.ISerializable
-System.Runtime.Serialization.IDeserializationCallback
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp
deleted file mode 100644
index 509f20ff956..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Reflection;
-
-// forward declarations:
-void GetMemberInfo();
-void GetPublicStaticMemberInfo();
-void GetPublicInstanceMethodMemberInfo();
-int main()
-{
- try
- {
- GetMemberInfo();
- GetPublicStaticMemberInfo();
- GetPublicInstanceMethodMemberInfo();
- }
- catch ( ArgumentNullException^ e )
- {
- Console::WriteLine( "ArgumentNullException occurred." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
- catch ( NotSupportedException^ e )
- {
- Console::WriteLine( "NotSupportedException occurred." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "SecurityException occurred." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception occurred." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
-
-}
-
-void GetMemberInfo()
-{
- String^ myString = "GetMember_String";
- Type^ myType = myString->GetType();
-
- // Get the members for myString starting with the letter C.
- array^myMembers = myType->GetMember( "C*" );
- if ( myMembers->Length > 0 )
- {
- Console::WriteLine( "\nThe member(s) starting with the letter C for type {0}:", myType );
- for ( int index = 0; index < myMembers->Length; index++ )
- Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] );
- }
- else
- Console::WriteLine( "No members match the search criteria." );
-}
-//
-
-//
-void GetPublicStaticMemberInfo()
-{
- String^ myString = "GetMember_String_BindingFlag";
- Type^ myType = myString->GetType();
-
- // Get the public static members for the class myString starting with the letter C
- array^myMembers = myType->GetMember( "C*", static_cast(BindingFlags::Public | BindingFlags::Static) );
- if ( myMembers->Length > 0 )
- {
- Console::WriteLine( "\nThe public static member(s) starting with the letter C for type {0}:", myType );
- for ( int index = 0; index < myMembers->Length; index++ )
- Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] );
- }
- else
- Console::WriteLine( "No members match the search criteria." );
-}
-//
-
-//
-void GetPublicInstanceMethodMemberInfo()
-{
- String^ myString = "GetMember_String_MemberType_BindingFlag";
- Type^ myType = myString->GetType();
-
- // Get the public instance methods for myString starting with the letter C.
- array^myMembers = myType->GetMember( "C*", MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Instance) );
- if ( myMembers->Length > 0 )
- {
- Console::WriteLine( "\nThe public instance method(s) starting with the letter C for type {0}:", myType );
- for ( int index = 0; index < myMembers->Length; index++ )
- Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] );
- }
- else
- Console::WriteLine( "No members match the search criteria." );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp
deleted file mode 100644
index f80aa9bb4c3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-// System::Type::GetMembers()
-/*
-This program demonstrates GetMembers() method of System::Type Class.
-Get the members (properties, methods, fields, events, and so on)
-of the class 'MyClass' and displays the same to the console.
-*/
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-
-//
-ref class MyClass
-{
-public:
- int myInt;
- String^ myString;
- MyClass(){}
-
- void Myfunction(){}
-
-};
-
-int main()
-{
- try
- {
- MyClass^ myObject = gcnew MyClass;
- array^myMemberInfo;
-
- // Get the type of 'MyClass'.
- Type^ myType = myObject->GetType();
-
- // Get the information related to all public members of 'MyClass'.
- myMemberInfo = myType->GetMembers();
- Console::WriteLine( "\nThe members of class '{0}' are :\n", myType );
- for ( int i = 0; i < myMemberInfo->Length; i++ )
- {
-
- // Display name and type of the concerned member.
- Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType );
-
- }
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp
deleted file mode 100644
index 41bb6aea10f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-// System::Type::GetMembers(BindingFlags)
-/*
-This program demonstrates 'GetMembers(BindingFlags)' method of
-System::Type Class. This will get all the public instance members
-declared or inherited by this type and displays the members to
-the console.
-*/
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-
-//
-ref class MyClass
-{
-public:
- int * myInt;
- String^ myString;
- MyClass(){}
-
- void Myfunction(){}
-
-};
-
-int main()
-{
- try
- {
- MyClass^ MyObject = gcnew MyClass;
- array^myMemberInfo;
-
- // Get the type of the class 'MyClass'.
- Type^ myType = MyObject->GetType();
-
- // Get the public instance members of the class 'MyClass'.
- myMemberInfo = myType->GetMembers( static_cast(BindingFlags::Public | BindingFlags::Instance) );
- Console::WriteLine( "\nThe public instance members of class '{0}' are : \n", myType );
- for ( int i = 0; i < myMemberInfo->Length; i++ )
- {
-
- // Display name and type of the member of 'MyClass'.
- Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType );
-
- }
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "SecurityException : {0}", e->Message );
- }
-
-
- //Output:
- //The public instance members of class 'MyClass' are :
-
- //'Myfunction' is a Method
- //'ToString' is a Method
- //'Equals' is a Method
- //'GetHashCode' is a Method
- //'GetType' is a Method
- //'.ctor' is a Constructor
- //'myInt' is a Field
- //'myString' is a Field
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp
deleted file mode 100644
index baf1615c7c0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class Program
-{
-
- public:
-
- // Method to get:
- void MethodA() { }
-
- };
-
- int main()
- {
-
- // Get MethodA()
- MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA");
- Console::WriteLine("Found method: {0}", mInfo );
-
- }
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp
deleted file mode 100644
index b4f0669dc23..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class Program
-{
-
- public:
-
- // Method to get:
- void MethodA() { }
-
- };
-
- int main()
- {
-
- // Get MethodA()
- MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA",
- static_cast(BindingFlags::Public | BindingFlags::Instance));
- Console::WriteLine("Found method: {0}", mInfo );
-
- }
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp
deleted file mode 100644
index 635d6dcd96c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Program
-{
-
-public:
- // Methods to get:
-
- void MethodA(int i, int j) { }
-
- void MethodA(array^ iarry) { }
-
- void MethodA(double *ip) { }
-
- // Method that takes a managed reference paramter.
- void MethodA(int% r) {}
-};
-
-int main()
-{
- MethodInfo^ mInfo;
-
-
- // Get MethodA(int i, int j)
- mInfo = Program::typeid->GetMethod("MethodA",
- BindingFlags::Public | BindingFlags::Instance,
- nullptr,
- CallingConventions::Any,
- gcnew array {int::typeid, int::typeid},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(array^ iarry)
- mInfo = Program::typeid->GetMethod("MethodA",
- BindingFlags::Public | BindingFlags::Instance,
- nullptr,
- CallingConventions::Any,
- gcnew array {int::typeid->MakeArrayType()},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(double *ip)
- mInfo = Program::typeid->GetMethod("MethodA",
- BindingFlags::Public | BindingFlags::Instance,
- nullptr,
- CallingConventions::Any,
- gcnew array {double::typeid->MakePointerType()},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(int% r)
- mInfo = Program::typeid->GetMethod("MethodA",
- BindingFlags::Public | BindingFlags::Instance,
- nullptr,
- CallingConventions::Any,
- gcnew array {int::typeid->MakeByRefType()},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-
-}
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp
deleted file mode 100644
index 5e67e5d4695..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Program
-{
-
-public:
- // Methods to get:
-
- void MethodA(int i, int j) { }
-
- void MethodA(array^ iarry) { }
-
- void MethodA(double *ip) { }
-
- // Method that takes a managed reference parameter.
- void MethodA(int% r) {}
-};
-
-int main()
-{
- MethodInfo^ mInfo;
-
-
- // Get MethodA(int i, int j)
- mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid,int::typeid});
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(array^ iarry)
- mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeArrayType()});
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(double *ip)
- mInfo = Program::typeid->GetMethod("MethodA", gcnew array {double::typeid->MakePointerType()});
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(int% r)
- mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeByRefType()});
- // Display the method information.
- Console::WriteLine("Found method: {0}", mInfo );
-
-}
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp
deleted file mode 100644
index 8fb1d143de6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Program
-{
-
-public:
- // Methods to get:
-
- void MethodA(int i, int j) { }
-
- void MethodA(array^ iarry) { }
-
- void MethodA(double *ip) { }
-
- // Method that takes a managed reference parameter.
- void MethodA(int% r) {}
-};
-
-int main()
-{
- MethodInfo^ mInfo;
-
-
- // Get MethodA(int i, int j)
- mInfo = Program::typeid->GetMethod("MethodA",
- static_cast(BindingFlags::Public | BindingFlags::Instance),
- nullptr,
- gcnew array {int::typeid, int::typeid},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(array^ iarry)
- mInfo = Program::typeid->GetMethod("MethodA",
- static_cast(BindingFlags::Public | BindingFlags::Instance),
- nullptr,
- gcnew array {int::typeid->MakeArrayType()},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(double *ip)
- mInfo = Program::typeid->GetMethod("MethodA",
- static_cast(BindingFlags::Public | BindingFlags::Instance),
- nullptr,
- gcnew array {double::typeid->MakePointerType()},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-
- // Get MethodA(int% r)
- mInfo = Program::typeid->GetMethod("MethodA",
- static_cast(BindingFlags::Public | BindingFlags::Instance),
- nullptr,
- gcnew array {int::typeid->MakeByRefType()},
- nullptr);
- Console::WriteLine("Found method: {0}", mInfo );
-}
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp
deleted file mode 100644
index c249289de27..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-// Create a class having two public methods and one protected method.
-public ref class MyTypeClass
-{
-public:
- void MyMethods(){}
-
- int MyMethods1()
- {
- return 3;
- }
-
-
-protected:
- String^ MyMethods2()
- {
- return "hello";
- }
-};
-
-void DisplayMethodInfo( array^myArrayMethodInfo )
-{
- // Display information for all methods.
- for ( int i = 0; i < myArrayMethodInfo->Length; i++ )
- {
- MethodInfo^ myMethodInfo = dynamic_cast(myArrayMethodInfo[ i ]);
- Console::WriteLine( "\nThe name of the method is {0}.", myMethodInfo->Name );
- }
-}
-
-int main()
-{
- Type^ myType = MyTypeClass::typeid;
-
- // Get the public methods.
- array^myArrayMethodInfo = myType->GetMethods( static_cast(BindingFlags::Public | BindingFlags::Instance | BindingFlags::DeclaredOnly) );
- Console::WriteLine( "\nThe number of public methods is {0}->", myArrayMethodInfo->Length );
-
- // Display all the methods.
- DisplayMethodInfo( myArrayMethodInfo );
-
- // Get the nonpublic methods.
- array^myArrayMethodInfo1 = myType->GetMethods( static_cast(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly) );
- Console::WriteLine( "\nThe number of protected methods is {0}->", myArrayMethodInfo1->Length );
-
- // Display information for all methods.
- DisplayMethodInfo( myArrayMethodInfo1 );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp
deleted file mode 100644
index 8c37fe7a44c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Create a class with two nested public classes and two nested protected classes.
-public ref class MyTypeClass
-{
- public:
- ref class Myclass1{};
-
- public:
- ref class Myclass2{};
-
- protected:
- ref class MyClass3{};
-
- protected:
- ref class MyClass4{};
-};
-
-void DisplayTypeInfo(array^ myArrayType)
-{
- // Display the information for all the nested classes.
- for each (Type^ t in myArrayType)
- Console::WriteLine( "The name of the nested class is {0}.", t->FullName);
-}
-
-int main()
-{
- Type^ myType = MyTypeClass::typeid;
-
- // Get the public nested classes.
- array^myTypeArray = myType->GetNestedTypes( static_cast(BindingFlags::Public));
- Console::WriteLine( "The number of nested public classes is {0}.", myTypeArray->Length );
-
- // Display all the public nested classes.
- DisplayTypeInfo( myTypeArray );
- Console::WriteLine();
-
- // Get the nonpublic nested classes.
- array^myTypeArray1 = myType->GetNestedTypes( static_cast(BindingFlags::NonPublic));
- Console::WriteLine( "The number of nested protected classes is {0}.", myTypeArray1->Length );
-
- // Display all the nonpublic nested classes.
- DisplayTypeInfo( myTypeArray1 );
-}
-// The example displays the following output:
-// The number of public nested classes is 2.
-// The name of the nested class is MyTypeClass+Myclass1.
-// The name of the nested class is MyTypeClass+Myclass2.
-//
-// The number of protected nested classes is 2.
-// The name of the nested class is MyTypeClass+MyClass3.
-// The name of the nested class is MyTypeClass+MyClass4.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp
deleted file mode 100644
index 53d43153bd8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class MyClass
-{
-public:
- ref class NestClass
- {
- public:
- static int myPublicInt = 0;
- };
-
- ref struct NestStruct
- {
- public:
- static int myPublicInt = 0;
- };
-};
-
-int main()
-{
- try
- {
- // Get the Type object corresponding to MyClass.
- Type^ myType = MyClass::typeid;
-
- // Get an array of nested type objects in MyClass.
- array^nestType = myType->GetNestedTypes();
- Console::WriteLine( "The number of nested types is {0}.", nestType->Length );
- System::Collections::IEnumerator^ myEnum = nestType->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Type^ t = safe_cast(myEnum->Current);
- Console::WriteLine( "Nested type is {0}.", t );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Error {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp
deleted file mode 100644
index 9be794b12cf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Create a class having three properties.
-public ref class PropertyClass
-{
-
-public:
- property String^ Property1
- {
- String^ get()
- {
- return "hello";
- }
- }
-
- property String^ Property2
- {
- String^ get()
- {
- return "hello";
- }
- }
-
-protected:
- property String^ Property3
- {
- String^ get()
- {
- return "hello";
- }
- }
-
-private:
- property int Property4
- {
- int get()
- {
- return 32;
- }
- }
-
-internal:
- property String^ Property5
- {
- String^ get()
- {
- return "value";
- }
- }
-
-public protected:
- property String^ Property6
- {
- String^ get()
- {
- return "value";
- }
- }
-};
-
-String^ GetVisibility(MethodInfo^ accessor)
-{
- if (accessor->IsPublic)
- return "Public";
- else if (accessor->IsPrivate)
- return "Private";
- else if (accessor->IsFamily)
- return "Protected";
- else if (accessor->IsAssembly)
- return "Internal/Friend";
- else
- return "Protected Internal/Friend";
-}
-
-void DisplayPropertyInfo(array^ propInfos )
-{
- // Display information for all properties.
- for each(PropertyInfo^ propInfo in propInfos) {
- bool readable = propInfo->CanRead;
- bool writable = propInfo->CanWrite;
-
- Console::WriteLine(" Property name: {0}", propInfo->Name);
- Console::WriteLine(" Property type: {0}", propInfo->PropertyType);
- Console::WriteLine(" Read-Write: {0}", readable && writable);
- if (readable) {
- MethodInfo^ getAccessor = propInfo->GetMethod;
- Console::WriteLine(" Visibility: {0}",
- GetVisibility(getAccessor));
- }
- if (writable) {
- MethodInfo^ setAccessor = propInfo->SetMethod;
- Console::WriteLine(" Visibility: {0}",
- GetVisibility(setAccessor));
- }
- Console::WriteLine();
- }
-}
-
-void main()
-{
- Type^ myType = PropertyClass::typeid;
-
- // Get the public properties.
- array^propInfos = myType->GetProperties( static_cast(BindingFlags::Public | BindingFlags::Instance) );
- Console::WriteLine("The number of public properties: {0}.\n",
- propInfos->Length);
- // Display the public properties.
- DisplayPropertyInfo( propInfos );
-
- // Get the non-public properties.
- array^propInfos1 = myType->GetProperties( static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
- Console::WriteLine("The number of non-public properties: {0}.\n",
- propInfos1->Length);
- // Display all the non-public properties.
- DisplayPropertyInfo(propInfos1);
-}
-// The example displays the following output:
-// The number of public properties: 2.
-//
-// Property name: Property2
-// Property type: System.String
-// Read-Write: False
-// Visibility: Public
-//
-// Property name: Property1
-// Property type: System.String
-// Read-Write: False
-// Visibility: Public
-//
-// The number of non-public properties: 4.
-//
-// Property name: Property6
-// Property type: System.String
-// Read-Write: False
-// Visibility: Protected Internal/Friend
-//
-// Property name: Property5
-// Property type: System.String
-// Read-Write: False
-// Visibility: Internal/Friend
-//
-// Property name: Property4
-// Property type: System.Int32
-// Read-Write: False
-// Visibility: Private
-//
-// Property name: Property3
-// Property type: System.String
-// Read-Write: False
-// Visibility: Protected
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp
deleted file mode 100644
index 8ae8ea145d3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-ref class MyClass
-{
-private:
- int myProperty;
-
-public:
-
- property int MyProperty
- {
- // Declare MyProperty.
- int get()
- {
- return myProperty;
- }
-
- void set( int value )
- {
- myProperty = value;
- }
- }
-};
-
-int main()
-{
- try
- {
- // Get the Type object corresponding to MyClass.
- Type^ myType = MyClass::typeid;
-
- // Get the PropertyInfo object by passing the property name.
- PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty" );
-
- // Display the property name.
- Console::WriteLine( "The {0} property exists in MyClass.", myPropInfo->Name );
- }
- catch ( NullReferenceException^ e )
- {
- Console::WriteLine( "The property does not exist in MyClass. {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp
deleted file mode 100644
index 9301970d3b4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-ref class MyClass
-{
-private:
- int myProperty;
-
-public:
-
- property int MyProperty
- {
- // Declare MyProperty.
- int get()
- {
- return myProperty;
- }
-
- void set( int value )
- {
- myProperty = value;
- }
- }
-};
-
-int main()
-{
- try
- {
- // Get Type object of MyClass.
- Type^ myType = MyClass::typeid;
-
- // Get the PropertyInfo by passing the property name and specifying the BindingFlags.
- PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty", static_cast(BindingFlags::Public | BindingFlags::Instance) );
-
- // Display Name property to console.
- Console::WriteLine( "{0} is a property of MyClass.", myPropInfo->Name );
- }
- catch ( NullReferenceException^ e )
- {
- Console::WriteLine( "MyProperty does not exist in MyClass. {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp
deleted file mode 100644
index 8b7ac89dba4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-ref class MyClass1
-{
-private:
- array^myArray;
-
-public:
-
- property int Item [int, int]
- {
-
- // Declare an indexer.
- int get( int i, int j )
- {
- return myArray[ i,j ];
- }
-
- void set( int i, int j, int value )
- {
- myArray[ i,j ] = value;
- }
-
- }
-
-};
-
-int main()
-{
- try
- {
-
- // Get the Type object.
- Type^ myType = MyClass1::typeid;
- array^myTypeArr = gcnew array(2);
-
- // Create an instance of a Type array.
- myTypeArr->SetValue( int::typeid, 0 );
- myTypeArr->SetValue( int::typeid, 1 );
-
- // Get the PropertyInfo object for the indexed property Item, which has two integer parameters.
- PropertyInfo^ myPropInfo = myType->GetProperty( "Item", myTypeArr );
-
- // Display the property.
- Console::WriteLine( "The {0} property exists in MyClass1.", myPropInfo );
- }
- catch ( NullReferenceException^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Source : {0}", e->Source );
- Console::WriteLine( "Message : {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp
deleted file mode 100644
index 905e696e9f8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class MyPropertyClass
-{
-private:
- array^ myPropertyArray;
-
-public:
-
- property int Item [int, int]
- {
- // Declare an indexer.
- int get( int i, int j )
- {
- return myPropertyArray[ i,j ];
- }
-
- void set( int i, int j, int value )
- {
- myPropertyArray[ i,j ] = value;
- }
-
- }
-
-};
-
-int main()
-{
- try
- {
- Type^ myType = MyPropertyClass::typeid;
- array^myTypeArray = gcnew array(2);
-
- // Create an instance of the Type array representing the number, order
- // and type of the parameters for the property.
- myTypeArray->SetValue( int::typeid, 0 );
- myTypeArray->SetValue( int::typeid, 1 );
-
- // Search for the indexed property whose parameters match the
- // specified argument types and modifiers.
- PropertyInfo^ myPropertyInfo = myType->GetProperty( "Item", int::typeid, myTypeArray, nullptr );
- Console::WriteLine( "{0}.{1} has a property type of {2}", myType->FullName, myPropertyInfo->Name, myPropertyInfo->PropertyType );
- }
- catch ( Exception^ ex )
- {
- Console::WriteLine( "An exception occurred {0}", ex->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp
deleted file mode 100644
index 406346579d0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-ref class MyClass1
-{
-private:
- String^ myMessage;
-
-public:
-
- property String^ MyProperty1
- {
- String^ get()
- {
- return myMessage;
- }
-
- void set( String^ value )
- {
- myMessage = value;
- }
- }
-};
-
-int main()
-{
- try
- {
- Type^ myType = MyClass1::typeid;
-
- // Get the PropertyInfo Object* representing MyProperty1.
- PropertyInfo^ myStringProperties1 = myType->GetProperty( "MyProperty1", String::typeid );
- Console::WriteLine( "The name of the first property of MyClass1 is {0}.", myStringProperties1->Name );
- Console::WriteLine( "The type of the first property of MyClass1 is {0}.", myStringProperties1->PropertyType );
- }
- catch ( ArgumentNullException^ e )
- {
- Console::WriteLine( "ArgumentNullException : {0}", e->Message );
- }
- catch ( AmbiguousMatchException^ e )
- {
- Console::WriteLine( "AmbiguousMatchException : {0}", e->Message );
- }
- catch ( NullReferenceException^ e )
- {
- Console::WriteLine( "Source : {0}", e->Source );
- Console::WriteLine( "Message : {0}", e->Message );
- }
- //Output:
- //The name of the first property of MyClass1 is MyProperty1.
- //The type of the first property of MyClass1 is System.String.
-
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp
deleted file mode 100644
index eb10775df99..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
- try {
- // Get the type of a specified class.
- Type^ myType1 = Type::GetType( "System.Int32" );
- Console::WriteLine( "The full name is {0}.\n", myType1->FullName );
- }
- catch ( TypeLoadException^ e ) {
- Console::WriteLine("{0}: Unable to load type System.Int32",
- e->GetType()->Name);
- }
-
- try {
- // Since NoneSuch does not exist in this assembly, GetType throws a TypeLoadException.
- Type^ myType2 = Type::GetType( "NoneSuch", true );
- Console::WriteLine( "The full name is {0}.", myType2->FullName );
- }
- catch ( TypeLoadException^ e ) {
- Console::WriteLine("{0}: Unable to load type NoneSuch",
- e->GetType()->Name);
- }
-
-}
-// The example displays the following output:
-// The full name is System.Int32.
-//
-// TypeLoadException: Unable to load type NoneSuch
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp
deleted file mode 100644
index 4eedf13f6b4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-
-// System::Type::GetTypeCode()
-// System::Type::GetProperties()
-// System::Type::GetTypeArray()
-// System::Type::GetType(String, Boolean, Boolean)
-/* The following example demonstrates the 'GetTypeCode()', 'GetProperties()', 'GetTypeArray()',
-'GetType(String, Boolean, Boolean)' methods of 'Type' class.
-An object of 'Type' corresponding to 'System::Int32 is obtained '. Properties of 'System::Type'
-is retrieved into 'PropertyInfo' array and displayed. Array of 'Type' objects is created
-which represents the type specified by an arbitary set of objects. When 'Type' object is
-attempted to create for 'sYSTem.iNT32', an exception is thrown when case-sensitive search
-is done.
-*/
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- //
- // Create an object of 'Type' class.
- Type^ myType1 = Type::GetType( "System.Int32" );
-
- // Get the 'TypeCode' of the 'Type' class object created above.
- TypeCode myTypeCode = Type::GetTypeCode( myType1 );
- Console::WriteLine( "TypeCode is: {0}", myTypeCode );
- //
-
- //
- array^myPropertyInfo;
-
- // Get the properties of 'Type' class object.
- myPropertyInfo = Type::GetType( "System.Type" )->GetProperties();
- Console::WriteLine( "Properties of System.Type are:" );
- for ( int i = 0; i < myPropertyInfo->Length; i++ )
- {
- Console::WriteLine( myPropertyInfo[ i ] );
-
- }
- //
-
- //
- array^myObject = gcnew array(3);
- myObject[ 0 ] = 66;
- myObject[ 1 ] = "puri";
- myObject[ 2 ] = 33.33;
-
- // Get the array of 'Type' class objects.
- array^myTypeArray = Type::GetTypeArray( myObject );
- Console::WriteLine( "Full names of the 'Type' objects in the array are:" );
- for ( int h = 0; h < myTypeArray->Length; h++ )
- {
- Console::WriteLine( myTypeArray[ h ]->FullName );
-
- }
- //
-
- //
- try
- {
- // Throws 'TypeLoadException' because of case-sensitive search.
- Type^ myType2 = Type::GetType( "sYSTem.iNT32", true, false );
- Console::WriteLine( myType2->FullName );
- }
- catch ( TypeLoadException^ e )
- {
- Console::WriteLine( e->Message );
- }
- //
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp
deleted file mode 100644
index 3bdbda50535..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// System::Type::GetTypeFromHandle(RuntimeTypeHandle)
-
-/*
-The following example demonstrates the 'GetTypeFromHandle(RuntimeTypeHandle)' method
-of the 'Type' Class.
-It defines an empty class 'Myclass1' and obtains an object of 'Myclass1'. Then the runtime handle of
-the object is obtained and passed as an argument to 'GetTypeFromHandle(RuntimeTypeHandle)'method. That
-returns the type referenced by the specified type handle.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-public ref class MyClass1{};
-
-int main()
-{
- //
- MyClass1^ myClass1 = gcnew MyClass1;
- // Get the type referenced by the specified type handle.
- Type^ myClass1Type = Type::GetTypeFromHandle( Type::GetTypeHandle( myClass1 ) );
- Console::WriteLine( "The Names of the Attributes : {0}", myClass1Type->Attributes );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp
deleted file mode 100644
index f5e69fb913a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- try
- {
-
- // Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1.
- String^ myString1 = "DIRECT.ddPalette.3";
-
- // Use a nonexistent ProgID WrongProgID.
- String^ myString2 = "WrongProgID";
-
- // Make a call to the method to get the type information of the given ProgID.
- Type^ myType1 = Type::GetTypeFromProgID( myString1, true );
- Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID );
-
- // Throw an exception because the ProgID is invalid and the throwOnError
- // parameter is set to True.
- Type^ myType2 = Type::GetTypeFromProgID( myString2, true );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp
deleted file mode 100644
index 1e6853e4688..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- try
- {
-
- // Use the ProgID localhost\HKEY_CLASSES_ROOT\DirControl::DirList.1.
- String^ theProgramID = "DirControl.DirList.1";
-
- // Use the server name localhost.
- String^ theServer = "localhost";
-
- // Make a call to the method to get the type information for the given ProgID.
- Type^ myType = Type::GetTypeFromProgID( theProgramID, theServer );
- if ( myType == nullptr )
- {
- throw gcnew Exception( "Invalid ProgID or Server." );
- }
- Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType->GUID );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp
deleted file mode 100644
index 706229d1e8d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- try
- {
-
- // Use server localhost.
- String^ theServer = "localhost";
-
- // Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1.
- String^ myString1 = "DirControl.DirList.1";
-
- // Use a wrong ProgID WrongProgID.
- String^ myString2 = "WrongProgID";
-
- // Make a call to the method to get the type information for the given ProgID.
- Type^ myType1 = Type::GetTypeFromProgID( myString1, theServer, true );
- Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID );
-
- // Throw an exception because the ProgID is invalid and the throwOnError
- // parameter is set to True.
- Type^ myType2 = Type::GetTypeFromProgID( myString2, theServer, true );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception occurred. The ProgID is wrong." );
- Console::WriteLine( "Source: {0}", e->Source );
- Console::WriteLine( "Message: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp
deleted file mode 100644
index fe262565879..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class MyClass1
-{
-private:
- int x;
-
-public:
- int MyMethod()
- {
- return x;
- }
-};
-
-int main()
-{
- MyClass1^ myClass1 = gcnew MyClass1;
-
- // Get the RuntimeTypeHandle from an object.
- RuntimeTypeHandle myRTHFromObject = Type::GetTypeHandle( myClass1 );
-
- // Get the RuntimeTypeHandle from a type.
- RuntimeTypeHandle myRTHFromType = MyClass1::typeid->TypeHandle;
-
- Console::WriteLine( "\nmyRTHFromObject.Value: {0}", myRTHFromObject.Value );
- Console::WriteLine( "myRTHFromObject.GetType(): {0}", myRTHFromObject.GetType() );
- Console::WriteLine( "Get the type back from the handle..." );
- Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromObject): {0}",
- Type::GetTypeFromHandle(myRTHFromObject) );
-
- Console::WriteLine( "\nmyRTHFromObject.Equals(myRTHFromType): {0}",
- myRTHFromObject.Equals(myRTHFromType) );
-
- Console::WriteLine( "\nmyRTHFromType.Value: {0}", myRTHFromType.Value );
- Console::WriteLine( "myRTHFromType.GetType(): {0}", myRTHFromType.GetType() );
- Console::WriteLine( "Get the type back from the handle..." );
- Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromType): {0}",
- Type::GetTypeFromHandle(myRTHFromType) );
-}
-
-/* This code example produces output similar to the following:
-
-myRTHFromObject.Value: 3295832
-myRTHFromObject.GetType(): System.RuntimeTypeHandle
-Get the type back from the handle...
-Type::GetTypeFromHandle(myRTHFromObject): MyClass1
-
-myRTHFromObject.Equals(myRTHFromType): True
-
-myRTHFromType.Value: 3295832
-myRTHFromType.GetType(): System.RuntimeTypeHandle
-Get the type back from the handle...
-Type::GetTypeFromHandle(myRTHFromType): MyClass1
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp
deleted file mode 100644
index 5f399d51673..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-ref class MyGetTypeFromCLSID
-{
-public:
- ref class MyClass1
- {
- public:
- void MyMethod1(){}
- };
-};
-
-int main()
-{
-
- // Get the type corresponding to the class MyClass.
- Type^ myType = MyGetTypeFromCLSID::MyClass1::typeid;
-
- // Get the Object* of the Guid.
- Guid myGuid = (Guid)myType->GUID;
- Console::WriteLine( "The name of the class is {0}", myType );
- Console::WriteLine( "The ClassId of MyClass is {0}", myType->GUID );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp
deleted file mode 100644
index c11f4e80d20..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-
-public ref class Example
-{
-public:
- // This method is for demonstration purposes. It includes a
- // tracking reference (C# ref, VB ByRef), an out parameter,
- // and a pointer.
- void Test(int% x, [OutAttribute()] int% y, int* z)
- {
- *z = x = y = 0;
- }
-};
-
-int main()
-{
- // All of the following display 'True'.
-
- // Define a managed array, get its type, and display HasElementType.
- array^ examples = {gcnew Example(), gcnew Example()};
- Type^ t = examples::typeid;
- Console::WriteLine(t);
- Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType);
-
- // When you use Reflection Emit to emit dynamic methods and
- // assemblies, you can create array types using MakeArrayType.
- // The following creates the type 'array of Example'.
- t = Example::typeid->MakeArrayType();
- Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType);
-
- // When you reflect over methods, HasElementType is true for
- // ref, out, and pointer parameter types. The following
- // gets the Test method, defined above, and examines its
- // parameters.
- MethodInfo^ mi = Example::typeid->GetMethod("Test");
- array^ parms = mi->GetParameters();
- t = parms[0]->ParameterType;
- Console::WriteLine("HasElementType is '{0}' for ref parameter types.", t->HasElementType);
- t = parms[1]->ParameterType;
- Console::WriteLine("HasElementType is '{0}' for out parameter types.", t->HasElementType);
- t = parms[2]->ParameterType;
- Console::WriteLine("HasElementType is '{0}' for pointer parameter types.", t->HasElementType);
-
- // When you use Reflection Emit to emit dynamic methods and
- // assemblies, you can create pointer and ByRef types to use
- // when you define method parameters.
- t = Example::typeid->MakePointerType();
- Console::WriteLine("HasElementType is '{0}' for pointer types.", t->HasElementType);
- t = Example::typeid->MakeByRefType();
- Console::WriteLine("HasElementType is '{0}' for ByRef types.", t->HasElementType);
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp
deleted file mode 100644
index a2a8c92e5cd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class MyTypeDelegator: public TypeDelegator
-{
-public:
- String^ myElementType;
-
-private:
- Type^ myType;
-
-public:
- MyTypeDelegator( Type^ myType )
- : TypeDelegator( myType )
- {
- this->myType = myType;
- }
-
-
-protected:
-
- // Override Type::HasElementTypeImpl().
- virtual bool HasElementTypeImpl() override
- {
-
- // Determine whether the type is an array.
- if ( myType->IsArray )
- {
- myElementType = "array";
- return true;
- }
-
-
- // Determine whether the type is a reference.
- if ( myType->IsByRef )
- {
- myElementType = "reference";
- return true;
- }
-
-
- // Determine whether the type is a pointer.
- if ( myType->IsPointer )
- {
- myElementType = "pointer";
- return true;
- }
-
-
- // Return false if the type is not a reference, array, or pointer type.
- return false;
- }
-
-};
-
-int main()
-{
- try
- {
- int myInt = 0;
- array^myArray = gcnew array(5);
- MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() );
-
- // Determine whether myType is an array, pointer, reference type.
- Console::WriteLine( "\nDetermine whether a variable is an array, pointer, or reference type.\n" );
- if ( myType->HasElementType )
- Console::WriteLine( "The type of myArray is {0}.", myType->myElementType );
- else
- Console::WriteLine( "myArray is not an array, pointer, or reference type." );
- myType = gcnew MyTypeDelegator( myInt.GetType() );
-
- // Determine whether myType is an array, pointer, reference type.
- if ( myType->HasElementType )
- Console::WriteLine( "The type of myInt is {0}.", myType->myElementType );
- else
- Console::WriteLine( "myInt is not an array, pointer, or reference type." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp
deleted file mode 100644
index 6bdc99f8a1b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class MyClass
-{
-protected:
- String^ myField;
-
-public:
- MyClass()
- {
- myField = "A sample protected field";
- }
-};
-
-int main()
-{
- try
- {
- MyClass^ myObject = gcnew MyClass;
-
- // Get the type of the 'MyClass'.
- Type^ myType = MyClass::typeid;
-
- // Get the field information and the attributes associated with MyClass.
- FieldInfo^ myFieldInfo = myType->GetField( "myField", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
- Console::WriteLine( "\nChecking for the AnsiClass attribute for a field.\n" );
-
- // Get and display the name, field, and the AnsiClass attribute.
- Console::WriteLine( "Name of Class: {0} \nValue of Field: {1} \nIsAnsiClass = {2}", myType->FullName, myFieldInfo->GetValue( myObject ), myType->IsAnsiClass );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp
deleted file mode 100644
index dadf165d511..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class MyTypeDelegator: public TypeDelegator
-{
-public:
- String^ myElementType;
- Type^ myType;
- MyTypeDelegator( Type^ myType )
- : TypeDelegator( myType )
- {
- this->myType = myType;
- }
-
-
-protected:
-
- // Override IsArrayImpl().
- virtual bool IsArrayImpl() override
- {
-
- // Determine whether the type is an array.
- if ( myType->IsArray )
- {
- myElementType = "array";
- return true;
- }
-
-
- // Return false if the type is not an array.
- return false;
- }
-
-};
-
-int main()
-{
- try
- {
- int myInt = 0;
-
- // Create an instance of an array element.
- array^myArray = gcnew array(5);
- MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() );
- Console::WriteLine( "\nDetermine whether the variable is an array.\n" );
-
- // Determine whether myType is an array type.
- if ( myType->IsArray )
- Console::WriteLine( "The type of myArray is {0}.", myType->myElementType );
- else
- Console::WriteLine( "myArray is not an array." );
- myType = gcnew MyTypeDelegator( myInt.GetType() );
-
- // Determine whether myType is an array type.
- if ( myType->IsArray )
- Console::WriteLine( "The type of myInt is {0}.", myType->myElementType );
- else
- Console::WriteLine( "myInt is not an array." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp
deleted file mode 100644
index 9c15d3604d7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::ComponentModel;
-using namespace System::Runtime::InteropServices;
-
-// The MyDemoAttribute class is selected as AutoLayout.
-
-[StructLayoutAttribute(LayoutKind::Auto)]
-public ref class MyDemoAttribute{};
-
-void MyAutoLayoutMethod( String^ typeName )
-{
- try
- {
-
- // Create an instance of the Type class using the GetType method.
- Type^ myType = Type::GetType( typeName );
-
- // Get and display the IsAutoLayout property of the
- // MyDemoAttribute instance.
- Console::WriteLine( "\nThe AutoLayout property for the MyDemoAttribute is {0}.", myType->IsAutoLayout );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nAn exception occurred: {0}.", e->Message );
- }
-
-}
-
-int main()
-{
- MyAutoLayoutMethod( "MyDemoAttribute" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp
deleted file mode 100644
index 028383c4410..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class MyDemoClass{};
-
-int main()
-{
- try
- {
- Type^ myType = Type::GetType( "MyDemoClass" );
-
- // Get and display the 'IsClass' property of the 'MyDemoClass' instance.
- Console::WriteLine( "\nIs the specified type a class? {0}.", myType->IsClass );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nAn exception occurred: {0}.", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp
deleted file mode 100644
index a9a34cadfd5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Runtime::Remoting::Contexts;
-
-public ref class ContextBoundClass: public ContextBoundObject
-{
- public:
- String^ Value;
-};
-
-public ref class Example
-{
-public:
- void Demo()
- {
- // Determine whether the types can be hosted in a Context.
- Console::WriteLine("The IsContextful property for the {0} type is {1}.",
- Example::typeid->Name, Example::typeid->IsContextful);
- Console::WriteLine("The IsContextful property for the {0} type is {1}.",
- ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsContextful);
-
- // Determine whether the types are marshalled by reference.
- Console::WriteLine("The IsMarshalByRef property of {0} is {1}.",
- Example::typeid->Name, Example::typeid->IsMarshalByRef );
- Console::WriteLine("The IsMarshalByRef property of {0} is {1}.",
- ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsMarshalByRef );
-
- // Determine whether the types are primitive datatypes.
- Console::WriteLine("{0} is a primitive data type: {1}.",
- int::typeid->Name, int::typeid->IsPrimitive );
- Console::WriteLine("{0} is a primitive data type: {1}.",
- String::typeid->Name, String::typeid->IsPrimitive );
- }
-};
-
-int main()
-{
- Example^ ex = gcnew Example;
- ex->Demo();
-}
-// The example displays the following output:
-// The IsContextful property for the Example type is False.
-// The IsContextful property for the ContextBoundClass type is True.
-// The IsMarshalByRef property of Example is False.
-// The IsMarshalByRef property of ContextBoundClass is True.
-// Int32 is a primitive data type: True.
-// String is a primitive data type: False.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp
deleted file mode 100644
index 1ce5137c1af..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class MyTypeDelegatorClass: public TypeDelegator
-{
-public:
- String^ myElementType;
-
-private:
- Type^ myType;
-
-public:
- MyTypeDelegatorClass( Type^ myType )
- : TypeDelegator( myType )
- {
- this->myType = myType;
- }
-
-protected:
-
- // Override IsContextfulImpl.
- virtual bool IsContextfulImpl() override
- {
-
- // Check whether the type is contextful.
- if ( myType->IsContextful )
- {
- myElementType = " is contextful ";
- return true;
- }
-
- return false;
- }
-
-};
-
-public ref class MyTypeDemoClass{};
-
-
-// This class demonstrates IsContextfulImpl.
-public ref class MyContextBoundClass: public ContextBoundObject
-{
-public:
- String^ myString;
-};
-
-int main()
-{
- try
- {
- MyTypeDelegatorClass^ myType;
- Console::WriteLine( "Check whether MyContextBoundClass can be hosted in a context." );
-
- // Check whether MyContextBoundClass is contextful.
- myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid );
- if ( myType->IsContextful )
- {
- Console::WriteLine( "{0} can be hosted in a context.", MyContextBoundClass::typeid );
- }
- else
- {
- Console::WriteLine( "{0} cannot be hosted in a context.", MyContextBoundClass::typeid );
- }
- myType = gcnew MyTypeDelegatorClass( MyTypeDemoClass::typeid );
- Console::WriteLine( "\nCheck whether MyTypeDemoClass can be hosted in a context." );
- if ( myType->IsContextful )
- {
- Console::WriteLine( "{0} can be hosted in a context.", MyTypeDemoClass::typeid );
- }
- else
- {
- Console::WriteLine( "{0} cannot be hosted in a context.", MyTypeDemoClass::typeid );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp
deleted file mode 100644
index f8e795207a6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-//
-using namespace System;
-
-// Declare an interface.
-interface class myIFace{};
-public ref class MyIsInterface{};
-
-void main()
-{
- try
- {
- // Get the IsInterface attribute for myIFace.
- bool myBool1 = myIFace::typeid->IsInterface;
-
- //Display the IsInterface attribute for myIFace.
- Console::WriteLine( "Is the specified type an interface? {0}.", myBool1 );
-
- // Get the attribute IsInterface for MyIsInterface.
- bool myBool2 = MyIsInterface::typeid->IsInterface;
-
- //Display the IsInterface attribute for MyIsInterface.
- Console::WriteLine( "Is the specified type an interface? {0}.", myBool2 );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nAn exception occurred: {0}.", e->Message );
- }
-}
-/* The example produces the following output:
-
-Is the specified type an interface? True.
-Is the specified type an interface? False.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp
deleted file mode 100644
index db0652f266e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::ComponentModel;
-using namespace System::Runtime::InteropServices;
-ref class MyTypeSequential1{};
-
-
-[StructLayoutAttribute(LayoutKind::Sequential)]
-ref class MyTypeSequential2{};
-
-int main()
-{
- try
- {
-
- // Create an instance of myTypeSeq1.
- MyTypeSequential1^ myObj1 = gcnew MyTypeSequential1;
-
- // Check for and display the SequentialLayout attribute.
- Console::WriteLine( "\nThe object myObj1 has IsLayoutSequential: {0}.", myObj1->GetType()->IsLayoutSequential );
-
- // Create an instance of 'myTypeSeq2' class.
- MyTypeSequential2^ myObj2 = gcnew MyTypeSequential2;
-
- // Check for and display the SequentialLayout attribute.
- Console::WriteLine( "\nThe object myObj2 has IsLayoutSequential: {0}.", myObj2->GetType()->IsLayoutSequential );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nAn exception occurred: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp
deleted file mode 100644
index d6c5c85b0f9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class MyTypeDelegatorClass: public TypeDelegator
-{
-public:
- String^ myElementType;
-
-private:
- Type^ myType;
-
-public:
- MyTypeDelegatorClass( Type^ myType )
- : TypeDelegator( myType )
- {
- this->myType = myType;
- }
-
-protected:
-
- // Override IsMarshalByRefImpl.
- virtual bool IsMarshalByRefImpl() override
- {
- // Determine whether the type is marshalled by reference.
- if ( myType->IsMarshalByRef )
- {
- myElementType = " marshalled by reference";
- return true;
- }
-
- return false;
- }
-};
-
-public ref class MyTypeDemoClass{};
-
-
-// This class is used to demonstrate the IsMarshalByRefImpl method.
-public ref class MyContextBoundClass: public ContextBoundObject
-{
-public:
- String^ myString;
-};
-
-int main()
-{
- try
- {
- MyTypeDelegatorClass^ myType;
- Console::WriteLine( "Determine whether MyContextBoundClass is marshalled by reference." );
-
- // Determine whether MyContextBoundClass type is marshalled by reference.
- myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid );
- if ( myType->IsMarshalByRef )
- {
- Console::WriteLine( "{0} is marshalled by reference.", MyContextBoundClass::typeid );
- }
- else
- {
- Console::WriteLine( "{0} is not marshalled by reference.", MyContextBoundClass::typeid );
- }
-
- // Determine whether int type is marshalled by reference.
- myType = gcnew MyTypeDelegatorClass( int::typeid );
- Console::WriteLine( "\nDetermine whether int is marshalled by reference." );
- if ( myType->IsMarshalByRef )
- {
- Console::WriteLine( "{0} is marshalled by reference.", int::typeid );
- }
- else
- {
- Console::WriteLine( "{0} is not marshalled by reference.", int::typeid );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp
deleted file mode 100644
index 777086959b5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class MyTypeDelegatorClass: public TypeDelegator
-{
-public:
- String^ myElementType;
-
-private:
- Type^ myType;
-
-public:
- MyTypeDelegatorClass( Type^ myType )
- : TypeDelegator( myType )
- {
- this->myType = myType;
- }
-
-protected:
-
- // Override the IsPrimitiveImpl.
- virtual bool IsPrimitiveImpl() override
- {
-
- // Determine whether the type is a primitive type.
- if ( myType->IsPrimitive )
- {
- myElementType = "primitive";
- return true;
- }
-
- return false;
- }
-};
-
-int main()
-{
- try
- {
- Console::WriteLine( "Determine whether int is a primitive type." );
- MyTypeDelegatorClass^ myType;
- myType = gcnew MyTypeDelegatorClass( int::typeid );
-
- // Determine whether int is a primitive type.
- if ( myType->IsPrimitive )
- {
- Console::WriteLine( "{0} is a primitive type.", int::typeid );
- }
- else
- {
- Console::WriteLine( "{0} is not a primitive type.", int::typeid );
- }
- Console::WriteLine( "\nDetermine whether String is a primitive type." );
- myType = gcnew MyTypeDelegatorClass( String::typeid );
-
- // Determine if String is a primitive type.
- if ( myType->IsPrimitive )
- {
- Console::WriteLine( "{0} is a primitive type.", String::typeid );
- }
- else
- {
- Console::WriteLine( "{0} is not a primitive type.", String::typeid );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp
deleted file mode 100644
index ef24b8b9c18..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-
-// Declare MyTestClass as sealed.
-ref class TestClass sealed{};
-
-int main()
-{
- TestClass^ testClassInstance = gcnew TestClass;
-
- // Get the type of testClassInstance.
- Type^ type = testClassInstance->GetType();
-
- // Get the IsSealed property of the myTestClassInstance.
- bool sealed = type->IsSealed;
- Console::WriteLine("{0} is sealed: {1}.", type->FullName, sealed);
-}
-// The example displays the following output:
-// TestClass is sealed: True.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp
deleted file mode 100644
index 80e31b7ccbb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-public ref class MyClass
-{
-public:
-
- // Declare a public class with the [Serializable] attribute.
-
- [Serializable]
- ref class MyTestClass{};
-
-
-};
-
-int main()
-{
- try
- {
- bool myBool = false;
- MyClass::MyTestClass^ myTestClassInstance = gcnew MyClass::MyTestClass;
-
- // Get the type of myTestClassInstance.
- Type^ myType = myTestClassInstance->GetType();
-
- // Get the IsSerializable property of myTestClassInstance.
- myBool = myType->IsSerializable;
- Console::WriteLine( "\nIs {0} serializable? {1}.", myType->FullName, myBool );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nAn exception occurred: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp
deleted file mode 100644
index c8ad8156905..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-
-// Declare an enum type.
-public enum class NumEnum
-{
- One, Two
-};
-
-int main()
-{
- bool flag = false;
- NumEnum testEnum = NumEnum::One;
-
- // Get the type of testEnum.
- Type^ t = testEnum.GetType();
-
- // Get the IsValueType property of the testEnum
- // variable.
- flag = t->IsValueType;
- Console::WriteLine("{0} is a value type: {1}", t->FullName, flag);
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp b/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp
deleted file mode 100644
index d6e8a01a328..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-
-namespace MyNamespace
-{
- ref class MyClass
- {
- };
-}
-
-void main()
-{
- Type^ myType = MyNamespace::MyClass::typeid;
- Console::WriteLine("Displaying information about {0}:", myType );
-
- // Get the namespace of the class MyClass.
- Console::WriteLine(" Namespace: {0}", myType->Namespace );
-
- // Get the name of the module.
- Console::WriteLine(" Module: {0}", myType->Module );
-
- // Get the fully qualified common language runtime namespace.
- Console::WriteLine(" Fully qualified type: {0}", myType );
-}
-// The example displays the following output:
-// Displaying information about MyNamespace.MyClass:
-// Namespace: MyNamespace
-// Module: type_tostring.exe
-// Fully qualified name: MyNamespace.MyClass
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp
deleted file mode 100644
index 23ac79f22ee..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-ref class MyClass
-{
-public:
- int myField;
-};
-
-void DisplayTypeHandle( RuntimeTypeHandle myTypeHandle )
-{
-
- // Get the type from the handle.
- Type^ myType = Type::GetTypeFromHandle( myTypeHandle );
-
- // Display the type.
- Console::WriteLine( "\nDisplaying the type from the handle:\n" );
- Console::WriteLine( "The type is {0}.", myType );
-}
-
-int main()
-{
- try
- {
- MyClass^ myClass = gcnew MyClass;
-
- // Get the type of MyClass.
- Type^ myClassType = myClass->GetType();
-
- // Get the runtime handle of MyClass.
- RuntimeTypeHandle myClassHandle = myClassType->TypeHandle;
- DisplayTypeHandle( myClassHandle );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp
deleted file mode 100644
index 439589d1a61..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp
+++ /dev/null
@@ -1,631 +0,0 @@
-
-// This is the main DLL file.
-using namespace System;
-using namespace System::Globalization;
-
-#define NULL 0
-
-//
-///
-/// Temperature class stores the value as UInt16
-/// and delegates most of the functionality
-/// to the UInt16 implementation.
-///
-public ref class Temperature: public IComparable, public IFormattable
-{
-protected:
-
- ///
- /// IComparable.CompareTo implementation.
- ///
- short m_value;
-
-public:
- virtual Int32 CompareTo( Object^ obj )
- {
- if ( obj->GetType() == Temperature::typeid )
- {
- Temperature^ temp = dynamic_cast(obj);
- return m_value.CompareTo( temp->m_value );
- }
-
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
-
- ///
- /// IFormattable.ToString implementation.
- ///
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr )
- {
- if ( format->Equals( "F" ) )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- if ( format->Equals( "C" ) )
- {
- return String::Format( "{0}'C", this->Celsius.ToString() );
- }
- }
-
- return m_value.ToString( format, provider );
- }
-
-
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->EndsWith( "F" ) )
- {
- temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- if ( s->EndsWith( "C" ) )
- {
- temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = UInt16::Parse( s, styles, provider );
- }
- }
-
- return temp;
- }
-
-
- property short Value
- {
-
- // The value holder
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (short)(value * 2 + 32);
- }
-
- }
-
- static property short MinValue
- {
- short get()
- {
- return UInt16::MinValue;
- }
-
- }
-
- static property short MaxValue
- {
- short get()
- {
- return UInt16::MaxValue;
- }
-
- }
-
-};
-//
-
-void main()
-{
- Temperature^ t1 = Temperature::Parse( "40'F", NumberStyles::Integer, nullptr );
- Console::WriteLine( t1->ToString( "F", nullptr ) );
- String^ str1 = t1->ToString( "C", nullptr );
- Console::WriteLine( str1 );
- Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr );
- Console::WriteLine( t2->ToString( "F", nullptr ) );
- Console::WriteLine( t1->CompareTo( t2 ) );
- Temperature^ t3 = Temperature::Parse( "40'C", NumberStyles::Integer, nullptr );
- Console::WriteLine( t3->ToString( "F", nullptr ) );
- Console::WriteLine( t1->CompareTo( t3 ) );
-}
-
-
-/* expected return values:
-40'F
-4'C
-40'F
-0
-112'F
--72
-*/
-namespace Snippets2
-{
- //
- public ref class Temperature
- {
- protected:
-
- // The value holder
- short m_value;
-
- public:
-
- static property short MinValue
- {
- short get()
- {
- return UInt16::MinValue;
- }
-
- }
-
- static property short MaxValue
- {
- short get()
- {
- return UInt16::MaxValue;
- }
-
- }
-
- property short Value
- {
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (short)(value * 2 + 32);
- }
-
- }
-
- };
-
-}
-//
-
-namespace Snippets3
-{
-
- //
- public ref class Temperature: public IComparable
- {
- protected:
-
- ///
- /// IComparable.CompareTo implementation.
- ///
- // The value holder
- short m_value;
-
- public:
- virtual Int32 CompareTo( Object^ obj )
- {
- if ( obj->GetType() == Temperature::typeid )
- {
- Temperature^ temp = dynamic_cast(obj);
- return m_value.CompareTo( temp->m_value );
- }
-
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
-
- property short Value
- {
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (value * 2 + 32);
- }
-
- }
-
- };
-
-}
-//
-
-namespace Snippets4
-{
-
- //
- public ref class Temperature: public IFormattable
- {
- protected:
-
- ///
- /// IFormattable.ToString implementation.
- ///
- // The value holder
- short m_value;
-
- public:
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr )
- {
- if ( format->Equals( "F" ) )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- if ( format->Equals( "C" ) )
- {
- return String::Format( "{0}'C", this->Celsius.ToString() );
- }
- }
-
- return m_value.ToString( format, provider );
- }
-
-
- property short Value
- {
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (short)(value * 2 + 32);
- }
-
- }
-
- };
-
-}
-//
-
-namespace Snippets5
-{
- //
- public ref class Temperature
- {
- protected:
-
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- // The value holder
- short m_value;
-
- public:
- static Temperature^ Parse( String^ s )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd( NULL )->EndsWith( "'F" ) )
- {
- temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) );
- }
- else
- {
- if ( s->TrimEnd( NULL )->EndsWith( "'C" ) )
- {
- temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) );
- }
- else
- {
- temp->Value = UInt16::Parse( s );
- }
- }
-
- return temp;
- }
-
-
- property short Value
- {
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (short)(value * 2 + 32);
- }
-
- }
-
- };
-
-}
-//
-
-namespace Snippets6
-{
- //
- public ref class Temperature
- {
- protected:
-
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- // The value holder
- short m_value;
-
- public:
- static Temperature^ Parse( String^ s, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd( NULL )->EndsWith( "'F" ) )
- {
- temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider );
- }
- else
- {
- if ( s->TrimEnd( NULL )->EndsWith( "'C" ) )
- {
- temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider );
- }
- else
- {
- temp->Value = UInt16::Parse( s, provider );
- }
- }
-
- return temp;
- }
-
-
- property short Value
- {
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (short)(value * 2 + 32);
- }
-
- }
-
- };
-
-}
-//
-
-namespace Snippets7
-{
- //
- public ref class Temperature
- {
- protected:
-
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- // The value holder
- short m_value;
-
- public:
- static Temperature^ Parse( String^ s, NumberStyles styles )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd( NULL )->EndsWith( "'F" ) )
- {
- temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles );
- }
- else
- {
- if ( s->TrimEnd( NULL )->EndsWith( "'C" ) )
- {
- temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles );
- }
- else
- {
- temp->Value = UInt16::Parse( s, styles );
- }
- }
-
- return temp;
- }
-
-
- property short Value
- {
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (short)(value * 2 + 32);
- }
-
- }
-
- };
-
-}
-//
-
-namespace Snippets8
-{
- //
- public ref class Temperature
- {
- protected:
-
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- // The value holder
- short m_value;
-
- public:
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
- if ( s->TrimEnd( NULL )->EndsWith( "'F" ) )
- {
- temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- if ( s->TrimEnd( NULL )->EndsWith( "'C" ) )
- {
- temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = UInt16::Parse( s, styles, provider );
- }
- }
-
- return temp;
- }
-
-
- property short Value
- {
- short get()
- {
- return m_value;
- }
-
- void set( short value )
- {
- m_value = value;
- }
-
- }
-
- property short Celsius
- {
- short get()
- {
- return (short)((m_value - 32) / 2);
- }
-
- void set( short value )
- {
- m_value = (short)(value * 2 + 32);
- }
-
- }
-
- };
-
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp
deleted file mode 100644
index 03bba64ea5d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-// System::UInt16::Equals(Object)
-/*
-The following program demonstrates the 'Equals(Object)' method
-of struct 'UInt16'. This compares an instance of 'UInt16' with the
-passed in Object* and returns true if they are equal.
-*/
-using namespace System;
-
-int main()
-{
- try
- {
- //
- UInt16 myVariable1 = 10;
- UInt16 myVariable2 = 10;
-
- //Display the declaring type.
- Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 );
- Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 );
-
- // Compare 'myVariable1' instance with 'myVariable2' Object.
- if ( myVariable1.Equals( myVariable2 ) )
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" );
- else
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" );
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp
deleted file mode 100644
index 75a62e5c82b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-using namespace System;
-using namespace System::Globalization;
-
-namespace Snippets
-{
- //
- ///
- /// Temperature class stores the value as UInt32
- /// and delegates most of the functionality
- /// to the UInt32 implementation.
- ///
- public ref class Temperature: public IComparable, public IFormattable
- {
- public:
- ///
- /// IComparable.CompareTo implementation.
- ///
- virtual int CompareTo( Object^ obj )
- {
- if ( (Temperature^)( obj ) )
- {
- Temperature^ temp = (Temperature^)( obj );
-
- return m_value.CompareTo( temp->m_value );
- }
-
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
- ///
- /// IFormattable.ToString implementation.
- ///
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr && format == "F" )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- return m_value.ToString( format, provider );
- }
-
-
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = UInt32::Parse( s, styles, provider );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets2
-{
- //
- public ref class Temperature
- {
- public:
- static property UInt32 MinValue
- {
- UInt32 get()
- {
- return UInt32::MinValue;
- }
- }
-
- static property UInt32 MaxValue
- {
- UInt32 get()
- {
- return UInt32::MaxValue;
- }
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets3
-{
- //
- public ref class Temperature: public IComparable
- {
- public:
- ///
- /// IComparable.CompareTo implementation.
- ///
- virtual int CompareTo( Object^ obj )
- {
- if ( (Temperature^)( obj ) )
- {
- Temperature^ temp = (Temperature^)( obj );
-
- return m_value.CompareTo( temp->m_value );
- }
-
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets4
-{
- //
- public ref class Temperature: public IFormattable
- {
- public:
- ///
- /// IFormattable.ToString implementation.
- ///
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr && format == "F" )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- return m_value.ToString( format, provider );
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets5
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) );
- }
- else
- {
- temp->Value = UInt32::Parse( s );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets6
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider );
- }
- else
- {
- temp->Value = UInt32::Parse( s, provider );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets7
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, NumberStyles styles )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles );
- }
- else
- {
- temp->Value = UInt32::Parse( s, styles );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets8
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = UInt32::Parse( s, styles, provider );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt32 m_value;
-
- public:
- property UInt32 Value
- {
- UInt32 get()
- {
- return m_value;
- }
- void set( UInt32 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets
-{
- void Main()
- {
- Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr );
- Console::WriteLine( t1->ToString( "F", nullptr ) );
-
- String^ str1 = t1->ToString( "G", nullptr );
- Console::WriteLine( str1 );
-
- Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr );
- Console::WriteLine( t2->ToString( "F", nullptr ) );
-
- Console::WriteLine( t1->CompareTo( t2 ) );
-
- Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr );
- Console::WriteLine( t3->ToString( "F", nullptr ) );
-
- Console::WriteLine( t1->CompareTo( t3 ) );
-
- Console::ReadLine();
- }
-}
-
-int main()
-{
- Snippets::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp
deleted file mode 100644
index 66564fc6421..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-// System::UInt32::Equals(Object)
-/*
-The following program demonstrates the 'Equals(Object)' method
-of struct 'UInt32'. This compares an instance of 'UInt32' with the
-passed in Object* and returns true if they are equal.
-*/
-using namespace System;
-
-int main()
-{
- try
- {
- //
- UInt32 myVariable1 = 20;
- UInt32 myVariable2 = 20;
-
- // Display the declaring type.
- Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 );
- Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 );
-
- // Compare 'myVariable1' instance with 'myVariable2' Object.
- if ( myVariable1.Equals( myVariable2 ) )
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" );
- else
- Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" );
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp
deleted file mode 100644
index 0e4d7eef2ef..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-using namespace System;
-using namespace System::Globalization;
-
-//
-///
-/// Temperature class stores the value as UInt64
-/// and delegates most of the functionality
-/// to the UInt64 implementation.
-///
-public ref class Temperature: public IComparable, public IFormattable
-{
-public:
- ///
- /// IComparable.CompareTo implementation.
- ///
- virtual int CompareTo( Object^ obj )
- {
- if ( (Temperature^)( obj ) )
- {
- Temperature^ temp = (Temperature^)( obj );
-
- return m_value.CompareTo( temp->m_value );
- }
-
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
- ///
- /// IFormattable.ToString implementation.
- ///
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr && format == "F" )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- return m_value.ToString( format, provider );
- }
-
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = UInt64::Parse( s, styles, provider );
- }
-
- return temp;
- }
-
-protected:
- // The value holder
- UInt64 m_value;
-
-public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
-};
-//
-
-namespace Snippets2
-{
- //
- public ref class Temperature
- {
- public:
- static property Int64 MinValue
- {
- Int64 get()
- {
- return UInt64::MinValue;
- }
- }
-
- static property UInt64 MaxValue
- {
- UInt64 get()
- {
- return UInt64::MaxValue;
- }
- }
-
- protected:
- // The value holder
- UInt64 m_value;
-
- public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets3
-{
- //
- public ref class Temperature: public IComparable
- {
- public:
- ///
- /// IComparable.CompareTo implementation.
- ///
- virtual int CompareTo( Object^ obj )
- {
- if ( (Temperature^)( obj ) )
- {
- Temperature^ temp = (Temperature^)( obj );
-
- return m_value.CompareTo( temp->m_value );
- }
-
- throw gcnew ArgumentException( "object is not a Temperature" );
- }
-
- protected:
- // The value holder
- UInt64 m_value;
-
- public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets4
-{
- //
- public ref class Temperature: public IFormattable
- {
- public:
- ///
- /// IFormattable.ToString implementation.
- ///
- virtual String^ ToString( String^ format, IFormatProvider^ provider )
- {
- if ( format != nullptr && format == "F" )
- {
- return String::Format( "{0}'F", this->Value.ToString() );
- }
-
- return m_value.ToString( format, provider );
- }
-
- protected:
- // The value holder
- UInt64 m_value;
-
- public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets5
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) );
- }
- else
- {
- temp->Value = UInt64::Parse( s );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt64 m_value;
-
- public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets6
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider );
- }
- else
- {
- temp->Value = UInt64::Parse( s, provider );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt64 m_value;
-
- public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets7
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, NumberStyles styles )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles );
- }
- else
- {
- temp->Value = UInt64::Parse( s, styles );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt64 m_value;
-
- public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-namespace Snippets8
-{
- //
- public ref class Temperature
- {
- public:
- ///
- /// Parses the temperature from a string in form
- /// [ws][sign]digits['F|'C][ws]
- ///
- static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
- {
- Temperature^ temp = gcnew Temperature;
-
- if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
- {
- temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
- }
- else
- {
- temp->Value = UInt64::Parse( s, styles, provider );
- }
-
- return temp;
- }
-
- protected:
- // The value holder
- UInt64 m_value;
-
- public:
- property UInt64 Value
- {
- UInt64 get()
- {
- return m_value;
- }
- void set( UInt64 value )
- {
- m_value = value;
- }
- }
- };
-}
-//
-
-int main()
-{
- Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr );
- Console::WriteLine( t1->ToString( "F", nullptr ) );
-
- String^ str1 = t1->ToString( "G", nullptr );
- Console::WriteLine( str1 );
-
- Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr );
- Console::WriteLine( t2->ToString( "F", nullptr ) );
-
- Console::WriteLine( t1->CompareTo( t2 ) );
-
- Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr );
- Console::WriteLine( t3->ToString( "F", nullptr ) );
-
- Console::WriteLine( t1->CompareTo( t3 ) );
-
- Console::ReadLine();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp
deleted file mode 100644
index b5928f9ee25..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-using namespace System;
-
-int main()
-{
- UInt64 value1 = 50;
- UInt64 value2 = 50;
-
- // Display the values.
- Console::WriteLine("value1: Type: {0} Value: {1}",
- value1.GetType()->Name, value1);
- Console::WriteLine("value2: Type: {0} Value: {1}",
- value2.GetType()->Name, value2);
-
- // Compare the two values.
- Console::WriteLine("value1 and value2 are equal: {0}",
- value1.Equals(value2));
-}
-// The example displays the following output:
-// value1: Type: UInt64 Value: 50
-// value2: Type: UInt64 Value: 50
-// value1 and value2 are equal: True
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp b/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp
deleted file mode 100644
index 6a1f8f2f542..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-/*
-System.Uri.IsHexDigit
-
-The following program reads a string from console and determines whether the
-specified character is valid hexadecimal digit.
-*/
-#using
-
-using namespace System;
-int main()
-{
- try
- {
- //
- Console::Write( "Type a string : " );
- String^ myString = Console::ReadLine();
- for ( int i = 0; i < myString->Length; i++ )
- if ( Uri::IsHexDigit( myString[ i ] ) )
- Console::WriteLine( "{0} is a hexadecimal digit.", myString[ i ] );
- else
- Console::WriteLine( "{0} is not a hexadecimal digit.", myString[ i ] );
- // The example produces output like the following:
- // Type a string : 3f5EaZ
- // 3 is a hexadecimal digit.
- // f is a hexadecimal digit.
- // 5 is a hexadecimal digit.
- // E is a hexadecimal digit.
- // a is a hexadecimal digit.
- // Z is not a hexadecimal digit.
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-}
-
-// ***** Output *****
-/*
-
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp
deleted file mode 100644
index dfec68d03a1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-using namespace System;
-
-//
-public ref struct Complex
-{
-public:
- double m_Re;
- double m_Im;
- virtual bool Equals( Object^ ob ) override
- {
- if ( dynamic_cast(ob) )
- {
- Complex^ c = dynamic_cast(ob);
- return m_Re == c->m_Re && m_Im == c->m_Im;
- }
- else
- {
- return false;
- }
- }
-
- virtual int GetHashCode() override
- {
- return m_Re.GetHashCode() ^ m_Im.GetHashCode();
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp b/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp
deleted file mode 100644
index 7cd42aba971..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-
-//
-// This example demonstrates the Char.ConvertFromUtf32() method
-// and Char.ConvertToUtf32() overloads.
-using namespace System;
-void Show( String^ s )
-{
-// Console::Write( "0x{0:X}, 0x{1:X}", (int)s->get_Chars( 0 ), (int)s->get_Chars( 1 ) );
- Console::Write( "0x{0:X}, 0x{1:X}", (int)s[ 0 ], (int)s[ 1 ] );
-}
-
-int main()
-{
- int music = 0x1D161; //U+1D161 = MUSICAL SYMBOL SIXTEENTH NOTE
-
- String^ s1;
- String^ comment1a = "Create a UTF-16 encoded string from a code point.";
- String^ comment1b = "Create a code point from a surrogate pair at a certain position in a string.";
- String^ comment1c = "Create a code point from a high surrogate and a low surrogate code point.";
-
- // -------------------------------------------------------------------
- // Convert the code point U+1D161 to UTF-16. The UTF-16 equivalent of
- // U+1D161 is a surrogate pair with hexadecimal values D834 and DD61.
- Console::WriteLine( comment1a );
- s1 = Char::ConvertFromUtf32( music );
- Console::Write( " 1a) 0x{0:X} => ", music );
- Show( s1 );
- Console::WriteLine();
-
- // Convert the surrogate pair in the string at index position
- // zero to a code point.
- Console::WriteLine( comment1b );
- music = Char::ConvertToUtf32( s1, 0 );
- Console::Write( " 1b) " );
- Show( s1 );
- Console::WriteLine( " => 0x{0:X}", music );
-
- // Convert the high and low characters in the surrogate pair into a code point.
- Console::WriteLine( comment1c );
- music = Char::ConvertToUtf32( s1[ 0 ], s1[ 1 ] );
- Console::Write( " 1c) " );
- Show( s1 );
- Console::WriteLine( " => 0x{0:X}", music );
-}
-
-/*
-This example produces the following results:
-
-Create a UTF-16 encoded string from a code point.
- 1a) 0x1D161 => 0xD834, 0xDD61
-Create a code point from a surrogate pair at a certain position in a string.
- 1b) 0xD834, 0xDD61 => 0x1D161
-Create a code point from a high surrogate and a low surrogate code point.
- 1c) 0xD834, 0xDD61 => 0x1D161
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp b/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp
deleted file mode 100644
index 1a9d98b34ef..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-
-//
-// This example demonstrates the Char.IsLowSurrogate() method
-// IsHighSurrogate() method
-// IsSurrogatePair() method
-using namespace System;
-int main()
-{
- Char cHigh = L'\xD800';
- Char cLow = L'\xDC00';
- array^temp0 = {L'a',L'\xD800',L'\xDC00',L'z'};
- String^ s1 = gcnew String( temp0 );
- String^ divider = String::Concat( Environment::NewLine, gcnew String( '-',70 ), Environment::NewLine );
- Console::WriteLine();
- Console::WriteLine( "Hexadecimal code point of the character, cHigh: {0:X4}", (int)cHigh );
- Console::WriteLine( "Hexadecimal code point of the character, cLow: {0:X4}", (int)cLow );
- Console::WriteLine();
- Console::WriteLine( "Characters in string, s1: 'a', high surrogate, low surrogate, 'z'" );
- Console::WriteLine( "Hexadecimal code points of the characters in string, s1: " );
- for ( int i = 0; i < s1->Length; i++ )
- {
- Console::WriteLine( "s1[{0}] = {1:X4} ", i, (int)s1[ i ] );
- }
- Console::WriteLine( divider );
- Console::WriteLine( "Is each of the following characters a high surrogate?" );
- Console::WriteLine( "A1) cLow? - {0}", Char::IsHighSurrogate( cLow ) );
- Console::WriteLine( "A2) cHigh? - {0}", Char::IsHighSurrogate( cHigh ) );
- Console::WriteLine( "A3) s1[0]? - {0}", Char::IsHighSurrogate( s1, 0 ) );
- Console::WriteLine( "A4) s1[1]? - {0}", Char::IsHighSurrogate( s1, 1 ) );
- Console::WriteLine( divider );
- Console::WriteLine( "Is each of the following characters a low surrogate?" );
- Console::WriteLine( "B1) cLow? - {0}", Char::IsLowSurrogate( cLow ) );
- Console::WriteLine( "B2) cHigh? - {0}", Char::IsLowSurrogate( cHigh ) );
- Console::WriteLine( "B3) s1[0]? - {0}", Char::IsLowSurrogate( s1, 0 ) );
- Console::WriteLine( "B4) s1[2]? - {0}", Char::IsLowSurrogate( s1, 2 ) );
- Console::WriteLine( divider );
- Console::WriteLine( "Is each of the following pairs of characters a surrogate pair?" );
- Console::WriteLine( "C1) cHigh and cLow? - {0}", Char::IsSurrogatePair( cHigh, cLow ) );
- Console::WriteLine( "C2) s1[0] and s1[1]? - {0}", Char::IsSurrogatePair( s1, 0 ) );
- Console::WriteLine( "C3) s1[1] and s1[2]? - {0}", Char::IsSurrogatePair( s1, 1 ) );
- Console::WriteLine( "C4) s1[2] and s1[3]? - {0}", Char::IsSurrogatePair( s1, 2 ) );
- Console::WriteLine( divider );
-}
-
-/*
-This example produces the following results:
-
-Hexadecimal code point of the character, cHigh: D800
-Hexadecimal code point of the character, cLow: DC00
-
-Characters in string, s1: 'a', high surrogate, low surrogate, 'z'
-Hexadecimal code points of the characters in string, s1:
-s1[0] = 0061
-s1[1] = D800
-s1[2] = DC00
-s1[3] = 007A
-
-----------------------------------------------------------------------
-
-Is each of the following characters a high surrogate?
-A1) cLow? - False
-A2) cHigh? - True
-A3) s1[0]? - False
-A4) s1[1]? - True
-
-----------------------------------------------------------------------
-
-Is each of the following characters a low surrogate?
-B1) cLow? - True
-B2) cHigh? - False
-B3) s1[0]? - False
-B4) s1[2]? - True
-
-----------------------------------------------------------------------
-
-Is each of the following pairs of characters a surrogate pair?
-C1) cHigh and cLow? - True
-C2) s1[0] and s1[1]? - False
-C3) s1[1] and s1[2]? - True
-C4) s1[2] and s1[3]? - False
-
-----------------------------------------------------------------------
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp
deleted file mode 100644
index 23e5a5ec992..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-//
-// This example demonstrates the Console.Beep() method.
-using namespace System;
-int main()
-{
- array^args = Environment::GetCommandLineArgs();
- int x = 0;
-
- //
- if ( (args->Length == 2) && (Int32::TryParse( args[ 1 ], x )) && ((x >= 1) && (x <= 9)) )
- {
- for ( int i = 1; i <= x; i++ )
- {
- Console::WriteLine( "Beep number {0}.", i );
- Console::Beep();
-
- }
- }
- else
- Console::WriteLine( "Usage: Enter the number of times (between 1 and 9) to beep." );
-}
-
-/*
-This example produces the following results:
-
->beep
-Usage: Enter the number of times (between 1 and 9) to beep
-
->beep 9
-Beep number 1.
-Beep number 2.
-Beep number 3.
-Beep number 4.
-Beep number 5.
-Beep number 6.
-Beep number 7.
-Beep number 8.
-Beep number 9.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp
deleted file mode 100644
index d933d3fdf50..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-
-//
-// This example demonstrates the Console.Beep(Int32, Int32) method
-using namespace System;
-using namespace System::Threading;
-ref class Sample
-{
-protected:
-
- // Define the frequencies of notes in an octave, as well as
- // silence (rest).
- enum class Tone
- {
- REST = 0,
- GbelowC = 196,
- A = 220,
- Asharp = 233,
- B = 247,
- C = 262,
- Csharp = 277,
- D = 294,
- Dsharp = 311,
- E = 330,
- F = 349,
- Fsharp = 370,
- G = 392,
- Gsharp = 415
- };
-
-
- // Define the duration of a note in units of milliseconds.
- enum class Duration
- {
- WHOLE = 1600,
- HALF = Duration::WHOLE / 2,
- QUARTER = Duration::HALF / 2,
- EIGHTH = Duration::QUARTER / 2,
- SIXTEENTH = Duration::EIGHTH / 2
- };
-
-
-public:
-
- // Define a note as a frequency (tone) and the amount of
- // time (duration) the note plays.
- value struct Note
- {
- public:
- Tone toneVal;
- Duration durVal;
-
- // Define a constructor to create a specific note.
- Note( Tone frequency, Duration time )
- {
- toneVal = frequency;
- durVal = time;
- }
-
-
- property Tone NoteTone
- {
-
- // Define properties to return the note's tone and duration.
- Tone get()
- {
- return toneVal;
- }
-
- }
-
- property Duration NoteDuration
- {
- Duration get()
- {
- return durVal;
- }
-
- }
-
- };
-
-
-protected:
-
- // Play the notes in a song.
- static void Play( array^ tune )
- {
- System::Collections::IEnumerator^ myEnum = tune->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Note n = *safe_cast(myEnum->Current);
- if ( n.NoteTone == Tone::REST )
- Thread::Sleep( (int)n.NoteDuration );
- else
- Console::Beep( (int)n.NoteTone, (int)n.NoteDuration );
- }
- }
-
-
-public:
- static void Main()
- {
-
- // Declare the first few notes of the song, "Mary Had A Little Lamb".
- array^ Mary = {Note( Tone::B, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::GbelowC, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::HALF ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::HALF ),Note( Tone::B, Duration::QUARTER ),Note( Tone::D, Duration::QUARTER ),Note( Tone::D, Duration::HALF )};
-
- // Play the song
- Play( Mary );
- }
-
-};
-
-int main()
-{
- Sample::Main();
-}
-
-/*
-This example produces the following results:
-
-This example plays the first few notes of "Mary Had A Little Lamb"
-through the console speaker.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp b/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp
deleted file mode 100644
index 75f186ab055..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-// This example demonstrates the Console.BufferHeight and
-// Console.BufferWidth properties.
-using namespace System;
-int main()
-{
- Console::WriteLine( "The current buffer height is {0} rows.", Console::BufferHeight );
- Console::WriteLine( "The current buffer width is {0} columns.", Console::BufferWidth );
-}
-
-/*
-This example produces the following results:
-
-The current buffer height is 300 rows.
-The current buffer width is 85 columns.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp b/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp
deleted file mode 100644
index 4ad4c4573e5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-using namespace System;
-
-void OnCancelKeyPressed(Object^ sender,
- ConsoleCancelEventArgs^ args)
-{
- Console::WriteLine("{0}The read operation has been interrupted.",
- Environment::NewLine);
-
- Console::WriteLine(" Key pressed: {0}", args->SpecialKey);
-
- Console::WriteLine(" Cancel property: {0}", args->Cancel);
-
- // Set the Cancel property to true to prevent the process from
- // terminating.
- Console::WriteLine("Setting the Cancel property to true...");
- args->Cancel = true;
-
- // Announce the new value of the Cancel property.
- Console::WriteLine(" Cancel property: {0}", args->Cancel);
- Console::WriteLine("The read operation will resume...{0}",
- Environment::NewLine);
-}
-
-int main()
-{
- // Clear the screen.
- Console::Clear();
-
- // Establish an event handler to process key press events.
- Console::CancelKeyPress +=
- gcnew ConsoleCancelEventHandler(OnCancelKeyPressed);
-
- while (true)
- {
- // Prompt the user.
- Console::Write("Press any key, or 'X' to quit, or ");
- Console::WriteLine("CTRL+C to interrupt the read operation:");
-
- // Start a console read operation. Do not display the input.
- ConsoleKeyInfo^ keyInfo = Console::ReadKey(true);
-
- // Announce the name of the key that was pressed .
- Console::WriteLine(" Key pressed: {0}{1}", keyInfo->Key,
- Environment::NewLine);
-
- // Exit if the user pressed the 'X' key.
- if (keyInfo->Key == ConsoleKey::X)
- {
- break;
- }
- }
-}
-// The example displays output similar to the following:
-// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation:
-// Key pressed: J
-//
-// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation:
-// Key pressed: Enter
-//
-// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation:
-//
-// The read operation has been interrupted.
-// Key pressed: ControlC
-// Cancel property: False
-// Setting the Cancel property to true...
-// Cancel property: True
-// The read operation will resume...
-//
-// Key pressed: Q
-//
-// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation:
-// Key pressed: X
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp
deleted file mode 100644
index fb1544c6848..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-
-//
-// This example demonstrates the
-// Console.CursorLeft and
-// Console.CursorTop properties, and the
-// Console.SetCursorPosition and
-// Console.Clear methods.
-using namespace System;
-int origRow;
-int origCol;
-void WriteAt( String^ s, int x, int y )
-{
- try
- {
- Console::SetCursorPosition( origCol + x, origRow + y );
- Console::Write( s );
- }
- catch ( ArgumentOutOfRangeException^ e )
- {
- Console::Clear();
- Console::WriteLine( e->Message );
- }
-
-}
-
-int main()
-{
-
- // Clear the screen, then save the top and left coordinates.
- Console::Clear();
- origRow = Console::CursorTop;
- origCol = Console::CursorLeft;
-
- // Draw the left side of a 5x5 rectangle, from top to bottom.
- WriteAt( "+", 0, 0 );
- WriteAt( "|", 0, 1 );
- WriteAt( "|", 0, 2 );
- WriteAt( "|", 0, 3 );
- WriteAt( "+", 0, 4 );
-
- // Draw the bottom side, from left to right.
- WriteAt( "-", 1, 4 ); // shortcut: WriteAt("---", 1, 4)
- WriteAt( "-", 2, 4 ); // ...
- WriteAt( "-", 3, 4 ); // ...
- WriteAt( "+", 4, 4 );
-
- // Draw the right side, from bottom to top.
- WriteAt( "|", 4, 3 );
- WriteAt( "|", 4, 2 );
- WriteAt( "|", 4, 1 );
- WriteAt( "+", 4, 0 );
-
- // Draw the top side, from right to left.
- WriteAt( "-", 3, 0 ); // shortcut: WriteAt("---", 1, 0)
- WriteAt( "-", 2, 0 ); // ...
- WriteAt( "-", 1, 0 ); // ...
-
- //
- WriteAt( "All done!", 0, 6 );
- Console::WriteLine();
-}
-
-/*
-This example produces the following results:
-
-+---+
-| |
-| |
-| |
-+---+
-
-All done!
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp
deleted file mode 100644
index d04872cd7db..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-//
-// This example demonstrates the Console.CursorSize property.
-using namespace System;
-int main()
-{
- String^ m0 = "This example increments the cursor size from 1% to 100%:\n";
- String^ m1 = "Cursor size = {0}%. (Press any key to continue...)";
- array^sizes = {1,10,20,30,40,50,60,70,80,90,100};
- int saveCursorSize;
-
- //
- saveCursorSize = Console::CursorSize;
- Console::WriteLine( m0 );
- System::Collections::IEnumerator^ myEnum = sizes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- int size = *safe_cast(myEnum->Current);
- Console::CursorSize = size;
- Console::WriteLine( m1, size );
- Console::ReadKey();
- }
-
- Console::CursorSize = saveCursorSize;
-}
-
-/*
-This example produces the following results:
-
-This example increments the cursor size from 1% to 100%:
-
-Cursor size = 1%. (Press any key to continue...)
-Cursor size = 10%. (Press any key to continue...)
-Cursor size = 20%. (Press any key to continue...)
-Cursor size = 30%. (Press any key to continue...)
-Cursor size = 40%. (Press any key to continue...)
-Cursor size = 50%. (Press any key to continue...)
-Cursor size = 60%. (Press any key to continue...)
-Cursor size = 70%. (Press any key to continue...)
-Cursor size = 80%. (Press any key to continue...)
-Cursor size = 90%. (Press any key to continue...)
-Cursor size = 100%. (Press any key to continue...)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp
deleted file mode 100644
index bf60e0028a7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// This example demonstrates the Console.CursorVisible property.
-using namespace System;
-
-int main()
-{
- String^ m1 = "\nThe cursor is {0}.\nType any text then press Enter. "
- "Type '+' in the first column to show \n"
- "the cursor, '-' to hide the cursor, "
- "or lowercase 'x' to quit:";
- String^ s;
- bool saveCursorVisibile;
- int saveCursorSize;
-
- //
- Console::CursorVisible = true; // Initialize the cursor to visible.
- saveCursorVisibile = Console::CursorVisible;
- saveCursorSize = Console::CursorSize;
- Console::CursorSize = 100; // Emphasize the cursor.
- for ( ; ; )
- {
- Console::WriteLine( m1, ((Console::CursorVisible == true) ? (String^)"VISIBLE" : "HIDDEN") );
- s = Console::ReadLine();
- if ( !String::IsNullOrEmpty( s ) )
- if ( s[ 0 ] == '+' )
- Console::CursorVisible = true;
- else
- if ( s[ 0 ] == '-' )
- Console::CursorVisible = false;
- else
- if ( s[ 0 ] == 'x' )
- break;
-
- }
- Console::CursorVisible = saveCursorVisibile;
- Console::CursorSize = saveCursorSize;
-}
-
-/*
-This example produces the following results. Note that these results
-cannot depict cursor visibility. You must run the example to see the
-cursor behavior:
-
-The cursor is VISIBLE.
-Type any text then press Enter. Type '+' in the first column to show
-the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
-The quick brown fox
-
-The cursor is VISIBLE.
-Type any text then press Enter. Type '+' in the first column to show
-the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
--
-
-The cursor is HIDDEN.
-Type any text then press Enter. Type '+' in the first column to show
-the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
-jumps over
-
-The cursor is HIDDEN.
-Type any text then press Enter. Type '+' in the first column to show
-the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
-+
-
-The cursor is VISIBLE.
-Type any text then press Enter. Type '+' in the first column to show
-the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
-the lazy dog.
-
-The cursor is VISIBLE.
-Type any text then press Enter. Type '+' in the first column to show
-the cursor, '-' to hide the cursor, or lowercase 'x' to quit:
-x
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp b/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp
deleted file mode 100644
index 8b8f1a06db8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-int main()
-{
- ConsoleKeyInfo cki;
- do
- {
- Console::WriteLine( "\nPress a key to display; press the 'x' key to quit." );
-
- // Your code could perform some useful task in the following loop. However,
- // for the sake of this example we'll merely pause for a quarter second.
- while ( !Console::KeyAvailable )
- Thread::Sleep( 250 );
- cki = Console::ReadKey( true );
- Console::WriteLine( "You pressed the '{0}' key.", cki.Key );
- }
- while ( cki.Key != ConsoleKey::X );
-}
-
-/*
-This example produces results similar to the following:
-
-Press a key to display; press the 'x' key to quit.
-You pressed the 'H' key.
-
-Press a key to display; press the 'x' key to quit.
-You pressed the 'E' key.
-
-Press a key to display; press the 'x' key to quit.
-You pressed the 'PageUp' key.
-
-Press a key to display; press the 'x' key to quit.
-You pressed the 'DownArrow' key.
-
-Press a key to display; press the 'x' key to quit.
-You pressed the 'X' key.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp b/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp
deleted file mode 100644
index fa7edff4517..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-//
-// This example demonstrates the Console.Read() method.
-using namespace System;
-int main()
-{
- String^ m1 = "\nType a string of text then press Enter. "
- "Type '+' anywhere in the text to quit:\n";
- String^ m2 = "Character '{0}' is hexadecimal 0x{1:x4}.";
- String^ m3 = "Character is hexadecimal 0x{0:x4}.";
- Char ch;
- int x;
-
- //
- Console::WriteLine( m1 );
- do
- {
- x = Console::Read();
- try
- {
- ch = Convert::ToChar( x );
- if ( Char::IsWhiteSpace( ch ) )
- {
- Console::WriteLine( m3, x );
- if ( ch == 0x0a )
- Console::WriteLine( m1 );
- }
- else
- Console::WriteLine( m2, ch, x );
- }
- catch ( OverflowException^ e )
- {
- Console::WriteLine( "{0} Value read = {1}.", e->Message, x );
- ch = Char::MinValue;
- Console::WriteLine( m1 );
- }
-
- }
- while ( ch != '+' );
-}
-
-/*
-This example produces the following results:
-
-Type a string of text then press Enter. Type '+' anywhere in the text to quit:
-
-The quick brown fox.
-Character 'T' is hexadecimal 0x0054.
-Character 'h' is hexadecimal 0x0068.
-Character 'e' is hexadecimal 0x0065.
-Character is hexadecimal 0x0020.
-Character 'q' is hexadecimal 0x0071.
-Character 'u' is hexadecimal 0x0075.
-Character 'i' is hexadecimal 0x0069.
-Character 'c' is hexadecimal 0x0063.
-Character 'k' is hexadecimal 0x006b.
-Character is hexadecimal 0x0020.
-Character 'b' is hexadecimal 0x0062.
-Character 'r' is hexadecimal 0x0072.
-Character 'o' is hexadecimal 0x006f.
-Character 'w' is hexadecimal 0x0077.
-Character 'n' is hexadecimal 0x006e.
-Character is hexadecimal 0x0020.
-Character 'f' is hexadecimal 0x0066.
-Character 'o' is hexadecimal 0x006f.
-Character 'x' is hexadecimal 0x0078.
-Character '.' is hexadecimal 0x002e.
-Character is hexadecimal 0x000d.
-Character is hexadecimal 0x000a.
-
-Type a string of text then press Enter. Type '+' anywhere in the text to quit:
-
-^Z
-Value was either too large or too small for a character. Value read = -1.
-
-Type a string of text then press Enter. Type '+' anywhere in the text to quit:
-
-+
-Character '+' is hexadecimal 0x002b.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp
deleted file mode 100644
index d2f1a175be4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Console.ReadKey.cpp : main project file.
-
-//
-using namespace System;
-
-void main()
-{
- ConsoleKeyInfo cki;
- // Prevent example from ending if CTL+C is pressed.
- Console::TreatControlCAsInput = true;
-
- Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key.");
- Console::WriteLine("Press the Escape (Esc) key to quit: \n");
- do
- {
- cki = Console::ReadKey();
- Console::Write(" --- You pressed ");
- if((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+");
- if((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+");
- if((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+");
- Console::WriteLine(cki.Key.ToString());
- } while (cki.Key != ConsoleKey::Escape);
-}
-// This example displays output similar to the following:
-// Press any combination of CTL, ALT, and SHIFT, and a console key.
-// Press the Escape (Esc) key to quit:
-//
-// a --- You pressed A
-// k --- You pressed ALT+K
-// â–º --- You pressed CTL+P
-// --- You pressed RightArrow
-// R --- You pressed SHIFT+R
-// --- You pressed CTL+I
-// j --- You pressed ALT+J
-// O --- You pressed SHIFT+O
-// § --- You pressed CTL+U }
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp
deleted file mode 100644
index f354fdf3929..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// Console.ReadKey2.cpp : main project file.
-
-//
-using namespace System;
-
-void main()
-{
- ConsoleKeyInfo cki;
- // Prevent example from ending if CTL+C is pressed.
- Console::TreatControlCAsInput = true;
-
- Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key.");
- Console::WriteLine("Press the Escape (Esc) key to quit: \n");
- do {
- cki = Console::ReadKey(true);
- Console::Write("You pressed ");
- if ((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+");
- if ((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+");
- if ((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+");
- Console::WriteLine("{0} (character '{1}')", cki.Key, cki.KeyChar);
- } while (cki.Key != ConsoleKey::Escape);
-}
-// This example displays output similar to the following:
-// Press any combination of CTL, ALT, and SHIFT, and a console key.
-// Press the Escape (Esc) key to quit:
-//
-// You pressed CTL+A (character '☺')
-// You pressed C (character 'c')
-// You pressed CTL+C (character '♥')
-// You pressed K (character 'k')
-// You pressed ALT+I (character 'i')
-// You pressed ALT+U (character 'u')
-// You pressed ALT+SHIFT+H (character 'H')
-// You pressed Escape (character 'â†')
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp b/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp
deleted file mode 100644
index 074acc11362..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-//
-// This example demonstrates the Console.SetWindowSize method,
-// the Console.WindowWidth property,
-// and the Console.WindowHeight property.
-using namespace System;
-int main()
-{
- int origWidth;
- int width;
- int origHeight;
- int height;
- String^ m1 = "The current window width is {0}, and the "
- "current window height is {1}.";
- String^ m2 = "The new window width is {0}, and the new "
- "window height is {1}.";
- String^ m4 = " (Press any key to continue...)";
-
- //
- // Step 1: Get the current window dimensions.
- //
- origWidth = Console::WindowWidth;
- origHeight = Console::WindowHeight;
- Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight );
- Console::WriteLine( m4 );
- Console::ReadKey( true );
-
- //
- // Step 2: Cut the window to 1/4 its original size.
- //
- width = origWidth / 2;
- height = origHeight / 2;
- Console::SetWindowSize( width, height );
- Console::WriteLine( m2, Console::WindowWidth, Console::WindowHeight );
- Console::WriteLine( m4 );
- Console::ReadKey( true );
-
- //
- // Step 3: Restore the window to its original size.
- //
- Console::SetWindowSize( origWidth, origHeight );
- Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight );
-}
-
-/*
-This example produces the following results:
-
-The current window width is 85, and the current window height is 43.
- (Press any key to continue...)
-The new window width is 42, and the new window height is 21.
- (Press any key to continue...)
-The current window width is 85, and the current window height is 43.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp b/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp
deleted file mode 100644
index 9fd1a51bc1b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-// This example demonstrates the Console.Title property.
-using namespace System;
-int main()
-{
- Console::WriteLine( "The current console title is: \"{0}\"", Console::Title );
- Console::WriteLine( " (Press any key to change the console title.)" );
- Console::ReadKey( true );
- Console::Title = "The title has changed!";
- Console::WriteLine( "Note that the new console title is \"{0}\"\n"
- " (Press any key to quit.)", Console::Title );
- Console::ReadKey( true );
-}
-
-/*
-This example produces the following results:
-
->myTitle
-The current console title is: "Command Prompt - myTitle"
- (Press any key to change the console title.)
-Note that the new console title is "The title has changed!"
- (Press any key to quit.)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp b/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp
deleted file mode 100644
index cb5364bab15..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-
-//
-// This example demonstrates the Console.WindowLeft and
-// Console.WindowTop properties.
-using namespace System;
-using namespace System::Text;
-using namespace System::IO;
-
-//
-int saveBufferWidth;
-int saveBufferHeight;
-int saveWindowHeight;
-int saveWindowWidth;
-bool saveCursorVisible;
-
-//
-int main()
-{
- String^ m1 = "1) Press the cursor keys to move the console window.\n"
- "2) Press any key to begin. When you're finished...\n"
- "3) Press the Escape key to quit.";
- String^ g1 = "+----";
- String^ g2 = "| ";
- String^ grid1;
- String^ grid2;
- StringBuilder^ sbG1 = gcnew StringBuilder;
- StringBuilder^ sbG2 = gcnew StringBuilder;
- ConsoleKeyInfo cki;
- int y;
-
- //
- try
- {
- saveBufferWidth = Console::BufferWidth;
- saveBufferHeight = Console::BufferHeight;
- saveWindowHeight = Console::WindowHeight;
- saveWindowWidth = Console::WindowWidth;
- saveCursorVisible = Console::CursorVisible;
-
- //
- Console::Clear();
- Console::WriteLine( m1 );
- Console::ReadKey( true );
-
- // Set the smallest possible window size before setting the buffer size.
- Console::SetWindowSize( 1, 1 );
- Console::SetBufferSize( 80, 80 );
- Console::SetWindowSize( 40, 20 );
-
- // Create grid lines to fit the buffer. (The buffer width is 80, but
- // this same technique could be used with an arbitrary buffer width.)
- for ( y = 0; y < Console::BufferWidth / g1->Length; y++ )
- {
- sbG1->Append( g1 );
- sbG2->Append( g2 );
-
- }
- sbG1->Append( g1, 0, Console::BufferWidth % g1->Length );
- sbG2->Append( g2, 0, Console::BufferWidth % g2->Length );
- grid1 = sbG1->ToString();
- grid2 = sbG2->ToString();
- Console::CursorVisible = false;
- Console::Clear();
- for ( y = 0; y < Console::BufferHeight - 1; y++ )
- {
- if ( y % 3 == 0 )
- Console::Write( grid1 );
- else
- Console::Write( grid2 );
-
- }
- Console::SetWindowPosition( 0, 0 );
- do
- {
- cki = Console::ReadKey( true );
- switch ( cki.Key )
- {
- case ConsoleKey::LeftArrow:
- if ( Console::WindowLeft > 0 )
- Console::SetWindowPosition( Console::WindowLeft - 1, Console::WindowTop );
- break;
-
- case ConsoleKey::UpArrow:
- if ( Console::WindowTop > 0 )
- Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop - 1 );
- break;
-
- case ConsoleKey::RightArrow:
- if ( Console::WindowLeft < (Console::BufferWidth - Console::WindowWidth) )
- Console::SetWindowPosition( Console::WindowLeft + 1, Console::WindowTop );
- break;
-
- case ConsoleKey::DownArrow:
- if ( Console::WindowTop < (Console::BufferHeight - Console::WindowHeight) )
- Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop + 1 );
- break;
- }
- }
- while ( cki.Key != ConsoleKey::Escape );
- }
- catch ( IOException^ e )
- {
- Console::WriteLine( e->Message );
- }
- finally
- {
- Console::Clear();
- Console::SetWindowSize( 1, 1 );
- Console::SetBufferSize( saveBufferWidth, saveBufferHeight );
- Console::SetWindowSize( saveWindowWidth, saveWindowHeight );
- Console::CursorVisible = saveCursorVisible;
- }
-
-} // end Main
-
-
-/*
-This example produces results similar to the following:
-
-1) Press the cursor keys to move the console window.
-2) Press any key to begin. When you're finished...
-3) Press the Escape key to quit.
-
-...
-
-+----+----+----+-
-| | | |
-| | | |
-+----+----+----+-
-| | | |
-| | | |
-+----+----+----+-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp b/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp
deleted file mode 100644
index b31dd5edc66..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// This code example demonstrates the Console.WriteLine() method.
-// Formatting for this example uses the "en-US" culture.
-
-using namespace System;
-
-public enum class Color {Yellow = 1, Blue, Green};
-
-int main()
-{
- DateTime thisDate = DateTime::Now;
- Console::Clear();
-
- // Format a negative integer or floating-point number in various ways.
- Console::WriteLine("Standard Numeric Format Specifiers");
- Console::WriteLine(
- "(C) Currency: . . . . . . . . {0:C}\n" +
- "(D) Decimal:. . . . . . . . . {0:D}\n" +
- "(E) Scientific: . . . . . . . {1:E}\n" +
- "(F) Fixed point:. . . . . . . {1:F}\n" +
- "(G) General:. . . . . . . . . {0:G}\n" +
- " (default):. . . . . . . . {0} (default = 'G')\n" +
- "(N) Number: . . . . . . . . . {0:N}\n" +
- "(P) Percent:. . . . . . . . . {1:P}\n" +
- "(R) Round-trip: . . . . . . . {1:R}\n" +
- "(X) Hexadecimal:. . . . . . . {0:X}\n",
- -123, -123.45f);
-
- // Format the current date in various ways.
- Console::WriteLine("Standard DateTime Format Specifiers");
- Console::WriteLine(
- "(d) Short date: . . . . . . . {0:d}\n" +
- "(D) Long date:. . . . . . . . {0:D}\n" +
- "(t) Short time: . . . . . . . {0:t}\n" +
- "(T) Long time:. . . . . . . . {0:T}\n" +
- "(f) Full date/short time: . . {0:f}\n" +
- "(F) Full date/long time:. . . {0:F}\n" +
- "(g) General date/short time:. {0:g}\n" +
- "(G) General date/long time: . {0:G}\n" +
- " (default):. . . . . . . . {0} (default = 'G')\n" +
- "(M) Month:. . . . . . . . . . {0:M}\n" +
- "(R) RFC1123:. . . . . . . . . {0:R}\n" +
- "(s) Sortable: . . . . . . . . {0:s}\n" +
- "(u) Universal sortable: . . . {0:u} (invariant)\n" +
- "(U) Universal full date/time: {0:U}\n" +
- "(Y) Year: . . . . . . . . . . {0:Y}\n",
- thisDate);
-
- // Format a Color enumeration value in various ways.
- Console::WriteLine("Standard Enumeration Format Specifiers");
- Console::WriteLine(
- "(G) General:. . . . . . . . . {0:G}\n" +
- " (default):. . . . . . . . {0} (default = 'G')\n" +
- "(F) Flags:. . . . . . . . . . {0:F} (flags or integer)\n" +
- "(D) Decimal number: . . . . . {0:D}\n" +
- "(X) Hexadecimal:. . . . . . . {0:X}\n",
- Color::Green);
-
-};
-
-
-/*
-This code example produces the following results:
-
-Standard Numeric Format Specifiers
-(C) Currency: . . . . . . . . ($123.00)
-(D) Decimal:. . . . . . . . . -123
-(E) Scientific: . . . . . . . -1.234500E+002
-(F) Fixed point:. . . . . . . -123.45
-(G) General:. . . . . . . . . -123
-(default):. . . . . . . . -123 (default = 'G')
-(N) Number: . . . . . . . . . -123.00
-(P) Percent:. . . . . . . . . -12,345.00 %
-(R) Round-trip: . . . . . . . -123.45
-(X) Hexadecimal:. . . . . . . FFFFFF85
-
-Standard DateTime Format Specifiers
-(d) Short date: . . . . . . . 6/26/2004
-(D) Long date:. . . . . . . . Saturday, June 26, 2004
-(t) Short time: . . . . . . . 8:11 PM
-(T) Long time:. . . . . . . . 8:11:04 PM
-(f) Full date/short time: . . Saturday, June 26, 2004 8:11 PM
-(F) Full date/long time:. . . Saturday, June 26, 2004 8:11:04 PM
-(g) General date/short time:. 6/26/2004 8:11 PM
-(G) General date/long time: . 6/26/2004 8:11:04 PM
-(default):. . . . . . . . 6/26/2004 8:11:04 PM (default = 'G')
-(M) Month:. . . . . . . . . . June 26
-(R) RFC1123:. . . . . . . . . Sat, 26 Jun 2004 20:11:04 GMT
-(s) Sortable: . . . . . . . . 2004-06-26T20:11:04
-(u) Universal sortable: . . . 2004-06-26 20:11:04Z (invariant)
-(U) Universal full date/time: Sunday, June 27, 2004 3:11:04 AM
-(Y) Year: . . . . . . . . . . June, 2004
-
-Standard Enumeration Format Specifiers
-(G) General:. . . . . . . . . Green
-(default):. . . . . . . . Green (default = 'G')
-(F) Flags:. . . . . . . . . . Green (flags or integer)
-(D) Decimal number: . . . . . 3
-(X) Hexadecimal:. . . . . . . 00000003
-
-*/
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp b/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp
deleted file mode 100644
index 528816ff13d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- TextReader^ tIn = Console::In;
- TextWriter^ tOut = Console::Out;
- tOut->WriteLine( "Hola Mundo!" );
- tOut->Write( "What is your name: " );
- String^ name = tIn->ReadLine();
- tOut->WriteLine( "Buenos Dias, {0}!", name );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp
deleted file mode 100644
index a876518582c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-
-//
-// This example demonstrates the Convert.ToBase64CharArray() and
-// Convert.FromBase64CharArray methods
-using namespace System;
-bool ArraysAreEqual( array^a1, array^a2 );
-int main()
-{
- array^byteArray1 = gcnew array(256);
- array^byteArray2 = gcnew array(256);
- array^charArray = gcnew array(352);
- int charArrayLength;
- String^ nl = Environment::NewLine;
- String^ ruler1a = " 1 2 3 4";
- String^ ruler2a = "1234567890123456789012345678901234567890";
- String^ ruler3a = "----+----+----+----+----+----+----+----+";
- String^ ruler1b = " 5 6 7 ";
- String^ ruler2b = "123456789012345678901234567890123456";
- String^ ruler3b = "----+----+----+----+----+----+----+-";
- String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b );
-
- // 1) Initialize and display a Byte array of arbitrary data.
- Console::WriteLine( "1) Input: A Byte array of arbitrary data.{0}", nl );
- for ( int x = 0; x < byteArray1->Length; x++ )
- {
- byteArray1[ x ] = (Byte)x;
- Console::Write( "{0:X2} ", byteArray1[ x ] );
- if ( ((x + 1) % 20) == 0 )
- Console::WriteLine();
-
- }
- Console::Write( "{0}{0}", nl );
-
- // 2) Convert the input Byte array to a Char array, with newlines inserted.
- charArrayLength = Convert::ToBase64CharArray( byteArray1, 0, byteArray1->Length,
- charArray, 0,
- Base64FormattingOptions::InsertLineBreaks );
- Console::WriteLine( "2) Convert the input Byte array to a Char array with newlines." );
- Console::Write( " Output: A Char array (length = {0}). ", charArrayLength );
- Console::WriteLine( "The elements of the array are:{0}", nl );
- Console::WriteLine( ruler );
- Console::WriteLine( gcnew String( charArray ) );
- Console::WriteLine();
-
- // 3) Convert the Char array back to a Byte array.
- Console::WriteLine( "3) Convert the Char array to an output Byte array." );
- byteArray2 = Convert::FromBase64CharArray( charArray, 0, charArrayLength );
-
- // 4) Are the input and output Byte arrays equivalent?
- Console::WriteLine( "4) The output Byte array is equal to the input Byte array: {0}", ArraysAreEqual( byteArray1, byteArray2 ) );
-}
-
-bool ArraysAreEqual( array^a1, array^a2 )
-{
- if ( a1->Length != a2->Length )
- return false;
-
- for ( int i = 0; i < a1->Length; i++ )
- if ( a1[ i ] != a2[ i ] )
- return false;
-
- return true;
-}
-
-/*
-This example produces the following results:
-
-1) Input: A Byte array of arbitrary data.
-
-00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
-14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27
-28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B
-3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
-50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63
-64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77
-78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B
-8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
-A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3
-B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7
-C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB
-DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
-F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-2) Convert the input Byte array to a Char array with newlines.
- Output: A Char array (length = 352). The elements of the array are:
-
- 1 2 3 4 5 6 7
-1234567890123456789012345678901234567890123456789012345678901234567890123456
-----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-
-AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4
-OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx
-cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq
-q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj
-5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==
-
-3) Convert the Char array to an output Byte array.
-4) The output Byte array is equal to the input Byte array: True
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp
deleted file mode 100644
index 316e8eeab95..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-
-//
-// This example demonstrates the Convert.ToBase64String() and
-// Convert.FromBase64String() methods
-using namespace System;
-bool ArraysAreEqual( array^a1, array^a2 );
-int main()
-{
- array^inArray = gcnew array(256);
- array^outArray = gcnew array(256);
- String^ s2;
- String^ s3;
- String^ step1 = "1) The input is a byte array (inArray) of arbitrary data.";
- String^ step2 = "2) Convert a subarray of the input data array to a base 64 string.";
- String^ step3 = "3) Convert the entire input data array to a base 64 string.";
- String^ step4 = "4) The two methods in steps 2 and 3 produce the same result: {0}";
- String^ step5 = "5) Convert the base 64 string to an output byte array (outArray).";
- String^ step6 = "6) The input and output arrays, inArray and outArray, are equal: {0}";
- int x;
- String^ nl = Environment::NewLine;
- String^ ruler1a = " 1 2 3 4";
- String^ ruler2a = "1234567890123456789012345678901234567890";
- String^ ruler3a = "----+----+----+----+----+----+----+----+";
- String^ ruler1b = " 5 6 7 ";
- String^ ruler2b = "123456789012345678901234567890123456";
- String^ ruler3b = "----+----+----+----+----+----+----+-";
- String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b, nl );
-
- // 1) Display an arbitrary array of input data (inArray). The data could be
- // derived from user input, a file, an algorithm, etc.
- Console::WriteLine( step1 );
- Console::WriteLine();
- for ( x = 0; x < inArray->Length; x++ )
- {
- inArray[ x ] = (Byte)x;
- Console::Write( "{0:X2} ", inArray[ x ] );
- if ( ((x + 1) % 20) == 0 )
- Console::WriteLine();
-
- }
- Console::Write( "{0}{0}", nl );
-
- // 2) Convert a subarray of the input data to a base64 string. In this case,
- // the subarray is the entire input data array. New lines (CRLF) are inserted.
- Console::WriteLine( step2 );
- s2 = Convert::ToBase64String( inArray, 0, inArray->Length, Base64FormattingOptions::InsertLineBreaks );
- Console::WriteLine( "{0}{1}{2}{3}", nl, ruler, s2, nl );
-
- // 3) Convert the input data to a base64 string. In this case, the entire
- // input data array is converted by default. New lines (CRLF) are inserted.
- Console::WriteLine( step3 );
- s3 = Convert::ToBase64String( inArray, Base64FormattingOptions::InsertLineBreaks );
-
- // 4) Test whether the methods in steps 2 and 3 produce the same result.
- Console::WriteLine( step4, s2->Equals( s3 ) );
-
- // 5) Convert the base 64 string to an output array (outArray).
- Console::WriteLine( step5 );
- outArray = Convert::FromBase64String( s2 );
-
- // 6) Is outArray equal to inArray?
- Console::WriteLine( step6, ArraysAreEqual( inArray, outArray ) );
-}
-
-bool ArraysAreEqual( array^a1, array^a2 )
-{
- if ( a1->Length != a2->Length )
- return false;
-
- for ( int i = 0; i < a1->Length; i++ )
- if ( a1[ i ] != a2[ i ] )
- return false;
-
- return true;
-}
-
-/*
-This example produces the following results:
-
-1) The input is a byte array (inArray) of arbitrary data.
-
-00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
-14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27
-28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B
-3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
-50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63
-64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77
-78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B
-8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
-A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3
-B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7
-C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB
-DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
-F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-2) Convert a subarray of the input data array to a base 64 string.
-
- 1 2 3 4 5 6 7
-1234567890123456789012345678901234567890123456789012345678901234567890123456
-----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+-
-AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4
-OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx
-cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq
-q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj
-5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==
-
-3) Convert the entire input data array to a base 64 string.
-4) The two methods in steps 2 and 3 produce the same result: True
-5) Convert the base 64 string to an output byte array (outArray).
-6) The input and output arrays, inArray and outArray, are equal: True
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp b/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp
deleted file mode 100644
index 38f78b48eef..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
- Double d = -2.345;
- int i = *safe_cast(Convert::ChangeType( d, int::typeid ));
- Console::WriteLine( "The double value {0} when converted to an int becomes {1}", d, i );
- String^ s = "12/12/98";
- DateTime dt = *safe_cast(Convert::ChangeType( s, DateTime::typeid ));
- Console::WriteLine( "The string value {0} when converted to a Date becomes {1}", s, dt );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp b/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp
deleted file mode 100644
index 1e507f938a2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-//
-// This example demonstrates the DateTime(Int64) constructor.
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Instead of using the implicit, default "G" date and time format string, we
- // use a custom format string that aligns the results and inserts leading zeroes.
- String^ format = "{0}) The {1} date and time is {2:MM/dd/yyyy hh:mm:ss tt}";
-
- // Create a DateTime for the maximum date and time using ticks.
- DateTime dt1 = DateTime(DateTime::MaxValue.Ticks);
-
- // Create a DateTime for the minimum date and time using ticks.
- DateTime dt2 = DateTime(DateTime::MinValue.Ticks);
-
- // Create a custom DateTime for 7/28/1979 at 10:35:05 PM using a
- // calendar based on the "en-US" culture, and ticks.
- Int64 ticks = DateTime(1979,07,28,22,35,5,(gcnew CultureInfo( "en-US",false ))->Calendar).Ticks;
- DateTime dt3 = DateTime(ticks);
- Console::WriteLine( format, 1, "maximum", dt1 );
- Console::WriteLine( format, 2, "minimum", dt2 );
- Console::WriteLine( format, 3, "custom ", dt3 );
- Console::WriteLine( "\nThe custom date and time is created from {0:N0} ticks.", ticks );
-}
-
-/*
-This example produces the following results:
-
-1) The maximum date and time is 12/31/9999 11:59:59 PM
-2) The minimum date and time is 01/01/0001 12:00:00 AM
-3) The custom date and time is 07/28/1979 10:35:05 PM
-
-The custom date and time is created from 624,376,461,050,000,000 ticks.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp b/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp
deleted file mode 100644
index a798bc4a24c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// Sample for Enum::ToString(String)
-
-using namespace System;
-
-public enum class Colors
-{
- Red, Green, Blue, Yellow = 12
-};
-
-int main()
-{
- Colors myColor = Colors::Yellow;
- Console::WriteLine( "Colors::Red = {0}", Colors::Red.ToString( "d" ) );
- Console::WriteLine( "Colors::Green = {0}", Colors::Green.ToString( "d" ) );
- Console::WriteLine( "Colors::Blue = {0}", Colors::Blue.ToString( "d" ) );
- Console::WriteLine( "Colors::Yellow = {0}", Colors::Yellow.ToString( "d" ) );
- Console::WriteLine( " {0}myColor = Colors::Yellow {0}", Environment::NewLine );
- Console::WriteLine( "myColor->ToString(\"g\") = {0}", myColor.ToString( "g" ) );
- Console::WriteLine( "myColor->ToString(\"G\") = {0}", myColor.ToString( "G" ) );
- Console::WriteLine( "myColor->ToString(\"x\") = {0}", myColor.ToString( "x" ) );
- Console::WriteLine( "myColor->ToString(\"X\") = {0}", myColor.ToString( "X" ) );
- Console::WriteLine( "myColor->ToString(\"d\") = {0}", myColor.ToString( "d" ) );
- Console::WriteLine( "myColor->ToString(\"D\") = {0}", myColor.ToString( "D" ) );
- Console::WriteLine( "myColor->ToString(\"f\") = {0}", myColor.ToString( "f" ) );
- Console::WriteLine( "myColor->ToString(\"F\") = {0}", myColor.ToString( "F" ) );
-}
-
-/*
-This example produces the following results:
-Colors::Red = 0
-Colors::Green = 1
-Colors::Blue = 2
-Colors::Yellow = 12
-
-myColor = Colors::Yellow
-
-myColor->ToString("g") = Yellow
-myColor->ToString("G") = Yellow
-myColor->ToString("x") = 0000000C
-myColor->ToString("X") = 0000000C
-myColor->ToString("d") = 12
-myColor->ToString("D") = 12
-myColor->ToString("f") = Yellow
-myColor->ToString("F") = Yellow
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp b/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp
deleted file mode 100644
index 8d067455708..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-
-public enum class VehicleDoors
-{
- Motorbike = 0,
- Sportscar = 2,
- Sedan = 4,
- Hatchback = 5
-};
-
-int main()
-{
- VehicleDoors myVeh = VehicleDoors::Sportscar;
- VehicleDoors yourVeh = VehicleDoors::Motorbike;
- VehicleDoors otherVeh = VehicleDoors::Sedan;
- Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, yourVeh );
- Int32 iRes = myVeh.CompareTo( yourVeh );
- Console::WriteLine( "{0}{1}", iRes > 0 ? (String^)"Yes" : "No", Environment::NewLine );
- Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, otherVeh );
- iRes = myVeh.CompareTo( otherVeh );
- Console::WriteLine( "{0}", iRes > 0 ? (String^)"Yes" : "No" );
-}
-// The example displays the following output:
-// Does a Sportscar have more doors than a Motorbike?
-// Yes
-//
-// Does a Sportscar have more doors than a Sedan?
-// No
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp b/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp
deleted file mode 100644
index 2c8b0fb26db..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-using namespace System;
-public enum class Colors
-{
- Red, Green, Blue, Yellow
-};
-
-public enum class Mammals
-{
- Cat, Dog, Horse, Dolphin
-};
-
-int main()
-{
- Mammals myPet = Mammals::Cat;
- Colors myColor = Colors::Red;
- Mammals yourPet = Mammals::Dog;
- Colors yourColor = Colors::Red;
- Console::WriteLine( "My favorite animal is a {0}", myPet );
- Console::WriteLine( "Your favorite animal is a {0}", yourPet );
- Console::WriteLine( "Do we like the same animal? {0}", myPet.Equals( yourPet ) ? (String^)"Yes" : "No" );
- Console::WriteLine();
- Console::WriteLine( "My favorite color is {0}", myColor );
- Console::WriteLine( "Your favorite color is {0}", yourColor );
- Console::WriteLine( "Do we like the same color? {0}", myColor.Equals( yourColor ) ? (String^)"Yes" : "No" );
- Console::WriteLine();
- Console::WriteLine( "The value of my color ({0}) is {1}", myColor, Enum::Format( Colors::typeid, myColor, "d" ) );
- Console::WriteLine( "The value of my pet (a {0}) is {1}", myPet, Enum::Format( Mammals::typeid, myPet, "d" ) );
- Console::WriteLine( "Even though they have the same value, are they equal? {0}", myColor.Equals( myPet ) ? (String^)"Yes" : "No" );
-}
-// The example displays the following output:
-// My favorite animal is a Cat
-// Your favorite animal is a Dog
-// Do we like the same animal? No
-//
-// My favorite color is Red
-// Your favorite color is Red
-// Do we like the same color? Yes
-//
-// The value of my color (Red) is 0
-// The value of my pet (a Cat) is 0
-// Even though they have the same value, are they equal? No
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp b/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp
deleted file mode 100644
index 1176bcd60d1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-using namespace System;
-public enum class Colors
-{
- Red, Green, Blue, Yellow
-};
-
-int main()
-{
- Colors myColor = Colors::Blue;
- Console::WriteLine( "My favorite color is {0}.", myColor );
- Console::WriteLine( "The value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "d" ) );
- Console::WriteLine( "The hex value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "x" ) );
-}
-// The example displays the folowing output:
-// My favorite color is Blue.
-// The value of my favorite color is 2.
-// The hex value of my favorite color is 00000002.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp
deleted file mode 100644
index f5f08936cf6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-using namespace System;
-
-enum class Colors
-{
- Red, Green, Blue, Yellow
-};
-
-enum class Styles
-{
- Plaid, Striped, Tartan, Corduroy
-};
-
-int main()
-{
- Console::WriteLine( "The 4th value of the Colors Enum is {0}", Enum::GetName( Colors::typeid, 3 ) );
- Console::WriteLine( "The 4th value of the Styles Enum is {0}", Enum::GetName( Styles::typeid, 3 ) );
-}
-// The example displays the following output:
-// The 4th value of the Colors Enum is Yellow
-// The 4th value of the Styles Enum is Corduroy
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp
deleted file mode 100644
index 5c01de3f879..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-//
-using namespace System;
-enum class Colors
-{
- Red, Green, Blue, Yellow
-};
-
-enum class Styles
-{
- Plaid, Striped, Tartan, Corduroy
-};
-
-int main()
-{
- Console::WriteLine( "The members of the Colors enum are:" );
- Array^ a = Enum::GetNames( Colors::typeid );
- Int32 i = 0;
- do
- {
- Object^ o = a->GetValue( i );
- Console::WriteLine( o->ToString() );
- }
- while ( ++i < a->Length );
-
- Console::WriteLine();
- Console::WriteLine( "The members of the Styles enum are:" );
- Array^ b = Enum::GetNames( Styles::typeid );
- i = 0;
- do
- {
- Object^ o = b->GetValue( i );
- Console::WriteLine( o->ToString() );
- }
- while ( ++i < b->Length );
-}
-// The example displays the following output:
-// The members of the Colors enum are:
-// Red
-// Green
-// Blue
-// Yellow
-//
-// The members of the Styles enum are:
-// Plaid
-// Striped
-// Tartan
-// Corduroy
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp
deleted file mode 100644
index 69416cafd99..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-//
-using namespace System;
-enum class Colors
-{
- Red, Green, Blue, Yellow
-};
-
-enum class Styles
-{
- Plaid = 0,
- Striped = 23,
- Tartan = 65,
- Corduroy = 78
-};
-
-int main()
-{
- Console::WriteLine( "The values of the Colors Enum are:" );
- Array^ a = Enum::GetValues( Colors::typeid );
- for ( Int32 i = 0; i < a->Length; i++ )
- {
- Object^ o = a->GetValue( i );
- Console::WriteLine( "{0}", Enum::Format( Colors::typeid, o, "D" ) );
- }
- Console::WriteLine();
- Console::WriteLine( "The values of the Styles Enum are:" );
- Array^ b = Enum::GetValues( Styles::typeid );
- for ( Int32 i = 0; i < b->Length; i++ )
- {
- Object^ o = b->GetValue( i );
- Console::WriteLine( "{0}", Enum::Format( Styles::typeid, o, "D" ) );
-
- }
-}
-// The example produces the following output:
-// The values of the Colors Enum are:
-// 0
-// 1
-// 2
-// 3
-//
-// The values of the Styles Enum are:
-// 0
-// 23
-// 65
-// 78
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp b/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp
deleted file mode 100644
index a5fc6c7c51d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-using namespace System;
-
-[Flags]
-enum class Colors
-{
- Red = 1,
- Green = 2,
- Blue = 4,
- Yellow = 8
-};
-
-int main()
-{
- Console::WriteLine( "The entries of the Colors enumeration are:" );
- Array^ a = Enum::GetNames( Colors::typeid );
- Int32 i = 0;
- while ( i < a->Length )
- {
- Object^ o = a->GetValue( i );
- Console::WriteLine( o->ToString() );
- i++;
- }
-
- Console::WriteLine();
- Object^ orange = Enum::Parse( Colors::typeid, "Red, Yellow" );
- Console::WriteLine("The orange value has the combined entries of {0}", orange );
-}
-
-/*
-This code example produces the following results:
-
-The entries of the Colors Enum are:
-Red
-Green
-Blue
-Yellow
-
-The orange value has the combined entries of Red, Yellow
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp b/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp
deleted file mode 100644
index d8cae622055..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
- Console::WriteLine();
-
- // Invoke this sample with an arbitrary set of command line arguments.
- Console::WriteLine( "CommandLine: {0}", Environment::CommandLine );
-}
-/*
-The example displays output like the following:
-
-C:\>env0 ARBITRARY TEXT
-
-CommandLine: env0 ARBITRARY TEXT
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp
deleted file mode 100644
index 8da45abecdb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-//
-// Sample for the Environment::ExpandEnvironmentVariables method
-using namespace System;
-int main()
-{
- String^ str;
- String^ nl = Environment::NewLine;
- Console::WriteLine();
-
- // <-- Keep this information secure! -->
- String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%";
- str = Environment::ExpandEnvironmentVariables( query );
- Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str );
-}
-
-/*
-This example produces the following results:
-
-ExpandEnvironmentVariables:
-My system drive is C: and my system root is C:\WINNT
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp b/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp
deleted file mode 100644
index 3da3cc965d5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-
-//
-// Sample for Environment class summary
-using namespace System;
-using namespace System::Collections;
-int main()
-{
- String^ str;
- String^ nl = Environment::NewLine;
-
- //
- Console::WriteLine();
- Console::WriteLine( "-- Environment members --" );
-
- // Invoke this sample with an arbitrary set of command line arguments.
- Console::WriteLine( "CommandLine: {0}", Environment::CommandLine );
- array^arguments = Environment::GetCommandLineArgs();
- Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) );
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "CurrentDirectory: {0}", Environment::CurrentDirectory );
- Console::WriteLine( "ExitCode: {0}", Environment::ExitCode );
- Console::WriteLine( "HasShutdownStarted: {0}", Environment::HasShutdownStarted );
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "MachineName: {0}", Environment::MachineName );
- Console::WriteLine( "NewLine: {0} first line {0} second line {0} third line", Environment::NewLine );
- Console::WriteLine( "OSVersion: {0}", Environment::OSVersion );
- Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace );
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory );
- Console::WriteLine( "TickCount: {0}", Environment::TickCount );
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "UserDomainName: {0}", Environment::UserDomainName );
- Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive );
-
- // <-- Keep this information secure! -->
- Console::WriteLine( "UserName: {0}", Environment::UserName );
- Console::WriteLine( "Version: {0}", Environment::Version );
- Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet );
-
- // No example for Exit(exitCode) because doing so would terminate this example.
- // <-- Keep this information secure! -->
- String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%";
- str = Environment::ExpandEnvironmentVariables( query );
- Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str );
- Console::WriteLine( "GetEnvironmentVariable: {0} My temporary directory is {1}.", nl, Environment::GetEnvironmentVariable( "TEMP" ) );
- Console::WriteLine( "GetEnvironmentVariables: " );
- IDictionary^ environmentVariables = Environment::GetEnvironmentVariables();
- IEnumerator^ myEnum = environmentVariables->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry^ de = safe_cast(myEnum->Current);
- Console::WriteLine( " {0} = {1}", de->Key, de->Value );
- }
-
- Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) );
- array^drives = Environment::GetLogicalDrives();
- Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) );
-}
-
-/*
-This example produces results similar to the following:
-(Any result that is lengthy or reveals information that should remain
-secure has been omitted and marked S"!---OMITTED---!".)
-
-C:\>env0 ARBITRARY TEXT
-
--- Environment members --
-CommandLine: env0 ARBITRARY TEXT
-GetCommandLineArgs: env0, ARBITRARY, TEXT
-CurrentDirectory: C:\Documents and Settings\!---OMITTED---!
-ExitCode: 0
-HasShutdownStarted: False
-MachineName: !---OMITTED---!
-NewLine:
- first line
- second line
- third line
-OSVersion: Microsoft Windows NT 5.1.2600.0
-StackTrace: ' at System::Environment::GetStackTrace(Exception e)
- at System::Environment::GetStackTrace(Exception e)
- at System::Environment::get_StackTrace()
- at Sample::Main()'
-SystemDirectory: C:\WINNT\System32
-TickCount: 17995355
-UserDomainName: !---OMITTED---!
-UserInteractive: True
-UserName: !---OMITTED---!
-Version: !---OMITTED---!
-WorkingSet: 5038080
-ExpandEnvironmentVariables:
- My system drive is C: and my system root is C:\WINNT
-GetEnvironmentVariable:
- My temporary directory is C:\DOCUME~1\!---OMITTED---!\LOCALS~1\Temp.
-GetEnvironmentVariables:
- !---OMITTED---!
-GetFolderPath: C:\WINNT\System32
-GetLogicalDrives: A:\, C:\, D:\
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp b/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp
deleted file mode 100644
index 8a06d998c6d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-// This example demonstrates the
-// Environment.ProcessorCount property.
-using namespace System;
-int main()
-{
- Console::WriteLine( "The number of processors on this computer is {0}.", Environment::ProcessorCount );
-}
-
-/*
-This example produces the following results:
-
-The number of processors on this computer is 1.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp b/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp
deleted file mode 100644
index d1bc63b6472..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-using namespace System;
-
-public ref class ThresholdReachedEventArgs : public EventArgs
-{
- public:
- property int Threshold;
- property DateTime TimeReached;
-};
-
-public ref class Counter
-{
- private:
- int threshold;
- int total;
-
- public:
- Counter() {};
-
- Counter(int passedThreshold)
- {
- threshold = passedThreshold;
- }
-
- void Add(int x)
- {
- total += x;
- if (total >= threshold) {
- ThresholdReachedEventArgs^ args = gcnew ThresholdReachedEventArgs();
- args->Threshold = threshold;
- args->TimeReached = DateTime::Now;
- OnThresholdReached(args);
- }
- }
-
- event EventHandler^ ThresholdReached;
-
- protected:
- virtual void OnThresholdReached(ThresholdReachedEventArgs^ e)
- {
- ThresholdReached(this, e);
- }
-};
-
-public ref class SampleHandler
-{
- public:
- static void c_ThresholdReached(Object^ sender, ThresholdReachedEventArgs^ e)
- {
- Console::WriteLine("The threshold of {0} was reached at {1}.",
- e->Threshold, e->TimeReached);
- Environment::Exit(0);
- }
-};
-
-void main()
-{
- Counter^ c = gcnew Counter((gcnew Random())->Next(10));
- c->ThresholdReached += gcnew EventHandler(SampleHandler::c_ThresholdReached);
-
- Console::WriteLine("press 'a' key to increase total");
- while (Console::ReadKey(true).KeyChar == 'a') {
- Console::WriteLine("adding one");
- c->Add(1);
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp b/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp
deleted file mode 100644
index 57b3be51deb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections;
-
-void NestedRunTest( bool displayDetails ); // forward declarations
-void NestedRoutine1( bool displayDetails );
-void NestedRoutine2( bool displayDetails );
-void RunTest( bool displayDetails );
-
-int main()
-{
- Console::WriteLine("\nException with some extra information..." );
- RunTest(false);
- Console::WriteLine("\nException with all extra information..." );
- RunTest(true);
-}
-
-void RunTest( bool displayDetails )
-{
- try
- {
- NestedRoutine1( displayDetails );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception was thrown." );
- Console::WriteLine( e->Message );
- if ( e->Data != nullptr )
- {
- Console::WriteLine( " Extra details:" );
-
- for each (DictionaryEntry de in e->Data)
- Console::WriteLine(" Key: {0,-20} Value: {1}",
- "'" + de.Key->ToString() + "'", de.Value);
- }
- }
-}
-
-void NestedRoutine1( bool displayDetails )
-{
- try
- {
- NestedRoutine2( displayDetails );
- }
- catch ( Exception^ e )
- {
- e->Data[ "ExtraInfo" ] = "Information from NestedRoutine1.";
- e->Data->Add( "MoreExtraInfo", "More information from NestedRoutine1." );
- throw;
- }
-}
-
-void NestedRoutine2( bool displayDetails )
-{
- Exception^ e = gcnew Exception( "This statement is the original exception message." );
- if ( displayDetails )
- {
- String^ s = "Information from NestedRoutine2.";
- int i = -903;
- DateTime dt = DateTime::Now;
- e->Data->Add( "stringInfo", s );
- e->Data[ "IntInfo" ] = i;
- e->Data[ "DateTimeInfo" ] = dt;
- }
-
- throw e;
-}
-
-/*
-This example produces the following results:
-
-Exception with some extra information...
-An exception was thrown.
-This statement is the original exception message.
- Extra details:
- The key is 'ExtraInfo' and the value is: Information from NestedRoutine1.
- The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1.
-
-Exception with all extra information...
-An exception was thrown.
-This statement is the original exception message.
- Extra details:
- The key is 'stringInfo' and the value is: Information from NestedRoutine2.
- The key is 'IntInfo' and the value is: -903
- The key is 'DateTimeInfo' and the value is: 11/26/2002 2:12:58 PM
- The key is 'ExtraInfo' and the value is: Information from NestedRoutine1.
- The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp b/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp
deleted file mode 100644
index 66e8c71ecbd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-//
-// This example demonstrates Math.Atan()
-// Math.Atan2()
-// Math.Tan()
-using namespace System;
-int main()
-{
- double x = 1.0;
- double y = 2.0;
- double angle;
- double radians;
- double result;
-
- // Calculate the tangent of 30 degrees.
- angle = 30;
- radians = angle * (Math::PI / 180);
- result = Math::Tan( radians );
- Console::WriteLine( "The tangent of 30 degrees is {0}.", result );
-
- // Calculate the arctangent of the previous tangent.
- radians = Math::Atan( result );
- angle = radians * (180 / Math::PI);
- Console::WriteLine( "The previous tangent is equivalent to {0} degrees.", angle );
-
- // Calculate the arctangent of an angle.
- String^ line1 = "{0}The arctangent of the angle formed by the x-axis and ";
- String^ line2 = "a vector to point ({0},{1}) is {2}, ";
- String^ line3 = "which is equivalent to {0} degrees.";
- radians = Math::Atan2( y, x );
- angle = radians * (180 / Math::PI);
- Console::WriteLine( line1, Environment::NewLine );
- Console::WriteLine( line2, x, y, radians );
- Console::WriteLine( line3, angle );
-}
-
-/*
-This example produces the following results:
-
-The tangent of 30 degrees is 0.577350269189626.
-The previous tangent is equivalent to 30 degrees.
-
-The arctangent of the angle formed by the x-axis and
-a vector to point (1,2) is 1.10714871779409,
-which is equivalent to 63.434948822922 degrees.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp b/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp
deleted file mode 100644
index ce21aac3d31..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-//
-// This example demonstrates Math.BigMul()
-using namespace System;
-int main()
-{
- int int1 = Int32::MaxValue;
- int int2 = Int32::MaxValue;
- Int64 longResult;
-
- //
- longResult = Math::BigMul( int1, int2 );
- Console::WriteLine( "Calculate the product of two Int32 values:" );
- Console::WriteLine( "{0} * {1} = {2}", int1, int2, longResult );
-}
-
-/*
-This example produces the following results:
-Calculate the product of two Int32 values:
-2147483647 * 2147483647 = 4611686014132420609
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp b/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp
deleted file mode 100644
index 30f8d543207..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-//
-// This example demonstrates Math.Max()
-using namespace System;
-int main()
-{
- String^ str = "{0}: The greater of {1,3} and {2,3} is {3}.";
- String^ nl = Environment::NewLine;
- Byte xByte1 = 1,xByte2 = 51;
- short xShort1 = -2,xShort2 = 52;
- int xInt1 = -3,xInt2 = 53;
- long xLong1 = -4,xLong2 = 54;
- float xSingle1 = 5.0f,xSingle2 = 55.0f;
- double xDouble1 = 6.0,xDouble2 = 56.0;
- Decimal xDecimal1 = 7,xDecimal2 = 57;
-
- // The following types are not CLS-compliant.
- SByte xSbyte1 = 101,xSbyte2 = 111;
- UInt16 xUshort1 = 102,xUshort2 = 112;
- UInt32 xUint1 = 103,xUint2 = 113;
- UInt64 xUlong1 = 104,xUlong2 = 114;
- Console::WriteLine( "{0}Display the greater of two values:{0}", nl );
- Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Max( xByte1, xByte2 ) );
- Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Max( xShort1, xShort2 ) );
- Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Max( xInt1, xInt2 ) );
- Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Max( xLong1, xLong2 ) );
- Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Max( xSingle1, xSingle2 ) );
- Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Max( xDouble1, xDouble2 ) );
- Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Max( xDecimal1, xDecimal2 ) );
-
- //
- Console::WriteLine( "{0}The following types are not CLS-compliant.{0}", nl );
- Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Max( xSbyte1, xSbyte2 ) );
- Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Max( xUshort1, xUshort2 ) );
- Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Max( xUint1, xUint2 ) );
- Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Max( xUlong1, xUlong2 ) );
-}
-
-/*
-This example produces the following results:
-
-Display the greater of two values:
-
-Byte : The greater of 1 and 51 is 51.
-Int16 : The greater of -2 and 52 is 52.
-Int32 : The greater of -3 and 53 is 53.
-Int64 : The greater of -4 and 54 is 54.
-Single : The greater of 5 and 55 is 55.
-Double : The greater of 6 and 56 is 56.
-Decimal: The greater of 7 and 57 is 57.
-
-(The following types are not CLS-compliant.)
-
-SByte : The greater of 101 and 111 is 111.
-UInt16 : The greater of 102 and 112 is 112.
-UInt32 : The greater of 103 and 113 is 113.
-UInt64 : The greater of 104 and 114 is 114.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp b/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp
deleted file mode 100644
index fe4036cee2d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-//
-// This example demonstrates Math.Min()
-using namespace System;
-int main()
-{
- String^ str = "{0}: The lesser of {1,3} and {2,3} is {3}.";
- String^ nl = Environment::NewLine;
- Byte xByte1 = 1,xByte2 = 51;
- short xShort1 = -2,xShort2 = 52;
- int xInt1 = -3,xInt2 = 53;
- long xLong1 = -4,xLong2 = 54;
- float xSingle1 = 5.0f,xSingle2 = 55.0f;
- double xDouble1 = 6.0,xDouble2 = 56.0;
- Decimal xDecimal1 = 7,xDecimal2 = 57;
-
- // The following types are not CLS-compliant.
- SByte xSbyte1 = 101,xSbyte2 = 111;
- UInt16 xUshort1 = 102,xUshort2 = 112;
- UInt32 xUint1 = 103,xUint2 = 113;
- UInt64 xUlong1 = 104,xUlong2 = 114;
- Console::WriteLine( "{0}Display the lesser of two values:{0}", nl );
- Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Min( xByte1, xByte2 ) );
- Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Min( xShort1, xShort2 ) );
- Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Min( xInt1, xInt2 ) );
- Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Min( xLong1, xLong2 ) );
- Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Min( xSingle1, xSingle2 ) );
- Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Min( xDouble1, xDouble2 ) );
- Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Min( xDecimal1, xDecimal2 ) );
-
- //
- Console::WriteLine( "{0}The following types are not CLS-compliant:{0}", nl );
- Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Min( xSbyte1, xSbyte2 ) );
- Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Min( xUshort1, xUshort2 ) );
- Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Min( xUint1, xUint2 ) );
- Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Min( xUlong1, xUlong2 ) );
-}
-
-/*
-This example produces the following results:
-
-Display the lesser of two values:
-
-Byte : The lesser of 1 and 51 is 1.
-Int16 : The lesser of -2 and 52 is -2.
-Int32 : The lesser of -3 and 53 is -3.
-Int64 : The lesser of -4 and 54 is -4.
-Single : The lesser of 5 and 55 is 5.
-Double : The lesser of 6 and 56 is 6.
-Decimal: The lesser of 7 and 57 is 7.
-
-The following types are not CLS-compliant:
-
-SByte : The lesser of 101 and 111 is 101.
-UInt16 : The lesser of 102 and 112 is 102.
-UInt32 : The lesser of 103 and 113 is 103.
-UInt64 : The lesser of 104 and 114 is 104.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp b/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp
deleted file mode 100644
index 200dda534ac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-//
-// This example demonstrates Math.Sign()
-using namespace System;
-String^ Test( int compare )
-{
- if ( compare == 0 )
- return "equal to";
- else
- if ( compare < 0 )
- return "less than";
- else
- return "greater than";
-}
-
-int main()
-{
- String^ str = "{0}: {1,3} is {2} zero.";
- String^ nl = Environment::NewLine;
- Byte xByte1 = 0;
- short xShort1 = -2;
- int xInt1 = -3;
- long xLong1 = -4;
- float xSingle1 = 0.0f;
- double xDouble1 = 6.0;
- Decimal xDecimal1 = -7;
-
- // The following type is not CLS-compliant.
- SByte xSbyte1 = -101;
- Console::WriteLine( "{0}Test the sign of the following types of values:", nl );
- Console::WriteLine( str, "Byte ", xByte1, Test( Math::Sign( xByte1 ) ) );
- Console::WriteLine( str, "Int16 ", xShort1, Test( Math::Sign( xShort1 ) ) );
- Console::WriteLine( str, "Int32 ", xInt1, Test( Math::Sign( xInt1 ) ) );
- Console::WriteLine( str, "Int64 ", xLong1, Test( Math::Sign( xLong1 ) ) );
- Console::WriteLine( str, "Single ", xSingle1, Test( Math::Sign( xSingle1 ) ) );
- Console::WriteLine( str, "Double ", xDouble1, Test( Math::Sign( xDouble1 ) ) );
- Console::WriteLine( str, "Decimal", xDecimal1, Test( Math::Sign( xDecimal1 ) ) );
-
- //
- Console::WriteLine( "{0}The following type is not CLS-compliant.", nl );
- Console::WriteLine( str, "SByte ", xSbyte1, Test( Math::Sign( xSbyte1 ) ) );
-}
-
-/*
-This example produces the following results:
-
-Test the sign of the following types of values:
-Byte : 0 is equal to zero.
-Int16 : -2 is less than zero.
-Int32 : -3 is less than zero.
-Int64 : -4 is less than zero.
-Single : 0 is equal to zero.
-Double : 6 is greater than zero.
-Decimal: -7 is less than zero.
-
-The following type is not CLS-compliant.
-SByte : -101 is less than zero.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp b/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp
deleted file mode 100644
index 0db73927f0c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-//
-// This example demonstrates the PlatformID enumeration.
-using namespace System;
-int main()
-{
- String^ msg1 = L"This is a Windows operating system.";
- String^ msg2 = L"This is a Unix operating system.";
- String^ msg3 = L"ERROR: This platform identifier is invalid.";
-
- // Assume this example is run on a Windows operating system.
- OperatingSystem^ os = Environment::OSVersion;
- PlatformID pid = os->Platform;
- switch ( pid )
- {
- case PlatformID::Win32NT:
- case PlatformID::Win32S:
- case PlatformID::Win32Windows:
- case PlatformID::WinCE:
- Console::WriteLine( msg1 );
- break;
-
- case PlatformID::Unix:
- Console::WriteLine( msg2 );
- break;
-
- default:
- Console::WriteLine( msg3 );
- break;
- }
- return 1;
-}
-
-/*
-This example produces the following results:
-
-This is a Windows operating system.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp
deleted file mode 100644
index 985c85cb847..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-//
-// Sample for String::LastIndexOf(String, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- start = str->Length - 1;
- Console::WriteLine( "All occurrences of 'he' from position {0} to 0.", start );
- Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str );
- Console::Write( "The string 'he' occurs at position(s): " );
- at = 0;
- while ( (start > -1) && (at > -1) )
- {
- at = str->LastIndexOf( "he", start );
- if ( at > -1 )
- {
- Console::Write( " {0} ", at );
- start = at - 1;
- }
- }
-
- Console::WriteLine();
-}
-
-/*
-This example produces the following results:
-All occurrences of 'he' from position 66 to 0.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-The string 'he' occurs at position(s): 56 45 8
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp
deleted file mode 100644
index 707743dd829..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-// Sample for String::LastIndexOf(String, Int32, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- int count;
- int end;
- start = str->Length - 1;
- end = start / 2 - 1;
- Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "The string 'he' occurs at position(s): " );
- count = 0;
- at = 0;
- while ( (start > -1) && (at > -1) )
- {
- count = start - end; //Count must be within the substring.
- at = str->LastIndexOf( "he", start, count );
- if ( at > -1 )
- {
- Console::Write( "{0} ", at );
- start = at - 1;
- }
- }
-
- Console::Write( "{0} {0} {0}", Environment::NewLine );
-}
-
-/*
-This example produces the following results:
-All occurrences of 'he' from position 66 to 32.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-The string 'he' occurs at position(s): 56 45
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp
deleted file mode 100644
index 545ffd356be..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-// Sample for String::LastIndexOfAny(Char[])
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- String^ target = "is";
- array^anyOf = target->ToCharArray();
- start = str->Length - 1;
- Console::WriteLine( "The last character occurrence from position {0} to 0.", start );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "A character in '{0}' occurs at position: ", target );
- at = str->LastIndexOfAny( anyOf );
- if ( at > -1 )
- Console::Write( at );
- else
- Console::Write( "(not found)" );
-
- Console::Write( "{0}{0}{0}", Environment::NewLine );
-}
-
-/*
-This example produces the following results:
-The last character occurrence from position 66 to 0.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-A character in 'is' occurs at position: 58
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp
deleted file mode 100644
index 4328318576a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-// Sample for String::LastIndexOfAny(Char, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- String^ target = "is";
- array^anyOf = target->ToCharArray();
- start = (str->Length - 1) / 2;
- Console::WriteLine( "The last character occurrence from position {0} to 0.", start );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "A character in '{0}' occurs at position: ", target );
- at = str->LastIndexOfAny( anyOf, start );
- if ( at > -1 )
- Console::Write( at );
- else
- Console::Write( "(not found)" );
-
- Console::Write( "{0}{0}{0}", Environment::NewLine );
-}
-
-/*
-This example produces the following results:
-The last character occurrence from position 33 to 0.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-A character in 'is' occurs at position: 12
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp
deleted file mode 100644
index 2c3f5ecd695..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-// Sample for String::LastIndexOfAny(Char[], Int32, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- int count;
- String^ target = "aid";
- array^anyOf = target->ToCharArray();
- start = ((str->Length - 1) * 2) / 3;
- count = (str->Length - 1) / 3;
- Console::WriteLine( "The last character occurrence from position {0} for {1} characters.", start, count );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "A character in '{0}' occurs at position: ", target );
- at = str->LastIndexOfAny( anyOf, start, count );
- if ( at > -1 )
- Console::Write( at );
- else
- Console::Write( "(not found)" );
-
- Console::Write( "{0}{0}{0}", Environment::NewLine );
-}
-
-/*
-This example produces the following results:
-The last character occurrence from position 44 for 22 characters.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-A character in 'aid' occurs at position: 27
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp b/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp
deleted file mode 100644
index 338ffdc3b4f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-// Sample for String::ToCharArray(Int32, Int32)
-using namespace System;
-using namespace System::Collections;
-int main()
-{
- String^ str = "012wxyz789";
- array^arr;
- arr = str->ToCharArray( 3, 4 );
- Console::Write( "The letters in '{0}' are: '", str );
- Console::Write( arr );
- Console::WriteLine( "'" );
- Console::WriteLine( "Each letter in '{0}' is:", str );
- IEnumerator^ myEnum = arr->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::WriteLine( c );
- }
-}
-
-/*
-This example produces the following results:
-The letters in '012wxyz789' are: 'wxyz'
-Each letter in '012wxyz789' is:
-w
-x
-y
-z
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp
deleted file mode 100644
index 67cba53ecab..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Globalization;
-String^ symbol( int r )
-{
- String^ s = "=";
- if ( r < 0 )
- s = "<";
- else
- if ( r > 0 )
- s = ">";
-
-
- return s;
-}
-
-int main()
-{
- String^ str1 = "change";
- String^ str2 = "dollar";
- String^ relation = nullptr;
- relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "en-US" ) ) );
- Console::WriteLine( "For en-US: {0} {1} {2}", str1, relation, str2 );
- relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "cs-CZ" ) ) );
- Console::WriteLine( "For cs-CZ: {0} {1} {2}", str1, relation, str2 );
-}
-
-/*
-This example produces the following results.
-For en-US: change < dollar
-For cs-CZ: change > dollar
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp
deleted file mode 100644
index 069e685cc76..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-// Sample for String::Compare(String, Int32, String, Int32, Int32)
-using namespace System;
-int main()
-{
-
- // 0123456
- String^ str1 = "machine";
- String^ str2 = "device";
- String^ str;
- int result;
- Console::WriteLine();
- Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 );
- result = String::Compare( str1, 2, str2, 0, 2 );
- str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to"));
- Console::Write( "Substring '{0}' in ' {1}' is ", str1->Substring( 2, 2 ), str1 );
- Console::Write( " {0} ", str );
- Console::WriteLine( "substring '{0}' in ' {1}'.", str2->Substring( 0, 2 ), str2 );
-}
-
-/*
-This example produces the following results:
-
-str1 = 'machine', str2 = 'device'
-Substring 'ch' in 'machine' is less than substring 'de' in 'device'.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp
deleted file mode 100644
index 0e2fd3df934..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean)
-using namespace System;
-int main()
-{
-
- // 0123456
- String^ str1 = "MACHINE";
- String^ str2 = "machine";
- String^ str;
- int result;
- Console::WriteLine();
- Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 );
- Console::WriteLine( "Ignore case:" );
- result = String::Compare( str1, 2, str2, 2, 2, true );
- str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to"));
- Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 );
- Console::Write( " {0} ", str );
- Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 );
- Console::WriteLine();
- Console::WriteLine( "Honor case:" );
- result = String::Compare( str1, 2, str2, 2, 2, false );
- str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to"));
- Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 );
- Console::Write( " {0} ", str );
- Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 );
-}
-
-/*
-This example produces the following results:
-
-str1 = 'MACHINE', str2 = 'machine'
-Ignore case:
-Substring 'CH' in 'MACHINE' is equal to substring 'ch' in 'machine'.
-
-Honor case:
-Substring 'CH' in 'MACHINE' is greater than substring 'ch' in 'machine'.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp
deleted file mode 100644
index 3afdbfd074c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-//
-// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean, CultureInfo)
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // 0123456
- String^ str1 = "MACHINE";
- String^ str2 = "machine";
- String^ str;
- int result;
- Console::WriteLine();
- Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 );
- Console::WriteLine( "Ignore case, Turkish culture:" );
- result = String::Compare( str1, 4, str2, 4, 2, true, gcnew CultureInfo( "tr-TR" ) );
- str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to"));
- Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 );
- Console::Write( " {0} ", str );
- Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 );
- Console::WriteLine();
- Console::WriteLine( "Ignore case, invariant culture:" );
- result = String::Compare( str1, 4, str2, 4, 2, true, CultureInfo::InvariantCulture );
- str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to"));
- Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 );
- Console::Write( " {0} ", str );
- Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 );
-}
-
-/*
-This example produces the following results:
-
-str1 = 'MACHINE', str2 = 'machine'
-Ignore case, Turkish culture:
-Substring 'IN' in 'MACHINE' is less than substring 'in' in 'machine'.
-
-Ignore case, invariant culture:
-Substring 'IN' in 'MACHINE' is equal to substring 'in' in 'machine'.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp b/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp
deleted file mode 100644
index 52112724b74..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-// Sample for String::CompareOrdinal(String, String)
-using namespace System;
-int main()
-{
- String^ str1 = "ABCD";
- String^ str2 = "abcd";
- String^ str;
- int result;
- Console::WriteLine();
- Console::WriteLine( "Compare the numeric values of the corresponding Char objects in each string." );
- Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 );
- result = String::CompareOrdinal( str1, str2 );
- str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to"));
- Console::Write( "String '{0}' is ", str1 );
- Console::Write( "{0} ", str );
- Console::WriteLine( "String '{0}'.", str2 );
-}
-
-/*
-This example produces the following results:
-
-Compare the numeric values of the corresponding Char objects in each string.
-str1 = 'ABCD', str2 = 'abcd'
-String 'ABCD' is less than String 'abcd'.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp b/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp
deleted file mode 100644
index 4b457f0078d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
- int i = -123;
- Object^ o = i;
- array^objs = { -123, -456, -789};
- Console::WriteLine("Concatenate 1, 2, and 3 objects:");
- Console::WriteLine("1) {0}", String::Concat(o));
- Console::WriteLine("2) {0}", String::Concat(o, o));
- Console::WriteLine("3) {0}", String::Concat(o, o, o));
-
- Console::WriteLine("\nConcatenate 4 objects and a variable length parameter list:" );
- Console::WriteLine("4) {0}", String::Concat(o, o, o, o));
- Console::WriteLine("5) {0}", String::Concat( o, o, o, o, o));
- Console::WriteLine("\nConcatenate a 3-element object array:");
- Console::WriteLine("6) {0}", String::Concat(objs));
-}
-// The example displays the following output:
-// Concatenate 1, 2, and 3 objects:
-// 1) -123
-// 2) -123-123
-// 3) -123-123-123
-//
-// Concatenate 4 objects and a variable length parameter list:
-// 4) -123-123-123-123
-// 5) -123-123-123-123-123
-//
-// Concatenate a 3-element object array:
-// 6) -123-456-789
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp b/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp
deleted file mode 100644
index d9beeec7af6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
- String^ s1 = "The quick brown fox jumps over the lazy dog";
- String^ s2 = "fox";
- bool b = s1->Contains( s2 );
- Console::WriteLine( "Is the string, s2, in the string, s1?: {0}", b );
- if (b) {
- int index = s1->IndexOf(s2);
- if (index >= 0)
- Console::WriteLine("'{0} begins at character position {1}",
- s2, index + 1);
- }
-}
-// This example displays the following output:
-// 'fox' is in the string 'The quick brown fox jumps over the lazy dog': True
-// 'fox begins at character position 17
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp
deleted file mode 100644
index 94de0334063..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-//
-// Sample for String::Equals(Object)
-// String::Equals(String)
-// String::Equals(String, String)
-using namespace System;
-using namespace System::Text;
-int main()
-{
- StringBuilder^ sb = gcnew StringBuilder( "abcd" );
- String^ str1 = "abcd";
- String^ str2 = nullptr;
- Object^ o2 = nullptr;
- Console::WriteLine();
- Console::WriteLine( " * The value of String str1 is '{0}'.", str1 );
- Console::WriteLine( " * The value of StringBuilder sb is '{0}'.", sb );
- Console::WriteLine();
- Console::WriteLine( "1a) String::Equals(Object). Object is a StringBuilder, not a String." );
- Console::WriteLine( " Is str1 equal to sb?: {0}", str1->Equals( sb ) );
- Console::WriteLine();
- Console::WriteLine( "1b) String::Equals(Object). Object is a String." );
- str2 = sb->ToString();
- o2 = str2;
- Console::WriteLine( " * The value of Object o2 is '{0}'.", o2 );
- Console::WriteLine( " Is str1 equal to o2?: {0}", str1->Equals( o2 ) );
- Console::WriteLine();
- Console::WriteLine( " 2) String::Equals(String)" );
- Console::WriteLine( " * The value of String str2 is '{0}'.", str2 );
- Console::WriteLine( " Is str1 equal to str2?: {0}", str1->Equals( str2 ) );
- Console::WriteLine();
- Console::WriteLine( " 3) String::Equals(String, String)" );
- Console::WriteLine( " Is str1 equal to str2?: {0}", String::Equals( str1, str2 ) );
-}
-
-/*
-This example produces the following results:
-
- * The value of String str1 is 'abcd'.
- * The value of StringBuilder sb is 'abcd'.
-
-1a) String::Equals(Object). Object is a StringBuilder, not a String.
- Is str1 equal to sb?: False
-
-1b) String::Equals(Object). Object is a String.
- * The value of Object o2 is 'abcd'.
- Is str1 equal to o2?: True
-
- 2) String::Equals(String)
- * The value of String str2 is 'abcd'.
- Is str1 equal to str2?: True
-
- 3) String::Equals(String, String)
- Is str1 equal to str2?: True
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp b/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp
deleted file mode 100644
index 536db349ec4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-// Sample for String.GetTypeCode()
-using namespace System;
-int main()
-{
- String^ str = "abc";
- TypeCode tc = str->GetTypeCode();
- Console::WriteLine( "The type code for '{0}' is {1}, which represents {2}.", str, tc.ToString( "D" ), tc.ToString( "F" ) );
-}
-
-/*
-This example produces the following results:
-The type code for 'abc' is 18, which represents String.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp
deleted file mode 100644
index 30d08ce5ace..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-//
-// Sample for String::IndexOf(Char, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- Console::WriteLine();
- Console::WriteLine( "All occurrences of 't' from position 0 to {0}.", str->Length - 1 );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "The letter 't' occurs at position(s): " );
- at = 0;
- start = 0;
- while ( (start < str->Length) && (at > -1) )
- {
- at = str->IndexOf( 't', start );
- if ( at == -1 )
- break;
-
- Console::Write( "{0} ", at );
- start = at + 1;
- }
-
- Console::WriteLine();
-}
-
-/*
-This example produces the following results:
-
-All occurrences of 't' from position 0 to 66.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-The letter 't' occurs at position(s): 7 11 33 41 44 55 64
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp
deleted file mode 100644
index f8a1385b749..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-//
-// Sample for String::IndexOf(String, Int32, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- int end;
- int count;
- end = str->Length;
- start = end / 2;
- Console::WriteLine();
- Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end - 1 );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "The string 'he' occurs at position(s): " );
- count = 0;
- at = 0;
- while ( (start <= end) && (at > -1) )
- {
-
- // start+count must be a position within -str-.
- count = end - start;
- at = str->IndexOf( "he", start, count );
- if ( at == -1 )
- break;
-
- Console::Write( "{0} ", at );
- start = at + 1;
- }
-
- Console::WriteLine();
-}
-
-/*
-This example produces the following results:
-
-All occurrences of 'he' from position 33 to 66.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-The string 'he' occurs at position(s): 45 56
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp
deleted file mode 100644
index 47b0a1db97c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-// Sample for String::IndexOfAny(Char[], Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- String^ target = "is";
- array^anyOf = target->ToCharArray();
- start = str->Length / 2;
- Console::WriteLine();
- Console::WriteLine( "The first character occurrence from position {0} to {1}.", start, str->Length - 1 );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "A character in '{0}' occurs at position: ", target );
- at = str->IndexOfAny( anyOf, start );
- if ( at > -1 )
- Console::Write( at );
- else
- Console::Write( "(not found)" );
-
- Console::WriteLine();
-}
-
-/*
-
-The first character occurrence from position 33 to 66.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-A character in 'is' occurs at position: 49
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp
deleted file mode 100644
index 4bd03080726..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-// Sample for String::IndexOfAny(Char[], Int32, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- int count;
- String^ target = "aid";
- array^anyOf = target->ToCharArray();
- start = (str->Length - 1) / 3;
- count = (str->Length - 1) / 4;
- Console::WriteLine();
- Console::WriteLine( "The first character occurrence from position {0} for {1} characters.", start, count );
- Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str );
- Console::Write( "A character in '{0}' occurs at position: ", target );
- at = str->IndexOfAny( anyOf, start, count );
- if ( at > -1 )
- Console::Write( at );
- else
- Console::Write( "(not found)" );
-
- Console::WriteLine();
-}
-
-/*
-
-The first character occurrence from position 22 for 16 characters.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-A character in 'aid' occurs at position: 27
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp b/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp
deleted file mode 100644
index b70c604b0b1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-// Sample for String::Intern(String)
-using namespace System;
-using namespace System::Text;
-int main()
-{
- String^ s1 = "MyTest";
- String^ s2 = (gcnew StringBuilder)->Append( "My" )->Append( "Test" )->ToString();
- String^ s3 = String::Intern( s2 );
- Console::WriteLine( "s1 == '{0}'", s1 );
- Console::WriteLine( "s2 == '{0}'", s2 );
- Console::WriteLine( "s3 == '{0}'", s3 );
- Console::WriteLine( "Is s2 the same reference as s1?: {0}", s2 == s1 );
- Console::WriteLine( "Is s3 the same reference as s1?: {0}", s3 == s1 );
-}
-
-/*
-This example produces the following results:
-s1 == 'MyTest'
-s2 == 'MyTest'
-s3 == 'MyTest'
-Is s2 the same reference as s1?: False
-Is s3 the same reference as s1?: True
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp b/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp
deleted file mode 100644
index a9a9593c87e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-String^ Test( String^ s )
-{
- if (String::IsNullOrEmpty(s))
- return "is null or empty";
- else
- return String::Format( "(\"{0}\") is neither null nor empty", s );
-}
-
-int main()
-{
- String^ s1 = "abcd";
- String^ s2 = "";
- String^ s3 = nullptr;
- Console::WriteLine( "String s1 {0}.", Test( s1 ) );
- Console::WriteLine( "String s2 {0}.", Test( s2 ) );
- Console::WriteLine( "String s3 {0}.", Test( s3 ) );
-}
-// The example displays the following output:
-// String s1 ("abcd") is neither null nor empty.
-// String s2 is null or empty.
-// String s3 is null or empty.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp b/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp
deleted file mode 100644
index bec722b1e9e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Sample for String::IsInterned(String)
-using namespace System;
-using namespace System::Text;
-using namespace System::Runtime::CompilerServices;
-
-// In the .NET Framework 2.0 the following attribute declaration allows you to
-// avoid the use of the interning when you use NGEN.exe to compile an assembly
-// to the native image cache.
-[assembly:CompilationRelaxations(CompilationRelaxations::NoStringInterning)];
-void Test( int sequence, String^ str )
-{
- Console::Write( "{0} The string '", sequence );
- String^ strInterned = String::IsInterned( str );
- if ( strInterned == nullptr )
- Console::WriteLine( "{0}' is not interned.", str );
- else
- Console::WriteLine( "{0}' is interned.", strInterned );
-}
-
-int main()
-{
-
- // String str1 is known at compile time, and is automatically interned.
- String^ str1 = "abcd";
-
- // Constructed string, str2, is not explicitly or automatically interned.
- String^ str2 = (gcnew StringBuilder)->Append( "wx" )->Append( "yz" )->ToString();
- Console::WriteLine();
- Test( 1, str1 );
- Test( 2, str2 );
-}
-
-//This example produces the following results:
-
-//1) The string, 'abcd', is interned.
-//2) The string, 'wxyz', is not interned.
-
-//If you use NGEN.exe to compile the assembly to the native image cache, this
-//example produces the following results:
-
-//1) The string, 'abcd', is not interned.
-//2) The string, 'wxyz', is not interned.
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp b/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp
deleted file mode 100644
index 07f204ebd9e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-//
-// Sample for String::Join(String, String[], int int)
-using namespace System;
-int main()
-{
- array^val = {"apple","orange","grape","pear"};
- String^ sep = ", ";
- String^ result;
- Console::WriteLine( "sep = '{0}'", sep );
- Console::WriteLine( "val[] = {{'{0}' '{1}' '{2}' '{3}'}}", val[ 0 ], val[ 1 ], val[ 2 ], val[ 3 ] );
- result = String::Join( sep, val, 1, 2 );
- Console::WriteLine( "String::Join(sep, val, 1, 2) = '{0}'", result );
-}
-
-/*
-This example produces the following results:
-sep = ', '
-val[] = {'apple' 'orange' 'grape' 'pear'}
-String::Join(sep, val, 1, 2) = 'orange, grape'
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp
deleted file mode 100644
index 809d2c001d6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-// Sample for String::LastIndexOf(Char, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- start = str->Length - 1;
- Console::WriteLine( "All occurrences of 't' from position {0} to 0.", start );
- Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str );
- Console::Write( "The letter 't' occurs at position(s): " );
- at = 0;
- while ( (start > -1) && (at > -1) )
- {
- at = str->LastIndexOf( 't', start );
- if ( at > -1 )
- {
- Console::Write( " {0} ", at );
- start = at - 1;
- }
- }
-}
-
-/*
-This example produces the following results:
-All occurrences of 't' from position 66 to 0.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-The letter 't' occurs at position(s): 64 55 44 41 33 11 7
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp
deleted file mode 100644
index 881187073e4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-// Sample for String::LastIndexOf(Char, Int32, Int32)
-using namespace System;
-int main()
-{
- String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
- String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
- String^ str = "Now is the time for all good men to come to the aid of their party.";
- int start;
- int at;
- int count;
- int end;
- start = str->Length - 1;
- end = start / 2 - 1;
- Console::WriteLine( "All occurrences of 't' from position {0} to {1}.", start, end );
- Console::WriteLine( "\n{0}\n{1}\n{2}", br1, br2, str );
- Console::Write( "The letter 't' occurs at position(s): " );
- count = 0;
- at = 0;
- while ( (start > -1) && (at > -1) )
- {
- count = start - end; //Count must be within the substring.
- at = str->LastIndexOf( 't', start, count );
- if ( at > -1 )
- {
- Console::Write( " {0} ", at );
- start = at - 1;
- }
- }
-}
-
-/*
-This example produces the following results:
-All occurrences of 't' from position 66 to 32.
-0----+----1----+----2----+----3----+----4----+----5----+----6----+-
-0123456789012345678901234567890123456789012345678901234567890123456
-Now is the time for all good men to come to the aid of their party.
-
-The letter 't' occurs at position(s): 64 55 44 41 33
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp b/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp
deleted file mode 100644
index e3a6250c8ac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-// Sample for String::Length
-using namespace System;
-int main()
-{
- String^ str = "abcdefg";
- Console::WriteLine( "1) The length of '{0}' is {1}", str, str->Length );
- Console::WriteLine( "2) The length of '{0}' is {1}", "xyz", ((String^)"xyz")->Length );
- int length = str->Length;
- Console::WriteLine( "1) The length of '{0}' is {1}", str, length );
-}
-
-/*
-This example displays the following output:
- 1) The length of 'abcdefg' is 7
- 2) The length of 'xyz' is 3
- 3) The length of 'abcdefg' is 7
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp b/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp
deleted file mode 100644
index 8193a3115e2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-
-void Show( String^ title, String^ s )
-{
- Console::Write( "Characters in string {0} = ", title );
- for each (short x in s) {
- Console::Write("{0:X4} ", x);
- }
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Character c; combining characters acute and cedilla; character 3/4
- array^temp0 = {L'c',L'\u0301',L'\u0327',L'\u00BE'};
- String^ s1 = gcnew String( temp0 );
- String^ s2 = nullptr;
- String^ divider = gcnew String( '-',80 );
- divider = String::Concat( Environment::NewLine, divider, Environment::NewLine );
-
- Show( "s1", s1 );
- Console::WriteLine();
- Console::WriteLine( "U+0063 = LATIN SMALL LETTER C" );
- Console::WriteLine( "U+0301 = COMBINING ACUTE ACCENT" );
- Console::WriteLine( "U+0327 = COMBINING CEDILLA" );
- Console::WriteLine( "U+00BE = VULGAR FRACTION THREE QUARTERS" );
- Console::WriteLine( divider );
- Console::WriteLine( "A1) Is s1 normalized to the default form (Form C)?: {0}", s1->IsNormalized() );
- Console::WriteLine( "A2) Is s1 normalized to Form C?: {0}", s1->IsNormalized( NormalizationForm::FormC ) );
- Console::WriteLine( "A3) Is s1 normalized to Form D?: {0}", s1->IsNormalized( NormalizationForm::FormD ) );
- Console::WriteLine( "A4) Is s1 normalized to Form KC?: {0}", s1->IsNormalized( NormalizationForm::FormKC ) );
- Console::WriteLine( "A5) Is s1 normalized to Form KD?: {0}", s1->IsNormalized( NormalizationForm::FormKD ) );
- Console::WriteLine( divider );
- Console::WriteLine( "Set string s2 to each normalized form of string s1." );
- Console::WriteLine();
- Console::WriteLine( "U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE" );
- Console::WriteLine( "U+0033 = DIGIT THREE" );
- Console::WriteLine( "U+2044 = FRACTION SLASH" );
- Console::WriteLine( "U+0034 = DIGIT FOUR" );
- Console::WriteLine( divider );
- s2 = s1->Normalize();
- Console::Write( "B1) Is s2 normalized to the default form (Form C)?: " );
- Console::WriteLine( s2->IsNormalized() );
- Show( "s2", s2 );
- Console::WriteLine();
- s2 = s1->Normalize( NormalizationForm::FormC );
- Console::Write( "B2) Is s2 normalized to Form C?: " );
- Console::WriteLine( s2->IsNormalized( NormalizationForm::FormC ) );
- Show( "s2", s2 );
- Console::WriteLine();
- s2 = s1->Normalize( NormalizationForm::FormD );
- Console::Write( "B3) Is s2 normalized to Form D?: " );
- Console::WriteLine( s2->IsNormalized( NormalizationForm::FormD ) );
- Show( "s2", s2 );
- Console::WriteLine();
- s2 = s1->Normalize( NormalizationForm::FormKC );
- Console::Write( "B4) Is s2 normalized to Form KC?: " );
- Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKC ) );
- Show( "s2", s2 );
- Console::WriteLine();
- s2 = s1->Normalize( NormalizationForm::FormKD );
- Console::Write( "B5) Is s2 normalized to Form KD?: " );
- Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKD ) );
- Show( "s2", s2 );
- Console::WriteLine();
-}
-
-/*
-This example produces the following results:
-
-Characters in string s1 = 0063 0301 0327 00BE
-
-U+0063 = LATIN SMALL LETTER C
-U+0301 = COMBINING ACUTE ACCENT
-U+0327 = COMBINING CEDILLA
-U+00BE = VULGAR FRACTION THREE QUARTERS
-
---------------------------------------------------------------------------------
-
-A1) Is s1 normalized to the default form (Form C)?: False
-A2) Is s1 normalized to Form C?: False
-A3) Is s1 normalized to Form D?: False
-A4) Is s1 normalized to Form KC?: False
-A5) Is s1 normalized to Form KD?: False
-
---------------------------------------------------------------------------------
-
-Set string s2 to each normalized form of string s1.
-
-U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE
-U+0033 = DIGIT THREE
-U+2044 = FRACTION SLASH
-U+0034 = DIGIT FOUR
-
---------------------------------------------------------------------------------
-
-B1) Is s2 normalized to the default form (Form C)?: True
-Characters in string s2 = 1E09 00BE
-
-B2) Is s2 normalized to Form C?: True
-Characters in string s2 = 1E09 00BE
-
-B3) Is s2 normalized to Form D?: True
-Characters in string s2 = 0063 0327 0301 00BE
-
-B4) Is s2 normalized to Form KC?: True
-Characters in string s2 = 1E09 0033 2044 0034
-
-B5) Is s2 normalized to Form KD?: True
-Characters in string s2 = 0063 0327 0301 0033 2044 0034
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp b/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp
deleted file mode 100644
index a7be6a4bd78..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-// This example demonstrates the String.Remove() method.
-using namespace System;
-int main()
-{
- String^ s = "abc---def";
-
- //
- Console::WriteLine( "Index: 012345678" );
- Console::WriteLine( "1) {0}", s );
- Console::WriteLine( "2) {0}", s->Remove( 3 ) );
- Console::WriteLine( "3) {0}", s->Remove( 3, 3 ) );
-}
-
-/*
-This example produces the following results:
-
-Index: 012345678
-1) abc---def
-2) abc
-3) abcdef
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp b/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp
deleted file mode 100644
index 5bb7e44d58f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- String^ str = "1 2 3 4 5 6 7 8 9";
- Console::WriteLine( "Original string: \"{0}\"", str );
- Console::WriteLine( "CSV string: \"{0}\"", str->Replace( ' ', ',' ) );
-}
-
-//
-// This example produces the following output:
-// Original string: "1 2 3 4 5 6 7 8 9"
-// CSV string: "1,2,3,4,5,6,7,8,9"
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp b/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp
deleted file mode 100644
index c976a43115b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-
-//
-// This example demonstrates the String.Split(Char[], Boolean) and
-// String.Split(Char[], Int32, Boolean) methods
-using namespace System;
-void Show( array^entries )
-{
- Console::WriteLine( "The return value contains these {0} elements:", entries->Length );
- System::Collections::IEnumerator^ myEnum = entries->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- String^ entry = safe_cast(myEnum->Current);
- Console::Write( "<{0}>", entry );
- }
-
- Console::Write( "{0}{0}", Environment::NewLine );
-}
-
-int main()
-{
- String^ s = ",one,,,two,,,,,three,,";
- array^sep = gcnew array{
- ','
- };
- array^result;
-
- //
- Console::WriteLine( "The original string is \"{0}\".", s );
- Console::WriteLine( "The separation character is '{0}'.", sep[ 0 ] );
- Console::WriteLine();
-
- //
- Console::WriteLine( "Split the string and return all elements:" );
- result = s->Split( sep, StringSplitOptions::None );
- Show( result );
-
- //
- Console::WriteLine( "Split the string and return all non-empty elements:" );
- result = s->Split( sep, StringSplitOptions::RemoveEmptyEntries );
- Show( result );
-
- //
- Console::WriteLine( "Split the string and return 2 elements:" );
- result = s->Split( sep, 2, StringSplitOptions::None );
- Show( result );
-
- //
- Console::WriteLine( "Split the string and return 2 non-empty elements:" );
- result = s->Split( sep, 2, StringSplitOptions::RemoveEmptyEntries );
- Show( result );
-}
-
-/*
-This example produces the following results:
-
-The original string is ",one,,,two,,,,,three,,".
-The separation character is ','.
-
-Split the string and return all elements:
-The return value contains these 12 elements:
-<><><><><><><><><>
-
-Split the string and return all non-empty elements:
-The return value contains these 3 elements:
-
-
-Split the string and return 2 elements:
-The return value contains these 2 elements:
-<>
-
-Split the string and return 2 non-empty elements:
-The return value contains these 2 elements:
-<,,two,,,,,three,,>
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp b/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp
deleted file mode 100644
index bb7a31a327d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-
-//
-// Sample for String::ToLower(CultureInfo)
-using namespace System;
-using namespace System::Globalization;
-void CodePoints( String^ title, String^ s )
-{
- Console::Write( "{0}The code points in {1} are: {0}", Environment::NewLine, title );
- System::Collections::IEnumerator^ myEnum = s->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- UInt16 u = safe_cast(myEnum->Current);
- Console::Write( "{0:x4} ", u );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
- String^ str1 = "INDIGO";
-
- // str2 = str1, except each 'I' is '\u0130' (Unicode LATIN CAPITAL I WITH DOT ABOVE).
- array^temp = {L'\u0130',L'N',L'D',L'\u0130',L'G',L'O'};
- String^ str2 = gcnew String( temp );
- String^ str3;
- String^ str4;
- Console::WriteLine();
- Console::WriteLine( "str1 = '{0}'", str1 );
- Console::WriteLine();
- Console::WriteLine( "str1 is {0} to str2.", ((0 == String::CompareOrdinal( str1, str2 )) ? (String^)"equal" : "not equal") );
- CodePoints( "str1", str1 );
- CodePoints( "str2", str2 );
- Console::WriteLine();
-
- // str3 is a lower case copy of str2, using English-United States culture.
- Console::WriteLine( "str3 = Lower case copy of str2 using English-United States culture." );
- str3 = str2->ToLower( gcnew CultureInfo( "en-US",false ) );
-
- // str4 is a lower case copy of str2, using Turkish-Turkey culture.
- Console::WriteLine( "str4 = Lower case copy of str2 using Turkish-Turkey culture." );
- str4 = str2->ToLower( gcnew CultureInfo( "tr-TR",false ) );
-
- // Compare the code points in str3 and str4.
- Console::WriteLine();
- Console::WriteLine( "str3 is {0} to str4.", ((0 == String::CompareOrdinal( str3, str4 )) ? (String^)"equal" : "not equal") );
- CodePoints( "str3", str3 );
- CodePoints( "str4", str4 );
-}
-
-/*
-This example produces the following results:
-
-str1 = 'INDIGO'
-
-str1 is not equal to str2.
-
-The code points in str1 are:
-0049 004e 0044 0049 0047 004f
-
-The code points in str2 are:
-0130 004e 0044 0130 0047 004f
-
-str3 = Lower case copy of str2 using English-United States culture.
-str4 = Lower case copy of str2 using Turkish-Turkey culture.
-
-str3 is equal to str4.
-
-The code points in str3 are:
-0069 006e 0064 0069 0067 006f
-
-The code points in str4 are:
-0069 006e 0064 0069 0067 006f
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp b/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp
deleted file mode 100644
index 389fdf3e61a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- String^ str1 = "123";
- String^ str2 = "abc";
- Console::WriteLine( "Original str1: {0}", str1 );
- Console::WriteLine( "Original str2: {0}", str2 );
- Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) );
- str2 = str1;
- Console::WriteLine();
- Console::WriteLine( "New str2: {0}", str2 );
- Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) );
-}
-
-/*
-This code produces the following output:
-Original str1: 123
-Original str2: abc
-str1 same as str2?: False
-
-New str2: 123
-str1 same as str2?: True
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp
deleted file mode 100644
index 9f50fa95027..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
-
- // Make an array of strings. Note that we have included spaces.
- array^s = { "hello ", "and ", "welcome ", "to ",
- "this ", "demo! "};
-
- // Put all the strings together.
- Console::WriteLine( String::Concat(s) );
-
- // Sort the strings, and put them together.
- Array::Sort( s );
- Console::WriteLine( String::Concat(s));
-}
-// The example displays the following output:
-// hello and welcome to this demo!
-// and demo! hello this to welcome
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp
deleted file mode 100644
index a8d0614ca35..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
-
- // we want to simply quickly add this person's name together
- String^ fName = "Simon";
- String^ mName = "Jake";
- String^ lName = "Harrows";
-
- // because we want a name to appear with a space in between each name,
- // put a space on the front of the middle, and last name, allowing for
- // the fact that a space may already be there
- mName = String::Concat( " ", mName->Trim() );
- lName = String::Concat( " ", lName->Trim() );
-
- // this line simply concatenates the two strings
- Console::WriteLine( "Welcome to this page, '{0}'!", String::Concat( String::Concat( fName, mName ), lName ) );
-}
-// The example displays the following output:
-// Welcome to this page, 'Simon Jake Harrows'!
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp b/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp
deleted file mode 100644
index 683bae6c061..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
-
- // Embed an array of characters in a string
- String^ strSource = "changed";
- array^destination = {'T','h','e',' ','i','n','i','t','i','a','l',' ','a','r','r','a','y'};
-
- // Print the char array
- Console::WriteLine( destination );
-
- // Embed the source string in the destination string
- strSource->CopyTo( 0, destination, 4, strSource->Length );
-
- // Print the resulting array
- Console::WriteLine( destination );
- strSource = "A different string";
-
- // Embed only a section of the source string in the destination
- strSource->CopyTo( 2, destination, 3, 9 );
-
- // Print the resulting array
- Console::WriteLine( destination );
-}
-// The example displays the following output:
-// The initial array
-// The changed array
-// Thedifferentarray
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp
deleted file mode 100644
index da9802a9dc7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Collections;
-
-String^ StripEndTags( String^ item )
-{
- bool found = false;
-
- // try to find a tag at the end of the line using EndsWith
- if ( item->Trim()->EndsWith( ">" ) )
- {
-
- // now search for the opening tag...
- int lastLocation = item->LastIndexOf( "" );
-
- // remove the identified section, if it is a valid region
- if ( lastLocation >= 0 ) {
- item = item->Substring( 0, lastLocation );
- found = true;
- }
- }
-
- if (found) item = StripEndTags(item);
-
- return item;
-}
-
-int main()
-{
-
- // process an input file that contains html tags.
- // this sample checks for multiple tags at the end of the line, rather than simply
- // removing the last one.
- // note: HTML markup tags always end in a greater than symbol (>).
- array^strSource = {"This is bold text","
This is large Text
","This has multiple tags","This has embedded tags.","This line simply ends with a greater than symbol, it should not be modified>"};
- Console::WriteLine( "The following lists the items before the ends have been stripped:" );
- Console::WriteLine( "-----------------------------------------------------------------" );
-
- // print out the initial array of strings
- IEnumerator^ myEnum1 = strSource->GetEnumerator();
- while ( myEnum1->MoveNext() )
- {
- String^ s = safe_cast(myEnum1->Current);
- Console::WriteLine( s );
- }
-
- Console::WriteLine();
- Console::WriteLine( "The following lists the items after the ends have been stripped:" );
- Console::WriteLine( "----------------------------------------------------------------" );
-
- // Display the array of strings.
- IEnumerator^ myEnum2 = strSource->GetEnumerator();
- while ( myEnum2->MoveNext() )
- {
- String^ s = safe_cast(myEnum2->Current);
- Console::WriteLine( StripEndTags( s ) );
- }
-}
-// The example displays the following output:
-// The following lists the items before the ends have been stripped:
-// -----------------------------------------------------------------
-// This is bold text
-//
This is large Text
-// This has multiple tags
-// This has embedded tags.
-// This line simply ends with a greater than symbol, it should not be modified>
-//
-// The following lists the items after the ends have been stripped:
-// ----------------------------------------------------------------
-// This is bold text
-//
This is large Text
-// This has multiple tags
-// This has embedded tags.
-// This line simply ends with a greater than symbol, it should not be modified>
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp
deleted file mode 100644
index 4f76320ec42..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-// This is the main project file for VC++ application project
-// generated using an Application Wizard.
-#define _UNICODE
-
-#include
-
-using namespace System;
-using namespace System::Text;
-
-// This is the entry point for this application
-int _tmain( void )
-{
- //
- // Unicode Mathematical operators
- wchar_t charArray1[4] = {L'\x2200',L'\x2202',L'\x200F',L'\x2205'};
- wchar_t * lptstr1 = &charArray1[ 0 ];
- String^ wszMathSymbols = gcnew String( lptstr1 );
-
- // Unicode Letterlike Symbols
- wchar_t charArray2[4] = {L'\x2111',L'\x2118',L'\x2122',L'\x2126'};
- wchar_t * lptstr2 = &charArray2[ 0 ];
- String^ wszLetterLike = gcnew String( lptstr2 );
-
- // Compare Strings - the result is false
- Console::WriteLine( String::Concat( L"The Strings are equal? ", (0 == String::Compare( wszLetterLike, wszMathSymbols ) ? (String^)"TRUE" : "FALSE") ) );
- //
-
- //
- // Null terminated ASCII characters in a simple char array
- char charArray3[4] = {0x41,0x42,0x43,0x00};
- char * pstr3 = &charArray3[ 0 ];
- String^ szAsciiUpper = gcnew String( pstr3 );
- char charArray4[4] = {0x61,0x62,0x63,0x00};
- char * pstr4 = &charArray4[ 0 ];
- String^ szAsciiLower = gcnew String( pstr4,0,sizeof(charArray4) );
-
- // Prints "ABC abc"
- Console::WriteLine( String::Concat( szAsciiUpper, " ", szAsciiLower ) );
-
- // Compare Strings - the result is true
- Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper->ToUpper(), szAsciiLower->ToUpper() ) ? (String^)"TRUE" : "FALSE") ) );
-
- // This is the effective equivalent of another Compare method, which ignores case
- Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper, szAsciiLower, true ) ? (String^)"TRUE" : "FALSE") ) );
- //
-
- //
- // Create a Unicode String with 5 Greek Alpha characters
- String^ szGreekAlpha = gcnew String( L'\x0391',5 );
-
- // Create a Unicode String with a Greek Omega character
- wchar_t charArray5[3] = {L'\x03A9',L'\x03A9',L'\x03A9'};
- String^ szGreekOmega = gcnew String( charArray5,2,1 );
- String^ szGreekLetters = String::Concat( szGreekOmega, szGreekAlpha, szGreekOmega->Clone() );
-
- // Examine the result
- Console::WriteLine( szGreekLetters );
-
- // The first index of Alpha
- int ialpha = szGreekLetters->IndexOf( L'\x0391' );
-
- // The last index of Omega
- int iomega = szGreekLetters->LastIndexOf( L'\x03A9' );
- Console::WriteLine( String::Concat( "The Greek letter Alpha first appears at index ", Convert::ToString( ialpha ) ) );
- Console::WriteLine( String::Concat( " and Omega last appears at index ", Convert::ToString( iomega ), " in this String." ) );
- //
-
- //
- char asciiChars[6] = {0x51,0x52,0x53,0x54,0x54,0x56};
- char * pstr6 = &asciiChars[ 0 ];
- UTF8Encoding^ encoding = gcnew UTF8Encoding( true,true );
- String^ utfeightstring = gcnew String( pstr6,0,sizeof(asciiChars),encoding );
-
- // prints "QRSTTV"
- Console::WriteLine( String::Concat( "The UTF8 String is ", utfeightstring ) );
- //
- return 0;
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp b/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp
deleted file mode 100644
index 9ca351899a1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- String^ strSource = "This is the string which we will perform the search on";
- Console::WriteLine( "The search string is: {0}\"{1}\" {0}", Environment::NewLine, strSource );
- String^ strTarget = "";
- int found = 0;
- int totFinds = 0;
- do
- {
- Console::Write( "Please enter a search value to look for in the above string (hit Enter to exit) ==> " );
- strTarget = Console::ReadLine();
- if ( !strTarget->Equals( "" ) )
- {
- for ( int i = 0; i < strSource->Length; i++ )
- {
- found = strSource->IndexOf( strTarget, i );
- if (found >= 0)
- {
- totFinds++;
- i = found;
- }
- else
- break;
-
- }
- }
- else
- return 0;
- Console::WriteLine( "{0}The search parameter '{1}' was found {2} times. {0}", Environment::NewLine, strTarget, totFinds );
- totFinds = 0;
- }
- while ( true );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp b/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp
deleted file mode 100644
index 1bd127d5ce3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-//
-using namespace System;
-
-int main()
-{
- String^ animal1 = "fox";
- String^ animal2 = "dog";
- String^ strTarget = String::Format( "The {0} jumps over the {1}.", animal1, animal2 );
- Console::WriteLine( "The original string is:{0}{1}{0}", Environment::NewLine, strTarget );
- Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal1 );
- String^ adj1 = Console::ReadLine();
- Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal2 );
- String^ adj2 = Console::ReadLine();
- adj1 = String::Concat( adj1->Trim(), " " );
- adj2 = String::Concat( adj2->Trim(), " " );
- strTarget = strTarget->Insert( strTarget->IndexOf( animal1 ), adj1 );
- strTarget = strTarget->Insert( strTarget->IndexOf( animal2 ), adj2 );
- Console::WriteLine( " {0}The final string is: {0} {1}", Environment::NewLine, strTarget );
-}
-// Output from the example might appear as follows:
-// The original string is:
-// The fox jumps over the dog.
-//
-// Enter an adjective (or group of adjectives) to describe the fox: ==> bold
-// Enter an adjective (or group of adjectives) to describe the dog: ==> lazy
-//
-// The final string is:
-// The bold fox jumps over the lazy dog.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp b/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp
deleted file mode 100644
index 8f6a431148c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-String^ MakeLine( int initVal, int multVal, String^ sep )
-{
- array^sArr = gcnew array(10);
- for ( int i = initVal; i < initVal + 10; i++ )
- sArr[ i - initVal ] = String::Format( "{0, -3}", i * multVal );
- return String::Join( sep, sArr );
-}
-
-int main()
-{
- Console::WriteLine( MakeLine( 0, 5, ", " ) );
- Console::WriteLine( MakeLine( 1, 6, " " ) );
- Console::WriteLine( MakeLine( 9, 9, ": " ) );
- Console::WriteLine( MakeLine( 4, 7, "< " ) );
-}
-// The example displays the following output:
-// 0 , 5 , 10 , 15 , 20 , 25 , 30 , 35 , 40 , 45
-// 6 12 18 24 30 36 42 48 54 60
-// 81 : 90 : 99 : 108: 117: 126: 135: 144: 153: 162
-// 28 < 35 < 42 < 49 < 56 < 63 < 70 < 77 < 84 < 91
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp b/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp
deleted file mode 100644
index 4ea0b86e8aa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Collections;
-int main()
-{
- array^info = {"Name","Title","Age","Location","Gender"};
- Console::WriteLine( "The initial values in the array are:" );
- IEnumerator^ myEnum = info->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- String^ s = safe_cast(myEnum->Current);
- Console::WriteLine( s );
- }
-
- Console::WriteLine( " {0}The lowercase of these values is:", Environment::NewLine );
- IEnumerator^ myEnum1 = info->GetEnumerator();
- while ( myEnum1->MoveNext() )
- {
- String^ s = safe_cast(myEnum1->Current);
- Console::WriteLine( s->ToLower() );
- }
-
- Console::WriteLine( " {0}The uppercase of these values is:", Environment::NewLine );
- IEnumerator^ myEnum2 = info->GetEnumerator();
- while ( myEnum2->MoveNext() )
- {
- String^ s = safe_cast(myEnum2->Current);
- Console::WriteLine( s->ToUpper() );
- }
-}
-// The example displays the following output:
-// The initial values in the array are:
-// Name
-// Title
-// Age
-// Location
-// Gender
-//
-// The lowercase of these values is:
-// name
-// title
-// age
-// location
-// gender
-//
-// The uppercase of these values is:
-// NAME
-// TITLE
-// AGE
-// LOCATION
-// GENDER
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp b/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp
deleted file mode 100644
index 4960d17021a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- String^ name = "Michelle Violet Banks";
- Console::WriteLine( "The entire name is '{0}'", name );
-
- // remove the middle name, identified by finding the spaces in the middle of the name->->.
- int foundS1 = name->IndexOf( " " );
- int foundS2 = name->IndexOf( " ", foundS1 + 1 );
- if ( foundS1 != foundS2 && foundS1 >= 0 )
- {
- name = name->Remove( foundS1 + 1, foundS2 - foundS1 );
- Console::WriteLine( "After removing the middle name, we are left with '{0}'", name );
- }
-}
-// The example displays the following output:
-// The entire name is 'Michelle Violet Banks'
-// After removing the middle name, we are left with 'Michelle Banks'
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp b/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp
deleted file mode 100644
index 4d7cac7c4d1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-//
-using namespace System;
-int main()
-{
- String^ errString = "This docment uses 3 other docments to docment the docmentation";
- Console::WriteLine( "The original string is:\n'{0}'\n", errString );
-
- // Correct the spelling of S"document".
- String^ correctString = errString->Replace( "docment", "document" );
- Console::WriteLine( "After correcting the string, the result is:\n'{0}'", correctString );
-}
-//
-// This code example produces the following output:
-//
-// The original string is:
-// 'This docment uses 3 other docments to docment the docmentation'
-//
-// After correcting the string, the result is:
-// 'This document uses 3 other documents to document the documentation'
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp
deleted file mode 100644
index 66a53e4c6dc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-using namespace System;
-
-String^ StripStartTags( String^ item )
-{
- // Determine whether a tag begins the string.
- if (item->Trim()->StartsWith("<")) {
- // Find the closing tag.
- int lastLocation = item->IndexOf(">");
-
- // Remove the tag.
- if ( lastLocation >= 0 ) {
- item = item->Substring(lastLocation+ 1);
-
- // Remove any additional starting tags.
- item = StripStartTags(item);
- }
- }
-
- return item;
-}
-
-int main()
-{
- array^ strSource = { "This is bold text",
- "
This is large Text
",
- "This has multiple tags",
- "This has embedded tags.",
- "This is bold text
-//