diff --git a/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp b/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp
deleted file mode 100644
index 914c8f0a8fb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Types:System.Globalization.CompareInfo
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Globalization;
-
-int main()
-{
- array^ sign = gcnew array { "<", "=", ">" };
-
- // The code below demonstrates how strings compare
- // differently for different cultures.
- String^ s1 = "Coté";
- String^ s2 = "coté";
- String^ s3 = "côte";
-
- // Set sort order of strings for French in France.
- CompareInfo^ ci = (gcnew CultureInfo("fr-FR"))->CompareInfo;
- Console::WriteLine(L"The LCID for {0} is {1}.", ci->Name, ci->LCID);
-
- // Display the result using fr-FR Compare of Coté = coté.
- Console::WriteLine(L"fr-FR Compare: {0} {2} {1}",
- s1, s2, sign[ci->Compare(s1, s2, CompareOptions::IgnoreCase) + 1]);
-
- // Display the result using fr-FR Compare of coté > côte.
- Console::WriteLine(L"fr-FR Compare: {0} {2} {1}",
- s2, s3, sign[ci->Compare(s2, s3, CompareOptions::None) + 1]);
-
- // Set sort order of strings for Japanese as spoken in Japan.
- ci = (gcnew CultureInfo("ja-JP"))->CompareInfo;
- Console::WriteLine(L"The LCID for {0} is {1}.", ci->Name, ci->LCID);
-
- // Display the result using ja-JP Compare of coté < côte.
- Console::WriteLine("ja-JP Compare: {0} {2} {1}",
- s2, s3, sign[ci->Compare(s2, s3) + 1]);
-}
-
-// This code produces the following output.
-//
-// The LCID for fr-FR is 1036.
-// fr-FR Compare: Coté = coté
-// fr-FR Compare: coté > côte
-// The LCID for ja-JP is 1041.
-// ja-JP Compare: coté < côte
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp
deleted file mode 100644
index 2c6841d495b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-// System::Diagnostics->CounterCreationDataCollection::ctor
-// System::Diagnostics->CounterCreationDataCollection->AddRange(CounterCreationDataCollection)
-/*
-The following program demonstrates 'CounterCreationDataCollection()' constructor and
-'AddRange(CounterCreationDataCollection)' method of 'CounterCreationDataCollection' class.
-A 'CounterCreationData' Object* is created and added to an instance of 'CounterCreationDataCollection'
-class. Then counters in the 'CounterCreationDataCollection' are displayed to the console.
-*/
-//
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-int main()
-{
- PerformanceCounter^ myCounter;
- try
- {
- String^ myCategoryName;
- int numberOfCounters;
- Console::Write( "Enter the number of counters : " );
- numberOfCounters = Int32::Parse( Console::ReadLine() );
- array^myCounterCreationData = gcnew array(numberOfCounters);
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- Console::Write( "Enter the counter name for {0} counter : ", i );
- myCounterCreationData[ i ] = gcnew CounterCreationData;
- myCounterCreationData[ i ]->CounterName = Console::ReadLine();
- }
- CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData );
- Console::Write( "Enter the category Name : " );
- myCategoryName = Console::ReadLine();
-
- // Check if the category already exists or not.
- if ( !PerformanceCounterCategory::Exists( myCategoryName ) )
- {
- CounterCreationDataCollection^ myNewCounterCollection = gcnew CounterCreationDataCollection;
-
- // Add the 'CounterCreationDataCollection' to 'CounterCreationDataCollection' Object*.
- myNewCounterCollection->AddRange( myCounterCollection );
- PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myNewCounterCollection );
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false );
-
- }
- Console::WriteLine( "The list of counters in CounterCollection are: " );
- for ( int i = 0; i < myNewCounterCollection->Count; i++ )
- Console::WriteLine( "Counter {0} is '{1}'", i + 1, myNewCounterCollection[ i ]->CounterName );
- }
- else
- {
- Console::WriteLine( "The category already exists" );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}.", e->Message );
- }
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp
deleted file mode 100644
index 04c88582196..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// System::Diagnostics->CounterCreationDataCollection::Contains(CounterCreationData)
-// System::Diagnostics->CounterCreationDataCollection::Remove(CounterCreationData)
-
-/*
-The following program demonstrates 'Contains' and 'Remove' methods of
-'CounterCreationDataCollection' class. An instance of 'CounterCreationDataCollection'
-is created by passing an array of 'CounterCreationData'. A particular instance of
-'CounterCreationData' is removed if it exist in the 'CounterCreationDataCollection'.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void main()
-{
- PerformanceCounter^ myCounter;
- try
- {
-//
-//
- String^ myCategoryName;
- int numberOfCounters;
- Console::Write( "Enter the category Name :" );
- myCategoryName = Console::ReadLine();
- // Check if the category already exists or not.
- if ( !PerformanceCounterCategory::Exists( myCategoryName ) )
- {
- Console::Write( "Enter the number of counters : " );
- numberOfCounters = Int32::Parse( Console::ReadLine() );
- array^ myCounterCreationData =
- gcnew array(numberOfCounters);
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- Console::Write( "Enter the counter name for {0} counter : ", i );
- myCounterCreationData[ i ] = gcnew CounterCreationData;
- myCounterCreationData[ i ]->CounterName = Console::ReadLine();
- }
- CounterCreationDataCollection^ myCounterCollection =
- gcnew CounterCreationDataCollection;
- // Add the 'CounterCreationData[]' to 'CounterCollection'.
- myCounterCollection->AddRange( myCounterCreationData );
-
- PerformanceCounterCategory::Create( myCategoryName,
- "Sample Category", myCounterCollection );
-
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- myCounter = gcnew PerformanceCounter( myCategoryName,
- myCounterCreationData[ i ]->CounterName, "", false );
- }
- if ( myCounterCreationData->Length > 0 )
- {
- if ( myCounterCollection->Contains( myCounterCreationData[ 0 ] ) )
- {
- myCounterCollection->Remove( myCounterCreationData[ 0 ] );
- Console::WriteLine( "'{0}' counter is removed from the" +
- " CounterCreationDataCollection", myCounterCreationData[ 0 ]->CounterName );
- }
- }
- else
- {
- Console::WriteLine( "The counters does not exist" );
- }
- }
- else
- {
- Console::WriteLine( "The category already exists" );
- }
-//
-//
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}.", e->Message );
- return;
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp
deleted file mode 100644
index 5af877a5275..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-// System::Diagnostics->CounterCreationDataCollection->CounterCreationDataCollection(CounterCreationData->Item[])
-
-/*
-The following program demonstrates 'CounterCreationDataCollection(CounterCreationData->Item[])'
-constructor of 'CounterCreationDataCollection' class.
-An instance of 'CounterCreationDataCollection' is created by passing an array of
-'CounterCreationData' to the constructor. The counters of the 'CounterCreationDataCollection'
-are displayed to the console.
-
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void main()
-{
- PerformanceCounter^ myCounter;
- try
- {
-
-//
- String^ myCategoryName;
- int numberOfCounters;
- Console::Write( "Enter the category Name : " );
- myCategoryName = Console::ReadLine();
-
- // Check if the category already exists or not.
- if ( !PerformanceCounterCategory::Exists( myCategoryName ) )
- {
- Console::Write( "Enter the number of counters : " );
- numberOfCounters = Int32::Parse( Console::ReadLine() );
- array^myCounterCreationData = gcnew array(numberOfCounters);
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- Console::Write( "Enter the counter name for {0} counter : ", i );
- myCounterCreationData[ i ] = gcnew CounterCreationData;
- myCounterCreationData[ i ]->CounterName = Console::ReadLine();
-
- }
- CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData );
-
- // Create the category.
- PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myCounterCollection );
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false );
-
- }
- Console::WriteLine( "The list of counters in 'CounterCollection' are :" );
- for ( int i = 0; i < myCounterCollection->Count; i++ )
- Console::WriteLine( "Counter {0} is '{1}'", i, myCounterCollection[ i ]->CounterName );
- }
- else
- {
- Console::WriteLine( "The category already exists" );
- }
-//
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}.", e->Message );
- return;
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp
deleted file mode 100644
index d9619066739..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-// System::Diagnostics->CounterCreationDataCollection->CounterCreationDataCollection(CounterCreationDataCollection)
-/*
-The following program demonstrates 'CounterCreationDataCollection(CounterCreationDataCollection)'
-constructor of 'CounterCreationDataCollection' class.
-An instance of 'CounterCreationDataCollection' is created by passing another instance
-of 'CounterCreationDataCollection'. The counters of the 'CounterCreationDataCollection'
-are displayed to the console.
-*/
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-void main()
-{
- PerformanceCounter^ myCounter;
- try
- {
-//
- String^ myCategoryName;
- int numberOfCounters;
- Console::Write( "Enter the number of counters : " );
- numberOfCounters = Int32::Parse( Console::ReadLine() );
- array^myCounterCreationData = gcnew array(numberOfCounters);
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- Console::Write( "Enter the counter name for {0} counter : ", i );
- myCounterCreationData[ i ] = gcnew CounterCreationData;
- myCounterCreationData[ i ]->CounterName = Console::ReadLine();
-
- }
- CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData );
- Console::Write( "Enter the category Name:" );
- myCategoryName = Console::ReadLine();
-
- // Check if the category already exists or not.
- if ( !PerformanceCounterCategory::Exists( myCategoryName ) )
- {
- CounterCreationDataCollection^ myNewCounterCollection = gcnew CounterCreationDataCollection( myCounterCollection );
- PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myNewCounterCollection );
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false );
-
- }
- Console::WriteLine( "The list of counters in 'CounterCollection' are : " );
- for ( int i = 0; i < myNewCounterCollection->Count; i++ )
- Console::WriteLine( "Counter {0} is '{1}'", i, myNewCounterCollection[ i ]->CounterName );
- }
- else
- {
- Console::WriteLine( "The category already exists" );
- }
-//
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}.", e->Message );
- return;
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp
deleted file mode 100644
index e4e097db2f4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-// System::Diagnostics->CounterCreationDataCollection::Insert(int, CounterCreationData)
-// System::Diagnostics->CounterCreationDataCollection::IndexOf(CounterCreationData)
-
-/*
-The following program demonstrates 'IndexOf(CounterCreationData)' and 'Insert(int, CounterCreationData)'
-methods of 'CounterCreationDataCollection' class. An instance of 'CounterCreationDataCollection'
-is created by passing an array of 'CounterCreationData' to the constructor. A counter is inserted
-into the 'CounterCreationDataCollection' at specified index. The inserted counter and
-its index are displayed to the console.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void main()
-{
- PerformanceCounter^ myCounter;
- try
- {
-//
-//
- String^ myCategoryName;
- int numberOfCounters;
- Console::Write( "Enter the category Name : " );
- myCategoryName = Console::ReadLine();
- // Check if the category already exists or not.
- if ( !PerformanceCounterCategory::Exists( myCategoryName ) )
- {
- Console::Write( "Enter the number of counters : " );
- numberOfCounters = Int32::Parse( Console::ReadLine() );
- array^ myCounterCreationData =
- gcnew array(numberOfCounters);
-
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- Console::Write( "Enter the counter name for {0} counter ", i );
- myCounterCreationData[ i ] = gcnew CounterCreationData;
- myCounterCreationData[ i ]->CounterName = Console::ReadLine();
- }
- CounterCreationDataCollection^ myCounterCollection =
- gcnew CounterCreationDataCollection( myCounterCreationData );
- CounterCreationData^ myInsertCounterCreationData = gcnew CounterCreationData(
- "CounterInsert","",PerformanceCounterType::NumberOfItems32 );
- // Insert an instance of 'CounterCreationData' in the 'CounterCreationDataCollection'.
- myCounterCollection->Insert( myCounterCollection->Count - 1,
- myInsertCounterCreationData );
- Console::WriteLine( "'{0}' counter is inserted into 'CounterCreationDataCollection'",
- myInsertCounterCreationData->CounterName );
- // Create the category.
- PerformanceCounterCategory::Create( myCategoryName, "Sample Category",
- myCounterCollection );
-
- for ( int i = 0; i < numberOfCounters; i++ )
- {
- myCounter = gcnew PerformanceCounter( myCategoryName,
- myCounterCreationData[ i ]->CounterName, "", false );
- }
- Console::WriteLine( "The index of '{0}' counter is {1}",
- myInsertCounterCreationData->CounterName, myCounterCollection->IndexOf( myInsertCounterCreationData ) );
- }
- else
- {
- Console::WriteLine( "The category already exists" );
- }
-//
-//
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}.", e->Message );
- return;
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp b/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp
deleted file mode 100644
index 2fe2f7b3082..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// System::Diagnostics->CounterSample->CounterSample(long, long, long, long, long, long, PerformanceCounterType)
-// System::Diagnostics->CounterSample->CounterSample(long, long, long, long, long, long, PerformanceCounterType, long)
-
-/* The following program demonstrates the constructors of the 'CounterSample'
-structure. It creates an instance of performance counter, configures it
-to interact with 'Processor' category, '% Processor Time' counter and
-'0' instance, creates an instance of 'CounterSample', and displays
-the corresponding fields.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
-//
- PerformanceCounter^ myPerformanceCounter1 = gcnew PerformanceCounter(
- "Processor","% Processor Time","0" );
- CounterSample myCounterSample1( 10L, 20L, 30L, 40L, 50L, 60L,
- PerformanceCounterType::AverageCount64 );
- Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample1.CounterTimeStamp );
-
- Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue );
- Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue );
- Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency );
- Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency );
- Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp );
- Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec );
- Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType );
- // Hold the results of sample.
- myCounterSample1 = myPerformanceCounter1->NextSample();
- Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue );
- Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue );
- Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency );
- Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency );
- Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp );
- Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec );
- Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType );
-//
- Console::WriteLine( "" );
- Console::WriteLine( "" );
-//
- PerformanceCounter^ myPerformanceCounter2 =
- gcnew PerformanceCounter( "Processor","% Processor Time","0" );
- CounterSample myCounterSample2( 10L, 20L, 30L, 40L, 50L, 60L,
- PerformanceCounterType::AverageCount64,300);
- Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp );
- Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue );
- Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue );
- Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency );
- Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency );
- Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp );
- Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec );
- Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType );
- Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp );
- // Hold the results of sample.
- myCounterSample2 = myPerformanceCounter2->NextSample();
- Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue );
- Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue );
- Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency );
- Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency );
- Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp );
- Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec );
- Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType );
- Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp );
-//
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp
deleted file mode 100644
index e5ffc2a58d4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-// The following code example demonstrates the effect of changing the
-// CurrencyDecimalDigits property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a negative value with the default number of decimal digits (2).
- Int64 myInt = -1234;
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-
- // Displays the same value with four decimal digits.
- nfi->CurrencyDecimalDigits = 4;
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-}
-
-/*
-This code produces the following output.
-
-($1, 234.00)
-($1, 234.0000)
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp
deleted file mode 100644
index 9620c7b2591..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-// The following code example demonstrates the effect of changing the
-// CurrencyDecimalSeparator property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S".").
- Int64 myInt = 123456789;
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-
- // Displays the same value with a blank as the separator.
- nfi->CurrencyDecimalSeparator = " ";
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-}
-
-/*
-This code produces the following output.
-
-$123, 456, 789.00
-$123, 456, 789 00
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp
deleted file mode 100644
index 0421ff605f4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-// The following code example demonstrates the effect of changing the
-// CurrencyGroupSeparator property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S", ").
- Int64 myInt = 123456789;
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-
- // Displays the same value with a blank as the separator.
- nfi->CurrencyGroupSeparator = " ";
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-}
-
-/*
-This code produces the following output.
-
-$123, 456, 789.00
-$123 456 789.00
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp
deleted file mode 100644
index a06da3edcbf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-// The following code example demonstrates the effect of changing the
-// CurrencyGroupSizes property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S".").
- Int64 myInt = 123456789012345;
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-
- // Displays the same value with different groupings.
- array^mySizes1 = {2,3,4};
- array^mySizes2 = {2,3,0};
- nfi->CurrencyGroupSizes = mySizes1;
- Console::WriteLine( myInt.ToString( "C", nfi ) );
- nfi->CurrencyGroupSizes = mySizes2;
- Console::WriteLine( myInt.ToString( "C", nfi ) );
-}
-
-/*
-This code produces the following output.
-
-$123, 456, 789, 012, 345.00
-$12, 3456, 7890, 123, 45.00
-$1234567890, 123, 45.00
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp
deleted file mode 100644
index a0af052a1d7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// The following example starts an instance of Notepad. The example
-// then retrieves and displays various properties of the associated
-// process. The example detects when the process exits, and displays
-// the process's exit code.
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-int main()
-{
-
- // Define variables to track the peak
- // memory usage of the process.
- _int64 peakPagedMem = 0,peakWorkingSet = 0,peakVirtualMem = 0;
- Process^ myProcess = nullptr;
- try
- {
-
- // Start the process.
- myProcess = Process::Start( "NotePad.exe" );
-
- // Display the process statistics until
- // the user closes the program.
- do
- {
- if ( !myProcess->HasExited )
- {
-
- // Refresh the current process property values.
- myProcess->Refresh();
- Console::WriteLine();
-
- // Display current process statistics.
- Console::WriteLine( "{0} -", myProcess );
- Console::WriteLine( "-------------------------------------" );
- Console::WriteLine( " physical memory usage: {0}", myProcess->WorkingSet64 );
- Console::WriteLine( " base priority: {0}", myProcess->BasePriority );
- Console::WriteLine( " priority class: {0}", myProcess->PriorityClass );
- Console::WriteLine( " user processor time: {0}", myProcess->UserProcessorTime );
- Console::WriteLine( " privileged processor time: {0}", myProcess->PrivilegedProcessorTime );
- Console::WriteLine( " total processor time: {0}", myProcess->TotalProcessorTime );
- Console::WriteLine(" PagedSystemMemorySize64: {0}", myProcess->PagedSystemMemorySize64);
- Console::WriteLine(" PagedMemorySize64: {0}", myProcess->PagedMemorySize64);
-
- // Update the values for the overall peak memory statistics.
- peakPagedMem = myProcess->PeakPagedMemorySize64;
- peakVirtualMem = myProcess->PeakVirtualMemorySize64;
- peakWorkingSet = myProcess->PeakWorkingSet64;
- if ( myProcess->Responding )
- {
- Console::WriteLine( "Status = Running" );
- }
- else
- {
- Console::WriteLine( "Status = Not Responding" );
- }
- }
- }
- while ( !myProcess->WaitForExit( 1000 ) );
- Console::WriteLine();
- Console::WriteLine( "Process exit code: {0}", myProcess->ExitCode );
-
- // Display peak memory statistics for the process.
- Console::WriteLine( "Peak physical memory usage of the process: {0}", peakWorkingSet );
- Console::WriteLine( "Peak paged memory usage of the process: {0}", peakPagedMem );
- Console::WriteLine( "Peak virtual memory usage of the process: {0}", peakVirtualMem );
- }
- finally
- {
- if ( myProcess != nullptr )
- {
- myProcess->Close();
- }
- }
-
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp b/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp
deleted file mode 100644
index 1ec20413156..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// System::Diagnostics->CounterCreationData
-// System::Diagnostics->CounterCreationData(String*, String*, PerformanceCounterType)
-// System::Diagnostics->CounterCreationData()
-// System::Diagnostics->CounterCreationData->CounterName
-// System::Diagnostics->CounterCreationData->CounterHelp
-// System::Diagnostics->CounterCreationData->CounterType
-
-/* The following program demonstrates 'CounterCreationData' class,
-CounterCreationData(String*, String*, PerformanceCounterType)',
-'CounterCreationData()', 'CounterName', 'CounterHelp' and
-'CounterType' members of 'System::Diagnostics->CounterCreationData'
-class. It creates the custom counters with 'CounterCreationData'
-and binds them to 'PerformanceCounterCategory' object. */
-
-//
-//
-//
-//
-//
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
- CounterCreationDataCollection^ myCol = gcnew CounterCreationDataCollection;
-
- // Create two custom counter objects.
- CounterCreationData^ myCounter1 = gcnew CounterCreationData( "Counter1","First custom counter",PerformanceCounterType::CounterDelta32 );
- CounterCreationData^ myCounter2 = gcnew CounterCreationData;
-
- // Set the properties of the 'CounterCreationData' Object*.
- myCounter2->CounterName = "Counter2";
- myCounter2->CounterHelp = "Second custom counter";
- myCounter2->CounterType = PerformanceCounterType::NumberOfItemsHEX32;
-
- // Add custom counter objects to CounterCreationDataCollection.
- myCol->Add( myCounter1 );
- myCol->Add( myCounter2 );
- if ( PerformanceCounterCategory::Exists( "New Counter Category" ) )
- PerformanceCounterCategory::Delete( "New Counter Category" );
-
- // Bind the counters to a PerformanceCounterCategory.
- PerformanceCounterCategory^ myCategory = PerformanceCounterCategory::Create( "New Counter Category", "Category Help", myCol );
- Console::WriteLine( "Counter Information:" );
- Console::WriteLine( "Category Name: {0}", myCategory->CategoryName );
- for ( int i = 0; i < myCol->Count; i++ )
- {
- // Display the properties of the CounterCreationData objects.
- Console::WriteLine( "CounterName : {0}", myCol[ i ]->CounterName );
- Console::WriteLine( "CounterHelp : {0}", myCol[ i ]->CounterHelp );
- Console::WriteLine( "CounterType : {0}", myCol[ i ]->CounterType );
- }
-}
-
-//
-//
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp
deleted file mode 100644
index b5b6c7488d8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-//Types:System.Collections.DictionaryEntry
-//Types:System.Collections.IDictionary
-//Types:System.Collections.IDictionaryEnumerator
-//
-using namespace System;
-using namespace System::Collections;
-
-//
-// This class implements a simple dictionary using an array of
-// DictionaryEntry objects (key/value pairs).
-public ref class SimpleDictionary : public IDictionary
-{
- // The array of items
-private:
- array^ items;
-private:
- int itemsInUse;
-
- // Construct the SimpleDictionary with the desired number of
- // items. The number of items cannot change for the life time of
- // this SimpleDictionary.
-public:
- SimpleDictionary(int size)
- {
- items = gcnew array(size);
- }
-
- #pragma region IDictionary Members
- //
-public:
- property virtual bool IsReadOnly
- {
- bool get()
- {
- return false;
- }
- }
- //
- //
-public:
- virtual bool Contains(Object^ key)
- {
- int index;
- return TryGetIndexOfKey(key, &index);
- }
- //
- //
-public:
- virtual property bool IsFixedSize
- {
- bool get()
- {
- return false;
- }
- }
- //
- //
-public:
- virtual void Remove(Object^ key)
- {
- if (key == nullptr)
- {
- throw gcnew ArgumentNullException("key");
- }
- // Try to find the key in the DictionaryEntry array
- int index;
- if (TryGetIndexOfKey(key, &index))
- {
- // If the key is found, slide all the items down.
- Array::Copy(items, index + 1, items, index, itemsInUse -
- index - 1);
- itemsInUse--;
- }
- else
- {
- // If the key is not in the dictionary, just return.
- return;
- }
- }
- //
- //
-public:
- virtual void Clear()
- {
- itemsInUse = 0;
- }
- //
- //
-public:
- virtual void Add(Object^ key, Object^ value)
- {
- // Add the new key/value pair even if this key already exists
- // in the dictionary.
- if (itemsInUse == items->Length)
- {
- throw gcnew InvalidOperationException
- ("The dictionary cannot hold any more items.");
- }
- items[itemsInUse++] = gcnew DictionaryEntry(key, value);
- }
- //
- //
-public:
- virtual property ICollection^ Keys
- {
- ICollection^ get()
- {
- // Return an array where each item is a key.
- array
- //
-public:
- virtual property ICollection^ Values
- {
- ICollection^ get()
- {
- // Return an array where each item is a value.
- array^ values = gcnew array(itemsInUse);
- for (int i = 0; i < itemsInUse; i++)
- {
- values[i] = items[i]->Value;
- }
- return values;
- }
- }
- //
- //
-public:
- virtual property Object^ default[Object^]
- {
- Object^ get(Object^ key)
- {
- // If this key is in the dictionary, return its value.
- int index;
- if (TryGetIndexOfKey(key, &index))
- {
- // The key was found; return its value.
- return items[index]->Value;
- }
- else
- {
- // The key was not found; return null.
- return nullptr;
- }
- }
-
- void set(Object^ key, Object^ value)
- {
- // If this key is in the dictionary, change its value.
- int index;
- if (TryGetIndexOfKey(key, &index))
- {
- // The key was found; change its value.
- items[index]->Value = value;
- }
- else
- {
- // This key is not in the dictionary; add this
- // key/value pair.
- Add(key, value);
- }
- }
- }
- //
-private:
- bool TryGetIndexOfKey(Object^ key, int* index)
- {
- for (*index = 0; *index < itemsInUse; *index++)
- {
- // If the key is found, return true (the index is also
- // returned).
- if (items[*index]->Key->Equals(key))
- {
- return true;
- }
- }
-
- // Key not found, return false (index should be ignored by
- // the caller).
- return false;
- }
-//
-//
-private:
- ref class SimpleDictionaryEnumerator : public IDictionaryEnumerator
- {
- // A copy of the SimpleDictionary object's key/value pairs.
-private:
- array^ items;
-private:
- int index;
-
-public:
- SimpleDictionaryEnumerator(SimpleDictionary^ sd)
- {
- // Make a copy of the dictionary entries currently in the
- // SimpleDictionary object.
- items = gcnew array(sd->Count);
- Array::Copy(sd->items, 0, items, 0, sd->Count);
- index = -1;
- }
-
- // Return the current item.
-public:
- virtual property Object^ Current
- {
- Object^ get()
- {
- ValidateIndex();
- return items[index];
- }
- }
-
- // Return the current dictionary entry.
-public:
- virtual property DictionaryEntry Entry
- {
- DictionaryEntry get()
- {
- return (DictionaryEntry) Current;
- }
- }
-
- // Return the key of the current item.
-public:
- virtual property Object^ Key
- {
- Object^ get()
- {
- ValidateIndex();
- return items[index]->Key;
- }
- }
-
- // Return the value of the current item.
-public:
- virtual property Object^ Value
- {
- Object^ get()
- {
- ValidateIndex();
- return items[index]->Value;
- }
- }
-
- // Advance to the next item.
-public:
- virtual bool MoveNext()
- {
- if (index < items->Length - 1)
- {
- index++;
- return true;
- }
- return false;
- }
-
- // Validate the enumeration index and throw an exception if
- // the index is out of range.
-private:
- void ValidateIndex()
- {
- if (index < 0 || index >= items->Length)
- {
- throw gcnew InvalidOperationException
- ("Enumerator is before or after the collection.");
- }
- }
-
- // Reset the index to restart the enumeration.
-public:
- virtual void Reset()
- {
- index = -1;
- }
- };
- //
-public:
- virtual IDictionaryEnumerator^ GetEnumerator()
- {
- // Construct and return an enumerator.
- return gcnew SimpleDictionaryEnumerator(this);
- }
- //
- #pragma endregion
-
- #pragma region ICollection Members
-public:
- virtual property bool IsSynchronized
- {
- bool get()
- {
- return false;
- }
- }
-
-public:
- virtual property Object^ SyncRoot
- {
- Object^ get()
- {
- throw gcnew NotImplementedException();
- }
- }
-
-public:
- virtual property int Count
- {
- int get()
- {
- return itemsInUse;
- }
- }
-
-public:
- virtual void CopyTo(Array^ array, int index)
- {
- throw gcnew NotImplementedException();
- }
- #pragma endregion
-
- #pragma region IEnumerable Members
-
- virtual IEnumerator^ IEnumerable_GetEnumerator()
- = IEnumerable::GetEnumerator
- {
- // Construct and return an enumerator.
- return ((IDictionary^)this)->GetEnumerator();
- }
- #pragma endregion
-};
-//
-
-int main()
-{
- // Create a dictionary that contains no more than three
- // entries.
- IDictionary^ d = gcnew SimpleDictionary(3);
-
- // Add three people and their ages to the dictionary.
- d->Add("Jeff", 40);
- d->Add("Kristin", 34);
- d->Add("Aidan", 1);
-
- Console::WriteLine("Number of elements in dictionary = {0}",
- d->Count);
-
- Console::WriteLine("Does dictionary contain 'Jeff'? {0}",
- d->Contains("Jeff"));
- Console::WriteLine("Jeff's age is {0}", d["Jeff"]);
-
- // Display every entry's key and value.
- for each (DictionaryEntry^ de in d)
- {
- Console::WriteLine("{0} is {1} years old.", de->Key,
- de->Value);
- }
-
- // Remove an entry that exists.
- d->Remove("Jeff");
-
- // Remove an entry that does not exist, but do not throw an
- // exception.
- d->Remove("Max");
-
- // Show the names (keys) of the people in the dictionary.
- for each (String^ s in d->Keys)
- {
- Console::WriteLine(s);
- }
-
- // Show the ages (values) of the people in the dictionary.
- for each (int age in d->Values)
- {
- Console::WriteLine(age);
- }
-}
-
-// This code produces the following output.
-//
-// Number of elements in dictionary = 3
-// Does dictionary contain 'Jeff'? True
-// Jeff's age is 40
-// Jeff is 40 years old.
-// Kristin is 34 years old.
-// Aidan is 1 years old.
-// Kristin
-// Aidan
-// 34
-// 1
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp
deleted file mode 100644
index 6d4e4af244c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-using namespace System;
-using namespace System::Collections;
-
-public ref class SimpleDictionary : DictionaryBase
-{
-};
-
-public ref class DictionaySamples
-{
-public:
- static void Main()
- {
- // Create a dictionary that contains no more than three entries.
- IDictionary^ myDictionary = gcnew SimpleDictionary();
-
- // Add three people and their ages to the dictionary.
- myDictionary->Add("Jeff", 40);
- myDictionary->Add("Kristin", 34);
- myDictionary->Add("Aidan", 1);
- // Display every entry's key and value.
- for each (DictionaryEntry de in myDictionary)
- {
- Console::WriteLine("{0} is {1} years old.", de.Key, de.Value);
- }
-
- // Remove an entry that exists.
- myDictionary->Remove("Jeff");
-
- // Remove an entry that does not exist, but do not throw an exception.
- myDictionary->Remove("Max");
-
- //
- for each (DictionaryEntry de in myDictionary)
- {
- //...
- }
- //
- }
-};
-
-int main()
-{
- DictionaySamples::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp
deleted file mode 100644
index ad273901016..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Specify the directories you want to manipulate.
- DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\MyDir" );
- try
- {
-
- // Determine whether the directory exists.
- if ( di->Exists )
- {
-
- // Indicate that the directory already exists.
- Console::WriteLine( "That path exists already." );
- return 0;
- }
-
- // Try to create the directory.
- di->Create();
- Console::WriteLine( "The directory was created successfully." );
-
- // 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/DirInfo Create/CPP/dirinfo create.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp
deleted file mode 100644
index b172c01236b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Specify the directories you want to manipulate.
- DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\MyDir" );
- try
- {
-
- // Determine whether the directory exists.
- if ( di->Exists )
- {
-
- // Indicate that it already exists.
- Console::WriteLine( "That path exists already." );
- return 0;
- }
-
- // Try to create the directory.
- di->Create();
- Console::WriteLine( "The directory was created successfully." );
-
- // 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/DirInfo Ctor/CPP/dirinfo ctor.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp
deleted file mode 100644
index 8a3584321aa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Specify the directories you want to manipulate.
- DirectoryInfo^ di1 = gcnew DirectoryInfo( "c:\\MyDir" );
- DirectoryInfo^ di2 = gcnew DirectoryInfo( "c:\\MyDir\\temp" );
- try
- {
-
- // Create the directories.
- di1->Create();
- di2->Create();
-
- // This operation will not be allowed because there are subdirectories.
- Console::WriteLine( "I am about to attempt to delete {0}.", di1->Name );
- di1->Delete();
- Console::WriteLine( "The Delete operation was successful, which was unexpected." );
- }
- catch ( Exception^ )
- {
- Console::WriteLine( "The Delete operation failed as expected." );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp
deleted file mode 100644
index c0751c822f0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Specify the directories you want to manipulate.
- DirectoryInfo^ di1 = gcnew DirectoryInfo( "c:\\MyDir" );
- try
- {
-
- // Create the directories.
- di1->Create();
- di1->CreateSubdirectory( "temp" );
-
- //This operation will not be allowed because there are subdirectories.
- Console::WriteLine( "I am about to attempt to delete {0}", di1->Name );
- di1->Delete();
- Console::WriteLine( "The Delete operation was successful, which was unexpected." );
- }
- catch ( Exception^ )
- {
- Console::WriteLine( "The Delete operation failed as expected." );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp
deleted file mode 100644
index 7ecd08dfd25..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" );
-
- // Get only subdirectories that contain the letter "p."
- array^dirs = di->GetDirectories( "*p*" );
- Console::WriteLine( "The number of directories containing the letter p is {0}.", dirs->Length );
- Collections::IEnumerator^ myEnum = dirs->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DirectoryInfo^ diNext = safe_cast(myEnum->Current);
- Console::WriteLine( "The number of files in {0} is {1}", diNext, diNext->GetFiles()->Length );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp
deleted file mode 100644
index 86cac85e3fc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
-
- // Get the creation time of a well-known directory.
- DateTime dt = Directory::GetCreationTime( Environment::CurrentDirectory );
-
- // Give feedback to the user.
- if ( DateTime::Now.Subtract( dt ).TotalDays > 364 )
- {
- Console::WriteLine( "This directory is over a year old." );
- }
- else
- if ( DateTime::Now.Subtract( dt ).TotalDays > 30 )
- {
- Console::WriteLine( "This directory is over a month old." );
- }
- else
- if ( DateTime::Now.Subtract( dt ).TotalDays <= 1 )
- {
- Console::WriteLine( "This directory is less than a day old." );
- }
- else
- {
- Console::WriteLine( "This directory was created on {0}", dt );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp
deleted file mode 100644
index 716792cead5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
-
- // Get the current directory.
- String^ path = Directory::GetCurrentDirectory();
- String^ target = "c:\\temp";
- Console::WriteLine( "The current directory is {0}", path );
- if ( !Directory::Exists( target ) )
- {
- Directory::CreateDirectory( target );
- }
-
- // Change the current directory.
- Environment::CurrentDirectory = target;
- if ( path->Equals( Directory::GetCurrentDirectory() ) )
- {
- Console::WriteLine( "You are in the temp directory." );
- }
- else
- {
- Console::WriteLine( "You are not in the temp directory." );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp
deleted file mode 100644
index 0896d4ca1b5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
-
- // Only get subdirectories that begin with the letter "p."
- array^dirs = Directory::GetDirectories( "c:\\", "p*" );
- Console::WriteLine( "The number of directories starting with p is {0}.", dirs->Length );
- Collections::IEnumerator^ myEnum = dirs->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Console::WriteLine( myEnum->Current );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp
deleted file mode 100644
index 95bb8528e02..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
-
- // Only get files that begin with the letter "c".
- array^dirs = Directory::GetFiles( "c:\\", "c*" );
- Console::WriteLine( "The number of files starting with c is {0}.", dirs->Length );
- Collections::IEnumerator^ myEnum = dirs->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Console::WriteLine( myEnum->Current );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp
deleted file mode 100644
index d38d877f932..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- String^ path = "c:\\MyDir";
- if ( !Directory::Exists( path ) )
- {
- Directory::CreateDirectory( path );
- }
- Directory::SetLastAccessTime( path, DateTime(1985,5,4) );
-
- // Get the creation time of a well-known directory.
- DateTime dt = Directory::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this directory was {0}", dt );
-
- // Update the last access time.
- Directory::SetLastAccessTime( path, DateTime::Now );
- dt = Directory::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this directory was {0}", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp
deleted file mode 100644
index 75e5bee709d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- String^ path = "c:\\MyDir";
- if ( !Directory::Exists( path ) )
- {
- Directory::CreateDirectory( path );
- }
- else
- {
-
- // Take an action which will affect the write time.
- Directory::SetLastWriteTime( path, DateTime(1985,4,3) );
- }
-
- // Get the creation time of a well-known directory.
- DateTime dt = Directory::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this directory was {0}", dt );
-
- // Update the last write time.
- Directory::SetLastWriteTime( path, DateTime::Now );
- dt = Directory::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this directory was {0}", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp
deleted file mode 100644
index 0da03649338..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- String^ path = "c:\\MyDir";
- if ( !Directory::Exists( path ) )
- {
- Directory::CreateDirectory( path );
- }
- Directory::SetLastAccessTime( path, DateTime(1985,5,4) );
-
- // Get the last access time of a well-known directory.
- DateTime dt = Directory::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this directory was {0}", dt );
-
- // Update the last access time.
- Directory::SetLastAccessTime( path, DateTime::Now );
- dt = Directory::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this directory was {0}", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp
deleted file mode 100644
index 45c4c45428c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-void main()
-{
- try
- {
- String^ path = "c:\\MyDir";
- if ( !Directory::Exists( path ) )
- {
- Directory::CreateDirectory( path );
- }
- else
- {
-
- // Take an action that will affect the write time.
- Directory::SetLastWriteTime( path, DateTime(1985,4,3) );
- }
-
- // Get the last write time of a well-known directory.
- DateTime dt = Directory::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this directory was {0}", dt );
-
- //Update the last write time.
- Directory::SetLastWriteTime( path, DateTime::Now );
- dt = Directory::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this directory was {0}", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp b/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp
deleted file mode 100644
index 9647674e17e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-
-// Copy a source directory to a target directory.
-void CopyDirectory( String^ SourceDirectory, String^ TargetDirectory )
-{
- DirectoryInfo^ source = gcnew DirectoryInfo( SourceDirectory );
- DirectoryInfo^ target = gcnew DirectoryInfo( TargetDirectory );
-
- //Determine whether the source directory exists.
- if ( !source->Exists )
- return;
-
- if ( !target->Exists )
- target->Create();
-
-
- //Copy files.
- array^sourceFiles = source->GetFiles();
- for ( int i = 0; i < sourceFiles->Length; ++i )
- File::Copy( sourceFiles[ i ]->FullName, String::Concat( target->FullName, "\\", sourceFiles[ i ]->Name ), true );
-
- //Copy directories.
- array^sourceDirectories = source->GetDirectories();
- for ( int j = 0; j < sourceDirectories->Length; ++j )
- CopyDirectory( sourceDirectories[ j ]->FullName, String::Concat( target->FullName, "\\", sourceDirectories[ j ]->Name ) );
-}
-
-int main()
-{
- CopyDirectory( "D:\\Tools", "D:\\NewTools" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp
deleted file mode 100644
index 3f5ffdf0349..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// System::Diagnostics::EntryWrittenEventArgs::ctor()
-
-/*
-The following example demonstrates 'EntryWrittenEventArgs ()'
-constructor of the 'EntryWrittenEventArgs' class. It creates a custom 'EventLog'
-and writes an entry into it. Then creates an 'EntryWrittenEventArgs' Object*
-using the first entry in the custom eventlog. This Object* is used to notify a message
-*/
-
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e )
-{
- if ( !e->Entry )
- Console::WriteLine( "A new entry is written in MyNewLog." );
-}
-
-int main()
-{
- try
- {
- EventLog^ myNewLog = gcnew EventLog;
- myNewLog->Log = "MyNewLog";
- myNewLog->Source = "MySource";
-
- // Create the source if it does not exist already.
- if ( !EventLog::SourceExists( "MySource" ) )
- {
- EventLog::CreateEventSource( "MySource", "MyNewLog" );
- Console::WriteLine( "CreatingEventSource" );
- }
-
- // Write an entry to the EventLog.
- myNewLog->WriteEntry( "The Latest entry in the Event Log" );
- int myEntries = myNewLog->Entries->Count;
- EventLogEntry^ entry = myNewLog->Entries[ myEntries - 1 ];
- EntryWrittenEventArgs^ myEntryEventArgs = gcnew EntryWrittenEventArgs;
- MyOnEntry( myNewLog, myEntryEventArgs );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception Raised{0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp
deleted file mode 100644
index 96f9f0f008b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// System::Diagnostics::EntryWrittenEventArgs::ctor(EventLogEntry)
-// System::Diagnostics::EntryWrittenEventArgs::Entry
-
-/*
-The following example demonstrates the 'Entry' property and EntryWrittenEventArgs (EventLogEntry)
-constructor of the 'EntryWrittenEventArgs' class. It creates a custom 'EventLog' and writes an
-entry into it. Then creates an 'EntryWrittenEventArgs' Object* using the first entry in the custom
-eventlog. This Object* is used to notify a message
-*/
-
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-//
-void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e )
-{
- EventLogEntry^ myEventLogEntry = e->Entry;
- if ( myEventLogEntry )
- {
- Console::WriteLine( "Current message entry is: '{0}'", myEventLogEntry->Message );
- }
- else
- {
- Console::WriteLine( "The current entry is null" );
- }
-}
-//
-
-int main()
-{
- try
- {
- EventLog^ myNewLog = gcnew EventLog;
- myNewLog->Log = "MyNewLog";
- myNewLog->Source = "MySource";
-
- // Create the source if it does not exist already.
- if ( !EventLog::SourceExists( "MySource" ) )
- {
- EventLog::CreateEventSource( "MySource", "MyNewLog" );
- Console::WriteLine( "CreatingEventSource" );
- }
-
- // Write an entry to the EventLog.
- myNewLog->WriteEntry( "The Latest entry in the Event Log" );
- int myEntries = myNewLog->Entries->Count;
- EventLogEntry^ entry = myNewLog->Entries[ myEntries - 1 ];
- EntryWrittenEventArgs^ myEntryEventArgs = gcnew EntryWrittenEventArgs( entry );
- MyOnEntry( myNewLog, myEntryEventArgs );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception Raised {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp
deleted file mode 100644
index 54a15c9b13c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-// System::Diagnostics::EventLogEntryType
-// System::Diagnostics::EventLogEntryType::Error
-// System::Diagnostics::EventLogEntryType::Warning
-// System::Diagnostics::EventLogEntryType::Information
-// System::Diagnostics::EventLogEntryType::FailureAudit
-// System::Diagnostics::EventLogEntryType::SuccessAudit
-/* The following program demonstrates 'Error', 'Warning',
-'Information', 'FailureAudit' and 'SuccessAudit' members of
-'EventLogEntryType' enumerator. It creates new source with a
-specified event log, new ID, EventLogEntryType and message,
-if does not exist.
-*/
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::Runtime::Serialization;
-void main()
-{
- try
- {
- EventLog^ myEventLog;
- String^ mySource = nullptr;
- String^ myLog = nullptr;
- String^ myType = nullptr;
- String^ myMessage = "A new event is created.";
- String^ myEventID = nullptr;
- int myIntLog = 0;
- int myID = 0;
- Console::Write( "Enter source name for new event (eg: Print): " );
- mySource = Console::ReadLine();
- Console::Write( "Enter log name in which to write an event(eg: System): " );
- myLog = Console::ReadLine();
- Console::WriteLine( "" );
- Console::WriteLine( " Select type of event to write:" );
- Console::WriteLine( " 1. Error " );
- Console::WriteLine( " 2. Warning" );
- Console::WriteLine( " 3. Information" );
- Console::WriteLine( " 4. FailureAudit" );
- Console::WriteLine( " 5. SuccessAudit" );
- Console::Write( "Enter the choice(eg. 1): " );
- myType = Console::ReadLine();
- myIntLog = Convert::ToInt32( myType );
- Console::Write( "Enter ID with which to write an event(eg: 0-65535): " );
- myEventID = Console::ReadLine();
- myID = Convert::ToInt32( myEventID );
-
- //
- // Check whether source exist in event log.
- if ( !EventLog::SourceExists( mySource ) )
- {
-
- // Create a new source in a specified log on a system.
- EventLog::CreateEventSource( mySource, myLog );
- }
-
- // Create an event log instance.* myEventLog = new EventLog(myLog);
- // Initialize source property of obtained instance.
- myEventLog->Source = mySource;
- switch ( myIntLog )
- {
- case 1:
-
- // Write an 'Error' entry in specified log of event log.
- myEventLog->WriteEntry( myMessage, EventLogEntryType::Error, myID );
- break;
-
- case 2:
-
- // Write a 'Warning' entry in specified log of event log.
- myEventLog->WriteEntry( myMessage, EventLogEntryType::Warning, myID );
- break;
-
- case 3:
-
- // Write an 'Information' entry in specified log of event log.
- myEventLog->WriteEntry( myMessage, EventLogEntryType::Information, myID );
- break;
-
- case 4:
-
- // Write a 'FailureAudit' entry in specified log of event log.
- myEventLog->WriteEntry( myMessage, EventLogEntryType::FailureAudit, myID );
- break;
-
- case 5:
-
- // Write a 'SuccessAudit' entry in specified log of event log.
- myEventLog->WriteEntry( myMessage, EventLogEntryType::SuccessAudit, myID );
- break;
-
- default:
- Console::WriteLine( "Error: Failed to create an event in event log." );
- break;
- }
- Console::WriteLine( "A new event in log '{0}' with ID '{1}' is successfully written into event log.", myEventLog->Log, myID );
-
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp
deleted file mode 100644
index 6cb7dbb7107..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-// System::Diagnostics::EventLogEntryCollection
-// System::Diagnostics::EventLogEntryCollection::CopyTo(EventLogEntry->Item[],int)
-
-/*
-The following example demonstrates the EventLogEntryCollection class and the
-CopyTo method of EventLogEntryCollection class. A new Source for eventlog 'MyNewLog'
-is created. A new entry is created for 'MyNewLog'. The entries of EventLog are copied
-to an Array.
-*/
-
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Diagnostics;
-int main()
-{
- try
- {
- String^ myLogName = "MyNewLog";
-
- // Check if the source exists.
- if ( !EventLog::SourceExists( "MySource" ) )
- {
- //Create source.
- EventLog::CreateEventSource( "MySource", myLogName );
- Console::WriteLine( "Creating EventSource" );
- }
- else
- myLogName = EventLog::LogNameFromSourceName( "MySource", "." );
-
- // Get the EventLog associated if the source exists.
- // Create an EventLog instance and assign its source.
- EventLog^ myEventLog2 = gcnew EventLog;
- myEventLog2->Source = "MySource";
-
- // Write an informational entry to the event log.
- myEventLog2->WriteEntry( "Successfully created a new Entry in the Log" );
- myEventLog2->Close();
-
- // Create a new EventLog Object*.
- EventLog^ myEventLog1 = gcnew EventLog;
- myEventLog1->Log = myLogName;
-
- // Obtain the Log Entries of S"MyNewLog".
- EventLogEntryCollection^ myEventLogEntryCollection = myEventLog1->Entries;
- myEventLog1->Close();
- Console::WriteLine( "The number of entries in 'MyNewLog' = {0}", myEventLogEntryCollection->Count );
-
- // Display the 'Message' property of EventLogEntry.
- for ( int i = 0; i < myEventLogEntryCollection->Count; i++ )
- {
- Console::WriteLine( "The Message of the EventLog is : {0}", myEventLogEntryCollection[ i ]->Message );
- }
-
- // Copy the EventLog entries to Array of type EventLogEntry.
- array^myEventLogEntryArray = gcnew array(myEventLogEntryCollection->Count);
- myEventLogEntryCollection->CopyTo( myEventLogEntryArray, 0 );
- IEnumerator^ myEnumerator = myEventLogEntryArray->GetEnumerator();
- while ( myEnumerator->MoveNext() )
- {
- EventLogEntry^ myEventLogEntry = safe_cast(myEnumerator->Current);
- Console::WriteLine( "The LocalTime the Event is generated is {0}", myEventLogEntry->TimeGenerated );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp
deleted file mode 100644
index 60cc220d29d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// System::Diagnostics::EventLogEntryCollection->Count
-// System::Diagnostics::EventLogEntryCollection::Item
-
-/*
-The following example demonstrates 'Item','Count' properties of
-EventLogEntryCollection class. A new Source for eventlog 'MyNewLog' is created.
-The program checks if a Event source exists. If the source already exists, it gets
-the Log name associated with it otherwise, creates a new event source.
-A new entry is created for 'MyNewLog'.Entries of 'MyNewLog' are obtained and
-the count and the messages are displayed.
-
-*/
-
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Diagnostics;
-
-void main()
-{
- try
- {
- String^ myLogName = "MyNewLog";
-
- // Check if the source exists.
- if ( !EventLog::SourceExists( "MySource" ) )
- {
-
- //Create source.
- EventLog::CreateEventSource( "MySource", myLogName );
- Console::WriteLine( "Creating EventSource" );
- }
- else
- myLogName = EventLog::LogNameFromSourceName( "MySource", "." );
-
- // Get the EventLog associated if the source exists.
- // Create an EventLog instance and assign its source.
- EventLog^ myEventLog2 = gcnew EventLog;
- myEventLog2->Source = "MySource";
-
- //Write an entry to the event log.
- myEventLog2->WriteEntry( "Successfully created a new Entry in the Log. " );
-
- //
- //
- // Create a new EventLog object.
- EventLog^ myEventLog1 = gcnew EventLog;
- myEventLog1->Log = myLogName;
-
- // Obtain the Log Entries of the Event Log
- EventLogEntryCollection^ myEventLogEntryCollection = myEventLog1->Entries;
- Console::WriteLine( "The number of entries in 'MyNewLog' = {0}", myEventLogEntryCollection->Count );
-
- // Display the 'Message' property of EventLogEntry.
- for ( int i = 0; i < myEventLogEntryCollection->Count; i++ )
- {
- Console::WriteLine( "The Message of the EventLog is : {0}", myEventLogEntryCollection[ i ]->Message );
- }
- //
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception Caught! {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp
deleted file mode 100644
index 2c9c0d22442..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// System::Diagnostics::EventLogEntry::EntryType
-// System::Diagnostics::EventLogEntry::Source
-
-/*
-The following example demonstrates the properties 'EntryType' and 'Source'
-of the class 'EventLogEntry'.
-A new instance of 'EventLog' class is created and is associated to existing
-System Log file of local machine. User selects the event type and the latest
-entry in the log file of that type and it's source is displayed.
-*/
-
-//
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
- String^ myEventType = nullptr;
-
- // Associate the instance of 'EventLog' with local System Log.
- EventLog^ myEventLog = gcnew EventLog( "System","." );
- Console::WriteLine( "1:Error" );
- Console::WriteLine( "2:Information" );
- Console::WriteLine( "3:Warning" );
- Console::WriteLine( "Select the Event Type" );
- int myOption = Convert::ToInt32( Console::ReadLine() );
- switch ( myOption )
- {
- case 1:
- myEventType = "Error";
- break;
-
- case 2:
- myEventType = "Information";
- break;
-
- case 3:
- myEventType = "Warning";
- break;
-
- default:
- break;
- }
- EventLogEntryCollection^ myLogEntryCollection = myEventLog->Entries;
- int myCount = myLogEntryCollection->Count;
-
- // Iterate through all 'EventLogEntry' instances in 'EventLog'.
- for ( int i = myCount - 1; i > -1; i-- )
- {
- EventLogEntry^ myLogEntry = myLogEntryCollection[ i ];
-
- // Select the entry having desired EventType.
- if ( myLogEntry->EntryType.Equals( myEventType ) )
- {
- // Display Source of the event.
- Console::WriteLine( "{0} was the source of last event of type {1}", myLogEntry->Source, myLogEntry->EntryType );
- return 0;
- }
- }
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp
deleted file mode 100644
index 24f99e2bd0d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// System.Diagnostics.EventLogInstaller
-
-// The following example demonstrates the EventLogInstaller class.
-// It defines the instance MyEventLogInstaller with the
-// attribute RunInstallerAttribute.
-//
-// The Log and Source properties of the new instance are set,
-// and the instance is added to the Installers collection.
-//
-// Note:
-// 1) Run this program using the following command:
-// InstallUtil.exe
-// 2) Uninstall the event log created in step 1 using the
-// following command:
-// InstallUtil.exe /u
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Configuration::Install;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-
-[RunInstaller(true)]
-ref class MyEventLogInstaller: public Installer
-{
-private:
- EventLogInstaller^ myEventLogInstaller;
-
-public:
- MyEventLogInstaller()
- {
- // Create an instance of an EventLogInstaller.
- myEventLogInstaller = gcnew EventLogInstaller;
-
- // Set the source name of the event log.
- myEventLogInstaller->Source = "NewLogSource";
-
- // Set the event log that the source writes entries to.
- myEventLogInstaller->Log = "MyNewLog";
-
- // Add myEventLogInstaller to the Installer collection.
- Installers->Add( myEventLogInstaller );
- }
-};
-//
-
-void main(){}
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp
deleted file mode 100644
index f89e23b187c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Globalization;
-using namespace System::IO;
-using namespace System::Data;
-using namespace System::Diagnostics;
-using namespace Microsoft::Win32;
-void GetNewOverflowSetting( OverflowAction * newOverflow, interior_ptr numDays );
-void DisplayEventLogProperties();
-void ChangeEventLogOverflowAction( String^ logName );
-
-/// The main entry point for the sample application.
-
-[STAThread]
-int main()
-{
- DisplayEventLogProperties();
- Console::WriteLine();
- Console::WriteLine( "Enter the name of an event log to change the" );
- Console::WriteLine( "overflow policy (or press Enter to exit): " );
- String^ input = Console::ReadLine();
- if ( !String::IsNullOrEmpty( input ) )
- {
- ChangeEventLogOverflowAction( input );
- }
-}
-
-
-// Prompt the user for the overflow policy setting.
-void GetNewOverflowSetting( OverflowAction * newOverflow, interior_ptr numDays )
-{
- Console::Write( "Enter the new overflow policy setting [" );
- Console::Write( " OverwriteOlder," );
- Console::Write( " DoNotOverwrite," );
- Console::Write( " OverwriteAsNeeded" );
- Console::WriteLine( "] : " );
- String^ input = Console::ReadLine();
- if ( !String::IsNullOrEmpty( input ) )
- {
- String^ INPUT = input->Trim()->ToUpper( CultureInfo::InvariantCulture );
- if ( INPUT->Equals( "OVERWRITEOLDER" ) )
- {
- *newOverflow = OverflowAction::OverwriteOlder;
- Console::WriteLine( "Enter the number of days to retain events: " );
- input = Console::ReadLine();
-
- if ( ( !Int32::TryParse( input, *numDays )) || ( *numDays == 0) )
- {
- Console::WriteLine( " Invalid input, defaulting to 7 days." );
- *numDays = 7;
- }
- }
- else
- if ( INPUT->Equals( "DONOTOVERWRITE" ) )
- {
- *newOverflow = OverflowAction::DoNotOverwrite;
- }
- else
- if ( INPUT->Equals( "OVERWRITEASNEEDED" ) )
- {
- *newOverflow = OverflowAction::OverwriteAsNeeded;
- }
- else
- Console::WriteLine( "Unrecognized overflow policy." );
- }
-
- Console::WriteLine();
-}
-
-
-//
-void DisplayEventLogProperties()
-{
-
- // Iterate through the current set of event log files,
- // displaying the property settings for each file.
- array^eventLogs = EventLog::GetEventLogs();
- System::Collections::IEnumerator^ myEnum = eventLogs->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- EventLog^ e = safe_cast(myEnum->Current);
- Int64 sizeKB = 0;
- Console::WriteLine();
- Console::WriteLine( "{0}:", e->LogDisplayName );
- Console::WriteLine( " Log name = \t\t {0}", e->Log );
- Console::WriteLine( " Number of event log entries = {0}", e->Entries->Count );
-
- // Determine if there is a file for this event log.
- RegistryKey ^ regEventLog = Registry::LocalMachine->OpenSubKey( String::Format( "System\\CurrentControlSet\\Services\\EventLog\\{0}", e->Log ) );
- if ( regEventLog )
- {
- Object^ temp = regEventLog->GetValue( "File" );
- if ( temp != nullptr )
- {
- Console::WriteLine( " Log file path = \t {0}", temp );
- FileInfo^ file = gcnew FileInfo( temp->ToString() );
-
- // Get the current size of the event log file.
- if ( file->Exists )
- {
- sizeKB = file->Length / 1024;
- if ( (file->Length % 1024) != 0 )
- {
- sizeKB++;
- }
- Console::WriteLine( " Current size = \t {0} kilobytes", sizeKB );
- }
- }
- else
- {
- Console::WriteLine( " Log file path = \t " );
- }
- }
-
- // Display the maximum size and overflow settings.
- sizeKB = e->MaximumKilobytes;
- Console::WriteLine( " Maximum size = \t {0} kilobytes", sizeKB );
- Console::WriteLine( " Overflow setting = \t {0}", e->OverflowAction );
- switch ( e->OverflowAction )
- {
- case OverflowAction::OverwriteOlder:
- Console::WriteLine( "\t Entries are retained a minimum of {0} days.", e->MinimumRetentionDays );
- break;
-
- case OverflowAction::DoNotOverwrite:
- Console::WriteLine( "\t Older entries are not overwritten." );
- break;
-
- case OverflowAction::OverwriteAsNeeded:
- Console::WriteLine( "\t If number of entries equals max size limit, a new event log entry overwrites the oldest entry." );
- break;
-
- default:
- break;
- }
- }
-}
-
-
-//
-//
-// Display the current event log overflow settings, and
-// prompt the user to input a new overflow setting.
-void ChangeEventLogOverflowAction( String^ logName )
-{
- if ( EventLog::Exists( logName ) )
- {
-
- // Display the current overflow setting of the
- // specified event log.
- EventLog^ inputLog = gcnew EventLog( logName );
- Console::WriteLine( " Event log {0}", inputLog->Log );
- OverflowAction logOverflow = inputLog->OverflowAction;
- Int32 numDays = inputLog->MinimumRetentionDays;
- Console::WriteLine( " Current overflow setting = {0}", logOverflow );
- if ( logOverflow == OverflowAction::OverwriteOlder )
- {
- Console::WriteLine( "\t Entries are retained a minimum of {0} days.", numDays );
- }
-
- // Prompt user for a new overflow setting.
- GetNewOverflowSetting( &logOverflow, &numDays );
-
- // Change the overflow setting on the event log.
- if ( logOverflow != inputLog->OverflowAction )
- {
- inputLog->ModifyOverflowPolicy( logOverflow, numDays );
- Console::WriteLine( "Event log overflow policy was modified successfully!" );
- }
- else
- {
- Console::WriteLine( "Event log overflow policy was not modified." );
- }
- }
- else
- {
- Console::WriteLine( "Event log {0} was not found.", logName );
- }
-}
-
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp
deleted file mode 100644
index f61b7647435..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Globalization;
-using namespace System::Diagnostics;
-
-[STAThread]
-int main()
-{
- array^args = Environment::GetCommandLineArgs();
-
- //
- EventSourceCreationData ^ mySourceData = gcnew EventSourceCreationData( "","" );
- bool registerSource = true;
-
- // Process input parameters.
- if ( args->Length > 1 )
- {
-
- // Require at least the source name.
- mySourceData->Source = args[ 1 ];
- if ( args->Length > 2 )
- {
- mySourceData->LogName = args[ 2 ];
- }
-
- if ( args->Length > 3 )
- {
- mySourceData->MachineName = args[ 3 ];
- }
-
- if ( (args->Length > 4) && (args[ 4 ]->Length > 0) )
- {
- mySourceData->MessageResourceFile = args[ 4 ];
- }
- }
- else
- {
-
- // Display a syntax help message.
- Console::WriteLine( "Input:" );
- Console::WriteLine( " source [event log] [machine name] [resource file]" );
- registerSource = false;
- }
-
-
- // Set defaults for parameters missing input.
- if ( mySourceData->MachineName->Length == 0 )
- {
-
- // Default to the local computer.
- mySourceData->MachineName = ".";
- }
-
- if ( mySourceData->LogName->Length == 0 )
- {
-
- // Default to the Application log.
- mySourceData->LogName = "Application";
- }
-
-
- //
- // Determine if the source exists on the specified computer.
- if ( !EventLog::SourceExists( mySourceData->Source, mySourceData->MachineName ) )
- {
-
- // The source does not exist.
- // Verify that the message file exists
- // and the event log is local.
- if ( (mySourceData->MessageResourceFile != nullptr) && (mySourceData->MessageResourceFile->Length > 0) )
- {
- if ( mySourceData->MachineName->Equals( "." ) )
- {
- if ( !System::IO::File::Exists( mySourceData->MessageResourceFile ) )
- {
- Console::WriteLine( "File {0} not found - message file not set for source.", mySourceData->MessageResourceFile );
- registerSource = false;
- }
- }
- else
- {
-
- // For simplicity, do not allow setting the message
- // file for a remote event log. To set the message
- // for a remote event log, and for source registration,
- // the file path should be specified with system-wide
- // environment variables that are valid on the remote
- // computer, such as
- // "%SystemRoot%\system32\myresource.dll".
- Console::WriteLine( "Message resource file ignored for remote event log." );
- registerSource = false;
- }
- }
- }
- else
- {
-
- // Do not register the source, it already exists.
- registerSource = false;
-
- // Get the event log corresponding to the existing source.
- String^ sourceLog;
- sourceLog = EventLog::LogNameFromSourceName( mySourceData->Source, mySourceData->MachineName );
-
- // Determine if the event source is registered for the
- // specified log.
- if ( sourceLog->ToUpper( CultureInfo::InvariantCulture ) != mySourceData->LogName->ToUpper( CultureInfo::InvariantCulture ) )
- {
-
- // An existing source is registered
- // to write to a different event log.
- Console::WriteLine( "Warning: source {0} is already registered to write to event log {1}", mySourceData->Source, sourceLog );
- }
- else
- {
-
- // The source is already registered
- // to write to the specified event log.
- Console::WriteLine( "Source {0} already registered to write to event log {1}", mySourceData->Source, sourceLog );
- }
- }
-
- if ( registerSource )
- {
-
- // Register the new event source for the specified event log.
- Console::WriteLine( "Registering new source {0} for event log {1}.", mySourceData->Source, mySourceData->LogName );
- EventLog::CreateEventSource( mySourceData );
- Console::WriteLine( "Event source was registered successfully!" );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp
deleted file mode 100644
index 07109b189ca..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-// System::Diagnostics::EventLog::Exists(String)
-/*
-The following sample demonstrates the 'Exists(String)'method of
-'EventLog' class. It checks for the existence of a log and displays
-the result accordingly.
-*/
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-void main()
-{
- try
- {
-
- //
- String^ myLog = "myNewLog";
- if ( EventLog::Exists( myLog ) )
- {
- Console::WriteLine( "Log '{0}' exists.", myLog );
- }
- else
- {
- Console::WriteLine( "Log '{0}' does not exist.", myLog );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp
deleted file mode 100644
index 663444e9b51..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// System::Diagnostics::EventLog::WriteEntry(String, String, EventLogEntryType, Int32, Int16)
-// System::Diagnostics::EventLog::WriteEntry(String, String, EventLogEntryType, Int32, Int16, Byte->Item[])
-// System::Diagnostics::EventLog::EventLog.WriteEntry(String, EventLogEntryType, Int32, Int16)
-
-/* The following example demonstrates the method
-'WriteEntry(String, String, EventLogEntryType, Int32, Int16)',
-'WriteEntry(String, String, EventLogEntryType, Int32, Int16, Byte->Item[]) '
-and 'WriteEntry(String, EventLogEntryType, Int32, Int16)' of class
-'EventLog'. The following example writes the information to an event log.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
- //
- int myEventID = 20;
- short myCategory = 10;
-
- // Write an informational entry to the event log.
- Console::WriteLine( "Write from first source " );
- EventLog::WriteEntry( "FirstSource", "Writing warning to event log.",
- EventLogEntryType::Information, myEventID, myCategory );
- //
-
- //
- //Create a byte array for binary data to associate with the entry.
- array^myByte = gcnew array(10);
- //Populate the byte array with simulated data.
- for ( int i = 0; i < 10; i++ )
- {
- myByte[ i ] = (Byte)(i % 2);
- }
- //Write an entry to the event log that includes associated binary data.
- Console::WriteLine( "Write from second source " );
- EventLog::WriteEntry( "SecondSource", "Writing warning to event log.",
- EventLogEntryType::Error, myEventID, myCategory, myByte );
- //
-
- //
- // Create an EventLog instance and assign its source.
- EventLog^ myLog = gcnew EventLog;
- myLog->Source = "ThirdSource";
-
- // Write an informational entry to the event log.
- Console::WriteLine( "Write from third source " );
- myLog->WriteEntry( "Writing warning to event log.",
- EventLogEntryType::Warning, myEventID, myCategory );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp
deleted file mode 100644
index 5d40a7c71c9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// System::Diagnostics::EventLog::WriteEntry(String,String,EventLogEntryType,Int32)
-
-/*
-The following sample demonstrates the
-'WriteEntry(String,String,EventLogEntryType,Int32)' method of
-'EventLog' class. It writes an entry to a custom event log, S"MyNewLog".
-It creates the source S"MySource" if the source does not already exist.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
- try
- {
-//
- // Create the source, if it does not already exist.
- if ( !EventLog::SourceExists( "MySource" ) )
- {
- EventLog::CreateEventSource( "MySource", "myNewLog" );
- Console::WriteLine( "Creating EventSource" );
- }
-
- // Set the 'description' for the event.
- String^ myMessage = "This is my event.";
- EventLogEntryType myEventLogEntryType = EventLogEntryType::Warning;
- int myApplicationEventId = 100;
-
- // Write the entry in the event log.
- Console::WriteLine( "Writing to EventLog.. " );
- EventLog::WriteEntry( "MySource", myMessage,
- myEventLogEntryType, myApplicationEventId );
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception:{0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp
deleted file mode 100644
index 4771b4f0eb5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// System::Diagnostics::EventLog::WriteEntry(String, EventLogEntryType, Int32, Int16, Byte[])
-
-/*
-The following sample demonstrates the
-'WriteEntry(String, EventLogEntryType, Int32, Int16, Byte->Item[])' method of
-'EventLog' class. It writes an entry to a custom event log, S"MyLog".
-It creates the source S"MySource" if the source does not already exist.
-It creates an 'EventLog' Object* and calls 'WriteEntry' passing the
-description, Log entry type, application specific identifier for the event,
-application specific subcategory and data to be associated with the entry.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
- try
- {
-//
- // Create the source, if it does not already exist.
- String^ myLogName = "myNewLog";
- if ( !EventLog::SourceExists( "MySource" ) )
- {
- EventLog::CreateEventSource( "MySource", myLogName );
- Console::WriteLine( "Creating EventSource" );
- }
- else
- myLogName = EventLog::LogNameFromSourceName( "MySource", "." );
-
- // Create an EventLog and assign source.
- EventLog^ myEventLog = gcnew EventLog;
- myEventLog->Source = "MySource";
- myEventLog->Log = myLogName;
-
- // Set the 'description' for the event.
- String^ myMessage = "This is my event.";
- EventLogEntryType myEventLogEntryType = EventLogEntryType::Warning;
- int myApplicatinEventId = 1100;
- short myApplicatinCategoryId = 1;
-
- // Set the 'data' for the event.
- array^ myRawData = gcnew array(4);
- for ( int i = 0; i < 4; i++ )
- {
- myRawData[ i ] = 1;
- }
- Console::WriteLine( "Writing to EventLog.. " );
- myEventLog->WriteEntry( myMessage, myEventLogEntryType, myApplicatinEventId, myApplicatinCategoryId, myRawData );
-//
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception:{0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp
deleted file mode 100644
index f18b6e52fe0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- FileInfo^ fi = gcnew FileInfo( "c:\\MyTest.txt" );
-
- // This text is added only once to the file.
- if ( !fi->Exists )
- {
- //Create a file to write to.
- StreamWriter^ sw = fi->CreateText();
- try
- {
- sw->WriteLine( "Hello" );
- sw->WriteLine( "And" );
- sw->WriteLine( "Welcome" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
- }
-
- // This text will always be added, making the file longer over time
- // if it is not deleted.
- StreamWriter^ sw = fi->AppendText();
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is Extra" );
- sw->WriteLine( "Text" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
-
- //Open the file to read from.
- StreamReader^ sr = fi->OpenText();
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//Hello
-//And
-//Welcome
-//This
-//is Extra
-//Text
-//
-//When you run this application a second time, you will see the following output:
-//
-//Hello
-//And
-//Welcome
-//This
-//is Extra
-//Text
-//This
-//is Extra
-//Text
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp
deleted file mode 100644
index cd1f26bb6ef..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = Path::GetTempFileName();
- FileInfo^ fi1 = gcnew FileInfo( path );
- //Create a file to write to.
- StreamWriter^ sw = fi1->CreateText();
- try
- {
- sw->WriteLine( "Hello" );
- sw->WriteLine( "And" );
- sw->WriteLine( "Welcome" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
-
- //Open the file to read from.
- StreamReader^ sr = fi1->OpenText();
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-
- try
- {
- String^ path2 = Path::GetTempFileName();
- FileInfo^ fi2 = gcnew FileInfo( path2 );
-
- //Ensure that the target does not exist.
- fi2->Delete();
-
- //Copy the file.
- fi1->CopyTo( path2 );
- Console::WriteLine( "{0} was copied to {1}.", path, path2 );
-
- //Delete the newly created file.
- fi2->Delete();
- Console::WriteLine( "{0} was successfully deleted.", path2 );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp
deleted file mode 100644
index 457a43483a3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- String^ path2 = "c:\\MyTest.txttemp";
- FileInfo^ fi1 = gcnew FileInfo( path );
- FileInfo^ fi2 = gcnew FileInfo( path2 );
- try
- {
- // Create the file and clean up handles.
- FileStream^ fs = fi1->Create();
- if ( fs )
- delete (IDisposable^)fs;
-
- //Ensure that the target does not exist.
- fi2->Delete();
-
- //Copy the file.
- fi1->CopyTo( path2 );
- Console::WriteLine( "{0} was copied to {1}.", path, path2 );
-
- //Try to copy it again, which should succeed.
- fi1->CopyTo( path2, true );
- Console::WriteLine( "The second Copy operation succeeded, which is expected." );
- }
- catch ( Exception^ )
- {
- Console::WriteLine( "Double copying was not allowed, which is not expected." );
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//The second Copy operation succeeded, which is expected.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp
deleted file mode 100644
index 8533b4ee458..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- FileInfo^ fi = gcnew FileInfo( path );
-
- // Delete the file if it exists.
- if ( fi->Exists )
- {
- fi->Delete();
- }
-
- //Create the file.
- FileStream^ fs = fi->Create();
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- //Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-
- //Open the stream and read it back.
- StreamReader^ sr = fi->OpenText();
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is some text in the file.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp
deleted file mode 100644
index eecfff022ed..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- FileInfo^ fi = gcnew FileInfo( path );
- if ( !fi->Exists )
- {
- //Create a file to write to.
- StreamWriter^ sw = fi->CreateText();
- try
- {
- sw->WriteLine( "Hello" );
- sw->WriteLine( "And" );
- sw->WriteLine( "Welcome" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
- }
-
- //Open the file to read from.
- StreamReader^ sr = fi->OpenText();
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//Hello
-//And
-//Welcome
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp
deleted file mode 100644
index d0901ff161a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- FileInfo^ fi1 = gcnew FileInfo( path );
- if ( !fi1->Exists )
- {
- //Create a file to write to.
- StreamWriter^ sw = fi1->CreateText();
- try
- {
- sw->WriteLine( "Hello" );
- sw->WriteLine( "And" );
- sw->WriteLine( "Welcome" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
- }
-
- //Open the file to read from.
- StreamReader^ sr = fi1->OpenText();
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-
- try
- {
- String^ path2 = String::Concat( path, "temp" );
- FileInfo^ fi2 = gcnew FileInfo( path2 );
-
- //Ensure that the target does not exist.
- fi2->Delete();
-
- //Copy the file.
- fi1->CopyTo( path2 );
- Console::WriteLine( "{0} was copied to {1}.", path, path2 );
-
- //Delete the newly created file.
- fi2->Delete();
- Console::WriteLine( "{0} was successfully deleted.", path2 );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//Hello
-//And
-//Welcome
-//c:\MyTest.txt was copied to c:\MyTest.txttemp.
-//c:\MyTest.txttemp was successfully deleted.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp
deleted file mode 100644
index c219e088f8c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- FileInfo^ fi1 = gcnew FileInfo( path );
- try
- {
- StreamWriter^ sw = fi1->CreateText();
- if ( sw )
- delete (IDisposable^)sw;
-
- String^ path2 = String::Concat( path, "temp" );
- FileInfo^ fi2 = gcnew FileInfo( path2 );
-
- //Ensure that the target does not exist.
- fi2->Delete();
-
- //Copy the file.
- fi1->CopyTo( path2 );
- Console::WriteLine( "{0} was copied to {1}.", path, path2 );
-
- //Delete the newly created file.
- fi2->Delete();
- Console::WriteLine( "{0} was successfully deleted.", path2 );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//c:\MyTest.txt was copied to c:\MyTest.txttemp.
-//c:\MyTest.txttemp was successfully deleted.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp
deleted file mode 100644
index 052607a8faf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- FileInfo^ fi = gcnew FileInfo( path );
-
- // Delete the file if it exists.
- if ( !fi->Exists )
- {
- //Create the file.
- FileStream^ fs = fi->Create();
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- //Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- //Open the stream and read it back.
- FileStream^ fs = fi->Open( FileMode::Open );
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is some text in the file.
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp
deleted file mode 100644
index 7996e15f1cf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- FileInfo^ fi = gcnew FileInfo( path );
-
- // Delete the file if it exists.
- if ( !fi->Exists )
- {
-
- //Create the file.
- FileStream^ fs = fi->Create();
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- //Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- //Open the stream and read it back.
- FileStream^ fs = fi->Open( FileMode::Open, FileAccess::Read );
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- try
- {
- //Try to write to the file.
- fs->Write( b, 0, b->Length );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Writing was disallowed, as expected: {0}", e );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is some text in the file.
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//Writing was disallowed, as expected: System.NotSupportedException: Stream does
-//not support writing.
-// at System.IO.__Error.WriteNotSupported()
-// at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
-// at main() in c:\documents and settings\MyComputer\my documents\
-//visual studio 2005\projects\finfo open2\finfo open2\
-//cpp_console_application.cpp:line 46
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp
deleted file mode 100644
index f81348f3afa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\MyTest.txt";
- FileInfo^ fi = gcnew FileInfo( path );
-
- // Delete the file if it exists.
- if ( !fi->Exists )
- {
- //Create the file.
- FileStream^ fs = fi->Create();
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- //Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- //Open the stream and read it back.
- FileStream^ fs = fi->OpenRead();
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is some text in the file.
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp
deleted file mode 100644
index 3868e7e68fb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-public ref class OpenTextTest
-{
-public:
- static void Main()
- {
- String^ path = "c:\\MyTest.txt";
-
- FileInfo^ fi = gcnew FileInfo(path);
-
- // Check for existing file
- if (!fi->Exists)
- {
- // Create the file.
- FileStream^ fs = fi->Create();
- array^ info =
- (gcnew UTF8Encoding(true))->GetBytes("This is some text in the file.");
-
- // Add some information to the file.
- fs->Write(info, 0, info->Length);
- fs->Close();
- }
-
- // Open the stream and read it back.
- StreamReader^ sr = fi->OpenText();
- String^ s = "";
- while ((s = sr->ReadLine()) != nullptr)
- {
- Console::WriteLine(s);
- }
- }
-};
-
-int main()
-{
- OpenTextTest::Main();
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is some text in the file.
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp
deleted file mode 100644
index e4a0ca98bdb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\Temp\\MyTest.txt";
- FileInfo^ fi = gcnew FileInfo( path );
-
- // Open the stream for writing.
- {
- FileStream^ fs = fi->OpenWrite();
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is to test the OpenWrite method." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- // Open the stream and read it back.
- {
- FileStream^ fs = fi->OpenRead();
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is to test the OpenWrite method.
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp b/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp
deleted file mode 100644
index e79c45b3672..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Delete the file if it exists.
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
-
- //Create the file.
- FileStream^ fs = File::Create( path );
- try
- {
- if ( fs->CanSeek )
- {
- Console::WriteLine( "The stream connected to {0} is seekable.", path );
- }
- else
- {
- Console::WriteLine( "The stream connected to {0} is not seekable.", path );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp b/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp
deleted file mode 100644
index 7dd44acda66..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Ensure that the file is readonly.
- File::SetAttributes( path, static_cast(File::GetAttributes( path ) | FileAttributes::ReadOnly) );
-
- //Create the file.
- FileStream^ fs = gcnew FileStream( path,FileMode::OpenOrCreate,FileAccess::Read );
- try
- {
- if ( fs->CanWrite )
- {
- Console::WriteLine( "The stream for file {0} is writable.", path );
- }
- else
- {
- Console::WriteLine( "The stream for file {0} is not writable.", path );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp b/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp
deleted file mode 100644
index cc2e6916562..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-void AddText( FileStream^ fs, String^ value )
-{
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( value );
- fs->Write( info, 0, info->Length );
-}
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Delete the file if it exists.
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
-
- //Create the file.
- {
- FileStream^ fs = File::Create( path );
- try
- {
- AddText( fs, "This is some text" );
- AddText( fs, "This is some more text," );
- AddText( fs, "\r\nand this is on a new line" );
- AddText( fs, "\r\n\r\nThe following is a subset of characters:\r\n" );
- for ( int i = 1; i < 120; i++ )
- {
- AddText( fs, Convert::ToChar( i ).ToString() );
-
- //Split the output at every 10th character.
- if ( Math::IEEERemainder( Convert::ToDouble( i ), 10 ) == 0 )
- {
- AddText( fs, "\r\n" );
- }
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- //Open the stream and read it back.
- {
- FileStream^ fs = File::OpenRead( path );
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp b/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp
deleted file mode 100644
index 1f0ebf4662f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- if ( !File::Exists( path ) )
- {
-
- // Create a file to write to.
- StreamWriter^ sw = File::CreateText( path );
- try
- {
- sw->WriteLine( "Hello" );
- sw->WriteLine( "And" );
- sw->WriteLine( "Welcome" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)(sw);
- }
- }
-
- // Open the file to read from.
- StreamReader^ sr = File::OpenText( path );
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)(sr);
- }
-
- try
- {
- String^ path2 = String::Concat( path, "temp" );
-
- // Ensure that the target does not exist.
- File::Delete( path2 );
-
- // Copy the file.
- File::Copy( path, path2 );
- Console::WriteLine( "{0} was copied to {1}.", path, path2 );
-
- // Delete the newly created file.
- File::Delete( path2 );
- Console::WriteLine( "{0} was successfully deleted.", path2 );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp b/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp
deleted file mode 100644
index 9c511bd99e5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Create the file, or overwrite if the file exists.
- FileStream^ fs = File::Create( path );
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-
- // Open the stream and read it back.
- StreamReader^ sr = File::OpenText( path );
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp b/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp
deleted file mode 100644
index e79d7bdd9ac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Create the file, or overwrite if the file exists.
- FileStream^ fs = File::Create( path, 1024 );
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-
- // Open the stream and read it back.
- StreamReader^ sr = File::OpenText( path );
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp b/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp
deleted file mode 100644
index e93de3ce721..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- if ( !File::Exists( path ) )
- {
-
- // Create a file to write to.
- StreamWriter^ sw = File::CreateText( path );
- try
- {
- sw->WriteLine( "Hello" );
- sw->WriteLine( "And" );
- sw->WriteLine( "Welcome" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
- }
-
- // Open the file to read from.
- StreamReader^ sr = File::OpenText( path );
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp b/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp
deleted file mode 100644
index 502539dd149..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Create the file if it does not exist.
- if ( !File::Exists( path ) )
- {
- File::Create( path );
- }
-
- if ( (File::GetAttributes( path ) & FileAttributes::Hidden) == FileAttributes::Hidden )
- {
-
- // Show the file.
- File::SetAttributes(path, File::GetAttributes( path ) & ~FileAttributes::Hidden);
- Console::WriteLine( "The {0} file is no longer hidden.", path );
- }
- else
- {
-
- // Hide the file.
- File::SetAttributes( path, static_cast(File::GetAttributes( path ) | FileAttributes::Hidden) );
- Console::WriteLine( "The {0} file is now hidden.", path );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp
deleted file mode 100644
index 80e27831de7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- String^ path = "c:\\Temp\\MyTest.txt";
- if ( !File::Exists( path ) )
- {
- File::Create( path );
- }
- File::SetLastAccessTime( path, DateTime(1985,5,4) );
-
- // Get the creation time of a well-known directory.
- DateTime dt = File::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this file was {0}.", dt );
-
- // Update the last access time.
- File::SetLastAccessTime( path, DateTime::Now );
- dt = File::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this file was {0}.", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp
deleted file mode 100644
index 8b796882ead..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- String^ path = "c:\\Temp\\MyTest.txt";
- if ( !File::Exists( path ) )
- {
- File::Create( path );
- }
- else
- {
-
- // Take an action that will affect the write time.
- File::SetLastWriteTime( path, DateTime(1985,4,3) );
- }
-
- // Get the creation time of a well-known directory.
- DateTime dt = File::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this file was {0}.", dt );
-
- // Update the last write time.
- File::SetLastWriteTime( path, DateTime::Now );
- dt = File::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this file was {0}.", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp b/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp
deleted file mode 100644
index 38bf0f2cab3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- String^ path2 = "c:\\temp2\\MyTest.txt";
- try
- {
- if ( !File::Exists( path ) )
- {
-
- // This statement ensures that the file is created,
- // but the handle is not kept.
- FileStream^ fs = File::Create( path );
- if ( fs )
- delete (IDisposable^)fs;
- }
-
- // Ensure that the target does not exist.
- if ( File::Exists( path2 ) )
- File::Delete( path2 );
-
- // Move the file.
- File::Move( path, path2 );
- Console::WriteLine( "{0} was moved to {1}.", path, path2 );
-
- // See if the original exists now.
- if ( File::Exists( path ) )
- {
- Console::WriteLine( "The original file still exists, which is unexpected." );
- }
- else
- {
- Console::WriteLine( "The original file no longer exists, which is expected." );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp b/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp
deleted file mode 100644
index 1378629c6eb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- // Create a temporary file, and put some data into it.
- String^ path = Path::GetTempFileName();
- FileStream^ fs = File::Open( path, FileMode::Open, FileAccess::Write, FileShare::None );
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-
- // Open the stream and read it back.
- fs = File::Open( path, FileMode::Open );
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp b/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp
deleted file mode 100644
index 09b89e18c7e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- // This sample assumes that you have a folder named "c:\temp" on your computer.
- String^ filePath = "c:\\temp\\MyTest.txt";
- // Delete the file if it exists.
- if (File::Exists( filePath ))
- {
- File::Delete( filePath );
- }
- // Create the file.
- FileStream^ fs = File::Create( filePath );
- try
- {
- array^ info = ( gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-
- // Open the stream and read it back.
- fs = File::Open( filePath, FileMode::Open, FileAccess::Read );
- try
- {
- array^ b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- try
- {
- // Try to write to the file.
- fs->Write( b, 0, b->Length );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Writing was disallowed, as expected: {0}", e->ToString() );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp b/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp
deleted file mode 100644
index c8b21c2f7d7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Create the file if it does not exist.
- if ( !File::Exists( path ) )
- {
- // Create the file.
- FileStream^ fs = File::Create( path );
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- // Open the stream and read it back.
- FileStream^ fs = File::Open( path, FileMode::Open, FileAccess::Read, FileShare::None );
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- try
- {
- // Try to get another handle to the same file.
- FileStream^ fs2 = File::Open( path, FileMode::Open );
- try
- {
- // Do some task here.
- }
- finally
- {
- if ( fs2 )
- delete (IDisposable^)fs2;
- }
- }
- catch ( Exception^ e )
- {
- Console::Write( "Opening the file twice is disallowed." );
- Console::WriteLine( ", as expected: {0}", e );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp
deleted file mode 100644
index d257fe26072..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- if ( !File::Exists( path ) )
- {
- // Create the file.
- FileStream^ fs = File::Create( path );
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- // Open the stream and read it back.
- FileStream^ fs = File::OpenRead( path );
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp
deleted file mode 100644
index 8bbd948b4c6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- if ( !File::Exists( path ) )
- {
- // Create the file.
- FileStream^ fs = File::Create( path );
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- // Open the stream and read it back.
- StreamReader^ sr = File::OpenText( path );
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp
deleted file mode 100644
index e08318b7bf6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // Open the stream and write to it.
- {
- FileStream^ fs = File::OpenWrite( path );
- try
- {
- array^info = (gcnew UTF8Encoding( true ))->
- GetBytes( "This is to test the OpenWrite method." );
-
- // Add some information to the file.
- fs->Write( info, 0, info->Length );
- }
- finally
- {
- if ( fs )
- delete (IDisposable^)fs;
- }
- }
-
- // Open the stream and read it back.
- {
- FileStream^ fs = File::OpenRead( path );
- try
- {
- array^b = gcnew array(1024);
- UTF8Encoding^ temp = gcnew UTF8Encoding( true );
- while ( fs->Read( b, 0, b->Length ) > 0 )
- {
- Console::WriteLine( temp->GetString( b ) );
- }
- }
- finally
- {
- if ( fs )
- delete(IDisposable^)fs;
- }
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp
deleted file mode 100644
index 3fe8c6832a2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- String^ path = "c:\\Temp\\MyTest.txt";
- if ( !File::Exists( path ) )
- {
- File::Create( path );
-
- // Update the last access time.
- }
- File::SetLastAccessTime( path, DateTime(1985,5,4) );
-
- // Get the creation time of a well-known directory.
- DateTime dt = File::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this file was {0}.", dt );
-
- // Update the last access time.
- File::SetLastAccessTime( path, DateTime::Now );
- dt = File::GetLastAccessTime( path );
- Console::WriteLine( "The last access time for this file was {0}.", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp
deleted file mode 100644
index 8b796882ead..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- String^ path = "c:\\Temp\\MyTest.txt";
- if ( !File::Exists( path ) )
- {
- File::Create( path );
- }
- else
- {
-
- // Take an action that will affect the write time.
- File::SetLastWriteTime( path, DateTime(1985,4,3) );
- }
-
- // Get the creation time of a well-known directory.
- DateTime dt = File::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this file was {0}.", dt );
-
- // Update the last write time.
- File::SetLastWriteTime( path, DateTime::Now );
- dt = File::GetLastWriteTime( path );
- Console::WriteLine( "The last write time for this file was {0}.", dt );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp b/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp
deleted file mode 100644
index f16d9cbcb6e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
-
- // Create a reference to a file, which might or might not exist.
- // If it does not exist, it is not yet created.
- FileInfo^ fi = gcnew FileInfo( "temp.txt" );
-
- // Create a writer, ready to add entries to the file.
- StreamWriter^ sw = fi->AppendText();
- sw->WriteLine( "Add as many lines as you like..." );
- sw->WriteLine( "Add another line to the output..." );
- sw->Flush();
- sw->Close();
-
- // Get the information out of the file and display it.
- StreamReader^ sr = gcnew StreamReader( fi->OpenRead() );
- Console::WriteLine( "This is the information in the first file:" );
- while ( sr->Peek() != -1 )
- Console::WriteLine( sr->ReadLine() );
-
- // Copy this file to another file. The file will not be overwritten if it already exists.
- FileInfo^ newfi = fi->CopyTo( "newTemp.txt" );
-
- // Get the information out of the new file and display it.* sr = new StreamReader(newfi->OpenRead());
- Console::WriteLine( "{0}This is the information in the second file:", Environment::NewLine );
- while ( sr->Peek() != -1 )
- Console::WriteLine( sr->ReadLine() );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is the information in the first file:
-//Add as many lines as you like...
-//Add another line to the output...
-//
-//This is the information in the second file:
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp b/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp
deleted file mode 100644
index 49b2ff55954..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-//
-// The following example displays the names and sizes
-// of the files in the specified directory.
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Make a reference to a directory.
- DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" );
-
- // Get a reference to each file in that directory.
- array^fiArr = di->GetFiles();
-
- // Display the names and sizes of the files.
- Console::WriteLine( "The directory {0} contains the following files:", di->Name );
- System::Collections::IEnumerator^ myEnum = fiArr->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- FileInfo^ f = safe_cast(myEnum->Current);
- Console::WriteLine( "The size of {0} is {1} bytes.", f->Name, f->Length );
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//The directory c:\ contains the following files:
-//The size of MyComputer.log is 274 bytes.
-//The size of AUTOEXEC.BAT is 0 bytes.
-//The size of boot.ini is 211 bytes.
-//The size of CONFIG.SYS is 0 bytes.
-//The size of hiberfil.sys is 1072775168 bytes.
-//The size of IO.SYS is 0 bytes.
-//The size of MASK.txt is 2700 bytes.
-//The size of mfc80.dll is 1093632 bytes.
-//The size of mfc80u.dll is 1079808 bytes.
-//The size of MSDOS.SYS is 0 bytes.
-//The size of NTDETECT.COM is 47564 bytes.
-//The size of ntldr is 250032 bytes.
-//The size of pagefile.sys is 1610612736 bytes.
-//The size of UpdatePatch.log is 22778 bytes.
-//The size of UpdatePatch.txt is 30 bytes.
-//The size of wt3d.ini is 234 bytes.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp
deleted file mode 100644
index c6df18efd4e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-
-namespace ConsoleApplication2
-{
- public ref class Program
- {
- public:
- static void Main()
- {
- // Loop through all the immediate subdirectories of C.
- for each (String^ entry in Directory::GetDirectories("C:\\"))
- {
- DisplayFileSystemInfoAttributes(gcnew DirectoryInfo(entry));
- }
- // Loop through all the files in C.
- for each (String^ entry in Directory::GetFiles("C:\\"))
- {
- DisplayFileSystemInfoAttributes(gcnew FileInfo(entry));
- }
- }
- //
- static void DisplayFileSystemInfoAttributes(FileSystemInfo^ fsi)
- {
- // Assume that this entry is a file.
- String^ entryType = "File";
-
- // Determine if entry is really a directory
- if ((fsi->Attributes & FileAttributes::Directory) == FileAttributes::Directory)
- {
- entryType = "Directory";
- }
- // Show this entry's type, name, and creation date.
- Console::WriteLine("{0} entry {1} was created on {2:D}", entryType, fsi->FullName, fsi->CreationTime);
- }
- //
- };
-};
-
-int main()
-{
- ConsoleApplication2::Program::Main();
-}
-
- // Output will vary based on contents of drive C.
-
- // Directory entry C:\Documents and Settings was created on Tuesday, November 25, 2003
- // Directory entry C:\Inetpub was created on Monday, January 12, 2004
- // Directory entry C:\Program Files was created on Tuesday, November 25, 2003
- // Directory entry C:\RECYCLER was created on Tuesday, November 25, 2003
- // Directory entry C:\System Volume Information was created on Tuesday, November 2, 2003
- // Directory entry C:\WINDOWS was created on Tuesday, November 25, 2003
- // File entry C:\IO.SYS was created on Tuesday, November 25, 2003
- // File entry C:\MSDOS.SYS was created on Tuesday, November 25, 2003
- // File entry C:\pagefile.sys was created on Saturday, December 27, 2003
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp b/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp
deleted file mode 100644
index 33129302fbb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
-
- // This text is added only once to the file.
- if ( !File::Exists( path ) )
- {
- // Create a file to write to.
- StreamWriter^ sw = File::CreateText( path );
- try
- {
- sw->WriteLine( "Hello" );
- sw->WriteLine( "And" );
- sw->WriteLine( "Welcome" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
- }
-
- // This text is always added, making the file longer over time
- // if it is not deleted.
- StreamWriter^ sw = File::AppendText( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is Extra" );
- sw->WriteLine( "Text" );
- }
- finally
- {
- if ( sw )
- delete (IDisposable^)sw;
- }
-
- // Open the file to read from.
- StreamReader^ sr = File::OpenText( path );
- try
- {
- String^ s = "";
- while ( s = sr->ReadLine() )
- {
- Console::WriteLine( s );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp
deleted file mode 100644
index 5c9e28f3fbd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- //
- // Create a new dictionary of strings, with string keys.
- //
- Dictionary^ openWith =
- gcnew Dictionary();
-
- // Add some elements to the dictionary. There are no
- // duplicate keys, but some of the values are duplicates.
- openWith->Add("txt", "notepad.exe");
- openWith->Add("bmp", "paint.exe");
- openWith->Add("dib", "paint.exe");
- openWith->Add("rtf", "wordpad.exe");
-
- // The Add method throws an exception if the new key is
- // already in the dictionary.
- try
- {
- openWith->Add("txt", "winword.exe");
- }
- catch (ArgumentException^)
- {
- Console::WriteLine("An element with Key = \"txt\" already exists.");
- }
- //
-
- //
- // The Item property is another name for the indexer, so you
- // can omit its name when accessing elements.
- Console::WriteLine("For key = \"rtf\", value = {0}.",
- openWith["rtf"]);
-
- // The indexer can be used to change the value associated
- // with a key.
- openWith["rtf"] = "winword.exe";
- Console::WriteLine("For key = \"rtf\", value = {0}.",
- openWith["rtf"]);
-
- // If a key does not exist, setting the indexer for that key
- // adds a new key/value pair.
- openWith["doc"] = "winword.exe";
- //
-
- //
- // The indexer throws an exception if the requested key is
- // not in the dictionary.
- try
- {
- Console::WriteLine("For key = \"tif\", value = {0}.",
- openWith["tif"]);
- }
- catch (KeyNotFoundException^)
- {
- Console::WriteLine("Key = \"tif\" is not found.");
- }
- //
-
- //
- // When a program often has to try keys that turn out not to
- // be in the dictionary, TryGetValue can be a more efficient
- // way to retrieve values.
- String^ value = "";
- if (openWith->TryGetValue("tif", value))
- {
- Console::WriteLine("For key = \"tif\", value = {0}.", value);
- }
- else
- {
- Console::WriteLine("Key = \"tif\" is not found.");
- }
- //
-
- //
- // ContainsKey can be used to test keys before inserting
- // them.
- if (!openWith->ContainsKey("ht"))
- {
- openWith->Add("ht", "hypertrm.exe");
- Console::WriteLine("Value added for key = \"ht\": {0}",
- openWith["ht"]);
- }
- //
-
- //
- // When you use foreach to enumerate dictionary elements,
- // the elements are retrieved as KeyValuePair objects.
- Console::WriteLine();
- for each( KeyValuePair kvp in openWith )
- {
- Console::WriteLine("Key = {0}, Value = {1}",
- kvp.Key, kvp.Value);
- }
- //
-
- //
- // To get the values alone, use the Values property.
- Dictionary::ValueCollection^ valueColl =
- openWith->Values;
-
- // The elements of the ValueCollection are strongly typed
- // with the type that was specified for dictionary values.
- Console::WriteLine();
- for each( String^ s in valueColl )
- {
- Console::WriteLine("Value = {0}", s);
- }
- //
-
- //
- // To get the keys alone, use the Keys property.
- Dictionary::KeyCollection^ keyColl =
- openWith->Keys;
-
- // The elements of the KeyCollection are strongly typed
- // with the type that was specified for dictionary keys.
- Console::WriteLine();
- for each( String^ s in keyColl )
- {
- Console::WriteLine("Key = {0}", s);
- }
- //
-
- //
- // Use the Remove method to remove a key/value pair.
- Console::WriteLine("\nRemove(\"doc\")");
- openWith->Remove("doc");
-
- if (!openWith->ContainsKey("doc"))
- {
- Console::WriteLine("Key \"doc\" is not found.");
- }
- //
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
-/* This code example produces the following output:
-
-An element with Key = "txt" already exists.
-For key = "rtf", value = wordpad.exe.
-For key = "rtf", value = winword.exe.
-Key = "tif" is not found.
-Key = "tif" is not found.
-Value added for key = "ht": hypertrm.exe
-
-Key = txt, Value = notepad.exe
-Key = bmp, Value = paint.exe
-Key = dib, Value = paint.exe
-Key = rtf, Value = winword.exe
-Key = doc, Value = winword.exe
-Key = ht, Value = hypertrm.exe
-
-Value = notepad.exe
-Value = paint.exe
-Value = paint.exe
-Value = winword.exe
-Value = winword.exe
-Value = hypertrm.exe
-
-Key = txt
-Key = bmp
-Key = dib
-Key = rtf
-Key = doc
-Key = ht
-
-Remove("doc")
-Key "doc" is not found.
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp
deleted file mode 100644
index b16f6d80b9c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-using namespace System;
-using namespace System::Collections::Generic;
-//using namespace System::Threading;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Create a new dictionary of strings, with string keys.
- //
- Dictionary^ myDictionary =
- gcnew Dictionary();
-
- // Add some elements to the dictionary. There are no
- // duplicate keys, but some of the values are duplicates.
- myDictionary->Add("txt", "notepad.exe");
- myDictionary->Add("bmp", "paint.exe");
- myDictionary->Add("dib", "paint.exe");
- myDictionary->Add("rtf", "wordpad.exe");
-
- //
- for each(KeyValuePair kvp in myDictionary)
- {
- Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value);
- }
- //
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp
deleted file mode 100644
index 96a21ffd2f0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- //
- // Create a new dictionary of strings, with string keys,
- // and access it through the IDictionary generic interface.
- IDictionary^ openWith =
- gcnew Dictionary();
-
- // Add some elements to the dictionary. There are no
- // duplicate keys, but some of the values are duplicates.
- openWith->Add("txt", "notepad.exe");
- openWith->Add("bmp", "paint.exe");
- openWith->Add("dib", "paint.exe");
- openWith->Add("rtf", "wordpad.exe");
-
- // The Add method throws an exception if the new key is
- // already in the dictionary.
- try
- {
- openWith->Add("txt", "winword.exe");
- }
- catch (ArgumentException^)
- {
- Console::WriteLine("An element with Key = \"txt\" already exists.");
- }
- //
-
- //
- // The Item property is another name for the indexer, so you
- // can omit its name when accessing elements.
- Console::WriteLine("For key = \"rtf\", value = {0}.",
- openWith["rtf"]);
-
- // The indexer can be used to change the value associated
- // with a key.
- openWith["rtf"] = "winword.exe";
- Console::WriteLine("For key = \"rtf\", value = {0}.",
- openWith["rtf"]);
-
- // If a key does not exist, setting the indexer for that key
- // adds a new key/value pair.
- openWith["doc"] = "winword.exe";
- //
-
- //
- // The indexer throws an exception if the requested key is
- // not in the dictionary.
- try
- {
- Console::WriteLine("For key = \"tif\", value = {0}.",
- openWith["tif"]);
- }
- catch (KeyNotFoundException^)
- {
- Console::WriteLine("Key = \"tif\" is not found.");
- }
- //
-
- //
- // When a program often has to try keys that turn out not to
- // be in the dictionary, TryGetValue can be a more efficient
- // way to retrieve values.
- String^ value = "";
- if (openWith->TryGetValue("tif", value))
- {
- Console::WriteLine("For key = \"tif\", value = {0}.", value);
- }
- else
- {
- Console::WriteLine("Key = \"tif\" is not found.");
- }
- //
-
- //
- // ContainsKey can be used to test keys before inserting
- // them.
- if (!openWith->ContainsKey("ht"))
- {
- openWith->Add("ht", "hypertrm.exe");
- Console::WriteLine("Value added for key = \"ht\": {0}",
- openWith["ht"]);
- }
- //
-
- //
- // When you use foreach to enumerate dictionary elements,
- // the elements are retrieved as KeyValuePair objects.
- Console::WriteLine();
- for each( KeyValuePair kvp in openWith )
- {
- Console::WriteLine("Key = {0}, Value = {1}",
- kvp.Key, kvp.Value);
- }
- //
-
- //
- // To get the values alone, use the Values property.
- ICollection^ icoll = openWith->Values;
-
- // The elements of the ValueCollection are strongly typed
- // with the type that was specified for dictionary values.
- Console::WriteLine();
- for each( String^ s in icoll )
- {
- Console::WriteLine("Value = {0}", s);
- }
- //
-
- //
- // To get the keys alone, use the Keys property.
- icoll = openWith->Keys;
-
- // The elements of the ValueCollection are strongly typed
- // with the type that was specified for dictionary values.
- Console::WriteLine();
- for each( String^ s in icoll )
- {
- Console::WriteLine("Key = {0}", s);
- }
- //
-
- //
- // Use the Remove method to remove a key/value pair.
- Console::WriteLine("\nRemove(\"doc\")");
- openWith->Remove("doc");
-
- if (!openWith->ContainsKey("doc"))
- {
- Console::WriteLine("Key \"doc\" is not found.");
- }
- //
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
-/* This code example produces the following output:
-
-An element with Key = "txt" already exists.
-For key = "rtf", value = wordpad.exe.
-For key = "rtf", value = winword.exe.
-Key = "tif" is not found.
-Key = "tif" is not found.
-Value added for key = "ht": hypertrm.exe
-
-Key = txt, Value = notepad.exe
-Key = bmp, Value = paint.exe
-Key = dib, Value = paint.exe
-Key = rtf, Value = winword.exe
-Key = doc, Value = winword.exe
-Key = ht, Value = hypertrm.exe
-
-Value = notepad.exe
-Value = paint.exe
-Value = paint.exe
-Value = winword.exe
-Value = winword.exe
-Value = hypertrm.exe
-
-Key = txt
-Key = bmp
-Key = dib
-Key = rtf
-Key = doc
-Key = ht
-
-Remove("doc")
-Key "doc" is not found.
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp
deleted file mode 100644
index d3c038ba91c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Create a new dictionary of strings, with string keys.
- //
- Dictionary^ exDictionary =
- gcnew Dictionary();
-
- // Add some elements to the dictionary. There are no
- // duplicate keys, but some of the values are duplicates.
- exDictionary->Add(0, "notepad.exe");
- exDictionary->Add(1, "paint.exe");
- exDictionary->Add(2, "paint.exe");
- exDictionary->Add(3, "wordpad.exe");
- IDictionary^ myDictionary = exDictionary;
- //
- for each(KeyValuePair kvp in myDictionary)
- {
- Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value);
- }
- //
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp
deleted file mode 100644
index 1439a447483..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections::Generic;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- //
- // Create the link list.
- array^ words =
- { "the", "fox", "jumped", "over", "the", "dog" };
- LinkedList^ sentence = gcnew LinkedList(words);
- Display(sentence, "The linked list values:");
- Console::WriteLine("sentence.Contains(\"jumped\") = {0}",
- sentence->Contains("jumped"));
- //
-
- // Add the word 'today' to the beginning of the linked list.
- sentence->AddFirst("today");
- Display(sentence, "Test 1: Add 'today' to beginning of the list:");
-
- //
- // Move the first node to be the last node.
- LinkedListNode^ mark1 = sentence->First;
- sentence->RemoveFirst();
- sentence->AddLast(mark1);
- //
- Display(sentence, "Test 2: Move first node to be last node:");
-
- // Change the last node to 'yesterday'.
- sentence->RemoveLast();
- sentence->AddLast("yesterday");
- Display(sentence, "Test 3: Change the last node to 'yesterday':");
-
- //
- // Move the last node to be the first node.
- mark1 = sentence->Last;
- sentence->RemoveLast();
- sentence->AddFirst(mark1);
- //
- Display(sentence, "Test 4: Move last node to be first node:");
-
-
- //
- // Indicate the last occurence of 'the'.
- sentence->RemoveFirst();
- LinkedListNode^ current = sentence->FindLast("the");
- //
- IndicateNode(current, "Test 5: Indicate last occurence of 'the':");
-
- //
- // Add 'lazy' and 'old' after 'the' (the LinkedListNode named current).
- sentence->AddAfter(current, "old");
- sentence->AddAfter(current, "lazy");
- //
- IndicateNode(current, "Test 6: Add 'lazy' and 'old' after 'the':");
-
- //
- // Indicate 'fox' node.
- current = sentence->Find("fox");
- IndicateNode(current, "Test 7: Indicate the 'fox' node:");
-
- // Add 'quick' and 'brown' before 'fox':
- sentence->AddBefore(current, "quick");
- sentence->AddBefore(current, "brown");
- //
- IndicateNode(current, "Test 8: Add 'quick' and 'brown' before 'fox':");
-
- // Keep a reference to the current node, 'fox',
- // and to the previous node in the list. Indicate the 'dog' node.
- mark1 = current;
- LinkedListNode^ mark2 = current->Previous;
- current = sentence->Find("dog");
- IndicateNode(current, "Test 9: Indicate the 'dog' node:");
-
- // The AddBefore method throws an InvalidOperationException
- // if you try to add a node that already belongs to a list.
- Console::WriteLine("Test 10: Throw exception by adding node (fox) already in the list:");
- try
- {
- sentence->AddBefore(current, mark1);
- }
- catch (InvalidOperationException^ ex)
- {
- Console::WriteLine("Exception message: {0}", ex->Message);
- }
- Console::WriteLine();
-
- //
- // Remove the node referred to by mark1, and then add it
- // before the node referred to by current.
- // Indicate the node referred to by current.
- sentence->Remove(mark1);
- sentence->AddBefore(current, mark1);
- //
- IndicateNode(current, "Test 11: Move a referenced node (fox) before the current node (dog):");
-
- //
- // Remove the node referred to by current.
- sentence->Remove(current);
- //
- IndicateNode(current, "Test 12: Remove current node (dog) and attempt to indicate it:");
-
- // Add the node after the node referred to by mark2.
- sentence->AddAfter(mark2, current);
- IndicateNode(current, "Test 13: Add node removed in test 11 after a referenced node (brown):");
-
- // The Remove method finds and removes the
- // first node that that has the specified value.
- sentence->Remove("old");
- Display(sentence, "Test 14: Remove node that has the value 'old':");
-
- //
- // When the linked list is cast to ICollection(Of String),
- // the Add method adds a node to the end of the list.
- sentence->RemoveLast();
- ICollection^ icoll = sentence;
- icoll->Add("rhinoceros");
- //
- Display(sentence, "Test 15: Remove last node, cast to ICollection, and add 'rhinoceros':");
-
- Console::WriteLine("Test 16: Copy the list to an array:");
- //
- // Create an array with the same number of
- // elements as the inked list.
- array^ sArray = gcnew array(sentence->Count);
- sentence->CopyTo(sArray, 0);
-
- for each (String^ s in sArray)
- {
- Console::WriteLine(s);
- }
- //
-
-
- //
- // Release all the nodes.
- sentence->Clear();
-
- Console::WriteLine();
- Console::WriteLine("Test 17: Clear linked list. Contains 'jumped' = {0}",
- sentence->Contains("jumped"));
- //
-
- Console::ReadLine();
- }
-
-private:
- static void Display(LinkedList^ words, String^ test)
- {
- Console::WriteLine(test);
- for each (String^ word in words)
- {
- Console::Write(word + " ");
- }
- Console::WriteLine();
- Console::WriteLine();
- }
-
- static void IndicateNode(LinkedListNode^ node, String^ test)
- {
- Console::WriteLine(test);
- if (node->List == nullptr)
- {
- Console::WriteLine("Node '{0}' is not in the list.\n",
- node->Value);
- return;
- }
-
- StringBuilder^ result = gcnew StringBuilder("(" + node->Value + ")");
- LinkedListNode^ nodeP = node->Previous;
-
- while (nodeP != nullptr)
- {
- result->Insert(0, nodeP->Value + " ");
- nodeP = nodeP->Previous;
- }
-
- node = node->Next;
- while (node != nullptr)
- {
- result->Append(" " + node->Value);
- node = node->Next;
- }
-
- Console::WriteLine(result);
- Console::WriteLine();
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
-//This code example produces the following output:
-//
-//The linked list values:
-//the fox jumped over the dog
-
-//Test 1: Add 'today' to beginning of the list:
-//today the fox jumped over the dog
-
-//Test 2: Move first node to be last node:
-//the fox jumped over the dog today
-
-//Test 3: Change the last node to 'yesterday':
-//the fox jumped over the dog yesterday
-
-//Test 4: Move last node to be first node:
-//yesterday the fox jumped over the dog
-
-//Test 5: Indicate last occurence of 'the':
-//the fox jumped over (the) dog
-
-//Test 6: Add 'lazy' and 'old' after 'the':
-//the fox jumped over (the) lazy old dog
-
-//Test 7: Indicate the 'fox' node:
-//the (fox) jumped over the lazy old dog
-
-//Test 8: Add 'quick' and 'brown' before 'fox':
-//the quick brown (fox) jumped over the lazy old dog
-
-//Test 9: Indicate the 'dog' node:
-//the quick brown fox jumped over the lazy old (dog)
-
-//Test 10: Throw exception by adding node (fox) already in the list:
-//Exception message: The LinkedList node belongs a LinkedList.
-
-//Test 11: Move a referenced node (fox) before the current node (dog):
-//the quick brown jumped over the lazy old fox (dog)
-
-//Test 12: Remove current node (dog) and attempt to indicate it:
-//Node 'dog' is not in the list.
-
-//Test 13: Add node removed in test 11 after a referenced node (brown):
-//the quick brown (dog) jumped over the lazy old fox
-
-//Test 14: Remove node that has the value 'old':
-//the quick brown dog jumped over the lazy fox
-
-//Test 15: Remove last node, cast to ICollection, and add 'rhinoceros':
-//the quick brown dog jumped over the lazy rhinoceros
-
-//Test 16: Copy the list to an array:
-//the
-//quick
-//brown
-//dog
-//jumped
-//over
-//the
-//lazy
-//rhinoceros
-
-//Test 17: Clear linked list. Contains 'jumped' = False
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp
deleted file mode 100644
index 8e667bffa93..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Create a new sorted list of strings, with string
- // keys.
- SortedList^ mySortedList =
- gcnew SortedList();
-
- // Add some elements to the list. There are no
- // duplicate keys, but some of the values are duplicates.
- mySortedList->Add(0, "notepad.exe");
- mySortedList->Add(1, "paint.exe");
- mySortedList->Add(2, "paint.exe");
- mySortedList->Add(3, "wordpad.exe");
-
- //
- String^ v = mySortedList->Values[3];
- //
-
- Console::WriteLine("Value at index 3: {0}", v);
-
- //
- for each( KeyValuePair kvp in mySortedList )
- {
- Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value);
- }
- //
- }
-};
-
-int main()
-{
- Example::Main();
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp
deleted file mode 100644
index 47488deda3e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- //
- // Create a new sorted list of strings, with string
- // keys.
- SortedList^ openWith =
- gcnew SortedList();
-
- // Add some elements to the list. There are no
- // duplicate keys, but some of the values are duplicates.
- openWith->Add("txt", "notepad.exe");
- openWith->Add("bmp", "paint.exe");
- openWith->Add("dib", "paint.exe");
- openWith->Add("rtf", "wordpad.exe");
-
- // The Add method throws an exception if the new key is
- // already in the list.
- try
- {
- openWith->Add("txt", "winword.exe");
- }
- catch (ArgumentException^)
- {
- Console::WriteLine("An element with Key = \"txt\" already exists.");
- }
- //
-
- //
- // The Item property is another name for the indexer, so you
- // can omit its name when accessing elements.
- Console::WriteLine("For key = \"rtf\", value = {0}.",
- openWith["rtf"]);
-
- // The indexer can be used to change the value associated
- // with a key.
- openWith["rtf"] = "winword.exe";
- Console::WriteLine("For key = \"rtf\", value = {0}.",
- openWith["rtf"]);
-
- // If a key does not exist, setting the indexer for that key
- // adds a new key/value pair.
- openWith["doc"] = "winword.exe";
- //
-
- //
- // The indexer throws an exception if the requested key is
- // not in the list.
- try
- {
- Console::WriteLine("For key = \"tif\", value = {0}.",
- openWith["tif"]);
- }
- catch (KeyNotFoundException^)
- {
- Console::WriteLine("Key = \"tif\" is not found.");
- }
- //
-
- //
- // When a program often has to try keys that turn out not to
- // be in the list, TryGetValue can be a more efficient
- // way to retrieve values.
- String^ value = "";
- if (openWith->TryGetValue("tif", value))
- {
- Console::WriteLine("For key = \"tif\", value = {0}.", value);
- }
- else
- {
- Console::WriteLine("Key = \"tif\" is not found.");
- }
- //
-
- //
- // ContainsKey can be used to test keys before inserting
- // them.
- if (!openWith->ContainsKey("ht"))
- {
- openWith->Add("ht", "hypertrm.exe");
- Console::WriteLine("Value added for key = \"ht\": {0}",
- openWith["ht"]);
- }
- //
-
- //
- // When you use foreach to enumerate list elements,
- // the elements are retrieved as KeyValuePair objects.
- Console::WriteLine();
- for each( KeyValuePair kvp in openWith )
- {
- Console::WriteLine("Key = {0}, Value = {1}",
- kvp.Key, kvp.Value);
- }
- //
-
- //
- // To get the values alone, use the Values property.
- IList^ ilistValues = openWith->Values;
-
- // The elements of the list are strongly typed with the
- // type that was specified for the SortedList values.
- Console::WriteLine();
- for each( String^ s in ilistValues )
- {
- Console::WriteLine("Value = {0}", s);
- }
-
- // The Values property is an efficient way to retrieve
- // values by index.
- Console::WriteLine("\nIndexed retrieval using the Values " +
- "property: Values[2] = {0}", openWith->Values[2]);
- //
-
- //
- // To get the keys alone, use the Keys property.
- IList^ ilistKeys = openWith->Keys;
-
- // The elements of the list are strongly typed with the
- // type that was specified for the SortedList keys.
- Console::WriteLine();
- for each( String^ s in ilistKeys )
- {
- Console::WriteLine("Key = {0}", s);
- }
-
- // The Keys property is an efficient way to retrieve
- // keys by index.
- Console::WriteLine("\nIndexed retrieval using the Keys " +
- "property: Keys[2] = {0}", openWith->Keys[2]);
- //
-
- //
- // Use the Remove method to remove a key/value pair.
- Console::WriteLine("\nRemove(\"doc\")");
- openWith->Remove("doc");
-
- if (!openWith->ContainsKey("doc"))
- {
- Console::WriteLine("Key \"doc\" is not found.");
- }
- //
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
-/* This code example produces the following output:
-
-An element with Key = "txt" already exists.
-For key = "rtf", value = wordpad.exe.
-For key = "rtf", value = winword.exe.
-Key = "tif" is not found.
-Key = "tif" is not found.
-Value added for key = "ht": hypertrm.exe
-
-Key = bmp, Value = paint.exe
-Key = dib, Value = paint.exe
-Key = doc, Value = winword.exe
-Key = ht, Value = hypertrm.exe
-Key = rtf, Value = winword.exe
-Key = txt, Value = notepad.exe
-
-Value = paint.exe
-Value = paint.exe
-Value = winword.exe
-Value = hypertrm.exe
-Value = winword.exe
-Value = notepad.exe
-
-Indexed retrieval using the Values property: Values[2] = winword.exe
-
-Key = bmp
-Key = dib
-Key = doc
-Key = ht
-Key = rtf
-Key = txt
-
-Indexed retrieval using the Keys property: Keys[2] = doc
-
-Remove("doc")
-Key "doc" is not found.
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp
deleted file mode 100644
index 506b780b31a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ fileName = "test.xml";
- if (!File::Exists(fileName))
- {
- Console::WriteLine("The file " + fileName
- + " does not exist.");
- return 0;
- }
- try
- {
- Console::WriteLine("Encrypt " + fileName);
-
- // Encrypt the file.
- File::Encrypt(fileName);
-
- Console::WriteLine("Decrypt " + fileName);
-
- // Decrypt the file.
- File::Decrypt(fileName);
-
- Console::WriteLine("Done");
- }
- catch (IOException^ ex)
- {
- Console::WriteLine("There was an IO problem.");
- Console::WriteLine(ex->Message);
- }
- catch (PlatformNotSupportedException^)
- {
- Console::WriteLine("Encryption is not supported on " +
- "this system.");
- }
- catch (NotSupportedException^)
- {
- Console::WriteLine("Encryption is not supported on " +
- "this system.");
- }
- catch (UnauthorizedAccessException^)
- {
- Console::WriteLine("The operation could not be "
- + "carried out.");
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp
deleted file mode 100644
index 4876d14c2dd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-
-// Move a file into another file, delete the original,
-// and create a backup of the replaced file.
-
-void ReplaceFile(String^ fileToMoveAndDelete,
- String^ fileToReplace, String^ backupOfFileToReplace)
-{
- File::Replace(fileToMoveAndDelete, fileToReplace,
- backupOfFileToReplace, false);
-}
-
-
-int main()
-{
- try
- {
- String^ originalFile = "test.xml";
- String^ fileToReplace = "test2.xml";
- String^ backUpOfFileToReplace = "test2.xml.bac";
-
- Console::WriteLine("Move the contents of " + originalFile + " into "
- + fileToReplace + ", delete " + originalFile
- + ", and create a backup of " + fileToReplace + ".");
-
- // Replace the file.
- ReplaceFile(originalFile, fileToReplace, backUpOfFileToReplace);
-
- Console::WriteLine("Done");
- }
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp
deleted file mode 100644
index 3cbff62e773..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Security::AccessControl;
-
-
- static void Addencryption(String^ fileName)
-{
- // Create a new FileInfo object.
- FileInfo^ fInfo = gcnew FileInfo(fileName);
- if (!fInfo->Exists)
- {
- fInfo->Create();
- }
- // Add encryption.
- fInfo->Encrypt();
-
-}
-
-
- static void Removeencryption(String^ fileName)
-{
-// Create a new FileInfo object.
- FileInfo^ fInfo = gcnew FileInfo(fileName);
- if (!fInfo->Exists)
- {
- fInfo->Create();
- }
- // Remove encryption.
- fInfo->Decrypt();
-}
-
-int main()
-{
- try
- {
- String^ fileName = "c:\\MyTest.txt";
- Console::WriteLine("Encrypt " + fileName);
-
- // Encrypt the file.
-
- Addencryption(fileName);
- Console::WriteLine("Decrypt " + fileName);
-
- // Decrypt the file.
- Removeencryption(fileName);
- Console::WriteLine("Done");
- }
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//Encrypt c:\MyTest.txt
-//Decrypt c:\MyTest.txt
-//Done
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp
deleted file mode 100644
index 27fb4bdc1ae..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-using namespace System;
-using namespace System::IO;
-
-//
-array^ Openfile(String^ fileName)
-{
- // Check the fileName argument.
- if (fileName == nullptr || fileName->Length == 0)
- {
- throw gcnew ArgumentNullException("fileName");
- }
-
- // Check to see if the file exists.
- FileInfo^ fInfo = gcnew FileInfo(fileName);
-
- // You can throw a personalized exception if
- // the file does not exist.
- if (!fInfo->Exists)
- {
- throw gcnew FileNotFoundException("The file was not found.",
- fileName);
- }
-
- try
- {
- // Open the file.
- FileStream^ fStream = gcnew FileStream(fileName, FileMode::Open);
-
- // Create a buffer.
- array^ buffer = gcnew array(fStream->Length);
-
- // Read the file contents to the buffer.
- fStream->Read(buffer, 0, (int)fStream->Length);
-
- // return the buffer.
- return buffer;
- }
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- return nullptr;
- }
-}
-//
-
-int main()
-{
-
-};
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp
deleted file mode 100644
index eb8b7aeaec2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-#using
-using namespace System;
-using namespace System::IO;
-using namespace System::Security::AccessControl;
-using namespace System::Security::Principal;
-
-// Adds an ACL entry on the specified file for the specified account.
-static void AddFileSecurity(String^ fileName, String^ account,
- FileSystemRights^ rights,
- AccessControlType^ controlType)
-{
- // Create a new FileInfo object.
- FileInfo^ fInfo = gcnew FileInfo(fileName);
- if (!fInfo->Exists)
- {
- fInfo->Create();
- }
-
- // Get a FileSecurity object that represents the
- // current security settings.
- FileSecurity^ fSecurity = fInfo->GetAccessControl();
-
- // Add the FileSystemAccessRule to the security settings.
- fSecurity->AddAccessRule(gcnew FileSystemAccessRule(account,
- *rights, *controlType));
-
- // Set the new access settings.
- fInfo->SetAccessControl(fSecurity);
-}
-
-// Removes an ACL entry on the specified file for the specified account.
-static void RemoveFileSecurity(String^ fileName, String^ account,
- FileSystemRights^ rights,
- AccessControlType^ controlType)
-{
- // Create a new FileInfo object.
- FileInfo^ fInfo = gcnew FileInfo(fileName);
- if (!fInfo->Exists)
- {
- fInfo->Create();
- }
-
- // Get a FileSecurity object that represents the
- // current security settings.
- FileSecurity^ fSecurity = fInfo->GetAccessControl();
-
- // Remove the FileSystemAccessRule from the security settings.
- fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule(account,
- *rights, *controlType));
-
- // Set the new access settings.
- fInfo->SetAccessControl(fSecurity);
-}
-
-int main()
-{
- try
- {
- String^ fileName = "c:\\test.xml";
-
- Console::WriteLine("Adding access control entry for " +
- fileName);
-
- // Add the access control entry to the file.
- // Before compiling this snippet, change MyDomain to your
- // domain name and MyAccessAccount to the name
- // you use to access your domain.
- AddFileSecurity(fileName, "MyDomain\\MyAccessAccount",
- FileSystemRights::ReadData, AccessControlType::Allow);
-
- Console::WriteLine("Removing access control entry from " +
- fileName);
-
- // Remove the access control entry from the file.
- // Before compiling this snippet, change MyDomain to your
- // domain name and MyAccessAccount to the name
- // you use to access your domain.
- RemoveFileSecurity(fileName, "MyDomain\\MyAccessAccount",
- FileSystemRights::ReadData, AccessControlType::Allow);
-
- Console::WriteLine("Done.");
- }
- catch (Exception^ e)
- {
- Console::WriteLine(e);
- }
-
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//Adding access control entry for c:\test.xml
-//Removing access control entry from c:\test.xml
-//Done.
-//
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp
deleted file mode 100644
index f7dbe0f1cb2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-
-using namespace System;
-using namespace System::IO;
-
-
-// Move a file into another file, delete the original,
-// and create a backup of the replaced file.
-void ReplaceFile(String^ fileToMoveAndDelete,
- String^ fileToReplace, String^ backupOfFileToReplace)
-{
- // Create a new FileInfo object.
- FileInfo^ fInfo = gcnew FileInfo(fileToMoveAndDelete);
-
- // replace the file.
- fInfo->Replace(fileToReplace, backupOfFileToReplace, false);
-}
-
-
-int main()
-{
- try
- {
- // originalFile and fileToReplace must contain
- // the path to files that already exist in the
- // file system. backUpOfFileToReplace is created
- // during the execution of the Replace method.
-
- String^ originalFile = "test.xml";
- String^ fileToReplace = "test2.xml";
- String^ backUpOfFileToReplace = "test2.xml.bak";
-
- if (File::Exists(originalFile) && (File::Exists(fileToReplace)))
- {
- Console::WriteLine("Move the contents of {0} into {1}, " +
- "delete {0}, and create a backup of {1}",
- originalFile, fileToReplace);
-
- // Replace the file.
- ReplaceFile(originalFile, fileToReplace,
- backUpOfFileToReplace);
- Console::WriteLine("Done");
- }
- else
- {
- Console::WriteLine("Either the file {0} or {1} doesn't " +
- "exist.", originalFile, fileToReplace);
- }
- }
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-}
-
-
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//Move the contents of c:\test1.xml into c:\test2.xml, delete c:\test1.xml,
-//and create a backup of c:\test2.xml
-//Done
-
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp
deleted file mode 100644
index e5fb1ade0c8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- // Create a temporary file.
- String^ filePath = Path::GetTempFileName();
- Console::WriteLine("Created a temp file at '{0}.", filePath);
-
- // Create a new FileInfo object.
- FileInfo^ fInfo = gcnew FileInfo(filePath);
-
- // Get the read-only value for a file.
- bool isReadOnly = fInfo->IsReadOnly;
-
- // Display whether the file is read-only.
- Console::WriteLine("The file read-only value for '{0}' is {1}.", fInfo->Name, isReadOnly);
-
- // Set the file to read-only.
- Console::WriteLine("Setting the read-only value for '{0}' to true.", fInfo->Name);
- fInfo->IsReadOnly = true;
-
- // Get the read-only value for a file.
- isReadOnly = fInfo->IsReadOnly;
-
- // Display that the file is now read-only.
- Console::WriteLine("The file read-only value for '{0}' is {1}.", fInfo->Name, isReadOnly);
-
- // Make the file mutable again so it can be deleted.
- fInfo->IsReadOnly = false;
-
- // Delete the temporary file.
- fInfo->Delete();
-
- return 0;
-};
-
-// This code produces output similar to the following,
-// though results may vary based on the computer, file structure, etc.:
-//
-// Created a temp file at 'C:\Users\UserName\AppData\Local\Temp\tmpB438.tmp'.
-// The file read-only value for 'tmpB438.tmp' is False.
-// Setting the read-only value for 'tmpB438.tmp' to true.
-// The file read-only value for 'tmpB438.tmp' is True.
-//
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp
deleted file mode 100644
index d31fd98984e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Security::AccessControl;
-
-int main()
-{
- try
- {
- // Create a file and write data to it.
-
- // Create an array of bytes.
- array^ messageByte =
- Encoding::ASCII->GetBytes("Here is some data.");
-
- // Create a file using the FileStream class.
- FileStream^ fWrite = gcnew FileStream("test.txt", FileMode::Create,
- FileAccess::ReadWrite, FileShare::None, 8, FileOptions::None);
-
- // Write the number of bytes to the file.
- fWrite->WriteByte((Byte)messageByte->Length);
-
- // Write the bytes to the file.
- fWrite->Write(messageByte, 0, messageByte->Length);
-
- // Close the stream.
- fWrite->Close();
-
-
- // Open a file and read the number of bytes.
-
- FileStream^ fRead = gcnew FileStream("test.txt",
- FileMode::Open);
-
- // The first byte is the string length.
- int length = (int)fRead->ReadByte();
-
- // Create a new byte array for the data.
- array^ readBytes = gcnew array(length);
-
- // Read the data from the file.
- fRead->Read(readBytes, 0, readBytes->Length);
-
- // Close the stream.
- fRead->Close();
-
- // Display the data.
- Console::WriteLine(Encoding::ASCII->GetString(readBytes));
-
- Console::WriteLine("Done writing and reading data.");
- }
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp
deleted file mode 100644
index 3c25ca60661..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Security::AccessControl;
-using namespace System::Security::Principal;
-
-int main()
-{
- try
- {
- // Create a file and write data to it.
-
- // Create an array of bytes.
- array^ messageByte =
- Encoding::ASCII->GetBytes("Here is some data.");
-
- // Specify an access control list (ACL)
- FileSecurity^ fs = gcnew FileSecurity();
-
- fs->AddAccessRule(
- gcnew FileSystemAccessRule("MYDOMAIN\\MyAccount",
- FileSystemRights::Modify, AccessControlType::Allow));
-
- // Create a file using the FileStream class.
- FileStream^ fWrite = gcnew FileStream("test.txt",
- FileMode::Create, FileSystemRights::Modify,
- FileShare::None, 8, FileOptions::None, fs);
-
- // Write the number of bytes to the file.
- fWrite->WriteByte((Byte)messageByte->Length);
-
- // Write the bytes to the file.
- fWrite->Write(messageByte, 0, messageByte->Length);
-
- // Close the stream.
- fWrite->Close();
-
- // Open a file and read the number of bytes.
-
- FileStream^ fRead =
- gcnew FileStream("test.txt", FileMode::Open);
-
- // The first byte is the string length.
- int length = (int)fRead->ReadByte();
-
- // Create a new byte array for the data.
- array^ readBytes = gcnew array(length);
-
- // Read the data from the file.
- fRead->Read(readBytes, 0, readBytes->Length);
-
- // Close the stream.
- fRead->Close();
-
- // Display the data.
- Console::WriteLine(Encoding::ASCII->GetString(readBytes));
-
- Console::WriteLine("Done writing and reading data.");
- }
-
- catch (IdentityNotMappedException^)
- {
- Console::WriteLine("You need to use your own credentials " +
- " 'MYDOMAIN\\MyAccount'.");
- }
-
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp
deleted file mode 100644
index 98e59f68290..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-namespace PathExample
-{
- public ref class GetCharExample
- {
- public:
- static void Main()
- {
- // Get a list of invalid path characters.
- array^ invalidPathChars = Path::GetInvalidPathChars();
-
- Console::WriteLine("The following characters are invalid in a path:");
- ShowChars(invalidPathChars);
- Console::WriteLine();
-
- // Get a list of invalid file characters.
- array^ invalidFileChars = Path::GetInvalidFileNameChars();
-
- Console::WriteLine("The following characters are invalid in a filename:");
- ShowChars(invalidFileChars);
- }
-
- static void ShowChars(array^ charArray)
- {
- Console::WriteLine("Char\tHex Value");
- // Display each invalid character to the console.
- for each (Char someChar in charArray)
- {
- if (Char::IsWhiteSpace(someChar))
- {
- Console::WriteLine(",\t{0:X4}", (Int16)someChar);
- }
- else
- {
- Console::WriteLine("{0:c},\t{1:X4}", someChar, (Int16)someChar);
- }
- }
- }
- };
-};
-
-int main()
-{
- PathExample::GetCharExample::Main();
-}
-// Note: Some characters may not be displayable on the console.
-// The output will look something like:
-//
-// The following characters are invalid in a path:
-// Char Hex Value
-// ", 0022
-// <, 003C
-// >, 003E
-// |, 007C
-// ...
-//
-// The following characters are invalid in a filename:
-// Char Hex Value
-// ", 0022
-// <, 003C
-// >, 003E
-// |, 007C
-// ...
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp
deleted file mode 100644
index 47d43906d84..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO::Ports;
-using namespace System::ComponentModel;
-
-void main()
-{
- array^ serialPorts = nullptr;
- try
- {
- // Get a list of serial port names.
- serialPorts = SerialPort::GetPortNames();
- }
- catch (Win32Exception^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-
- Console::WriteLine("The following serial ports were found:");
-
- // Display each port name to the console.
- for each(String^ port in serialPorts)
- {
- Console::WriteLine(port);
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp
deleted file mode 100644
index 4c29bcd1705..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::ComponentModel;
-using namespace System::IO;
-using namespace System::Windows::Forms;
-public ref class Form1: public System::Windows::Forms::Form
-{
-private:
- System::Windows::Forms::TextBox^ textBox1;
-
- //
- String^ CreateMultilevelIndentString()
- {
-
- //
- // Creates a TextWriter to use as the base output writer.
- System::IO::StringWriter^ baseTextWriter = gcnew System::IO::StringWriter;
-
- // Create an IndentedTextWriter and set the tab string to use
- // as the indentation string for each indentation level.
- System::CodeDom::Compiler::IndentedTextWriter^ indentWriter = gcnew IndentedTextWriter( baseTextWriter," " );
-
- //
- //
- // Sets the indentation level.
- indentWriter->Indent = 0;
-
- //
- // Output test strings at stepped indentations through a recursive loop method.
- WriteLevel( indentWriter, 0, 5 );
-
- // Return the resulting string from the base StringWriter.
- return baseTextWriter->ToString();
- }
-
-
- //
- void WriteLevel( IndentedTextWriter^ indentWriter, int level, int totalLevels )
- {
-
- // Output a test string with a new-line character at the end.
- indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level );
-
- // If not yet at the highest recursion level, call this output method for the next level of indentation.
- if ( level < totalLevels )
- {
-
- // Increase the indentation count for the next level of indented output.
- indentWriter->Indent++;
-
- // Call the WriteLevel method to write test output for the next level of indentation.
- WriteLevel( indentWriter, level + 1, totalLevels );
-
- // Restores the indentation count for this level after the recursive branch method has returned.
- indentWriter->Indent--;
- }
- else
- //
- // Outputs a string using the WriteLineNoTabs method.
- indentWriter->WriteLineNoTabs( "This is a test phrase written with the IndentTextWriter.WriteLineNoTabs method." );
- //
- // Outputs a test string with a new-line character at the end.
- indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level );
- }
-
-
- //
- //
- void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- textBox1->Text = CreateMultilevelIndentString();
- }
-
-
-public:
- Form1()
- {
- System::Windows::Forms::Button^ button1 = gcnew System::Windows::Forms::Button;
- this->textBox1 = gcnew System::Windows::Forms::TextBox;
- this->SuspendLayout();
- 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, 40 );
- this->textBox1->Multiline = true;
- this->textBox1->Name = "textBox1";
- this->textBox1->Size = System::Drawing::Size( 391, 242 );
- this->textBox1->TabIndex = 0;
- this->textBox1->Text = "";
- button1->Location = System::Drawing::Point( 11, 8 );
- button1->Name = "button1";
- button1->Size = System::Drawing::Size( 229, 23 );
- button1->TabIndex = 1;
- button1->Text = "Generate string using IndentedTextWriter";
- button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 407, 287 );
- this->Controls->Add( button1 );
- this->Controls->Add( this->textBox1 );
- this->Name = "Form1";
- this->Text = "IndentedTextWriter example";
- this->ResumeLayout( false );
- }
-
-};
-
-
-[STAThread]
-int main()
-{
- Application::Run( gcnew Form1 );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp
deleted file mode 100644
index 8997b4e85f5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-using namespace System::Collections::ObjectModel;
-
-// This class represents a simple line item in an order. All the
-// values are immutable except quantity.
-//
-public ref class OrderItem
-{
-private:
- int _quantity;
-
-public:
- initonly int PartNumber;
- initonly String^ Description;
- initonly double UnitPrice;
-
- OrderItem(int partNumber, String^ description,
- int quantity, double unitPrice)
- {
- this->PartNumber = partNumber;
- this->Description = description;
- this->Quantity = quantity;
- this->UnitPrice = unitPrice;
- }
-
- property int Quantity
- {
- int get() { return _quantity; }
- void set(int value)
- {
- if (value < 0)
- throw gcnew ArgumentException("Quantity cannot be negative.");
-
- _quantity = value;
- }
- }
-
- virtual String^ ToString() override
- {
- return String::Format(
- "{0,9} {1,6} {2,-12} at {3,8:#,###.00} = {4,10:###,###.00}",
- PartNumber, _quantity, Description, UnitPrice,
- UnitPrice * _quantity);
- }
-};
-
-// This class represents a very simple keyed list of OrderItems,
-// inheriting most of its behavior from the KeyedCollection and
-// Collection classes. The immediate base class is the constructed
-// type KeyedCollection. When you inherit
-// from KeyedCollection, the second generic type argument is the
-// type that you want to store in the collection -- in this case
-// OrderItem. The first type argument is the type that you want
-// to use as a key. Its values must be calculated from OrderItem;
-// in this case it is the int field PartNumber, so SimpleOrder
-// inherits KeyedCollection.
-//
-public ref class SimpleOrder : KeyedCollection
-{
- // The parameterless constructor of the base class creates a
- // KeyedCollection with an internal dictionary. For this code
- // example, no other constructors are exposed.
- //
-public:
- SimpleOrder() {}
-
- // This is the only method that absolutely must be overridden,
- // because without it the KeyedCollection cannot extract the
- // keys from the items. The input parameter type is the
- // second generic type argument, in this case OrderItem, and
- // the return value type is the first generic type argument,
- // in this case int.
- //
-protected:
- virtual int GetKeyForItem(OrderItem^ item) override
- {
- // In this example, the key is the part number.
- return item->PartNumber;
- }
-};
-
-public ref class Demo
-{
-public:
- static void Main()
- {
- SimpleOrder^ weekly = gcnew SimpleOrder();
-
- // The Add method, inherited from Collection, takes OrderItem.
- //
- weekly->Add(gcnew OrderItem(110072674, "Widget", 400, 45.17));
- weekly->Add(gcnew OrderItem(110072675, "Sprocket", 27, 5.3));
- weekly->Add(gcnew OrderItem(101030411, "Motor", 10, 237.5));
- weekly->Add(gcnew OrderItem(110072684, "Gear", 175, 5.17));
-
- Display(weekly);
-
- // The Contains method of KeyedCollection takes the key,
- // type, in this case int.
- //
- Console::WriteLine("\nContains(101030411): {0}",
- weekly->Contains(101030411));
-
- // The default Item property of KeyedCollection takes a key.
- //
- Console::WriteLine("\nweekly(101030411)->Description: {0}",
- weekly[101030411]->Description);
-
- // The Remove method of KeyedCollection takes a key.
- //
- Console::WriteLine("\nRemove(101030411)");
- weekly->Remove(101030411);
- Display(weekly);
-
- // The Insert method, inherited from Collection, takes an
- // index and an OrderItem.
- //
- Console::WriteLine("\nInsert(2, New OrderItem(...))");
- weekly->Insert(2, gcnew OrderItem(111033401, "Nut", 10, .5));
- Display(weekly);
-
- // The default Item property is overloaded. One overload comes
- // from KeyedCollection; that overload
- // is read-only, and takes Integer because it retrieves by key.
- // The other overload comes from Collection, the
- // base class of KeyedCollection; it
- // retrieves by index, so it also takes an Integer. The compiler
- // uses the most-derived overload, from KeyedCollection, so the
- // only way to access SimpleOrder by index is to cast it to
- // Collection. Otherwise the index is interpreted
- // as a key, and KeyNotFoundException is thrown.
- //
- Collection^ coweekly = weekly;
- Console::WriteLine("\ncoweekly[2].Description: {0}",
- coweekly[2]->Description);
-
- Console::WriteLine("\ncoweekly[2] = gcnew OrderItem(...)");
- coweekly[2] = gcnew OrderItem(127700026, "Crank", 27, 5.98);
-
- OrderItem^ temp = coweekly[2];
-
- // The IndexOf method inherited from Collection
- // takes an OrderItem instead of a key
- //
- Console::WriteLine("\nIndexOf(temp): {0}", weekly->IndexOf(temp));
-
- // The inherited Remove method also takes an OrderItem.
- //
- Console::WriteLine("\nRemove(temp)");
- weekly->Remove(temp);
- Display(weekly);
-
- Console::WriteLine("\nRemoveAt(0)");
- weekly->RemoveAt(0);
- Display(weekly);
-
- }
-
-private:
- static void Display(SimpleOrder^ order)
- {
- Console::WriteLine();
- for each( OrderItem^ item in order )
- {
- Console::WriteLine(item);
- }
- }
-};
-
-void main()
-{
- Demo::Main();
-}
-
-/* This code example produces the following output:
-
-110072674 400 Widget at 45.17 = 18,068.00
-110072675 27 Sprocket at 5.30 = 143.10
-101030411 10 Motor at 237.50 = 2,375.00
-110072684 175 Gear at 5.17 = 904.75
-
-Contains(101030411): True
-
-weekly(101030411)->Description: Motor
-
-Remove(101030411)
-
-110072674 400 Widget at 45.17 = 18,068.00
-110072675 27 Sprocket at 5.30 = 143.10
-110072684 175 Gear at 5.17 = 904.75
-
-Insert(2, New OrderItem(...))
-
-110072674 400 Widget at 45.17 = 18,068.00
-110072675 27 Sprocket at 5.30 = 143.10
-111033401 10 Nut at .50 = 5.00
-110072684 175 Gear at 5.17 = 904.75
-
-coweekly(2)->Description: Nut
-
-coweekly[2] = gcnew OrderItem(...)
-
-IndexOf(temp): 2
-
-Remove(temp)
-
-110072674 400 Widget at 45.17 = 18,068.00
-110072675 27 Sprocket at 5.30 = 143.10
-110072684 175 Gear at 5.17 = 904.75
-
-RemoveAt(0)
-
-110072675 27 Sprocket at 5.30 = 143.10
-110072684 175 Gear at 5.17 = 904.75
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp
deleted file mode 100644
index 37225c227f3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-using namespace System::Collections::ObjectModel;
-
-public enum class ChangeTypes
-{
- Added,
- Removed,
- Replaced,
- Cleared
-};
-
-ref class SimpleOrderChangedEventArgs;
-
-// This class represents a simple line item in an order. All the
-// values are immutable except quantity.
-//
-public ref class OrderItem
-{
-private:
- int _quantity;
-
-public:
- initonly int PartNumber;
- initonly String^ Description;
- initonly double UnitPrice;
-
- OrderItem(int partNumber, String^ description, int quantity,
- double unitPrice)
- {
- this->PartNumber = partNumber;
- this->Description = description;
- this->Quantity = quantity;
- this->UnitPrice = unitPrice;
- };
-
- property int Quantity
- {
- int get() { return _quantity; };
- void set(int value)
- {
- if (value < 0)
- throw gcnew ArgumentException("Quantity cannot be negative.");
-
- _quantity = value;
- };
- };
-
- virtual String^ ToString() override
- {
- return String::Format(
- "{0,9} {1,6} {2,-12} at {3,8:#,###.00} = {4,10:###,###.00}",
- PartNumber, _quantity, Description, UnitPrice,
- UnitPrice * _quantity);
- };
-};
-
-// Event argument for the Changed event.
-//
-public ref class SimpleOrderChangedEventArgs : EventArgs
-{
-public:
- OrderItem^ ChangedItem;
- initonly ChangeTypes ChangeType;
- OrderItem^ ReplacedWith;
-
- SimpleOrderChangedEventArgs(ChangeTypes change,
- OrderItem^ item, OrderItem^ replacement)
- {
- this->ChangeType = change;
- this->ChangedItem = item;
- this->ReplacedWith = replacement;
- }
-};
-
-// This class derives from KeyedCollection and shows how to override
-// the protected ClearItems, InsertItem, RemoveItem, and SetItem
-// methods in order to change the behavior of the default Item
-// property and the Add, Clear, Insert, and Remove methods. The
-// class implements a Changed event, which is raised by all the
-// protected methods.
-//
-// SimpleOrder is a collection of OrderItem objects, and its key
-// is the PartNumber field of OrderItem-> PartNumber is an Integer,
-// so SimpleOrder inherits KeyedCollection.
-// (Note that the key of OrderItem cannot be changed; if it could
-// be changed, SimpleOrder would have to override ChangeItemKey.)
-//
-public ref class SimpleOrder : KeyedCollection
-{
-public:
- event EventHandler^ Changed;
-
- // This parameterless constructor calls the base class constructor
- // that specifies a dictionary threshold of 0, so that the internal
- // dictionary is created as soon as an item is added to the
- // collection.
- //
- SimpleOrder() : KeyedCollection(nullptr, 0) {};
-
- // This is the only method that absolutely must be overridden,
- // because without it the KeyedCollection cannot extract the
- // keys from the items.
- //
-protected:
- virtual int GetKeyForItem(OrderItem^ item) override
- {
- // In this example, the key is the part number.
- return item->PartNumber;
- }
-
- virtual void InsertItem(int index, OrderItem^ newItem) override
- {
- __super::InsertItem(index, newItem);
-
- Changed(this, gcnew SimpleOrderChangedEventArgs(
- ChangeTypes::Added, newItem, nullptr));
- }
-
- //
- virtual void SetItem(int index, OrderItem^ newItem) override
- {
- OrderItem^ replaced = this->Items[index];
- __super::SetItem(index, newItem);
-
- Changed(this, gcnew SimpleOrderChangedEventArgs(
- ChangeTypes::Replaced, replaced, newItem));
- }
- //
-
- virtual void RemoveItem(int index) override
- {
- OrderItem^ removedItem = Items[index];
- __super::RemoveItem(index);
-
- Changed(this, gcnew SimpleOrderChangedEventArgs(
- ChangeTypes::Removed, removedItem, nullptr));
- }
-
- virtual void ClearItems() override
- {
- __super::ClearItems();
-
- Changed(this, gcnew SimpleOrderChangedEventArgs(
- ChangeTypes::Cleared, nullptr, nullptr));
- }
-
- //
- // This method uses the internal reference to the dictionary
- // to test fo
-public:
- void AddOrMerge(OrderItem^ newItem)
- {
-
- int key = this->GetKeyForItem(newItem);
- OrderItem^ existingItem = nullptr;
-
- // The dictionary is not created until the first item is
- // added, so it is necessary to test for null. Using
- // AndAlso ensures that TryGetValue is not called if the
- // dictionary does not exist.
- //
- if (this->Dictionary != nullptr &&
- this->Dictionary->TryGetValue(key, existingItem))
- {
- existingItem->Quantity += newItem->Quantity;
- }
- else
- {
- this->Add(newItem);
- }
- }
- //
-};
-
-public ref class Demo
-{
-public:
- static void Main()
- {
- SimpleOrder^ weekly = gcnew SimpleOrder();
- weekly->Changed += gcnew
- EventHandler(ChangedHandler);
-
- // The Add method, inherited from Collection, takes OrderItem->
- //
- weekly->Add(gcnew OrderItem(110072674, "Widget", 400, 45.17));
- weekly->Add(gcnew OrderItem(110072675, "Sprocket", 27, 5.3));
- weekly->Add(gcnew OrderItem(101030411, "Motor", 10, 237.5));
- weekly->Add(gcnew OrderItem(110072684, "Gear", 175, 5.17));
-
- Display(weekly);
-
- // The Contains method of KeyedCollection takes TKey.
- //
- Console::WriteLine("\nContains(101030411): {0}",
- weekly->Contains(101030411));
-
- // The default Item property of KeyedCollection takes the key
- // type, Integer. The property is read-only.
- //
- Console::WriteLine("\nweekly[101030411]->Description: {0}",
- weekly[101030411]->Description);
-
- // The Remove method of KeyedCollection takes a key.
- //
- Console::WriteLine("\nRemove(101030411)");
- weekly->Remove(101030411);
-
- // The Insert method, inherited from Collection, takes an
- // index and an OrderItem.
- //
- Console::WriteLine("\nInsert(2, gcnew OrderItem(...))");
- weekly->Insert(2, gcnew OrderItem(111033401, "Nut", 10, .5));
-
- // The default Item property is overloaded. One overload comes
- // from KeyedCollection; that overload
- // is read-only, and takes Integer because it retrieves by key.
- // The other overload comes from Collection, the
- // base class of KeyedCollection; it
- // retrieves by index, so it also takes an Integer. The compiler
- // uses the most-derived overload, from KeyedCollection, so the
- // only way to access SimpleOrder by index is to cast it to
- // Collection. Otherwise the index is interpreted
- // as a key, and KeyNotFoundException is thrown.
- //
- Collection^ coweekly = weekly;
- Console::WriteLine("\ncoweekly[2].Description: {0}",
- coweekly[2]->Description);
-
- Console::WriteLine("\ncoweekly[2] = gcnew OrderItem(...)");
- coweekly[2] = gcnew OrderItem(127700026, "Crank", 27, 5.98);
-
- OrderItem^ temp = coweekly[2];
-
- // The IndexOf method, inherited from Collection,
- // takes an OrderItem instead of a key.
- //
- Console::WriteLine("\nIndexOf(temp): {0}", weekly->IndexOf(temp));
-
- // The inherited Remove method also takes an OrderItem->
- //
- Console::WriteLine("\nRemove(temp)");
- weekly->Remove(temp);
-
- Console::WriteLine("\nRemoveAt(0)");
- weekly->RemoveAt(0);
-
- weekly->AddOrMerge(gcnew OrderItem(110072684, "Gear", 1000, 5.17));
-
- Display(weekly);
-
- Console::WriteLine();
- weekly->Clear();
- }
-
-private:
- static void Display(SimpleOrder^ order)
- {
- Console::WriteLine();
- for each( OrderItem^ item in order )
- {
- Console::WriteLine(item);
- }
- }
-
- static void ChangedHandler(Object^ source,
- SimpleOrderChangedEventArgs^ e)
- {
- OrderItem^ item = e->ChangedItem;
-
- if (e->ChangeType == ChangeTypes::Replaced)
- {
- OrderItem^ replacement = e->ReplacedWith;
-
- Console::WriteLine("{0} (quantity {1}) was replaced " +
- "by {2}, (quantity {3}).", item->Description,
- item->Quantity, replacement->Description,
- replacement->Quantity);
- }
- else if(e->ChangeType == ChangeTypes::Cleared)
- {
- Console::WriteLine("The order list was cleared.");
- }
- else
- {
- Console::WriteLine("{0} (quantity {1}) was {2}.",
- item->Description, item->Quantity, e->ChangeType);
- }
- }
-};
-
-void main()
-{
- Demo::Main();
-}
-
-/* This code example produces the following output:
-
-Widget (quantity 400) was Added.
-Sprocket (quantity 27) was Added.
-Motor (quantity 10) was Added.
-Gear (quantity 175) was Added.
-
-110072674 400 Widget at 45.17 = 18,068.00
-110072675 27 Sprocket at 5.30 = 143.10
-101030411 10 Motor at 237.50 = 2,375.00
-110072684 175 Gear at 5.17 = 904.75
-
-Contains(101030411): True
-
-weekly[101030411]->Description: Motor
-
-Remove(101030411)
-Motor (quantity 10) was Removed.
-
-Insert(2, gcnew OrderItem(...))
-Nut (quantity 10) was Added.
-
-coweekly[2].Description: Nut
-
-coweekly[2] = gcnew OrderItem(...)
-Nut (quantity 10) was replaced by Crank, (quantity 27).
-
-IndexOf(temp): 2
-
-Remove(temp)
-Crank (quantity 27) was Removed.
-
-RemoveAt(0)
-Widget (quantity 400) was Removed.
-
-110072675 27 Sprocket at 5.30 = 143.10
-110072684 1175 Gear at 5.17 = 6,074.75
-
-The order list was cleared.
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp
deleted file mode 100644
index 8fb5233f28b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- List^ dinosaurs = gcnew List(4);
-
- Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity);
-
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Deinonychus");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nIList^ roDinosaurs = dinosaurs->AsReadOnly()");
- IList^ roDinosaurs = dinosaurs->AsReadOnly();
-
- Console::WriteLine("\nElements in the read-only IList:");
- for each(String^ dinosaur in roDinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\ndinosaurs[2] = \"Coelophysis\"");
- dinosaurs[2] = "Coelophysis";
-
- Console::WriteLine("\nElements in the read-only IList:");
- for each(String^ dinosaur in roDinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-}
-
-/* This code example produces the following output:
-
-Capacity: 4
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Deinonychus
-
-IList^ roDinosaurs = dinosaurs->AsReadOnly()
-
-Elements in the read-only IList:
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Deinonychus
-
-dinosaurs[2] = "Coelophysis"
-
-Elements in the read-only IList:
-Tyrannosaurus
-Amargasaurus
-Coelophysis
-Deinonychus
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp
deleted file mode 100644
index df52855da1d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity);
-
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Deinonychus");
- dinosaurs->Add("Compsognathus");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity);
- Console::WriteLine("Count: {0}", dinosaurs->Count);
-
- Console::WriteLine("\nContains(\"Deinonychus\"): {0}",
- dinosaurs->Contains("Deinonychus"));
-
- Console::WriteLine("\nInsert(2, \"Compsognathus\")");
- dinosaurs->Insert(2, "Compsognathus");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\ndinosaurs[3]: {0}", dinosaurs[3]);
-
- Console::WriteLine("\nRemove(\"Compsognathus\")");
- dinosaurs->Remove("Compsognathus");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- dinosaurs->TrimExcess();
- Console::WriteLine("\nTrimExcess()");
- Console::WriteLine("Capacity: {0}", dinosaurs->Capacity);
- Console::WriteLine("Count: {0}", dinosaurs->Count);
-
- dinosaurs->Clear();
- Console::WriteLine("\nClear()");
- Console::WriteLine("Capacity: {0}", dinosaurs->Capacity);
- Console::WriteLine("Count: {0}", dinosaurs->Count);
-}
-
-/* This code example produces the following output:
-
-Capacity: 0
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Deinonychus
-Compsognathus
-
-Capacity: 8
-Count: 5
-
-Contains("Deinonychus"): True
-
-Insert(2, "Compsognathus")
-
-Tyrannosaurus
-Amargasaurus
-Compsognathus
-Mamenchisaurus
-Deinonychus
-Compsognathus
-
-dinosaurs[3]: Mamenchisaurus
-
-Remove("Compsognathus")
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Deinonychus
-Compsognathus
-
-TrimExcess()
-Capacity: 5
-Count: 5
-
-Clear()
-Capacity: 5
-Count: 0
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp
deleted file mode 100644
index eb95c6a9af7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp
+++ /dev/null
@@ -1,51 +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()
-{
- List^ lpf = gcnew List();
-
- lpf->Add(PointF(27.8F, 32.62F));
- lpf->Add(PointF(99.3F, 147.273F));
- lpf->Add(PointF(7.5F, 1412.2F));
-
- Console::WriteLine();
- for each(PointF p in lpf)
- {
- Console::WriteLine(p);
- }
-
- List^ lp =
- lpf->ConvertAll(
- gcnew Converter(PointFToPoint)
- );
-
- Console::WriteLine();
- for each(Point p in lp)
- {
- 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/List`1_CopyTo/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp
deleted file mode 100644
index ce250927500..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Brachiosaurus");
- dinosaurs->Add("Compsognathus");
-
- Console::WriteLine();
- for each(String^ dinosaurs in dinosaurs )
- {
- Console::WriteLine(dinosaurs);
- }
-
- // Create an array of 15 strings.
- array^ arr = gcnew array(15);
-
- dinosaurs->CopyTo(arr);
- dinosaurs->CopyTo(arr, 6);
- dinosaurs->CopyTo(2, arr, 12, 3);
-
- Console::WriteLine("\nContents of the array:");
- for each(String^ dinosaurs in arr )
- {
- Console::WriteLine(dinosaurs);
- }
-}
-
-/* This code example produces the following output:
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Brachiosaurus
-Deinonychus
-Tyrannosaurus
-Compsognathus
-
-IndexOf("Tyrannosaurus"): 0
-
-IndexOf("Tyrannosaurus", 3): 5
-
-IndexOf("Tyrannosaurus", 2, 2): -1
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp
deleted file mode 100644
index d4033713e6c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-// Search predicate returns true if a string ends in "saurus".
-bool EndsWithSaurus(String^ s)
-{
- return s->ToLower()->EndsWith("saurus");
-};
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Compsognathus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Oviraptor");
- dinosaurs->Add("Velociraptor");
- dinosaurs->Add("Deinonychus");
- dinosaurs->Add("Dilophosaurus");
- dinosaurs->Add("Gallimimus");
- dinosaurs->Add("Triceratops");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nTrueForAll(EndsWithSaurus): {0}",
- dinosaurs->TrueForAll(gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nFind(EndsWithSaurus): {0}",
- dinosaurs->Find(gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nFindLast(EndsWithSaurus): {0}",
- dinosaurs->FindLast(gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nFindAll(EndsWithSaurus):");
- List^ sublist =
- dinosaurs->FindAll(gcnew Predicate(EndsWithSaurus));
-
- for each(String^ dinosaur in sublist)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine(
- "\n{0} elements removed by RemoveAll(EndsWithSaurus).",
- dinosaurs->RemoveAll(gcnew Predicate(EndsWithSaurus)));
-
- Console::WriteLine("\nList now contains:");
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nExists(EndsWithSaurus): {0}",
- dinosaurs->Exists(gcnew Predicate(EndsWithSaurus)));
-}
-
-/* This code example produces the following output:
-
-Compsognathus
-Amargasaurus
-Oviraptor
-Velociraptor
-Deinonychus
-Dilophosaurus
-Gallimimus
-Triceratops
-
-TrueForAll(EndsWithSaurus): False
-
-Find(EndsWithSaurus): Amargasaurus
-
-FindLast(EndsWithSaurus): Dilophosaurus
-
-FindAll(EndsWithSaurus):
-Amargasaurus
-Dilophosaurus
-
-2 elements removed by RemoveAll(EndsWithSaurus).
-
-List now contains:
-Compsognathus
-Oviraptor
-Velociraptor
-Deinonychus
-Gallimimus
-Triceratops
-
-Exists(EndsWithSaurus): False
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp
deleted file mode 100644
index 6ca3a08037e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Brachiosaurus");
- dinosaurs->Add("Deinonychus");
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Compsognathus");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nIndexOf(\"Tyrannosaurus\"): {0}",
- dinosaurs->IndexOf("Tyrannosaurus"));
-
- Console::WriteLine("\nIndexOf(\"Tyrannosaurus\", 3): {0}",
- dinosaurs->IndexOf("Tyrannosaurus", 3));
-
- Console::WriteLine("\nIndexOf(\"Tyrannosaurus\", 2, 2): {0}",
- dinosaurs->IndexOf("Tyrannosaurus", 2, 2));
-}
-
-/* This code example produces the following output:
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Brachiosaurus
-Deinonychus
-Tyrannosaurus
-Compsognathus
-
-IndexOf("Tyrannosaurus"): 0
-
-IndexOf("Tyrannosaurus", 3): 5
-
-IndexOf("Tyrannosaurus", 2, 2): -1
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp
deleted file mode 100644
index c6ffc2e2707..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Brachiosaurus");
- dinosaurs->Add("Deinonychus");
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Compsognathus");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\"): {0}",
- dinosaurs->LastIndexOf("Tyrannosaurus"));
-
- Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\", 3): {0}",
- dinosaurs->LastIndexOf("Tyrannosaurus", 3));
-
- Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\", 4, 4): {0}",
- dinosaurs->LastIndexOf("Tyrannosaurus", 4, 4));
-}
-
-/* This code example produces the following output:
-
-Tyrannosaurus
-Amargasaurus
-Mamenchisaurus
-Brachiosaurus
-Deinonychus
-Tyrannosaurus
-Compsognathus
-
-LastIndexOf("Tyrannosaurus"): 5
-
-LastIndexOf("Tyrannosaurus", 3): 0
-
-LastIndexOf("Tyrannosaurus", 4, 4): -1
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp
deleted file mode 100644
index fbee67ad25b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- array^ input = { "Brachiosaurus",
- "Amargasaurus",
- "Mamenchisaurus" };
-
- List^ dinosaurs =
- gcnew List((IEnumerable^) input);
-
- Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nAddRange(dinosaurs)");
- dinosaurs->AddRange(dinosaurs);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nRemoveRange(2, 2)");
- dinosaurs->RemoveRange(2, 2);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- input = gcnew array { "Tyrannosaurus",
- "Deinonychus",
- "Velociraptor"};
-
- Console::WriteLine("\nInsertRange(3, (IEnumerable^) input)");
- dinosaurs->InsertRange(3, (IEnumerable^) input);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\noutput = dinosaurs->GetRange(2, 3)->ToArray()");
- array^ output = dinosaurs->GetRange(2, 3)->ToArray();
-
- Console::WriteLine();
- for each(String^ dinosaur in output )
- {
- Console::WriteLine(dinosaur);
- }
-}
-
-/* This code example produces the following output:
-
-Capacity: 3
-
-Brachiosaurus
-Amargasaurus
-Mamenchisaurus
-
-AddRange(dinosaurs)
-
-Brachiosaurus
-Amargasaurus
-Mamenchisaurus
-Brachiosaurus
-Amargasaurus
-Mamenchisaurus
-
-RemoveRange(2, 2)
-
-Brachiosaurus
-Amargasaurus
-Amargasaurus
-Mamenchisaurus
-
-InsertRange(3, (IEnumerable^) input)
-
-Brachiosaurus
-Amargasaurus
-Amargasaurus
-Tyrannosaurus
-Deinonychus
-Velociraptor
-Mamenchisaurus
-
-output = dinosaurs->GetRange(2, 3)->ToArray()
-
-Amargasaurus
-Tyrannosaurus
-Deinonychus
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp
deleted file mode 100644
index 71c584db785..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Pachycephalosaurus");
- dinosaurs->Add("Parasauralophus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Coelophysis");
- dinosaurs->Add("Oviraptor");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- dinosaurs->Reverse();
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- dinosaurs->Reverse(1, 4);
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-}
-
-/* This code example produces the following output:
-
-Pachycephalosaurus
-Parasauralophus
-Mamenchisaurus
-Amargasaurus
-Coelophysis
-Oviraptor
-
-Oviraptor
-Coelophysis
-Amargasaurus
-Mamenchisaurus
-Parasauralophus
-Pachycephalosaurus
-
-Oviraptor
-Parasauralophus
-Mamenchisaurus
-Amargasaurus
-Coelophysis
-Pachycephalosaurus
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp
deleted file mode 100644
index 4ae53587c2f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_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(List^ list)
-{
- Console::WriteLine();
- for each(String^ s in list)
- {
- if (s == nullptr)
- Console::WriteLine("(null)");
- else
- Console::WriteLine("\"{0}\"", s);
- }
-};
-
-void main()
-{
- List^ dinosaurs = gcnew List();
- dinosaurs->Add("Pachycephalosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("");
- dinosaurs->Add(nullptr);
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Deinonychus");
- Display(dinosaurs);
-
- Console::WriteLine("\nSort with generic Comparison delegate:");
- dinosaurs->Sort(
- 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/List`1_SortSearch/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp
deleted file mode 100644
index e37961290a5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Pachycephalosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Deinonychus");
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nSort");
- dinosaurs->Sort();
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nBinarySearch and Insert \"Coelophysis\":");
- int index = dinosaurs->BinarySearch("Coelophysis");
- if (index < 0)
- {
- dinosaurs->Insert(~index, "Coelophysis");
- }
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nBinarySearch and Insert \"Tyrannosaurus\":");
- index = dinosaurs->BinarySearch("Tyrannosaurus");
- if (index < 0)
- {
- dinosaurs->Insert(~index, "Tyrannosaurus");
- }
-
- Console::WriteLine();
- for each(String^ dinosaur in dinosaurs)
- {
- Console::WriteLine(dinosaur);
- }
-}
-
-/* This code example produces the following output:
-
-Pachycephalosaurus
-Amargasaurus
-Mamenchisaurus
-Deinonychus
-
-Sort
-
-Amargasaurus
-Deinonychus
-Mamenchisaurus
-Pachycephalosaurus
-
-BinarySearch and Insert "Coelophysis":
-
-Amargasaurus
-Coelophysis
-Deinonychus
-Mamenchisaurus
-Pachycephalosaurus
-
-BinarySearch and Insert "Tyrannosaurus":
-
-Amargasaurus
-Coelophysis
-Deinonychus
-Mamenchisaurus
-Pachycephalosaurus
-Tyrannosaurus
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp
deleted file mode 100644
index 396d3d9f86e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class DinoComparer: IComparer
-{
-public:
- virtual int Compare(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 SearchAndInsert(List^ list, String^ insert,
- DinoComparer^ dc)
-{
- Console::WriteLine("\nBinarySearch and Insert \"{0}\":", insert);
-
- int index = list->BinarySearch(insert, dc);
-
- if (index < 0)
- {
- list->Insert(~index, insert);
- }
-};
-
-void Display(List^ list)
-{
- Console::WriteLine();
- for each(String^ s in list)
- {
- Console::WriteLine(s);
- }
-};
-
-void main()
-{
- List^ dinosaurs = gcnew List();
- dinosaurs->Add("Pachycephalosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Deinonychus");
- Display(dinosaurs);
-
- DinoComparer^ dc = gcnew DinoComparer();
-
- Console::WriteLine("\nSort with alternate comparer:");
- dinosaurs->Sort(dc);
- Display(dinosaurs);
-
- SearchAndInsert(dinosaurs, "Coelophysis", dc);
- Display(dinosaurs);
-
- SearchAndInsert(dinosaurs, "Oviraptor", dc);
- Display(dinosaurs);
-
- SearchAndInsert(dinosaurs, "Tyrannosaur", dc);
- Display(dinosaurs);
-
- SearchAndInsert(dinosaurs, nullptr, dc);
- Display(dinosaurs);
-}
-
-/* This code example produces the following output:
-
-Pachycephalosaurus
-Amargasaurus
-Mamenchisaurus
-Deinonychus
-
-Sort with alternate comparer:
-
-Deinonychus
-Amargasaurus
-Mamenchisaurus
-Pachycephalosaurus
-
-BinarySearch and Insert "Coelophysis":
-
-Coelophysis
-Deinonychus
-Amargasaurus
-Mamenchisaurus
-Pachycephalosaurus
-
-BinarySearch and Insert "Oviraptor":
-
-Oviraptor
-Coelophysis
-Deinonychus
-Amargasaurus
-Mamenchisaurus
-Pachycephalosaurus
-
-BinarySearch and Insert "Tyrannosaur":
-
-Oviraptor
-Coelophysis
-Deinonychus
-Tyrannosaur
-Amargasaurus
-Mamenchisaurus
-Pachycephalosaurus
-
-BinarySearch and Insert "":
-
-
-Oviraptor
-Coelophysis
-Deinonychus
-Tyrannosaur
-Amargasaurus
-Mamenchisaurus
-Pachycephalosaurus
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp
deleted file mode 100644
index dbb74dd3f43..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class DinoComparer: IComparer
-{
-public:
- virtual int Compare(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(List^ list)
-{
- Console::WriteLine();
- for each(String^ s in list)
- {
- Console::WriteLine(s);
- }
-};
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Pachycephalosaurus");
- dinosaurs->Add("Parasauralophus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Galimimus");
- dinosaurs->Add("Mamenchisaurus");
- dinosaurs->Add("Deinonychus");
- dinosaurs->Add("Oviraptor");
- dinosaurs->Add("Tyrannosaurus");
-
- int herbivores = 5;
- Display(dinosaurs);
-
- DinoComparer^ dc = gcnew DinoComparer();
-
- Console::WriteLine("\nSort a range with the alternate comparer:");
- dinosaurs->Sort(0, herbivores, dc);
- Display(dinosaurs);
-
- Console::WriteLine("\nBinarySearch a range and Insert \"{0}\":",
- "Brachiosaurus");
-
- int index = dinosaurs->BinarySearch(0, herbivores, "Brachiosaurus", dc);
-
- if (index < 0)
- {
- dinosaurs->Insert(~index, "Brachiosaurus");
- herbivores++;
- }
-
- Display(dinosaurs);
-}
-
-/* This code example produces the following output:
-
-Pachycephalosaurus
-Parasauralophus
-Amargasaurus
-Galimimus
-Mamenchisaurus
-Deinonychus
-Oviraptor
-Tyrannosaurus
-
-Sort a range with the alternate comparer:
-
-Galimimus
-Amargasaurus
-Mamenchisaurus
-Parasauralophus
-Pachycephalosaurus
-Deinonychus
-Oviraptor
-Tyrannosaurus
-
-BinarySearch a range and Insert "Brachiosaurus":
-
-Galimimus
-Amargasaurus
-Brachiosaurus
-Mamenchisaurus
-Parasauralophus
-Pachycephalosaurus
-Deinonychus
-Oviraptor
-Tyrannosaurus
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp
deleted file mode 100644
index 4836a5745f6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-// The following code example demonstrates the effect of changing the NumberDecimalDigits property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a negative value with the default number of decimal digits (2).
- Int64 myInt = -1234;
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-
- // Displays the same value with four decimal digits.
- nfi->NumberDecimalDigits = 4;
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-}
-
-/*
-This code produces the following output.
--1, 234.00
--1, 234.0000
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp
deleted file mode 100644
index 3314e9eab5c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-// The following code example demonstrates the effect of changing the
-// NumberDecimalSeparator property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S".").
- Int64 myInt = 123456789;
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-
- // Displays the same value with a blank as the separator.
- nfi->NumberDecimalSeparator = " ";
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-}
-
-/*
-This code produces the following output.
-123, 456, 789.00
-123, 456, 789 00
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp b/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp
deleted file mode 100644
index 8211f6d47a8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//Types:System.Globalization.NumberFormatInfo
-//
-using namespace System;
-using namespace System::Globalization;
-using namespace System::Text;
-
-int main()
-{
- StringBuilder^ builder = gcnew StringBuilder();
-
- // Loop through all the specific cultures known to the CLR.
- for each(CultureInfo^ culture in
- CultureInfo::GetCultures (CultureTypes::SpecificCultures))
- {
- // Only show the currency symbols for cultures
- // that speak English.
- if (culture->TwoLetterISOLanguageName == "en")
- {
- //
- // Display the culture name and currency symbol.
- NumberFormatInfo^ numberFormat = culture->NumberFormat;
- builder->AppendFormat("The currency symbol for '{0}'"+
- "is '{1}'",culture->DisplayName,
- numberFormat->CurrencySymbol);
- builder->AppendLine();
- //
- }
- }
- Console::WriteLine(builder);
-}
-
-// This code produces the following output.
-//
-// The currency symbol for 'English (United States)' is '$'
-// The currency symbol for 'English (United Kingdom)' is 'Ј'
-// The currency symbol for 'English (Australia)' is '$'
-// The currency symbol for 'English (Canada)' is '$'
-// The currency symbol for 'English (New Zealand)' is '$'
-// The currency symbol for 'English (Ireland)' is '?'
-// The currency symbol for 'English (South Africa)' is 'R'
-// The currency symbol for 'English (Jamaica)' is 'J$'
-// The currency symbol for 'English (Caribbean)' is '$'
-// The currency symbol for 'English (Belize)' is 'BZ$'
-// The currency symbol for 'English (Trinidad and Tobago)' is 'TT$'
-// The currency symbol for 'English (Zimbabwe)' is 'Z$'
-// The currency symbol for 'English (Republic of the Philippines)' is 'Php'
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp
deleted file mode 100644
index 96cb476c415..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-// The following code example demonstrates the effect of changing the NumberGroupSeparator property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S", ").
- Int64 myInt = 123456789;
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-
- // Displays the same value with a blank as the separator.
- nfi->NumberGroupSeparator = " ";
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-}
-
-/*
-This code produces the following output.
-123, 456, 789.00
-123 456 789.00
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp
deleted file mode 100644
index f51cb7d8d13..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example demonstrates the effect of changing the NumberGroupSizes property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S".").
- Int64 myInt = 123456789012345;
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-
- // Displays the same value with different groupings.
- array^mySizes1 = {2,3,4};
- array^mySizes2 = {2,3,0};
- nfi->NumberGroupSizes = mySizes1;
- Console::WriteLine( myInt.ToString( "N", nfi ) );
- nfi->NumberGroupSizes = mySizes2;
- Console::WriteLine( myInt.ToString( "N", nfi ) );
-}
-
-/*
-This code produces the following output.
-123, 456, 789, 012, 345.00
-12, 3456, 7890, 123, 45.00
-1234567890, 123, 45.00
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp b/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp
deleted file mode 100644
index 5fe0650df9b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//Types:System.Globalization.NumberStyles (enum)
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Globalization;
-
-
-int main()
-{
- // Parse the string as a hex value and display the
- // value as a decimal.
- String^ numberString = "A";
- int stringValue = Int32::Parse(numberString, NumberStyles::HexNumber);
- Console::WriteLine("{0} in hex = {1} in decimal.",
- numberString, stringValue);
-
- // Parse the string, allowing a leading sign, and ignoring
- // leading and trailing white spaces.
- numberString = " -45 ";
- stringValue =Int32::Parse(numberString, NumberStyles::AllowLeadingSign |
- NumberStyles::AllowLeadingWhite | NumberStyles::AllowTrailingWhite);
- Console::WriteLine("'{0}' parsed to an int is '{1}'.",
- numberString, stringValue);
-
- // Parse the string, allowing parentheses, and ignoring
- // leading and trailing white spaces.
- numberString = " (37) ";
- stringValue = Int32::Parse(numberString, NumberStyles::AllowParentheses |
- NumberStyles::AllowLeadingSign | NumberStyles::AllowLeadingWhite |
- NumberStyles::AllowTrailingWhite);
-
- Console::WriteLine("'{0}' parsed to an int is '{1}'.",
- numberString, stringValue);
-}
-
-// This code produces the following output.
-//
-// A in hex = 10 in decimal.
-// ' -45 ' parsed to an int is '-45'.
-// ' (37) ' parsed to an int is '-37'.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp
deleted file mode 100644
index 75724099841..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-using namespace System::Collections::ObjectModel;
-
-public ref class Demo
-{
-public:
- static void Main()
- {
- Collection^ dinosaurs = gcnew Collection();
-
- dinosaurs->Add("Psitticosaurus");
- dinosaurs->Add("Caudipteryx");
- dinosaurs->Add("Compsognathus");
- dinosaurs->Add("Muttaburrasaurus");
-
- Console::WriteLine("{0} dinosaurs:", dinosaurs->Count);
- Display(dinosaurs);
-
- Console::WriteLine("\nIndexOf(\"Muttaburrasaurus\"): {0}",
- dinosaurs->IndexOf("Muttaburrasaurus"));
-
- Console::WriteLine("\nContains(\"Caudipteryx\"): {0}",
- dinosaurs->Contains("Caudipteryx"));
-
- Console::WriteLine("\nInsert(2, \"Nanotyrannus\")");
- dinosaurs->Insert(2, "Nanotyrannus");
- Display(dinosaurs);
-
- Console::WriteLine("\ndinosaurs[2]: {0}", dinosaurs[2]);
-
- Console::WriteLine("\ndinosaurs[2] = \"Microraptor\"");
- dinosaurs[2] = "Microraptor";
- Display(dinosaurs);
-
- Console::WriteLine("\nRemove(\"Microraptor\")");
- dinosaurs->Remove("Microraptor");
- Display(dinosaurs);
-
- Console::WriteLine("\nRemoveAt(0)");
- dinosaurs->RemoveAt(0);
- Display(dinosaurs);
-
- Console::WriteLine("\ndinosaurs.Clear()");
- dinosaurs->Clear();
- Console::WriteLine("Count: {0}", dinosaurs->Count);
- }
-
-private:
- static void Display(Collection^ cs)
- {
- Console::WriteLine();
- for each( String^ item in cs )
- {
- Console::WriteLine(item);
- }
- }
-};
-
-int main()
-{
- Demo::Main();
-}
-
-/* This code example produces the following output:
-
-4 dinosaurs:
-
-Psitticosaurus
-Caudipteryx
-Compsognathus
-Muttaburrasaurus
-
-IndexOf("Muttaburrasaurus"): 3
-
-Contains("Caudipteryx"): True
-
-Insert(2, "Nanotyrannus")
-
-Psitticosaurus
-Caudipteryx
-Nanotyrannus
-Compsognathus
-Muttaburrasaurus
-
-dinosaurs[2]: Nanotyrannus
-
-dinosaurs[2] = "Microraptor"
-
-Psitticosaurus
-Caudipteryx
-Microraptor
-Compsognathus
-Muttaburrasaurus
-
-Remove("Microraptor")
-
-Psitticosaurus
-Caudipteryx
-Compsognathus
-Muttaburrasaurus
-
-RemoveAt(0)
-
-Caudipteryx
-Compsognathus
-Muttaburrasaurus
-
-dinosaurs.Clear()
-Count: 0
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp b/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp
deleted file mode 100644
index 08709a04488..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ path1 = "c:\\temp\\MyTest.txt";
- String^ path2 = "c:\\temp\\MyTest";
- String^ path3 = "temp";
- if ( Path::HasExtension( path1 ) )
- {
- Console::WriteLine( "{0} has an extension.", path1 );
- }
-
- if ( !Path::HasExtension( path2 ) )
- {
- Console::WriteLine( "{0} has no extension.", path2 );
- }
-
- if ( !Path::IsPathRooted( path3 ) )
- {
- Console::WriteLine( "The string {0} contains no root information.", path3 );
- }
-
- Console::WriteLine( "The full path of {0} is {1}.", path3, Path::GetFullPath( path3 ) );
- Console::WriteLine( "{0} is the location for temporary files.", Path::GetTempPath() );
- Console::WriteLine( "{0} is a file available for use.", Path::GetTempFileName() );
- Console::WriteLine( "\r\nThe set of invalid characters in a path is:" );
- Console::WriteLine( "(Note that the wildcard characters '*' and '?' are not invalid.):" );
- Collections::IEnumerator^ myEnum = Path::InvalidPathChars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = *safe_cast(myEnum->Current);
- Console::WriteLine( c );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp
deleted file mode 100644
index 331d7abbb90..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-// The following code example demonstrates the effect of changing the PercentDecimalDigits property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a negative value with the default number of decimal digits (2).
- Double myInt = 0.1234;
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-
- // Displays the same value with four decimal digits.
- nfi->PercentDecimalDigits = 4;
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-}
-
-/*
-This code produces the following output.
-12.34 %
-12.3400 %
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp
deleted file mode 100644
index de975569dfb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-// The following code example demonstrates the effect of changing the
-// PercentDecimalSeparator property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S".").
- Double myInt = 0.1234;
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-
- // Displays the same value with a blank as the separator.
- nfi->PercentDecimalSeparator = " ";
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-}
-
-/*
-This code produces the following output.
-12.34 %
-12 34 %
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp
deleted file mode 100644
index 39d7c7a20ca..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-// The following code example demonstrates the effect of changing the
-// PercentGroupSeparator property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S", ").
- Double myInt = 1234.5678;
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-
- // Displays the same value with a blank as the separator.
- nfi->PercentGroupSeparator = " ";
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-}
-
-/*
-This code produces the following output.
-123, 456.78 %
-123 456.78 %
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp
deleted file mode 100644
index 2edc2ec4edf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-// The following code example demonstrates the effect of changing the PercentGroupSizes property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets a NumberFormatInfo associated with the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- NumberFormatInfo^ nfi = MyCI->NumberFormat;
-
- // Displays a value with the default separator (S".").
- Double myInt = 123456789012345.6789;
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-
- // Displays the same value with different groupings.
- array^mySizes1 = {2,3,4};
- array^mySizes2 = {2,3,0};
- nfi->PercentGroupSizes = mySizes1;
- Console::WriteLine( myInt.ToString( "P", nfi ) );
- nfi->PercentGroupSizes = mySizes2;
- Console::WriteLine( myInt.ToString( "P", nfi ) );
-}
-
-/*
-This code produces the following output.
-
-12, 345, 678, 901, 234, 600.00 %
-1234, 5678, 9012, 346, 00.00 %
-123456789012, 346, 00.00 %
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp b/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp
deleted file mode 100644
index ec0c28aeb8c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Drawing;
-using namespace System::Collections;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-using namespace System::Data;
-using namespace System::Diagnostics;
-
-///
-/// Summary description for Form1.
-///
-public ref class Form1: public System::Windows::Forms::Form
-{
-private:
-
- ///
- /// Required designer variable.
- ///
- System::ComponentModel::Container^ components;
-
-public:
- Form1()
- {
- components = nullptr;
-
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- }
-
-
-protected:
-
- ///
- /// Clean up any resources being used.
- ///
- ~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()
- {
- //
- // Form1
- //
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 292, 266 );
- this->Name = "Form1";
- this->Text = "Form1";
- this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load );
- }
-
- void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- //
- PerformanceCounter^ PC = gcnew PerformanceCounter;
- PC->CategoryName = "Process";
- PC->CounterName = "Private Bytes";
- PC->InstanceName = "Explorer";
- MessageBox::Show( PC->NextValue().ToString() );
- //
-
- //
- Array^ PerfCat = PerformanceCounterCategory::GetCategories();
- MessageBox::Show( String::Concat( "The number of performance counter categories in the local machine is ", PerfCat->Length ) );
- //
- }
-};
-
-///
-/// The main entry point for the application.
-///
-
-[STAThread]
-int main()
-{
- Application::Run( gcnew Form1 );
-}
-
-//Output:
-//11.11 %
-//11.11 Percent
diff --git a/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp b/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp
deleted file mode 100644
index 9cdd3a26593..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-int main()
-{
-
- //
- if ( !PerformanceCounterCategory::Exists( "Orders" ) )
- {
- CounterCreationData^ milk = gcnew CounterCreationData;
- milk->CounterName = "milk";
- milk->CounterType = PerformanceCounterType::NumberOfItems32;
-
- CounterCreationData^ milkPerSecond = gcnew CounterCreationData;
- milkPerSecond->CounterName = "milk orders/second";
- milkPerSecond->CounterType = PerformanceCounterType::RateOfCountsPerSecond32;
-
- CounterCreationDataCollection^ ccds = gcnew CounterCreationDataCollection;
- ccds->Add( milkPerSecond );
- ccds->Add( milk );
- PerformanceCounterCategory::Create( "Orders", "Number of processed orders", ccds );
- }
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp
deleted file mode 100644
index fe5c4b92d7c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// cpp.cpp : main project file.
-// System::Diagnostics.PerformanceCounterInstaller
-/*
-The following example demonstrates 'PerformanceCounterInstaller' class.
-A class is inherited from 'Installer' having 'RunInstallerAttribute' set to true.
-A new instance of 'PerformanceCounterInstaller' is created and its 'CategoryName'
-is set. Then this instance is added to 'InstallerCollection'.
-Note:
-1)To run this example use the following command:
-InstallUtil::exe PerformanceCounterInstaller::exe
-2)To uninstall the perfomance counter use the following command:
-InstallUtil::exe /u PerformanceCounterInstaller::exe
-*/
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Configuration::Install;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-
-[RunInstaller(true)]
-ref class MyPerformanceCounterInstaller: public Installer
-{
-public:
- MyPerformanceCounterInstaller()
- {
- try
- {
- // Create an instance of 'PerformanceCounterInstaller'.
- PerformanceCounterInstaller^ myPerformanceCounterInstaller =
- gcnew PerformanceCounterInstaller;
- // Set the 'CategoryName' for performance counter.
- myPerformanceCounterInstaller->CategoryName =
- "MyPerformanceCounter";
- CounterCreationData^ myCounterCreation = gcnew CounterCreationData;
- myCounterCreation->CounterName = "MyCounter";
- myCounterCreation->CounterHelp = "Counter Help";
- // Add a counter to collection of myPerformanceCounterInstaller.
- myPerformanceCounterInstaller->Counters->Add( myCounterCreation );
- Installers->Add( myPerformanceCounterInstaller );
- }
- catch ( Exception^ e )
- {
- this->Context->LogMessage( "Error occurred : " + e->Message );
- }
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp
deleted file mode 100644
index f51c915deba..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Diagnostics;
-
-// Output information about the counter sample.
-void OutputSample( CounterSample s )
-{
- Console::WriteLine( "\r\n+++++++++++" );
- Console::WriteLine( "Sample values - \r\n" );
- Console::WriteLine( " BaseValue = {0}", s.BaseValue );
- Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency );
- Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp );
- Console::WriteLine( " CounterType = {0}", s.CounterType );
- Console::WriteLine( " RawValue = {0}", s.RawValue );
- Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency );
- Console::WriteLine( " TimeStamp = {0}", s.TimeStamp );
- Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec );
- Console::WriteLine( "++++++++++++++++++++++" );
-}
-
-//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
-// Description - This counter type shows how many items are processed, on average,
-// during an operation. Counters of this type display a ratio of the items
-// processed (such as bytes sent) to the number of operations completed. The
-// ratio is calculated by comparing the number of items processed during the
-// last interval to the number of operations completed during the last interval.
-// Generic type - Average
-// Formula - (N1 - N0) / (D1 - D0), where the numerator (N) represents the number
-// of items processed during the last sample interval and the denominator (D)
-// represents the number of operations completed during the last two sample
-// intervals.
-// Average (Nx - N0) / (Dx - D0)
-// Example PhysicalDisk\ Avg. Disk Bytes/Transfer
-//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
-float MyComputeCounterValue( CounterSample s0, CounterSample s1 )
-{
- float numerator = (float)s1.RawValue - (float)s0.RawValue;
- float denomenator = (float)s1.BaseValue - (float)s0.BaseValue;
- float counterValue = numerator / denomenator;
- return counterValue;
-}
-
-bool SetupCategory()
-{
- if ( !PerformanceCounterCategory::Exists( "AverageCounter64SampleCategory" ) )
- {
- CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection;
-
- // Add the counter.
- CounterCreationData^ averageCount64 = gcnew CounterCreationData;
- averageCount64->CounterType = PerformanceCounterType::AverageCount64;
- averageCount64->CounterName = "AverageCounter64Sample";
- CCDC->Add( averageCount64 );
-
- // Add the base counter.
- CounterCreationData^ averageCount64Base = gcnew CounterCreationData;
- averageCount64Base->CounterType = PerformanceCounterType::AverageBase;
- averageCount64Base->CounterName = "AverageCounter64SampleBase";
- CCDC->Add( averageCount64Base );
-
- // Create the category.
- PerformanceCounterCategory::Create( "AverageCounter64SampleCategory", "Demonstrates usage of the AverageCounter64 performance counter type.", CCDC );
- return (true);
- }
- else
- {
- Console::WriteLine( "Category exists - AverageCounter64SampleCategory" );
- return (false);
- }
-}
-
-void CreateCounters( PerformanceCounter^% PC, PerformanceCounter^% BPC )
-{
-
- // Create the counters.
- //
- PC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64Sample",false );
- //
-
- BPC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64SampleBase",false );
- PC->RawValue = 0;
- BPC->RawValue = 0;
-}
-//
-void CollectSamples( ArrayList^ samplesList, PerformanceCounter^ PC, PerformanceCounter^ BPC )
-{
- Random^ r = gcnew Random( DateTime::Now.Millisecond );
-
- // Loop for the samples.
- for ( int j = 0; j < 100; j++ )
- {
- int value = r->Next( 1, 10 );
- Console::Write( "{0} = {1}", j, value );
- PC->IncrementBy( value );
- BPC->Increment();
- if ( (j % 10) == 9 )
- {
- OutputSample( PC->NextSample() );
- samplesList->Add( PC->NextSample() );
- }
- else
- Console::WriteLine();
- System::Threading::Thread::Sleep( 50 );
- }
-}
-//
-
-void CalculateResults( ArrayList^ samplesList )
-{
- for ( int i = 0; i < (samplesList->Count - 1); i++ )
- {
- // Output the sample.
- OutputSample( *safe_cast(samplesList[ i ]) );
- OutputSample( *safe_cast(samplesList[ i + 1 ]) );
-
- // Use .NET to calculate the counter value.
- Console::WriteLine( ".NET computed counter value = {0}", CounterSampleCalculator::ComputeCounterValue( *safe_cast(samplesList[ i ]), *safe_cast(samplesList[ i + 1 ]) ) );
-
- // Calculate the counter value manually.
- Console::WriteLine( "My computed counter value = {0}", MyComputeCounterValue( *safe_cast(samplesList[ i ]), *safe_cast(samplesList[ i + 1 ]) ) );
- }
-}
-
-int main()
-{
- ArrayList^ samplesList = gcnew ArrayList;
- PerformanceCounter^ PC;
- PerformanceCounter^ BPC;
- SetupCategory();
- CreateCounters( PC, BPC );
- CollectSamples( samplesList, PC, BPC );
- CalculateResults( samplesList );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp
deleted file mode 100644
index 0c6d5707320..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-// Notice that the sample 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 and #3 are Whidbey.
-
-#if ( BELOW_WHIDBEY_BUILD )
-
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Diagnostics;
-using namespace System::Runtime::InteropServices;
-
-void OutputSample( CounterSample s )
-{
- Console::WriteLine( "\r\n+++++++++++" );
- Console::WriteLine( "Sample values - \r\n" );
- Console::WriteLine( " BaseValue = {0}", s.BaseValue );
- Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency );
- Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp );
- Console::WriteLine( " CounterType = {0}", s.CounterType );
- Console::WriteLine( " RawValue = {0}", s.RawValue );
- Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency );
- Console::WriteLine( " TimeStamp = {0}", s.TimeStamp );
- Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec );
- Console::WriteLine( "++++++++++++++++++++++" );
-}
-
-// Reads the counter information to enable setting the RawValue.
-[DllImport("Kernel32.dll")]
-extern bool QueryPerformanceCounter( [Out]__int64 * value );
-
-bool SetupCategory()
-{
- if ( !PerformanceCounterCategory::Exists( "ElapsedTimeSampleCategory" ) )
- {
- CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection;
-
- // Add the counter.
- CounterCreationData^ ETimeData = gcnew CounterCreationData;
- ETimeData->CounterType = PerformanceCounterType::ElapsedTime;
- ETimeData->CounterName = "ElapsedTimeSample";
- CCDC->Add( ETimeData );
-
- // Create the category.
- PerformanceCounterCategory::Create( "ElapsedTimeSampleCategory",
- "Demonstrates usage of the ElapsedTime performance counter type.",
- CCDC );
- return true;
- }
- else
- {
- Console::WriteLine( "Category exists - ElapsedTimeSampleCategory" );
- return false;
- }
-}
-
-void CreateCounters( PerformanceCounter^% PC )
-{
- // Create the counter.
- PC = gcnew PerformanceCounter( "ElapsedTimeSampleCategory",
- "ElapsedTimeSample",
- false );
-}
-
-void CollectSamples( ArrayList^ samplesList, PerformanceCounter^ PC )
-{
- __int64 pcValue;
- DateTime Start;
-
- // Initialize the counter.
- QueryPerformanceCounter( &pcValue );
- PC->RawValue = pcValue;
- Start = DateTime::Now;
-
- // Loop for the samples.
- for ( int j = 0; j < 1000; j++ )
- {
- // Output the values.
- if ( (j % 10) == 9 )
- {
- Console::WriteLine( "NextValue() = {0}", PC->NextValue() );
- Console::WriteLine( "Actual elapsed time = {0}", DateTime::Now.Subtract( Start ) );
- OutputSample( PC->NextSample() );
- samplesList->Add( PC->NextSample() );
- }
-
- // reset the counter on 100th iteration.
- if ( j % 100 == 0 )
- {
- QueryPerformanceCounter( &pcValue );
- PC->RawValue = pcValue;
- Start = DateTime::Now;
- }
- System::Threading::Thread::Sleep( 50 );
- }
-
- Console::WriteLine( "Elapsed time = {0}", DateTime::Now.Subtract( Start ) );
-}
-
-void main()
-{
- ArrayList^ samplesList = gcnew ArrayList;
-// PerformanceCounter^ PC;
- SetupCategory();
-// CreateCounters( PC );
- CreateCounters();
- CollectSamples( samplesList, PC );
-}
-//
-
-#else
-// Build sample for Whidbey or higher.
-
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Diagnostics;
-using namespace System::Runtime::InteropServices;
-
-void OutputSample( CounterSample s )
-{
- Console::WriteLine( "\r\n+++++++++++" );
- Console::WriteLine( "Sample values - \r\n" );
- Console::WriteLine( " BaseValue = {0}", s.BaseValue );
- Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency );
- Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp );
- Console::WriteLine( " CounterType = {0}", s.CounterType );
- Console::WriteLine( " RawValue = {0}", s.RawValue );
- Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency );
- Console::WriteLine( " TimeStamp = {0}", s.TimeStamp );
- Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec );
- Console::WriteLine( "++++++++++++++++++++++" );
-}
-
-void CollectSamples()
-{
- String^ categoryName = "ElapsedTimeSampleCategory";
- String^ counterName = "ElapsedTimeSample";
-
- // Create the performance counter category.
- if ( !PerformanceCounterCategory::Exists( categoryName ) )
- {
- CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection;
-
- // Add the counter.
- CounterCreationData^ ETimeData = gcnew CounterCreationData;
- ETimeData->CounterType = PerformanceCounterType::ElapsedTime;
- ETimeData->CounterName = counterName;
- CCDC->Add( ETimeData );
-
- // Create the category.
- PerformanceCounterCategory::Create( categoryName,
- "Demonstrates ElapsedTime performance counter usage.",
- CCDC );
- }
- else
- {
- Console::WriteLine( "Category exists - {0}", categoryName );
- }
-
-
- //
- // Create the performance counter.
- PerformanceCounter^ PC = gcnew PerformanceCounter( categoryName,
- counterName,
- false );
- // Initialize the counter.
- PC->RawValue = Stopwatch::GetTimestamp();
- //
-
- DateTime Start = DateTime::Now;
-
- // Loop for the samples.
- for ( int j = 0; j < 100; j++ )
- {
- // Output the values.
- if ( (j % 10) == 9 )
- {
- Console::WriteLine( "NextValue() = {0}", PC->NextValue() );
- Console::WriteLine( "Actual elapsed time = {0}", DateTime::Now.Subtract( Start ) );
- OutputSample( PC->NextSample() );
- }
-
- // Reset the counter on every 20th iteration.
- if ( j % 20 == 0 )
- {
- PC->RawValue = Stopwatch::GetTimestamp();
- Start = DateTime::Now;
- }
- System::Threading::Thread::Sleep( 50 );
- }
-
- Console::WriteLine( "Elapsed time = {0}", DateTime::Now.Subtract( Start ) );
-}
-
-int main()
-{
- CollectSamples();
-}
-//
-#endif
diff --git a/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp b/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp
deleted file mode 100644
index c551e40c3f6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-int main()
-{
- // Get the current process.
- Process^ currentProcess = Process::GetCurrentProcess();
-
- // Get all processes running on the local computer.
- array^localAll = Process::GetProcesses();
-
- // Get all instances of Notepad running on the local computer.
- // This will return an empty array if notepad isn't running.
- array^localByName = Process::GetProcessesByName("notepad");
-
- // Get a process on the local computer, using the process id.
- // This will throw an exception if there is no such process.
- Process^ localById = Process::GetProcessById(1234);
-
-
- // Get processes running on a remote computer. Note that this
- // and all the following calls will timeout and throw an exception
- // if "myComputer" and 169.0.0.0 do not exist on your local network.
-
- // Get all processes on a remote computer.
- array^remoteAll = Process::GetProcesses("myComputer");
-
- // Get all instances of Notepad running on the specific computer, using machine name.
- array^remoteByName = Process::GetProcessesByName( "notepad", "myComputer" );
-
- // Get all instances of Notepad running on the specific computer, using IP address.
- array^ipByName = Process::GetProcessesByName( "notepad", "169.0.0.0" );
-
- // Get a process on a remote computer, using the process id and machine name.
- Process^ remoteById = Process::GetProcessById( 2345, "myComputer" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp
deleted file mode 100644
index b4879144d08..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-#using
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-
-int main()
-{
- Process^ myProcess = gcnew Process;
-
- try
- {
- myProcess->StartInfo->UseShellExecute = false;
- // You can start any process, HelloWorld is a do-nothing example.
- myProcess->StartInfo->FileName = "C:\\HelloWorld.exe";
- myProcess->StartInfo->CreateNoWindow = true;
- myProcess->Start();
- // This code assumes the process you are starting will terminate itself.
- // Given that it is started without a window so you cannot terminate it
- // on the desktop, it must terminate itself or you can do it programmatically
- // from this application using the Kill method.
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp
deleted file mode 100644
index 6db5fa36f59..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-
-// Opens the Internet Explorer application.
-void OpenApplication(String^ myFavoritesPath)
-{
- // Start Internet Explorer. Defaults to the home page.
- Process::Start("IExplore.exe");
-
- // Display the contents of the favorites folder in the browser.
- Process::Start(myFavoritesPath);
-}
-
-// Opens urls and .html documents using Internet Explorer.
-void OpenWithArguments()
-{
- // URLs are not considered documents. They can only be opened
- // by passing them as arguments.
- Process::Start("IExplore.exe", "www.northwindtraders.com");
-
- // Start a Web page using a browser associated with .html and .asp files.
- Process::Start("IExplore.exe", "C:\\myPath\\myFile.htm");
- Process::Start("IExplore.exe", "C:\\myPath\\myFile.asp");
-}
-
-// Uses the ProcessStartInfo class to start new processes,
-// both in a minimized mode.
-void OpenWithStartInfo()
-{
- ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("IExplore.exe");
- startInfo->WindowStyle = ProcessWindowStyle::Minimized;
- Process::Start(startInfo);
- startInfo->Arguments = "www.northwindtraders.com";
- Process::Start(startInfo);
-}
-
-int main()
-{
- // Get the path that stores favorite links.
- String^ myFavoritesPath = Environment::GetFolderPath(Environment::SpecialFolder::Favorites);
- OpenApplication(myFavoritesPath);
- OpenWithArguments();
- OpenWithStartInfo();
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp
deleted file mode 100644
index b84436e8b00..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Place the following code into a console project called StartArgsEcho. It depends on the
-// console application named argsecho.exe.
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
- ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("argsecho.exe");
- startInfo->WindowStyle = ProcessWindowStyle::Normal;
-
- // Start with one argument.
- // Output of ArgsEcho:
- // [0]=/a
- startInfo->Arguments = "/a";
- Process::Start(startInfo);
-
- // Start with multiple arguments separated by spaces.
- // Output of ArgsEcho:
- // [0] = /a
- // [1] = /b
- // [2] = c:\temp
- startInfo->Arguments = "/a /b c:\\temp";
- Process::Start(startInfo);
-
- // An argument with spaces inside quotes is interpreted as multiple arguments.
- // Output of ArgsEcho:
- // [0] = /a
- // [1] = literal string arg
- startInfo->Arguments = "/a \"literal string arg\"";
- Process::Start(startInfo);
-
- // An argument inside double quotes is interpreted as if the quote weren't there,
- // that is, as separate arguments.
- // Output of ArgsEcho:
- // [0] = /a
- // [1] = /b:string
- // [2] = in
- // [3] = double
- // [4] = quotes
- startInfo->Arguments = "/a /b:\"\"string in double quotes\"\"";
- Process::Start(startInfo);
-
- // Triple-escape quotation marks to include the character in the final argument received
- // by the target process.
- // [0] = /a
- // [1] = /b:"quoted string"
- startInfo->Arguments = "/a /b:\"\"\"quoted string\"\"\"";
- Process::Start(startInfo);
-
- return 0;
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp
deleted file mode 100644
index d4fd5c0b6cd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// Place this code into a console project called ArgsEcho to build the argsecho.exe target
-
-using namespace System;
-
-int main(array ^args)
-{
- Console::WriteLine("Received the following arguments:\n");
-
- for (int i = 0; i < args->Length; i++)
- {
- Console::WriteLine("[" + i + "] = " + args[i]);
- }
-
- Console::WriteLine("\nPress any key to exit");
- Console::ReadLine();
- return 0;
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp
deleted file mode 100644
index 57ea4cc3263..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// System::Diagnostics::ProcessModule
-/* The following program demonstrates the use of 'ProcessModule' class.
-It creates a notepad, gets the 'MainModule' and all other modules of
-the process 'notepad.exe', displays some of the properties of each modules.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-void main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "Properties of the modules associated with 'notepad' are:" );
-
- // Display the properties of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( "The moduleName is {0}", myProcessModule->ModuleName );
- Console::WriteLine( "The {0}'s base address is: {1}", myProcessModule->ModuleName, myProcessModule->BaseAddress );
- Console::WriteLine( "The {0}'s Entry point address is: {1}", myProcessModule->ModuleName, myProcessModule->EntryPointAddress );
- Console::WriteLine( "The {0}'s File name is: {1}", myProcessModule->ModuleName, myProcessModule->FileName );
- }
- myProcessModule = myProcess->MainModule;
-
- // Display the properties of the main module.
- Console::WriteLine( "The process's main moduleName is: {0}", myProcessModule->ModuleName );
- Console::WriteLine( "The process's main module's base address is: {0}", myProcessModule->BaseAddress );
- Console::WriteLine( "The process's main module's Entry point address is: {0}", myProcessModule->EntryPointAddress );
- Console::WriteLine( "The process's main module's File name is: {0}", myProcessModule->FileName );
- myProcess->CloseMainWindow();
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp
deleted file mode 100644
index c941fb56f0d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// System::Diagnostics::ProcessModule::BaseAddress
-
-/* The following program demonstrates the use of 'BaseAddress' property of
-'ProcessModule' class. It creates a notepad, gets the 'MainModule' and
-all other modules of the process 'notepad.exe', displays 'BaseAddress'
-for all the modules and the main module.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-void main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "Base addresses of the modules associated with 'notepad' are:" );
-
- // Display the 'BaseAddress' of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->BaseAddress );
- }
- myProcessModule = myProcess->MainModule;
-
- // Display the 'BaseAddress' of the main module.
- Console::WriteLine( "The process's main module's base address is: {0}", myProcessModule->BaseAddress );
- myProcess->CloseMainWindow();
- //
-
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp
deleted file mode 100644
index a03a38206d4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// System::Diagnostics::ProcessModule::EntryPointAddress
-
-/* The following program demonstrates the use of 'EntryPointAddress' property of
-'ProcessModule' class. It creates a notepad, gets the 'MainModule' and
-all other modules of the process 'notepad.exe', displays 'EntryPointAddress'
-for all the modules and the main module.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-void main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "Entry point addresses of the modules associated with 'notepad' are:" );
-
- // Display the 'EntryPointAddress' of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->EntryPointAddress );
- }
- myProcessModule = myProcess->MainModule;
- Console::WriteLine( "The process's main module's EntryPointAddress is: {0}", myProcessModule->EntryPointAddress );
- myProcess->CloseMainWindow();
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp
deleted file mode 100644
index a67c20e8412..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// System::Diagnostics::ProcessModule::FileName
-
-/* The following program demonstrates the use of 'FileName' property of
-'ProcessModule' class. It creates a notepad, gets the 'MainModule' and
-all other modules of the process 'notepad.exe', displays 'FileName'
-for all the modules and the main module.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "File names of the modules associated with 'notepad' are:" );
-
- // Display the 'FileName' of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( "{0:s} : {1:s}", myProcessModule->ModuleName, myProcessModule->FileName );
- }
- myProcessModule = myProcess->MainModule;
-
- // Display the 'FileName' of the main module.
- Console::WriteLine( "The process's main module's FileName is: {0}", myProcessModule->FileName );
- myProcess->CloseMainWindow();
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp
deleted file mode 100644
index 62a1569e9f3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// System::Diagnostics::ProcessModule::FileVersionInfo
-
-/* The following program demonstrates the use of 'FileVersionInfo' property of
-'ProcessModule' class. It creates a notepad, gets the 'MainModule' and
-all other modules of the process 'notepad.exe', displays 'FileVersionInfo'
-for all the modules and the main module.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-void main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "'FileversionInfo' of the modules associated with 'notepad' are:" );
-
- // Display the 'FileVersionInfo' of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->FileVersionInfo );
- }
- myProcessModule = myProcess->MainModule;
-
- // Display the 'FileVersionInfo' of main module.
- Console::WriteLine( "The process's main module's FileVersionInfo is: {0}", myProcessModule->FileVersionInfo );
- myProcess->CloseMainWindow();
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp
deleted file mode 100644
index 8d5907528ee..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// System::Diagnostics::ProcessModule::ModuleMemorySize
-
-/* The following program demonstrates the use of 'ModuleMemorySize' property of
-'ProcessModule' class. It creates a notepad, gets the 'MainModule' and
-all other modules of the process 'notepad.exe', displays 'ModuleMemorySize'
-for all the modules and the main module.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "Module memory sizes of the modules associated with 'notepad' are:" );
-
- // Display the 'ModuleMemorySize' of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->ModuleMemorySize );
- }
- myProcessModule = myProcess->MainModule;
-
- // Display the 'ModuleMemorySize' of the main module.
- Console::WriteLine( "The process's main module's ModuleMemorySize is: {0}", myProcessModule->ModuleMemorySize );
- myProcess->CloseMainWindow();
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp
deleted file mode 100644
index 96abbee1dab..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// System::Diagnostics::ProcessModule::ModuleName
-
-/* The following program demonstrates the use of 'ModuleName' property of
-'ProcessModule' class. It creates a notepad, gets the 'MainModule' and
-all other modules of the process 'notepad.exe', displays 'ModuleName'
-for all the modules and the main module.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "Module names of the modules associated with 'notepad' are:" );
-
- // Display the 'ModuleName' of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( myProcessModule->ModuleName );
- }
- myProcessModule = myProcess->MainModule;
-
- // Display the 'ModuleName' of the main module.
- Console::WriteLine( "The process's main moduleName is: {0}", myProcessModule->ModuleName );
- myProcess->CloseMainWindow();
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp
deleted file mode 100644
index 9bd9a254aa0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// System::Diagnostics::ProcessModule::ToString
-
-/* The following program demonstrates the use of 'ToString' property of
-'ProcessModule' class. It creates a notepad, gets the 'MainModule' and
-all other modules of the process 'notepad.exe', displays 'ToString'
-for all the modules and the main module.
-*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-int main()
-{
- try
- {
- //
- Process^ myProcess = gcnew Process;
-
- // Get the process start information of notepad.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" );
-
- // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*.
- myProcess->StartInfo = myProcessStartInfo;
-
- // Create a notepad.
- myProcess->Start();
- System::Threading::Thread::Sleep( 1000 );
- ProcessModule^ myProcessModule;
-
- // Get all the modules associated with 'myProcess'.
- ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules;
- Console::WriteLine( "ToString properties of the modules associated with 'notepad' are:" );
-
- // Display the ToString of each of the modules.
- for ( int i = 0; i < myProcessModuleCollection->Count; i++ )
- {
- myProcessModule = myProcessModuleCollection[ i ];
- Console::WriteLine( "{0} : {1}", myProcessModuleCollection[ i ]->ModuleName, myProcessModule->ToString() );
- }
- myProcessModule = myProcess->MainModule;
-
- // Display the ToString of the main module.
- Console::WriteLine( "The process's main module is : {0}", myProcessModule->ToString() );
- myProcess->CloseMainWindow();
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0}", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp
deleted file mode 100644
index dc1a08793ee..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-void main()
-{
- //
- // Run "cl.exe /cld stdstr.cpp /link /out:sample.exe". UseShellExecute is false because we're specifying
- // an executable directly and in this case depending on it being in a PATH folder. By setting
- // RedirectStandardOutput to true, the output of cl.exe is directed to the Process.StandardOutput stream
- // which is then displayed in this console window directly.
- Process^ compiler = gcnew Process;
- compiler->StartInfo->FileName = "cl.exe";
- compiler->StartInfo->Arguments = "/clr stdstr.cpp /link /out:sample.exe";
- compiler->StartInfo->UseShellExecute = false;
- compiler->StartInfo->RedirectStandardOutput = true;
- compiler->Start();
-
- Console::WriteLine( compiler->StandardOutput->ReadToEnd() );
-
- compiler->WaitForExit();
- //
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp b/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp
deleted file mode 100644
index 194770fb873..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-// System::Diagnostics::Process::MainWindowTitle
-/* The following program demonstrates the property 'MainWindowTitle' of class 'Process'.
-It creates a new process notepad on local computer and displays its caption to console.
-*/
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-int main()
-{
- try
- {
-
- // Create an instance of process component.
- Process^ myProcess = gcnew Process;
-
- // Create an instance of 'myProcessStartInfo'.
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo;
- myProcessStartInfo->FileName = "notepad";
- myProcess->StartInfo = myProcessStartInfo;
-
- // Start process.
- myProcess->Start();
-
- // Allow the process to finish starting.
- myProcess->WaitForInputIdle();
- Console::Write( "Main window Title : {0}", myProcess->MainWindowTitle );
- myProcess->CloseMainWindow();
- myProcess->Close();
- }
- catch ( Exception^ e )
- {
- Console::Write( " Message : {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp
deleted file mode 100644
index b295733c646..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// System::Diagnostics::Process::StandardError
-/*
-The following example demonstrates property 'StandardError' of
-'Process' class.
-
-It starts a process(net.exe) which writes an error message on to the standard
-error when a bad network path is given. This program gets 'StandardError' of
-net.exe process and reads output from its stream reader.*/
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-using namespace System::IO;
-
-void GetStandardError( array^args )
-{
-//
- Process^ myProcess = gcnew Process;
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "net ",String::Concat( "use ", args[ 0 ] ) );
-
- myProcessStartInfo->UseShellExecute = false;
- myProcessStartInfo->RedirectStandardError = true;
- myProcess->StartInfo = myProcessStartInfo;
- myProcess->Start();
-
- StreamReader^ myStreamReader = myProcess->StandardError;
- // Read the standard error of net.exe and write it on to console.
- Console::WriteLine( myStreamReader->ReadLine() );
- myProcess->Close();
-//
-}
-
-void main( int argc, char *argv[] )
-{
- if ( argc < 2 )
- {
- Console::WriteLine( "\nThis requires a machine name as a parameter which is not on the network." );
- Console::WriteLine( "\nUsage:" );
- Console::WriteLine( "Process_StandardError <\\\\machine name>" );
- }
- else
- {
- GetStandardError( Environment::GetCommandLineArgs() );
- }
- return;
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp
deleted file mode 100644
index 02249c8a531..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-/// System.Diagnostics.Process.StandardInput
-//
-//
-// The following example illustrates how to redirect the StandardInput
-// stream of a process. The example starts the sort command with
-// redirected input. It then prompts the user for text, and passes
-// that to the sort command by means of the redirected input stream.
-// The sort command results are displayed to the user on the console.
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-int main()
-{
- Console::WriteLine( "Ready to sort one or more text lines..." );
-
- // Start the Sort.exe process with redirected input.
- // Use the sort command to sort the input text.
- Process^ myProcess = gcnew Process;
- if ( myProcess )
- {
- myProcess->StartInfo->FileName = "Sort.exe";
- myProcess->StartInfo->UseShellExecute = false;
- myProcess->StartInfo->RedirectStandardInput = true;
- myProcess->Start();
- StreamWriter^ myStreamWriter = myProcess->StandardInput;
- if ( myStreamWriter )
- {
-
- // Prompt the user for input text lines to sort.
- // Write each line to the StandardInput stream of
- // the sort command.
- String^ inputText;
- int numLines = 0;
- do
- {
- Console::WriteLine( "Enter a line of text (or press the Enter key to stop):" );
- inputText = Console::ReadLine();
- if ( inputText && inputText->Length > 0 )
- {
- numLines++;
- myStreamWriter->WriteLine( inputText );
- }
- }
- while ( inputText && inputText->Length != 0 );
-
- // Write a report header to the console.
- if ( numLines > 0 )
- {
- Console::WriteLine( " {0} sorted text line(s) ", numLines.ToString() );
- Console::WriteLine( "------------------------" );
- }
- else
- {
- Console::WriteLine( " No input was sorted" );
- }
-
- // End the input stream to the sort command.
- // When the stream closes, the sort command
- // writes the sorted text lines to the
- // console.
- myStreamWriter->Close();
- }
-
- // Wait for the sort process to write the sorted text lines.
- myProcess->WaitForExit();
- myProcess->Close();
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp
deleted file mode 100644
index 6820437e824..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-using namespace System;
-using namespace System::IO;
-using namespace System::Diagnostics;
-
-int main()
-{
- Process^ process = gcnew Process();
- process->StartInfo->FileName = "ipconfig.exe";
- process->StartInfo->UseShellExecute = false;
- process->StartInfo->RedirectStandardOutput = true;
- process->Start();
-
- // Synchronously read the standard output of the spawned process->
- StreamReader^ reader = process->StandardOutput;
- String^ output = reader->ReadToEnd();
-
- // Write the redirected output to this application's window.
- Console::WriteLine(output);
-
- process->WaitForExit();
- process->Close();
-
- Console::WriteLine("\n\nPress any key to exit");
- Console::ReadLine();
- return 0;
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp
deleted file mode 100644
index 7494c07f40a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-// System::Diagnostics::Process::SynchronizingObject
-
-/*
-The following example demonstrates the property 'SynchronizingObject'
-of 'Process' class.
-
-It starts a process 'mspaint.exe' on button click.
-It attaches 'MyProcessExited' method of 'MyButton' class as EventHandler to
-'Exited' event of the process.
-*/
-
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::Windows::Forms;
-
-ref class Form1: public System::Windows::Forms::Form
-{
-private:
- System::ComponentModel::Container^ components;
-
- //
- ref class MyButton: public Button
- {
- public:
- void MyProcessExited( Object^ source, EventArgs^ e )
- {
- MessageBox::Show( "The process has exited." );
- }
- };
-
-public:
- MyButton^ button1;
-private:
- void MyProcessExited( Object^ source, EventArgs^ e )
- {
- MessageBox::Show( "The process has exited." );
- }
- void button1_Click( Object^ sender, EventArgs^ e )
- {
- Process^ myProcess = gcnew Process;
- ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "mspaint" );
- myProcess->StartInfo = myProcessStartInfo;
- myProcess->Start();
- myProcess->Exited += gcnew System::EventHandler( this, &Form1::MyProcessExited );
-
- // Set 'EnableRaisingEvents' to true, to raise 'Exited' event when process is terminated.
- myProcess->EnableRaisingEvents = true;
-
- // Set method handling the exited event to be called ;
- // on the same thread on which MyButton was created.
- myProcess->SynchronizingObject = button1;
- MessageBox::Show( "Waiting for the process 'mspaint' to exit...." );
- myProcess->WaitForExit();
- myProcess->Close();
- }
- //
-
- void InitializeComponent()
- {
- this->button1 = gcnew MyButton;
- this->SuspendLayout();
-
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point( 40, 80 );
- this->button1->Name = "button1";
- this->button1->Size = System::Drawing::Size( 168, 32 );
- this->button1->TabIndex = 0;
- this->button1->Text = "Click Me";
- this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
-
- //
- // Form1
- //
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 292, 273 );
- array^newControls = {this->button1};
- this->Controls->AddRange( newControls );
- this->Name = "Form1";
- this->Text = "Form1";
- this->ResumeLayout( false );
- }
-
-public:
- ~Form1()
- {
- if ( components != nullptr )
- {
- delete components;
- }
- }
-
-public:
- Form1()
- : components( nullptr )
- {
- InitializeComponent();
- }
-};
-
-[STAThread]
-void main()
-{
- Application::Run( gcnew Form1 );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp
deleted file mode 100644
index 70a6c01850b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-// This is kind of a ripoff of 'process_synchronizingobject.cs' for use as a znippet
-// for the remarks section.
-
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::Windows::Forms;
-
-namespace SynchronizingObjectTest
-{
- public ref class SyncForm : System::Windows::Forms::Form
- {
-
- public:
- SyncForm() : components( nullptr )
- {
- InitializeComponent();
- }
-
- ~SyncForm()
- {
- if ( components != nullptr )
- {
- delete components;
- }
- }
-
- static void Main()
- {
- Application::Run(gcnew SyncForm);
- }
-#if 0 // Dispose is implicit
- protected:
- virtual void Dispose( bool disposing ) override
- {
- if( disposing )
- {
- if (components != null)
- {
- components->Dispose();
- }
- }
- base->Dispose( disposing );
- }
-#endif
-
- private:
- System::ComponentModel::Container^ components;
- Process^ process1;
- Button^ button1;
- Label^ label1;
-
- void InitializeComponent()
- {
- this->button1 = gcnew Button();
- this->label1 = gcnew Label();
- this->SuspendLayout();
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(20, 20);
- this->button1->Name = "button1";
- this->button1->Size = System::Drawing::Size(160, 30);
- this->button1->TabIndex = 0;
- this->button1->Text = "Click Me";
- this->button1->Click += gcnew EventHandler(this, &SyncForm::button1_Click);
- //
- // textbox
- //
- this->label1->Location = System::Drawing::Point(20, 20);
- this->label1->Name = "textbox1";
- this->label1->Size = System::Drawing::Size(160, 30);
- this->label1->TabIndex = 1;
- this->label1->Text = "Waiting for the process 'notepad' to exit....";
- this->label1->ForeColor = System::Drawing::Color::Red;
- this->label1->Visible = false;
- //
- // Form1
- //
- this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
- this->ClientSize = System::Drawing::Size(200, 70);
- this->Controls->Add(this->button1);
- this->Controls->Add(this->label1);
- this->Name = "SyncForm";
- this->Text = "SyncForm";
- this->ResumeLayout(false);
- }
-
-
-
- void button1_Click(Object^ sender, System::EventArgs^ e)
- {
- this->button1->Hide();
- this->label1->Show();
-
- process1 = gcnew Process();
- ProcessStartInfo^ process1StartInfo= gcnew ProcessStartInfo("notepad");
-
- //
- this->process1->StartInfo->Domain = "";
- this->process1->StartInfo->LoadUserProfile = false;
- this->process1->StartInfo->Password = nullptr;
- this->process1->StartInfo->StandardErrorEncoding = nullptr;
- this->process1->StartInfo->StandardOutputEncoding = nullptr;
- this->process1->StartInfo->UserName = "";
- this->process1->SynchronizingObject = this;
- //
-
- // Set method handling the exited event to be called
- process1->Exited += gcnew EventHandler(this, &SyncForm::TheProcessExited);
- // Set 'EnableRaisingEvents' to true, to raise 'Exited' event when process is terminated.
- process1->EnableRaisingEvents = true;
-
- this->Refresh();
- process1->StartInfo = process1StartInfo;
- process1->Start();
-
- process1->WaitForExit();
- process1->Close();
- }
-
- void TheProcessExited(Object^ source, EventArgs^ e)
- {
- this->label1->Hide();
- this->button1->Show();
- MessageBox::Show("The process has exited.");
- }
- };
-}
-
-[STAThread]
-int main()
-{
- SynchronizingObjectTest::SyncForm::Main();
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp b/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp
deleted file mode 100644
index 327d731d991..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- try
- {
- // Create an instance of StreamReader to read from a file.
- StreamReader^ sr = gcnew StreamReader( "TestFile.txt" );
- try
- {
- String^ line;
-
- // Read and display lines from the file until the end of
- // the file is reached.
- while ( line = sr->ReadLine() )
- {
- Console::WriteLine( line );
- }
- }
- finally
- {
- if ( sr )
- delete (IDisposable^)sr;
- }
- }
- catch ( Exception^ e )
- {
- // Let the user know what went wrong.
- Console::WriteLine( "The file could not be read:" );
- Console::WriteLine( e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp b/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp
deleted file mode 100644
index abd2bed7dea..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-
-//
-// For Directory::GetFiles and Directory::GetDirectories
-//
-// For File::Exists, Directory::Exists
-using namespace System;
-using namespace System::IO;
-using namespace System::Collections;
-
-// Insert logic for processing found files here.
-void ProcessFile( String^ path )
-{
- Console::WriteLine( "Processed file '{0}'.", path );
-}
-
-
-// Process all files in the directory passed in, recurse on any directories
-// that are found, and process the files they contain.
-void ProcessDirectory( String^ targetDirectory )
-{
-
- // Process the list of files found in the directory.
- array^fileEntries = Directory::GetFiles( targetDirectory );
- IEnumerator^ files = fileEntries->GetEnumerator();
- while ( files->MoveNext() )
- {
- String^ fileName = safe_cast(files->Current);
- ProcessFile( fileName );
- }
-
-
- // Recurse into subdirectories of this directory.
- array^subdirectoryEntries = Directory::GetDirectories( targetDirectory );
- IEnumerator^ dirs = subdirectoryEntries->GetEnumerator();
- while ( dirs->MoveNext() )
- {
- String^ subdirectory = safe_cast(dirs->Current);
- ProcessDirectory( subdirectory );
- }
-}
-
-int main( int argc, char *argv[] )
-{
- for ( int i = 1; i < argc; i++ )
- {
- String^ path = gcnew String(argv[ i ]);
- if ( File::Exists( path ) )
- {
-
- // This path is a file
- ProcessFile( path );
- }
- else
- if ( Directory::Exists( path ) )
- {
-
- // This path is a directory
- ProcessDirectory( path );
- }
- else
- {
- Console::WriteLine( "{0} is not a valid file or directory.", path );
- }
-
- }
-}
-
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp
deleted file mode 100644
index b873188879c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-// This console application illustrates various uses
-// of the StackTrace and StackFrame classes.
-namespace SampleInternal
-{
- public ref class ClassLevel6
- {
- public:
- void Level6Method()
- {
- throw gcnew Exception( "An error occurred in the lowest internal class method." );
- }
-
- };
-
- public ref class ClassLevel5
- {
- public:
-
- //
- void Level5Method()
- {
- try
- {
- ClassLevel6^ nestedClass = gcnew ClassLevel6;
- nestedClass->Level6Method();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( " Level5Method exception handler" );
- StackTrace^ st = gcnew StackTrace;
-
- // Display the most recent function call.
- StackFrame^ sf = st->GetFrame( 0 );
- Console::WriteLine();
- Console::WriteLine( " Exception in method: " );
- Console::WriteLine( " {0}", sf->GetMethod() );
- if ( st->FrameCount > 1 )
- {
-
- // Display the highest-level function call
- // in the trace.
- sf = st->GetFrame( st->FrameCount - 1 );
- Console::WriteLine( " Original function call at top of call stack):" );
- Console::WriteLine( " {0}", sf->GetMethod() );
- }
- Console::WriteLine();
- Console::WriteLine( " ... throwing exception to next level ..." );
- Console::WriteLine( "-------------------------------------------------\n" );
- throw e;
- }
-
- }
-
- //
- };
-
- public ref class ClassLevel4
- {
- public:
- void Level4Method()
- {
-
- //
- try
- {
- ClassLevel5^ nestedClass = gcnew ClassLevel5;
- nestedClass->Level5Method();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( " Level4Method exception handler" );
-
- // Build a stack trace from a dummy stack frame.
- // Explicitly specify the source file name, line number
- // and column number.
- StackTrace^ st = gcnew StackTrace( gcnew StackFrame( "source.cs",79,24 ) );
- Console::WriteLine( " Stack trace with dummy stack frame: {0}", st->ToString() );
-
- // Access the StackFrames explicitly to display the file
- // name, line number and column number properties.
- // StackTrace.ToString only includes the method name.
- for ( int i = 0; i < st->FrameCount; i++ )
- {
- StackFrame^ sf = st->GetFrame( i );
- Console::WriteLine( " File: {0}", sf->GetFileName() );
- Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() );
- Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() );
-
- }
- Console::WriteLine();
- Console::WriteLine( " ... throwing exception to next level ..." );
- Console::WriteLine( "-------------------------------------------------\n" );
- throw e;
- }
-
-
- //
- }
-
- };
-
- public ref class ClassLevel3
- {
- public:
-
- //
- void Level3Method()
- {
- try
- {
- ClassLevel4^ nestedClass = gcnew ClassLevel4;
- nestedClass->Level4Method();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( " Level3Method exception handler" );
-
- // Build a stack trace from a dummy stack frame.
- // Explicitly specify the source file name and line number.
- StackTrace^ st = gcnew StackTrace( gcnew StackFrame( "source.cs",60 ) );
- Console::WriteLine( " Stack trace with dummy stack frame: {0}", st->ToString() );
- for ( int i = 0; i < st->FrameCount; i++ )
- {
-
- //
- // Display the stack frame properties.
- StackFrame^ sf = st->GetFrame( i );
- Console::WriteLine( " File: {0}", sf->GetFileName() );
- Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() );
-
- // Note that the column number defaults to zero
- // when not initialized.
- Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() );
- Console::WriteLine( " Intermediate Language Offset: {0}", sf->GetILOffset().ToString() );
- Console::WriteLine( " Native Offset: {0}", sf->GetNativeOffset().ToString() );
-
- //
-
- }
- Console::WriteLine();
- Console::WriteLine( " ... throwing exception to next level ..." );
- Console::WriteLine( "-------------------------------------------------\n" );
- throw e;
- }
-
- }
-
- //
- };
-
- public ref class ClassLevel2
- {
- public:
-
- //
- void Level2Method()
- {
- try
- {
- ClassLevel3^ nestedClass = gcnew ClassLevel3;
- nestedClass->Level3Method();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( " Level2Method exception handler" );
-
- // Display the full call stack at this level.
- StackTrace^ st1 = gcnew StackTrace( true );
- Console::WriteLine( " Stack trace for this level: {0}", st1->ToString() );
-
- // Build a stack trace from one frame, skipping the
- // current frame and using the next frame.
- StackTrace^ st2 = gcnew StackTrace( gcnew StackFrame( 1,true ) );
- Console::WriteLine( " Stack trace built with next level frame: {0}", st2->ToString() );
-
- // Build a stack trace skipping the current frame, and
- // including all the other frames.
- StackTrace^ st3 = gcnew StackTrace( 1,true );
- Console::WriteLine( " Stack trace built from the next level up: {0}", st3->ToString() );
- Console::WriteLine();
- Console::WriteLine( " ... throwing exception to next level ..." );
- Console::WriteLine( "-------------------------------------------------\n" );
- throw e;
- }
-
- }
-
- //
- };
-
- public ref class ClassLevel1
- {
- public:
-
- //
- void InternalMethod()
- {
- try
- {
- ClassLevel2^ nestedClass = gcnew ClassLevel2;
- nestedClass->Level2Method();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( " InternalMethod exception handler" );
-
- // Build a stack trace from one frame, skipping the
- // current frame and using the next frame. By
- // default, file and line information are not displayed.
- StackTrace^ st = gcnew StackTrace( gcnew StackFrame( 1 ) );
- Console::WriteLine( " Stack trace for next level frame: {0}", st->ToString() );
- Console::WriteLine( " Stack frame for next level: " );
- Console::WriteLine( " {0}", st->GetFrame( 0 )->ToString() );
- Console::WriteLine( " Line Number: {0}", st->GetFrame( 0 )->GetFileLineNumber().ToString() );
- Console::WriteLine();
- Console::WriteLine( " ... throwing exception to next level ..." );
- Console::WriteLine( "-------------------------------------------------\n" );
- throw e;
- }
-
- }
-
- //
- };
-
-}
-
-
-using namespace SampleInternal;
-
-namespace SamplePublic
-{
- class ConsoleApp
- {
- public:
-
- //
-
- [STAThread]
- static void Main()
- {
- ClassLevel1 ^ mainClass = gcnew ClassLevel1;
- try
- {
- mainClass->InternalMethod();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( " Main method exception handler" );
-
- // Display file and line information, if available.
- StackTrace^ st = gcnew StackTrace( gcnew StackFrame( true ) );
- Console::WriteLine( " Stack trace for current level: {0}", st->ToString() );
- Console::WriteLine( " File: {0}", st->GetFrame( 0 )->GetFileName() );
- Console::WriteLine( " Line Number: {0}", st->GetFrame( 0 )->GetFileLineNumber().ToString() );
- Console::WriteLine();
- Console::WriteLine( "-------------------------------------------------\n" );
- }
-
- }
-
- //
- };
-
-}
-
-int main()
-{
- SamplePublic::ConsoleApp::Main();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp
deleted file mode 100644
index 83e6e596d61..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-ref class StackTraceSample
-{
-private:
- ref class MyInternalClass
- {
- public:
- void ThrowsException()
- {
- try
- {
- throw gcnew Exception( "A problem was encountered." );
- }
- catch ( Exception^ e )
- {
-
- // Create a StackTrace that captures
- // filename, line number, and column
- // information for the current thread.
- StackTrace^ st = gcnew StackTrace( true );
- String^ stackIndent = "";
- for ( int i = 0; i < st->FrameCount; i++ )
- {
-
- // Note that at this level, there are five
- // stack frames, one for each method invocation.
- StackFrame^ sf = st->GetFrame( i );
- Console::WriteLine();
- Console::WriteLine( "{0}Method: {1}", stackIndent, sf->GetMethod() );
- Console::WriteLine( "{0}File: {1}", stackIndent, sf->GetFileName() );
- Console::WriteLine( "{0}Line Number: {1}", stackIndent, sf->GetFileLineNumber().ToString() );
- stackIndent = String::Concat( stackIndent, " " );
-
- }
- throw e;
- }
-
- }
-
- };
-
-
-protected:
- void MyProtectedMethod()
- {
- MyInternalClass^ mic = gcnew MyInternalClass;
- mic->ThrowsException();
- }
-
-
-public:
- void MyPublicMethod()
- {
- MyProtectedMethod();
- }
-
-};
-
-int main()
-{
- StackTraceSample^ sample = gcnew StackTraceSample;
- try
- {
- sample->MyPublicMethod();
- }
- catch ( Exception^ )
- {
-
- // Create a StackTrace that captures
- // filename, line number, and column
- // information for the current thread.
- StackTrace^ st = gcnew StackTrace( true );
- for ( int i = 0; i < st->FrameCount; i++ )
- {
-
- // For an executable built from C++, there
- // are two stack frames here: one for main,
- // and one for the _mainCRTStartup stub.
- StackFrame^ sf = st->GetFrame( i );
- Console::WriteLine();
- Console::WriteLine( "High up the call stack, Method: {0}", sf->GetMethod()->ToString() );
- Console::WriteLine( "High up the call stack, Line Number: {0}", sf->GetFileLineNumber().ToString() );
-
- }
- }
-
-}
-
-/*
-This console application produces the following output when
-compiled with the Debug configuration.
-
- Method: Void ThrowsException()
- File: c:\samples\stacktraceframe\myclass.cpp
- Line Number: 20
-
- Method: Void MyProtectedMethod()
- File: c:\samples\stacktraceframe\myclass.cpp
- Line Number: 45
-
- Method: Void MyPublicMethod()
- File: c:\samples\stacktraceframe\myclass.cpp
- Line Number: 50
-
- Method: Int32 main()
- File: c:\samples\stacktraceframe\myclass.cpp
- Line Number: 56
-
- Method: UInt32 _mainCRTStartup()
- File:
- Line Number: 0
-
- High up the call stack, Method: Int32 main()
- High up the call stack, Line Number: 62
-
- High up the call stack, Method: UInt32 _mainCRTStartup()
- High up the call stack, Line Number: 0
-
-This console application produces the following output when
-compiled with the Release configuration.
-
- Method: Void ThrowsException()
- File:
- Line Number: 0
-
- Method: Int32 main()
- File:
- Line Number: 0
-
- Method: UInt32 _mainCRTStartup()
- File:
- Line Number: 0
-
- High up the call stack, Method: Int32 main()
- High up the call stack, Line Number: 0
-
- High up the call stack, Method: UInt32 _mainCRTStartup()
- High up the call stack, Line Number: 0
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp
deleted file mode 100644
index 2dcb2ce73fc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-ref class MyConsoleApp
-{
-private:
- ref class MyInnerClass
- {
- public:
- void ThrowsException()
- {
- try
- {
- throw gcnew Exception( "A problem was encountered." );
- }
- catch ( Exception^ )
- {
-
- // Create a StackTrace starting at the next level
- // stack frame. Skip the first frame, the frame of
- // this level, which hides the internal implementation
- // of the ThrowsException method. Include the line
- // number, file name, and column number information
- // for each frame.
- //
- StackTrace^ st = gcnew StackTrace( 1,true );
- array^stFrames = st->GetFrames();
- for ( int i; i < stFrames->Length; i++ )
- {
- StackFrame^ sf = stFrames[ i ];
- Console::WriteLine( "Method: {0}", sf->GetMethod() );
-
- }
- //
- }
-
- }
-
- };
-
-
-public:
- void MyPublicMethod()
- {
- MyInnerClass^ helperClass = gcnew MyInnerClass;
- helperClass->ThrowsException();
- }
-
-};
-
-void main()
-{
- MyConsoleApp^ myApp = gcnew MyConsoleApp;
- myApp->MyPublicMethod();
-}
-
-/*
-This console application produces the following output
-when compiled with optimization off.
-
-Note that the ThrowsException() method is not identified in
-this stack trace.
-
- Method: Void MyPublicMethod()
- Method: Void Main()
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp
deleted file mode 100644
index 49e44641a2b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-ref class MyConsoleApp
-{
-private:
-
- //
- ref class MyInnerClass
- {
- public:
- void ThrowsException()
- {
- try
- {
- throw gcnew Exception( "A problem was encountered." );
- }
- catch ( Exception^ )
- {
-
- // Log the Exception. We do not want to reveal the
- // inner workings of the class, or be too verbose, so
- // we will create a StackTrace with a single
- // StackFrame, where the frame is that of the calling
- // method.
- //
- StackFrame^ fr = gcnew StackFrame( 1,true );
- StackTrace^ st = gcnew StackTrace( fr );
- EventLog::WriteEntry( fr->GetMethod()->Name, st->ToString(), EventLogEntryType::Warning );
- //
-
- // Note that whenever this application is run, the EventLog
- // contains an Event similar to the following Event.
- //
- // Event Type: Warning
- // Event Source: MyPublicMethod
- // Event Category: None
- // Event ID: 0
- // Date: 6/17/2001
- // Time: 6:39:56 PM
- // User: N/A
- // Computer: MYCOMPUTER
- // Description:
- //
- // at MyConsoleApp.MyPublicMethod()
- //
- // For more information, see Help and Support Center at
- // http://go.microsoft.com/fwlink/events.asp.
- }
-
- }
-
- };
- //
-
-
-public:
-
- //
- void MyPublicMethod()
- {
- MyInnerClass^ helperClass = gcnew MyInnerClass;
- helperClass->ThrowsException();
- }
-
-};
-
-void main()
-{
- MyConsoleApp^ helperClass = gcnew MyConsoleApp;
- helperClass->MyPublicMethod();
-}
-
-/*
-This console application produces the following output
-when compiled with optimization off.
-
-Note that the ThrowsException() method is not identified in
-this stack trace.
-
- Method: Void MyPublicMethod()
- Method: Void Main()
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp
deleted file mode 100644
index 3b2fe7a7575..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-// System.Diagnostics.Stopwatch
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-//
-void DisplayTimerProperties()
-{
- // Display the timer frequency and resolution.
- if ( Stopwatch::IsHighResolution )
- {
- Console::WriteLine( "Operations timed using the system's high-resolution performance counter." );
- }
- else
- {
- Console::WriteLine( "Operations timed using the DateTime class." );
- }
-
- Int64 frequency = Stopwatch::Frequency;
- Console::WriteLine( " Timer frequency in ticks per second = {0}", frequency );
- Int64 nanosecPerTick = (1000L * 1000L * 1000L) / frequency;
- Console::WriteLine( " Timer is accurate within {0} nanoseconds", nanosecPerTick );
-}
-//
-
-//
-void TimeOperations()
-{
- Int64 nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch::Frequency;
- const long numIterations = 10000;
-
- // Define the operation title names.
- array^operationNames = {"Operation: Int32.Parse(\"0\")","Operation: Int32.TryParse(\"0\")","Operation: Int32.Parse(\"a\")","Operation: Int32.TryParse(\"a\")"};
-
- // Time four different implementations for parsing
- // an integer from a string.
- for ( int operation = 0; operation <= 3; operation++ )
- {
- //
- // Define variables for operation statistics.
- Int64 numTicks = 0;
- Int64 numRollovers = 0;
- Int64 maxTicks = 0;
- Int64 minTicks = Int64::MaxValue;
- int indexFastest = -1;
- int indexSlowest = -1;
- Int64 milliSec = 0;
- Stopwatch ^ time10kOperations = Stopwatch::StartNew();
-
- // Run the current operation 10001 times.
- // The first execution time will be tossed
- // out, since it can skew the average time.
- for ( int i = 0; i <= numIterations; i++ )
- {
- //
- Int64 ticksThisTime = 0;
- int inputNum;
- Stopwatch ^ timePerParse;
- switch ( operation )
- {
- case 0:
-
- // Parse a valid integer using
- // a try-catch statement.
- // Start a new stopwatch timer.
- timePerParse = Stopwatch::StartNew();
- try
- {
- inputNum = Int32::Parse( "0" );
- }
- catch ( FormatException^ )
- {
- inputNum = 0;
- }
-
- // Stop the timer, and save the
- // elapsed ticks for the operation.
- timePerParse->Stop();
- ticksThisTime = timePerParse->ElapsedTicks;
- break;
-
- case 1:
-
- // Parse a valid integer using
- // the TryParse statement.
- // Start a new stopwatch timer.
- timePerParse = Stopwatch::StartNew();
- if ( !Int32::TryParse( "0", inputNum ) )
- {
- inputNum = 0;
- }
-
- // Stop the timer, and save the
- // elapsed ticks for the operation.
- timePerParse->Stop();
- ticksThisTime = timePerParse->ElapsedTicks;
- break;
-
- case 2:
-
- // Parse an invalid value using
- // a try-catch statement.
- // Start a new stopwatch timer.
- timePerParse = Stopwatch::StartNew();
- try
- {
- inputNum = Int32::Parse( "a" );
- }
- catch ( FormatException^ )
- {
- inputNum = 0;
- }
-
- // Stop the timer, and save the
- // elapsed ticks for the operation.
- timePerParse->Stop();
- ticksThisTime = timePerParse->ElapsedTicks;
- break;
-
- case 3:
-
- // Parse an invalid value using
- // the TryParse statement.
- // Start a new stopwatch timer.
- timePerParse = Stopwatch::StartNew();
- if ( !Int32::TryParse( "a", inputNum ) )
- {
- inputNum = 0;
- }
-
- // Stop the timer, and save the
- // elapsed ticks for the operation.
- timePerParse->Stop();
- ticksThisTime = timePerParse->ElapsedTicks;
- break;
-
- default:
- break;
- }
- //
-
- // Skip over the time for the first operation,
- // just in case it caused a one-time
- // performance hit.
- if ( i == 0 )
- {
- time10kOperations->Reset();
- time10kOperations->Start();
- }
- else
- {
- // Update operation statistics
- // for iterations 1-10001.
- if ( maxTicks < ticksThisTime )
- {
- indexSlowest = i;
- maxTicks = ticksThisTime;
- }
- if ( minTicks > ticksThisTime )
- {
- indexFastest = i;
- minTicks = ticksThisTime;
- }
- numTicks += ticksThisTime;
- if ( numTicks < ticksThisTime )
- {
- // Keep track of rollovers.
- numRollovers++;
- }
- }
- }
-
- // Display the statistics for 10000 iterations.
- time10kOperations->Stop();
- milliSec = time10kOperations->ElapsedMilliseconds;
- Console::WriteLine();
- Console::WriteLine( "{0} Summary:", operationNames[ operation ] );
- Console::WriteLine( " Slowest time: #{0}/{1} = {2} ticks", indexSlowest, numIterations, maxTicks );
- Console::WriteLine( " Fastest time: #{0}/{1} = {2} ticks", indexFastest, numIterations, minTicks );
- Console::WriteLine( " Average time: {0} ticks = {1} nanoseconds", numTicks / numIterations, (numTicks * nanosecPerTick) / numIterations );
- Console::WriteLine( " Total time looping through {0} operations: {1} milliseconds", numIterations, milliSec );
- //
-
- }
-}
-//
-
-int main()
-{
- DisplayTimerProperties();
- Console::WriteLine();
- Console::WriteLine( "Press the Enter key to begin:" );
- Console::ReadLine();
- Console::WriteLine();
- TimeOperations();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp b/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp
deleted file mode 100644
index 15c96facbe9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-//Types:System.Globalization.StringInfo
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Globalization;
-
-
-// Show how to enumerate each real character (honoring surrogates)
-// in a string.
-
-void EnumTextElements(String^ combiningChars)
-{
- // This StringBuilder holds the output results.
- StringBuilder^ sb = gcnew StringBuilder();
-
- // Use the enumerator returned from GetTextElementEnumerator
- // method to examine each real character.
- TextElementEnumerator^ charEnum =
- StringInfo::GetTextElementEnumerator(combiningChars);
- while (charEnum->MoveNext())
- {
- sb->AppendFormat("Character at index {0} is '{1}'{2}",
- charEnum->ElementIndex, charEnum->GetTextElement(),
- Environment::NewLine);
- }
-
- // Show the results.
- Console::WriteLine("Result of GetTextElementEnumerator:");
- Console::WriteLine(sb);
-}
-
-
-// Show how to discover the index of each real character
-// (honoring surrogates) in a string.
-
-void EnumTextElementIndexes(String^ combiningChars)
-{
- // This StringBuilder holds the output results.
- StringBuilder^ sb = gcnew StringBuilder();
-
- // Use the ParseCombiningCharacters method to
- // get the index of each real character in the string.
- array ^ textElemIndex =
- StringInfo::ParseCombiningCharacters(combiningChars);
-
- // Iterate through each real character showing the character
- // and the index where it was found.
- for (int i = 0; i < textElemIndex->Length; i++)
- {
- sb->AppendFormat("Character {0} starts at index {1}{2}",
- i, textElemIndex[i], Environment::NewLine);
- }
-
- // Show the results.
- Console::WriteLine("Result of ParseCombiningCharacters:");
- Console::WriteLine(sb);
-}
-
-int main()
-{
-
- // The string below contains combining characters.
- String^ combiningChars = L"a\u0304\u0308bc\u0327";
-
- // Show each 'character' in the string.
- EnumTextElements(combiningChars);
-
- // Show the index in the string where each 'character' starts.
- EnumTextElementIndexes(combiningChars);
-
-};
-
-// This code produces the following output.
-//
-// Result of GetTextElementEnumerator:
-// Character at index 0 is 'a-"'
-// Character at index 3 is 'b'
-// Character at index 4 is 'c,'
-//
-// Result of ParseCombiningCharacters:
-// Character 0 starts at index 0
-// Character 1 starts at index 3
-// Character 2 starts at index 4
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp b/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp
deleted file mode 100644
index 7d915b93810..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- //Create a FileInfo instance representing an existing text file.
- FileInfo^ MyFile = gcnew FileInfo( "c:\\csc.txt" );
-
- //Instantiate a StreamReader to read from the text file.
- StreamReader^ sr = MyFile->OpenText();
-
- //Read a single character.
- int FirstChar = sr->Read();
-
- //Display the ASCII number of the character read in both decimal and hexadecimal format.
- Console::WriteLine( "The ASCII number of the first character read is {0:D} in decimal and {1:X} in hexadecimal.", FirstChar, FirstChar );
-
- //
- sr->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp
deleted file mode 100644
index 91fe38d447f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
- StreamWriter^ sw = gcnew StreamWriter( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- FileStream^ fs = gcnew FileStream( path,FileMode::Open );
- try
- {
- StreamReader^ sr = gcnew StreamReader( fs );
- try
- {
- while ( sr->Peek() >= 0 )
- {
- Console::WriteLine( sr->ReadLine() );
- }
- }
- finally
- {
- delete sr;
- }
- }
- finally
- {
- delete fs;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp
deleted file mode 100644
index 9966a619ccf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
- StreamWriter^ sw = gcnew StreamWriter( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- StreamReader^ sr = gcnew StreamReader( path );
- try
- {
- while ( sr->Peek() >= 0 )
- {
- Console::WriteLine( sr->ReadLine() );
- }
- }
- finally
- {
- delete sr;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp
deleted file mode 100644
index 2bd7741e9da..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
-
- //Use an encoding other than the default (UTF8).
- StreamWriter^ sw = gcnew StreamWriter( path,false,gcnew UnicodeEncoding );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- StreamReader^ sr = gcnew StreamReader( path,true );
- try
- {
- while ( sr->Peek() >= 0 )
- {
- Console::Write( (Char)sr->Read() );
- }
-
- //Test for the encoding after reading, or at least
- //after the first read.
- Console::WriteLine( "The encoding used was {0}.", sr->CurrentEncoding );
- Console::WriteLine();
- }
- finally
- {
- delete sr;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp
deleted file mode 100644
index cbfd1711768..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
- StreamWriter^ sw = gcnew StreamWriter( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- StreamReader^ sr = gcnew StreamReader( path );
- try
- {
- while ( sr->Peek() > -1 )
- {
- Console::WriteLine( sr->ReadLine() );
- }
- }
- finally
- {
- delete sr;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp
deleted file mode 100644
index 3b817c31cf1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
- StreamWriter^ sw = gcnew StreamWriter( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- StreamReader^ sr = gcnew StreamReader( path );
- try
- {
- while ( sr->Peek() >= 0 )
- {
- Console::Write( (Char)sr->Read() );
- }
- }
- finally
- {
- delete sr;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp
deleted file mode 100644
index 5ce83649e21..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
- StreamWriter^ sw = gcnew StreamWriter( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- StreamReader^ sr = gcnew StreamReader( path );
- try
- {
- //This is an arbitrary size for this example.
- array^c = nullptr;
- while ( sr->Peek() >= 0 )
- {
- c = gcnew array(5);
- sr->Read( c, 0, c->Length );
-
- //The output will look odd, because
- //only five characters are read at a time.
- Console::WriteLine( c );
- }
- }
- finally
- {
- delete sr;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp
deleted file mode 100644
index 5829e1a8108..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
- StreamWriter^ sw = gcnew StreamWriter( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- StreamReader^ sr = gcnew StreamReader( path );
- try
- {
- while ( sr->Peek() >= 0 )
- {
- Console::WriteLine( sr->ReadLine() );
- }
- }
- finally
- {
- delete sr;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp
deleted file mode 100644
index 5ae01bcfc2e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ path = "c:\\temp\\MyTest.txt";
- try
- {
- if ( File::Exists( path ) )
- {
- File::Delete( path );
- }
- StreamWriter^ sw = gcnew StreamWriter( path );
- try
- {
- sw->WriteLine( "This" );
- sw->WriteLine( "is some text" );
- sw->WriteLine( "to test" );
- sw->WriteLine( "Reading" );
- }
- finally
- {
- delete sw;
- }
-
- StreamReader^ sr = gcnew StreamReader( path );
- try
- {
- //This allows you to do one Read operation.
- Console::WriteLine( sr->ReadToEnd() );
- }
- finally
- {
- delete sr;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The process failed: {0}", e );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp
deleted file mode 100644
index ab6a5a558b4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Create a reference to a directory.
- DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" );
-
- // Create the directory only if it does not already exist.
- if ( !di->Exists )
- di->Create();
-
-
- // Create a subdirectory in the directory just created.
- DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" );
-
- // Process that directory as required.
- // ...
- // Delete the subdirectory.
- dis->Delete( true );
-
- // Delete the directory.
- di->Delete( true );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp
deleted file mode 100644
index 26deda48521..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Make a reference to a directory.
- DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" );
-
- // Create the directory only if it does not already exist.
- if ( !di->Exists )
- di->Create();
-
-
- // Create a subdirectory in the directory just created.
- DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" );
-
- // Process that directory as required.
- // ...
- // Delete the subdirectory. The true indicates that if subdirectories
- // or files are in this directory, they are to be deleted as well.
- dis->Delete( true );
-
- // Delete the directory.
- di->Delete( true );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp
deleted file mode 100644
index e9e232e4458..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Make a reference to a directory.
- DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" );
-
- // Get a reference to each directory in that directory.
- array^diArr = di->GetDirectories();
-
- // Display the names of the directories.
- Collections::IEnumerator^ myEnum = diArr->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DirectoryInfo^ dri = safe_cast(myEnum->Current);
- Console::WriteLine( dri->Name );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp
deleted file mode 100644
index 3acf01cd274..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Make a reference to a directory.
- DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" );
-
- // Create the directory only if it does not already exist.
- if ( !di->Exists )
- di->Create();
-
-
- // Create a subdirectory in the directory just created.
- DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" );
-
- // Move the main directory. Note that the contents move with the directory.
- if ( !Directory::Exists( "NewTempDir" ) )
- di->MoveTo( "NewTempDir" );
-
- try
- {
-
- // Attempt to delete the subdirectory. Note that because it has been
- // moved, an exception is thrown.
- dis->Delete( true );
- }
- catch ( Exception^ )
- {
-
- // Handle this exception in some way, such as with the following code:
- // Console::WriteLine(S"That directory does not exist.");
- }
-
-
- // Point the DirectoryInfo reference to the new directory.
- //di = new DirectoryInfo(S"NewTempDir");
- // Delete the directory.
- //di->Delete(true);
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp
deleted file mode 100644
index 73ca8a192a8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Make a reference to a directory.
- DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" );
-
- // Create the directory only if it does not already exist.
- if ( !di->Exists )
- di->Create();
-
-
- // Create a subdirectory in the directory just created.
- DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" );
-
- // Get a reference to the parent directory of the subdirectory you just made.
- DirectoryInfo^ parentDir = dis->Parent;
- Console::WriteLine( "The parent directory of '{0}' is '{1}'", dis->Name, parentDir->Name );
-
- // Delete the parent directory.
- di->Delete( true );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp
deleted file mode 100644
index becae48d9ab..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-// System.Diagnostics.EventLogInstaller
-// The following example demonstrates the EventLogInstaller class.
-// It defines the instance SampleEventLogInstaller with the
-// attribute RunInstallerAttribute.
-//
-// The Log and Source properties of the new instance are set,
-// along with the new resource file properties,
-// and the instance is added to the collection of installers
-// to be run during an installation.
-//
-// Note:
-// 1) Run this program using the following command:
-// InstallUtil.exe
-// 2) Uninstall the event log created in step 1 using the
-// following command:
-// InstallUtil.exe /u
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Configuration::Install;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-
-[RunInstaller(true)]
-public ref class SampleEventLogInstaller : public Installer
-{
-private:
- EventLogInstaller^ myEventLogInstaller;
-
-public:
- SampleEventLogInstaller()
- {
-
- // Create an instance of an EventLogInstaller.
- myEventLogInstaller = gcnew EventLogInstaller;
-
- // Set the source name of the event log.
- myEventLogInstaller->Source = "ApplicationEventSource";
-
- // Set the event log into which the source writes entries.
- //myEventLogInstaller.Log = "MyCustomLog";
- myEventLogInstaller->Log = "myNewLog";
-
- // Set the resource file for the event log.
- // The message strings are defined in EventLogMsgs.mc; the message
- // identifiers used in the application must match those defined in the
- // corresponding message resource file. The messages must be built
- // into a Win32 resource library and copied to the target path on the
- // system.
- myEventLogInstaller->CategoryResourceFile =
- Environment::SystemDirectory + "\\eventlogmsgs.dll";
- myEventLogInstaller->CategoryCount = 3;
- myEventLogInstaller->MessageResourceFile =
- Environment::SystemDirectory + "\\eventlogmsgs.dll";
- myEventLogInstaller->ParameterResourceFile =
- Environment::SystemDirectory + "\\eventlogmsgs.dll";
-
- // Add myEventLogInstaller to the installer collection.
- Installers->Add( myEventLogInstaller );
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "Usage: InstallUtil.exe [.exe | .dll]" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp
deleted file mode 100644
index 7bfe2badf7e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-void CleanUp();
-void CreateEventSourceSample1( String^ messageFile );
-void WriteEventSample1();
-void WriteEventSample2();
-void EventInstanceSamples();
-
-//
-// The following constants match the message definitions
-// in the message resource file. They are used to specify
-// the resource identifier for a localized string in the
-// message resource file.
-// The message resource file is an .mc file built into a
-// Win32 resource file using the message compiler (MC) tool.
-//
-const short InstallCategoryMsgId = 1;
-const short QueryCategoryMsgId = 2;
-const short RefreshCategoryMsgId = 3;
-const short CategoryCount = 3;
-
-//
-//
-// Define the resource identifiers for the event messages.
-// Resource identifiers combine the message ID and the severity field.
-const long AuditSuccessMsgId = 1000;
-const long AuditFailedMsgId = 1001 + 0x80000000;
-const long InformationMsgId = 1002;
-const long WarningMsgId = 1003 + 0x80000000;
-const long UpdateCycleCompleteMsgId = 1004;
-const long ServerConnectionDownMsgId = 1005 + 0x80000000;
-
-//
-//
-const long DisplayNameMsgId = 5001;
-const long ServiceNameMsgId = 5002;
-
-//
-//
-
-[STAThread]
-int main()
-{
- array^args = Environment::GetCommandLineArgs();
- String^ messageFile;
- if ( args->Length > 1 )
- {
-
- // Use the input argument as the message resource file.
- messageFile = args[ 1 ];
- }
- else
- {
-
- // Use the default message dll.
- messageFile = String::Format( "{0}\\{1}", System::Environment::CurrentDirectory, "EventLogMsgs.dll" );
- }
-
- CleanUp();
- CreateEventSourceSample1( messageFile );
- WriteEventSample1();
- WriteEventSample2();
- EventInstanceSamples();
-}
-
-void CleanUp()
-{
- String^ sourceName = "SampleApplicationSource";
-
- // Delete the event source in order to re-register
- // the source with the latest configuration properties.
- if ( EventLog::SourceExists( sourceName ) )
- {
- Console::WriteLine( "Deleting event source {0}.", sourceName );
- EventLog::DeleteEventSource( sourceName );
- }
-}
-//
-void CreateEventSourceSample1( String^ messageFile )
-{
- String^ myLogName;
- String^ sourceName = "SampleApplicationSource";
-
- // Create the event source if it does not exist.
- if ( !EventLog::SourceExists( sourceName ) )
- {
-
- // Create a new event source for the custom event log
- // named "myNewLog."
- myLogName = "myNewLog";
- EventSourceCreationData ^ mySourceData = gcnew EventSourceCreationData( sourceName,myLogName );
-
- // Set the message resource file that the event source references.
- // All event resource identifiers correspond to text in this file.
- if ( !System::IO::File::Exists( messageFile ) )
- {
- Console::WriteLine( "Input message resource file does not exist - {0}", messageFile );
- messageFile = "";
- }
- else
- {
-
- // Set the specified file as the resource
- // file for message text, category text, and
- // message parameter strings.
- mySourceData->MessageResourceFile = messageFile;
- mySourceData->CategoryResourceFile = messageFile;
- mySourceData->CategoryCount = CategoryCount;
- mySourceData->ParameterResourceFile = messageFile;
- Console::WriteLine( "Event source message resource file set to {0}", messageFile );
- }
-
- Console::WriteLine( "Registering new source for event log." );
- EventLog::CreateEventSource( mySourceData );
- }
- else
- {
-
- // Get the event log corresponding to the existing source.
- myLogName = EventLog::LogNameFromSourceName( sourceName, "." );
- }
-
-
- // Register the localized name of the event log.
- // For example, the actual name of the event log is "myNewLog," but
- // the event log name displayed in the Event Viewer might be
- // "Sample Application Log" or some other application-specific
- // text.
- EventLog^ myEventLog = gcnew EventLog( myLogName,".",sourceName );
- if ( messageFile->Length > 0 )
- {
- myEventLog->RegisterDisplayName( messageFile, DisplayNameMsgId );
- }
-}
-//
-
-void WriteEventSample1()
-{
- //
- // Create the event source if it does not exist.
- String^ sourceName = "SampleApplicationSource";
- if ( !EventLog::SourceExists( sourceName ) )
- {
-
- // Call a local method to register the event log source
- // for the event log "myNewLog." Use the resource file
- // EventLogMsgs.dll in the current directory for message text.
- String^ messageFile = String::Format( "{0}\\{1}", System::Environment::CurrentDirectory, "EventLogMsgs.dll" );
- CreateEventSourceSample1( messageFile );
- }
-
- // Get the event log corresponding to the existing source.
- String^ myLogName = EventLog::LogNameFromSourceName( sourceName, "." );
- EventLog^ myEventLog = gcnew EventLog( myLogName,".",sourceName );
-
- // Define two audit events.
- // The message identifiers correspond to the message text in the
- // message resource file defined for the source.
- EventInstance ^ myAuditSuccessEvent = gcnew EventInstance( AuditSuccessMsgId,0,EventLogEntryType::SuccessAudit );
- EventInstance ^ myAuditFailEvent = gcnew EventInstance( AuditFailedMsgId,0,EventLogEntryType::FailureAudit );
-
- // Insert the method name into the event log message.
- array^insertStrings = {"EventLogSamples.WriteEventSample1"};
-
- // Write the events to the event log.
- myEventLog->WriteEvent( myAuditSuccessEvent, insertStrings );
-
- // Append binary data to the audit failure event entry.
- array^binaryData = {3,4,5,6};
- myEventLog->WriteEvent( myAuditFailEvent, binaryData, insertStrings );
-
- //
-}
-
-void WriteEventSample2()
-{
- //
- String^ sourceName = "SampleApplicationSource";
- if ( EventLog::SourceExists( sourceName ) )
- {
-
- // Define an informational event and a warning event.
- // The message identifiers correspond to the message text in the
- // message resource file defined for the source.
- EventInstance ^ myInfoEvent = gcnew EventInstance( InformationMsgId,0,EventLogEntryType::Information );
- EventInstance ^ myWarningEvent = gcnew EventInstance( WarningMsgId,0,EventLogEntryType::Warning );
-
- // Insert the method name into the event log message.
- array^insertStrings = {"EventLogSamples.WriteEventSample2"};
-
- // Write the events to the event log.
- EventLog::WriteEvent( sourceName, myInfoEvent, 0 );
-
- // Append binary data to the warning event entry.
- array^binaryData = {7,8,9,10};
- EventLog::WriteEvent( sourceName, myWarningEvent, binaryData, insertStrings );
- }
- else
- {
- Console::WriteLine( "Warning - event source {0} not registered", sourceName );
- }
- //
-}
-
-void EventInstanceSamples()
-{
-
- //
- // Ensure that the source has already been registered using
- // EventLogInstaller or EventLog.CreateEventSource.
- String^ sourceName = "SampleApplicationSource";
- if ( EventLog::SourceExists( sourceName ) )
- {
- // Define an informational event with no category.
- // The message identifier corresponds to the message text in the
- // message resource file defined for the source.
- EventInstance ^ myEvent = gcnew EventInstance( UpdateCycleCompleteMsgId,0 );
-
- // Write the event to the event log using the registered source.
- EventLog::WriteEvent( sourceName, myEvent, 0 );
-
- // Reuse the event data instance for another event entry.
- // Set the entry category and message identifiers for
- // the appropriate resource identifiers in the resource files
- // for the registered source. Set the event type to Warning.
- myEvent->CategoryId = RefreshCategoryMsgId;
- myEvent->EntryType = EventLogEntryType::Warning;
- myEvent->InstanceId = ServerConnectionDownMsgId;
-
- // Write the event to the event log using the registered source.
- // Insert the machine name into the event message text.
- array^ss = {Environment::MachineName};
- EventLog::WriteEvent( sourceName, myEvent, ss );
- }
- else
- {
- Console::WriteLine( "Warning - event source {0} not registered", sourceName );
- }
- //
- //
-
- // Get the event log corresponding to the existing source.
- String^ myLogName = EventLog::LogNameFromSourceName( sourceName, "." );
-
- // Find each instance of a specific event log entry in a
- // particular event log.
- EventLog^ myEventLog = gcnew EventLog( myLogName,"." );
- int count = 0;
- Console::WriteLine( "Searching event log entries for the event ID {0}...", ServerConnectionDownMsgId );
-
- // Search for the resource ID, display the event text,
- // and display the number of matching entries.
- System::Collections::IEnumerator^ myEnum = myEventLog->Entries->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- EventLogEntry^ entry = safe_cast(myEnum->Current);
- if ( entry->InstanceId == ServerConnectionDownMsgId )
- {
- count++;
- Console::WriteLine();
- Console::WriteLine( "Entry ID = {0}", entry->InstanceId );
- Console::WriteLine( "Reported at {0}", entry->TimeWritten );
- Console::WriteLine( "Message text:" );
- Console::WriteLine( "\t{0}", entry->Message );
- }
- }
-
- Console::WriteLine();
- Console::WriteLine( "Found {0} events with ID {1} in event log {2}.", count, ServerConnectionDownMsgId, myLogName );
- //
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp
deleted file mode 100644
index 9006e0e4c6d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- FileInfo^ fi = gcnew FileInfo( "temp.txt" );
-
- // Create a writer, ready to add entries to the file.
- StreamWriter^ sw = fi->AppendText();
- sw->WriteLine( "Add as many lines as you like..." );
- sw->WriteLine( "Add another line to the output..." );
- sw->Flush();
- sw->Close();
-
- // Get the information out of the file and display it.
- // Remember that the file might have other lines if it already existed.
- StreamReader^ sr = gcnew StreamReader( fi->OpenRead() );
- while ( sr->Peek() != -1 )
- Console::WriteLine( sr->ReadLine() );
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//Add as many lines as you like...
-//Add another line to the output...
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp
deleted file mode 100644
index 3b56ad744a1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Create a reference to a file, which might or might not exist.
- // If it does not exist, it is not yet created.
- FileInfo^ fi = gcnew FileInfo( "temp.txt" );
-
- // Create a writer, ready to add entries to the file.
- StreamWriter^ sw = fi->AppendText();
- sw->WriteLine( "Add as many lines as you like..." );
- sw->WriteLine( "Add another line to the output..." );
- sw->Flush();
- sw->Close();
-
- // Get the information out of the file and display it.
- StreamReader^ sr = gcnew StreamReader( fi->OpenRead() );
- Console::WriteLine( "This is the information in the first file:" );
- while ( sr->Peek() != -1 )
- Console::WriteLine( sr->ReadLine() );
-
-
- // Copy this file to another file. The true parameter specifies
- // that the file will be overwritten if it already exists.
- FileInfo^ newfi = fi->CopyTo( "newTemp.txt", true );
-
- // Get the information out of the new file and display it.* sr = new StreamReader( newfi->OpenRead() );
- Console::WriteLine( "{0}This is the information in the second file:", Environment::NewLine );
- while ( sr->Peek() != -1 )
- Console::WriteLine( sr->ReadLine() );
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is the information in the first file:
-//Add as many lines as you like...
-//Add another line to the output...
-//This is the information in the second file:
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp
deleted file mode 100644
index a5bcc91ed5d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Create a reference to a file.
- FileInfo^ fi = gcnew FileInfo( "temp.txt" );
-
- // Actually create the file.
- FileStream^ fs = fi->Create();
-
- // Modify the file as required, and then close the file.
- fs->Close();
-
- // Delete the file.
- fi->Delete();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp
deleted file mode 100644
index 194a71d29f4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Open an existing file, or create a new one.
- FileInfo^ fi = gcnew FileInfo( "temp.txt" );
-
- // Determine the full path of the file just created.
- DirectoryInfo^ di = fi->Directory;
-
- // Figure out what other entries are in that directory.
- array^fsi = di->GetFileSystemInfos();
- Console::WriteLine( "The directory '{0}' contains the following files and directories:", di->FullName );
-
- // Print the names of all the files and subdirectories of that directory.
- Collections::IEnumerator^ myEnum = fsi->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- FileSystemInfo^ info = safe_cast(myEnum->Current);
- Console::WriteLine( info->Name );
- }
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//The directory 'C:\Visual Studio 2005\release' contains the following files
-//and directories:
-//fileinfodirectory.exe
-//fileinfodirectory.pdb
-//newTemp.txt
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp
deleted file mode 100644
index bdd66b10555..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Open an existing file, or create a new one.
- FileInfo^ fi = gcnew FileInfo( "temp.txt" );
-
- // Create a writer, ready to add entries to the file.
- StreamWriter^ sw = fi->AppendText();
- sw->WriteLine( "This is a new entry to add to the file" );
- sw->WriteLine( "This is yet another line to add..." );
- sw->Flush();
- sw->Close();
-
- // Get the information out of the file and display it.
- StreamReader^ sr = gcnew StreamReader( fi->OpenRead() );
- while ( sr->Peek() != -1 )
- Console::WriteLine( sr->ReadLine() );
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//This is a new entry to add to the file
-//This is yet another line to add...
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp
deleted file mode 100644
index e29a987391a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Create a reference to the current directory.
- DirectoryInfo^ di = gcnew DirectoryInfo( Environment::CurrentDirectory );
-
- // Create an array representing the files in the current directory.
- array^fi = di->GetFiles();
- Console::WriteLine( "The following files exist in the current directory:" );
-
- // Print out the names of the files in the current directory.
- Collections::IEnumerator^ myEnum = fi->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- FileInfo^ fiTemp = safe_cast(myEnum->Current);
- Console::WriteLine( fiTemp->Name );
- }
-}
-
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//The following files exist in the current directory:
-//fileinfoname.exe
-//fileinfoname.pdb
-//newTemp.txt
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp
deleted file mode 100644
index 7919473364a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Open an existing file, or create a new one.
- FileInfo^ fi = gcnew FileInfo( "temp.txt" );
-
- // Open the file just specified such that no one else can use it.
- FileStream^ fs = fi->Open( FileMode::OpenOrCreate, FileAccess::ReadWrite, FileShare::None );
-
- // Create another reference to the same file.
- FileInfo^ nextfi = gcnew FileInfo( "temp.txt" );
- try
- {
-
- // Try opening the same file, which was locked by the previous process.
- nextfi->Open( FileMode::OpenOrCreate, FileAccess::Read );
- Console::WriteLine( "The file was not locked, and was opened by a second process." );
- }
- catch ( IOException^ )
- {
- Console::WriteLine( "The file could not be opened because it was locked by another process." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e );
- }
-
-
- // Close the file so it can be deleted.
- fs->Close();
-}
-//This code produces output similar to the following;
-//results may vary based on the computer/file structure/etc.:
-//
-//The file could not be opened because it was locked by another process.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp
deleted file mode 100644
index feda725012e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections::Generic;
-using namespace System::Collections::ObjectModel;
-
-void main()
-{
- List^ dinosaurs = gcnew List();
-
- dinosaurs->Add("Tyrannosaurus");
- dinosaurs->Add("Amargasaurus");
- dinosaurs->Add("Deinonychus");
- dinosaurs->Add("Compsognathus");
-
- ReadOnlyCollection^ readOnlyDinosaurs =
- gcnew ReadOnlyCollection(dinosaurs);
-
- Console::WriteLine();
- for each(String^ dinosaur in readOnlyDinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- Console::WriteLine("\nCount: {0}", readOnlyDinosaurs->Count);
-
- Console::WriteLine("\nContains(\"Deinonychus\"): {0}",
- readOnlyDinosaurs->Contains("Deinonychus"));
-
- Console::WriteLine("\nreadOnlyDinosaurs[3]: {0}",
- readOnlyDinosaurs[3]);
-
- Console::WriteLine("\nIndexOf(\"Compsognathus\"): {0}",
- readOnlyDinosaurs->IndexOf("Compsognathus"));
-
- Console::WriteLine("\nInsert into the wrapped List:");
- Console::WriteLine("Insert(2, \"Oviraptor\")");
- dinosaurs->Insert(2, "Oviraptor");
-
- Console::WriteLine();
- for each( String^ dinosaur in readOnlyDinosaurs )
- {
- Console::WriteLine(dinosaur);
- }
-
- array^ dinoArray =
- gcnew array(readOnlyDinosaurs->Count + 2);
- readOnlyDinosaurs->CopyTo(dinoArray, 1);
-
- Console::WriteLine("\nCopied array has {0} elements:",
- dinoArray->Length);
- for each( String^ dinosaur in dinoArray )
- {
- Console::WriteLine("\"{0}\"", dinosaur);
- }
-}
-
-/* This code example produces the following output:
-
-Tyrannosaurus
-Amargasaurus
-Deinonychus
-Compsognathus
-
-Count: 4
-
-Contains("Deinonychus"): True
-
-readOnlyDinosaurs[3]: Compsognathus
-
-IndexOf("Compsognathus"): 3
-
-Insert into the wrapped List:
-Insert(2, "Oviraptor")
-
-Tyrannosaurus
-Amargasaurus
-Oviraptor
-Deinonychus
-Compsognathus
-
-Copied array has 7 elements:
-""
-"Tyrannosaurus"
-"Amargasaurus"
-"Oviraptor"
-"Deinonychus"
-"Compsognathus"
-""
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp b/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp
deleted file mode 100644
index c576f3dc408..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-void CombinePaths( String^ p1, String^ p2 )
-{
- try
- {
- String^ combination = Path::Combine( p1, p2 );
- Console::WriteLine( "When you combine '{0}' and '{1}', the result is: {2}'{3}'", p1, p2, Environment::NewLine, combination );
- }
- catch ( Exception^ e )
- {
- if (p1 == nullptr)
- p1 = "nullptr";
- if (p2 == nullptr)
- p2 = "nullptr";
- Console::WriteLine( "You cannot combine '{0}' and '{1}' because: {2}{3}", p1, p2, Environment::NewLine, e->Message );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
- String^ path1 = "c:\\temp";
- String^ path2 = "subdir\\file.txt";
- String^ path3 = "c:\\temp.txt";
- String^ path4 = "c:^*&)(_=@#'\\^.*(.txt";
- String^ path5 = "";
- String^ path6 = nullptr;
- CombinePaths( path1, path2 );
- CombinePaths( path1, path3 );
- CombinePaths( path3, path2 );
- CombinePaths( path4, path2 );
- CombinePaths( path5, path2 );
- CombinePaths( path6, path2 );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp
deleted file mode 100644
index ea3629d178b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Diagnostics;
-using namespace System::Text;
-
-ref class StandardAsyncOutputExample
-{
-private:
- static int lineCount = 0;
- static StringBuilder^ output = nullptr;
-
-public:
- static void Run()
- {
- Process^ process = gcnew Process();
- process->StartInfo->FileName = "ipconfig.exe";
- process->StartInfo->UseShellExecute = false;
- process->StartInfo->RedirectStandardOutput = true;
- output = gcnew StringBuilder();
- process->OutputDataReceived += gcnew DataReceivedEventHandler(OutputHandler);
- process->Start();
-
- // Asynchronously read the standard output of the spawned process.
- // This raises OutputDataReceived events for each line of output.
- process->BeginOutputReadLine();
- process->WaitForExit();
-
- // Write the redirected output to this application's window.
- Console::WriteLine(output);
-
- process->WaitForExit();
- process->Close();
-
- Console::WriteLine("\n\nPress any key to exit");
- Console::ReadLine();
- }
-
-private:
- static void OutputHandler(Object^ sender, DataReceivedEventArgs^ e)
- {
- // Prepend line numbers to each line of the output.
- if (!String::IsNullOrEmpty(e->Data))
- {
- lineCount++;
- output->Append("\n[" + lineCount + "]: " + e->Data);
- }
- }
-};
-
-int main()
-{
- StandardAsyncOutputExample::Run();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp
deleted file mode 100644
index 6dc1d4e11d3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-// System.Diagnostics
-//
-// Requires .NET Framework version 1.2 or higher.
-
-// The following example uses the net view command to list the
-// available network resources available on a remote computer,
-// and displays the results to the console. Specifying the optional
-// error log file redirects error output to that file.
-
-//
-// Define the namespaces used by this sample.
-#using
-
-using namespace System;
-using namespace System::Text;
-using namespace System::Globalization;
-using namespace System::IO;
-using namespace System::Diagnostics;
-using namespace System::Threading;
-using namespace System::ComponentModel;
-
-ref class ProcessNetStreamRedirection
-{
-private:
- // Define static variables shared by class methods.
- static StreamWriter^ streamError = nullptr;
- static String^ netErrorFile = "";
- static StringBuilder^ netOutput = nullptr;
- static bool errorRedirect = false;
- static bool errorsWritten = false;
-
-public:
- static void RedirectNetCommandStreams()
- {
- String^ netArguments;
- Process^ netProcess;
-
- // Get the input computer name.
- Console::WriteLine( "Enter the computer name for the net view command:" );
- netArguments = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture );
- if ( String::IsNullOrEmpty( netArguments ) )
- {
- // Default to the help command if there is not an input argument.
- netArguments = "/?";
- }
-
- // Check if errors should be redirected to a file.
- errorsWritten = false;
- Console::WriteLine( "Enter a fully qualified path to an error log file" );
- Console::WriteLine( " or just press Enter to write errors to console:" );
- netErrorFile = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture );
- if ( !String::IsNullOrEmpty( netErrorFile ) )
- {
- errorRedirect = true;
- }
-
- // Note that at this point, netArguments and netErrorFile
- // are set with user input. If the user did not specify
- // an error file, then errorRedirect is set to false.
-
- // Initialize the process and its StartInfo properties.
- netProcess = gcnew Process;
- netProcess->StartInfo->FileName = "Net.exe";
-
- // Build the net command argument list.
- netProcess->StartInfo->Arguments = String::Format( "view {0}", netArguments );
-
- // Set UseShellExecute to false for redirection.
- netProcess->StartInfo->UseShellExecute = false;
-
- // Redirect the standard output of the net command.
- // This stream is read asynchronously using an event handler.
- netProcess->StartInfo->RedirectStandardOutput = true;
- netProcess->OutputDataReceived += gcnew DataReceivedEventHandler( NetOutputDataHandler );
- netOutput = gcnew StringBuilder;
- if ( errorRedirect )
- {
-
- // Redirect the error output of the net command.
- netProcess->StartInfo->RedirectStandardError = true;
- netProcess->ErrorDataReceived += gcnew DataReceivedEventHandler( NetErrorDataHandler );
- }
- else
- {
-
- // Do not redirect the error output.
- netProcess->StartInfo->RedirectStandardError = false;
- }
-
- Console::WriteLine( "\nStarting process: net {0}",
- netProcess->StartInfo->Arguments );
- if ( errorRedirect )
- {
- Console::WriteLine( "Errors will be written to the file {0}", netErrorFile );
- }
-
- // Start the process.
- netProcess->Start();
-
- // Start the asynchronous read of the standard output stream.
- netProcess->BeginOutputReadLine();
-
- if ( errorRedirect )
- {
- // Start the asynchronous read of the standard
- // error stream.
- netProcess->BeginErrorReadLine();
- }
-
- // Let the net command run, collecting the output.
- netProcess->WaitForExit();
-
- if ( streamError != nullptr )
- {
- // Close the error file.
- streamError->Close();
- }
- else
- {
- // Set errorsWritten to false if the stream is not
- // open. Either there are no errors, or the error
- // file could not be opened.
- errorsWritten = false;
- }
-
- if ( netOutput->Length > 0 )
- {
- // If the process wrote more than just
- // white space, write the output to the console.
- Console::WriteLine( "\nPublic network shares from net view:\n{0}\n",
- netOutput->ToString() );
- }
-
- if ( errorsWritten )
- {
- // Signal that the error file had something
- // written to it.
- array^errorOutput = File::ReadAllLines( netErrorFile );
- if ( errorOutput->Length > 0 )
- {
- Console::WriteLine( "\nThe following error output was appended to {0}.",
- netErrorFile );
- System::Collections::IEnumerator^ myEnum = errorOutput->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- String^ errLine = safe_cast(myEnum->Current);
- Console::WriteLine( " {0}", errLine );
- }
- }
- Console::WriteLine();
- }
-
- netProcess->Close();
-
- }
-
-private:
- static void NetOutputDataHandler( Object^ /*sendingProcess*/,
- DataReceivedEventArgs^ outLine )
- {
- // Collect the net view command output.
- if ( !String::IsNullOrEmpty( outLine->Data ) )
- {
- // Add the text to the collected output.
- netOutput->AppendFormat( "\n {0}", outLine->Data );
- }
- }
-
- static void NetErrorDataHandler( Object^ /*sendingProcess*/,
- DataReceivedEventArgs^ errLine )
- {
- // Write the error text to the file if there is something to
- // write and an error file has been specified.
-
- if ( !String::IsNullOrEmpty( errLine->Data ) )
- {
- if ( !errorsWritten )
- {
- if ( streamError == nullptr )
- {
- // Open the file.
- try
- {
- streamError = gcnew StreamWriter( netErrorFile,true );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Could not open error file!" );
- Console::WriteLine( e->Message->ToString() );
- }
- }
-
- if ( streamError != nullptr )
- {
- // Write a header to the file if this is the first
- // call to the error output handler.
- streamError->WriteLine();
- streamError->WriteLine( DateTime::Now.ToString() );
- streamError->WriteLine( "Net View error output:" );
- }
- errorsWritten = true;
- }
-
- if ( streamError != nullptr )
- {
- // Write redirected errors to the file.
- streamError->WriteLine( errLine->Data );
- streamError->Flush();
- }
- }
- }
-};
-//
-
-/// The main entry point for the application.
-void main()
-{
- try
- {
- ProcessNetStreamRedirection::RedirectNetCommandStreams();
- }
- catch ( InvalidOperationException^ e )
- {
- Console::WriteLine( "Exception:" );
- Console::WriteLine( e );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp
deleted file mode 100644
index 037704e8279..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-// System.Diagnostics
-//
-// Requires .NET Framework version 1.2 or higher.
-
-// Define the namespaces used by this sample.
-#using
-
-using namespace System;
-using namespace System::Text;
-using namespace System::IO;
-using namespace System::Diagnostics;
-using namespace System::Threading;
-using namespace System::ComponentModel;
-
-//
-ref class ProcessNMakeStreamRedirection
-{
-private:
- // Define static variables shared by class methods.
- static StreamWriter^ buildLogStream = nullptr;
- static Mutex^ logMutex = gcnew Mutex;
- static int maxLogLines = 25;
- static int currentLogLines = 0;
-
-public:
- static void RedirectNMakeCommandStreams()
- {
- String^ nmakeArguments = nullptr;
- Process^ nmakeProcess;
-
- // Get the input nmake command-line arguments.
- Console::WriteLine( "Enter the NMake command line arguments (@commandfile or /f makefile, etc):" );
- String^ inputText = Console::ReadLine();
- if ( !String::IsNullOrEmpty( inputText ) )
- {
- nmakeArguments = inputText;
- }
-
- Console::WriteLine( "Enter max line limit for log file (default is 25):" );
- inputText = Console::ReadLine();
- if ( !String::IsNullOrEmpty( inputText ) )
- {
- if ( !Int32::TryParse( inputText, maxLogLines ) )
- {
- maxLogLines = 25;
- }
- }
- Console::WriteLine( "Output beyond {0} lines will be ignored.",
- maxLogLines.ToString() );
-
- // Initialize the process and its StartInfo properties.
- nmakeProcess = gcnew Process;
- nmakeProcess->StartInfo->FileName = "NMake.exe";
-
- // Build the nmake command argument list.
- if ( !String::IsNullOrEmpty( nmakeArguments ) )
- {
- nmakeProcess->StartInfo->Arguments = nmakeArguments;
- }
-
- // Set UseShellExecute to false for redirection.
- nmakeProcess->StartInfo->UseShellExecute = false;
-
- // Redirect the standard output of the nmake command.
- // Read the stream asynchronously using an event handler.
- nmakeProcess->StartInfo->RedirectStandardOutput = true;
- nmakeProcess->OutputDataReceived += gcnew DataReceivedEventHandler( NMakeOutputDataHandler );
-
- // Redirect the error output of the nmake command.
- nmakeProcess->StartInfo->RedirectStandardError = true;
- nmakeProcess->ErrorDataReceived += gcnew DataReceivedEventHandler( NMakeErrorDataHandler );
-
- logMutex->WaitOne();
-
- currentLogLines = 0;
-
- // Write a header to the log file.
- String^ buildLogFile = "NmakeCmd.Txt";
- try
- {
- buildLogStream = gcnew StreamWriter( buildLogFile,true );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Could not open output file {0}", buildLogFile );
- Console::WriteLine( "Exception = {0}", e->ToString() );
- Console::WriteLine( e->Message->ToString() );
-
- buildLogStream = nullptr;
- }
-
- if ( buildLogStream != nullptr )
- {
- Console::WriteLine( "Nmake output logged to {0}", buildLogFile );
-
- buildLogStream->WriteLine();
- buildLogStream->WriteLine( DateTime::Now.ToString() );
- if ( !String::IsNullOrEmpty( nmakeArguments ) )
- {
- buildLogStream->Write( "Command line = NMake {0}", nmakeArguments );
- }
- else
- {
- buildLogStream->Write( "Command line = Nmake" );
- }
- buildLogStream->WriteLine();
- buildLogStream->Flush();
-
- logMutex->ReleaseMutex();
-
- // Start the process.
- Console::WriteLine();
- Console::WriteLine( "\nStarting Nmake command" );
- Console::WriteLine();
- nmakeProcess->Start();
-
- // Start the asynchronous read of the output stream.
- nmakeProcess->BeginOutputReadLine();
-
- // Start the asynchronous read of the error stream.
- nmakeProcess->BeginErrorReadLine();
-
- // Let the nmake command run, collecting the output.
- nmakeProcess->WaitForExit();
-
- nmakeProcess->Close();
- buildLogStream->Close();
- logMutex->Dispose();
- }
- }
-
-private:
- static void NMakeOutputDataHandler( Object^ sendingProcess,
- DataReceivedEventArgs^ outLine )
- {
- // Collect the output, displaying it to the screen and
- // logging it to the output file. Cancel the read
- // operation when the maximum line limit is reached.
-
- if ( !String::IsNullOrEmpty( outLine->Data ) )
- {
- logMutex->WaitOne();
-
- currentLogLines++;
- if ( currentLogLines > maxLogLines )
- {
- // Display the line to the console.
- // Skip writing the line to the log file.
- Console::WriteLine( "StdOut: {0}", outLine->Data->ToString() );
- }
- else
- if ( currentLogLines == maxLogLines )
- {
- LogToFile( "StdOut", "", true );
-
- // Stop reading the output streams.
- Process^ p = dynamic_cast(sendingProcess);
- if ( p != nullptr )
- {
- p->CancelOutputRead();
- p->CancelErrorRead();
- }
- }
- else
- {
- // Write the line to the log file.
- LogToFile( "StdOut", outLine->Data, true );
- }
- logMutex->ReleaseMutex();
- }
- }
-
- static void NMakeErrorDataHandler( Object^ sendingProcess,
- DataReceivedEventArgs^ errLine )
- {
-
- // Collect the error output, displaying it to the screen and
- // logging it to the output file. Cancel the error output
- // read operation when the maximum line limit is reached.
-
- if ( !String::IsNullOrEmpty( errLine->Data ) )
- {
- logMutex->WaitOne();
-
- currentLogLines++;
- if ( currentLogLines > maxLogLines )
- {
-
- // Display the line to the console.
- // Skip writing the line to the log file.
- Console::WriteLine( "StdErr: {0}", errLine->Data->ToString() );
- }
- else
- if ( currentLogLines == maxLogLines )
- {
- LogToFile( "StdOut", "", true );
-
- // Stop reading the output streams.
- Process^ p = dynamic_cast(sendingProcess);
- if ( p != nullptr )
- {
- p->CancelOutputRead();
- p->CancelErrorRead();
- }
- }
- else
- {
- // Write the line to the log file.
- LogToFile( "StdErr", errLine->Data, true );
- }
- logMutex->ReleaseMutex();
- }
- }
-
- static void LogToFile( String^ logPrefix, String^ logText,
- bool echoToConsole )
- {
- // Write the specified line to the log file stream.
- StringBuilder^ logString = gcnew StringBuilder;
-
- if ( !String::IsNullOrEmpty( logPrefix ) )
- {
- logString->AppendFormat( "{0}> ", logPrefix );
- }
-
- if ( !String::IsNullOrEmpty( logText ) )
- {
- logString->Append( logText );
- }
-
- if ( buildLogStream != nullptr )
- {
- buildLogStream->WriteLine( "[{0}] {1}",
- DateTime::Now.ToString(), logString->ToString() );
- buildLogStream->Flush();
- }
-
- if ( echoToConsole )
- {
- Console::WriteLine( logString->ToString() );
- }
- }
-};
-//
-
-/// The main entry point for the application.
-void main()
-{
- try
- {
- ProcessNMakeStreamRedirection::RedirectNMakeCommandStreams();
- }
- catch ( InvalidOperationException^ e )
- {
- Console::WriteLine( "Exception:" );
- Console::WriteLine( e );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp
deleted file mode 100644
index 87b8730cbc4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-// System.Diagnostics
-//
-// Requires .NET Framework version 1.2 or higher.
-
-// The following example uses the sort command to sort a list
-// of input text lines, and displays the sorted list to the console.
-
-//
-// Define the namespaces used by this sample.
-#using
-
-using namespace System;
-using namespace System::Text;
-using namespace System::IO;
-using namespace System::Diagnostics;
-using namespace System::Threading;
-using namespace System::ComponentModel;
-
-ref class SortOutputRedirection
-{
-private:
- // Define static variables shared by class methods.
- static StringBuilder^ sortOutput = nullptr;
- static int numOutputLines = 0;
-
-public:
- static void SortInputListText()
- {
- // Initialize the process and its StartInfo properties.
- // The sort command is a console application that
- // reads and sorts text input.
-
- Process^ sortProcess;
- sortProcess = gcnew Process;
- sortProcess->StartInfo->FileName = "Sort.exe";
-
- // Set UseShellExecute to false for redirection.
- sortProcess->StartInfo->UseShellExecute = false;
-
- // Redirect the standard output of the sort command.
- // This stream is read asynchronously using an event handler.
- sortProcess->StartInfo->RedirectStandardOutput = true;
- sortOutput = gcnew StringBuilder;
-
- // Set our event handler to asynchronously read the sort output.
- sortProcess->OutputDataReceived += gcnew DataReceivedEventHandler( SortOutputHandler );
-
- // Redirect standard input as well. This stream
- // is used synchronously.
- sortProcess->StartInfo->RedirectStandardInput = true;
-
- // Start the process.
- sortProcess->Start();
-
- // Use a stream writer to synchronously write the sort input.
- StreamWriter^ sortStreamWriter = sortProcess->StandardInput;
-
- // Start the asynchronous read of the sort output stream.
- sortProcess->BeginOutputReadLine();
-
- // Prompt the user for input text lines. Write each
- // line to the redirected input stream of the sort command.
- Console::WriteLine( "Ready to sort up to 50 lines of text" );
-
- String^ inputText;
- int numInputLines = 0;
- do
- {
- Console::WriteLine( "Enter a text line (or press the Enter key to stop):" );
-
- inputText = Console::ReadLine();
- if ( !String::IsNullOrEmpty( inputText ) )
- {
- numInputLines++;
- sortStreamWriter->WriteLine( inputText );
- }
- }
- while ( !String::IsNullOrEmpty( inputText ) && (numInputLines < 50) );
-
- Console::WriteLine( "" );
- Console::WriteLine();
-
- // End the input stream to the sort command.
- sortStreamWriter->Close();
-
- // Wait for the sort process to write the sorted text lines.
- sortProcess->WaitForExit();
-
- if ( numOutputLines > 0 )
- {
-
- // Write the formatted and sorted output to the console.
- Console::WriteLine( " Sort results = {0} sorted text line(s) ",
- numOutputLines.ToString() );
- Console::WriteLine( "----------" );
- Console::WriteLine( sortOutput->ToString() );
- }
- else
- {
- Console::WriteLine( " No input lines were sorted." );
- }
-
- sortProcess->Close();
- }
-
-private:
- static void SortOutputHandler( Object^ /*sendingProcess*/,
- DataReceivedEventArgs^ outLine )
- {
- // Collect the sort command output.
- if ( !String::IsNullOrEmpty( outLine->Data ) )
- {
- numOutputLines++;
-
- // Add the text to the collected output.
- sortOutput->AppendFormat( "\n[{0}] {1}",
- numOutputLines.ToString(), outLine->Data );
- }
- }
-};
-
-/// The main entry point for the application.
-void main()
-{
- try
- {
- SortOutputRedirection::SortInputListText();
- }
- catch ( InvalidOperationException^ e )
- {
- Console::WriteLine( "Exception:" );
- Console::WriteLine( e );
- }
-}
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp b/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp
deleted file mode 100644
index 5289fe8f30b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-// System::Diagnostics::Process::Refresh
-// System::Diagnostics::Process::HasExited
-// System::Diagnostics::Process::Close
-// System::Diagnostics::Process::CloseMainWindow
-// The following example starts an instance of Notepad. It then
-// retrieves the physical memory usage of the associated process at
-// 2 second intervals for a maximum of 10 seconds. The example detects
-// whether the process exits before 10 seconds have elapsed.
-// The example closes the process if it is still running after
-// 10 seconds.
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::Threading;
-int main()
-{
- try
- {
- Process^ myProcess;
- myProcess = Process::Start( "Notepad.exe" );
-
- // Display physical memory usage 5 times at intervals of 2 seconds.
- for ( int i = 0; i < 5; i++ )
- {
- if ( !myProcess->HasExited )
- {
-
- // Discard cached information about the process.
- myProcess->Refresh();
-
- // Print working set to console.
- Console::WriteLine( "Physical Memory Usage : {0}", myProcess->WorkingSet.ToString() );
-
- // Wait 2 seconds.
- Thread::Sleep( 2000 );
- }
- else
- {
- break;
- }
-
- }
- myProcess->CloseMainWindow();
-
- // Free resources associated with process.
- myProcess->Close();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following exception was raised: " );
- Console::WriteLine( e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp b/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp
deleted file mode 100644
index db06be9bee1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-// System::Diagnostics::Process::WorkingSet
-// System::Diagnostics::Process::BasePriority
-// System::Diagnostics::Process::UserProcessorTime
-// System::Diagnostics::Process::PrivilegedProcessorTime
-// System::Diagnostics::Process::TotalProcessorTime
-// System::Diagnostics::Process::ToString
-// System::Diagnostics::Process::Responding
-// System::Diagnostics::Process::PriorityClass
-// System::Diagnostics::Process::ExitCode
-// The following example starts an instance of Notepad. The example
-// then retrieves and displays various properties of the associated
-// process. The example detects when the process exits, and displays the process's exit code.
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-using namespace System::Threading;
-int main()
-{
- try
- {
- Process^ myProcess;
- myProcess = Process::Start( "NotePad.exe" );
- while ( !myProcess->HasExited )
- {
- Console::WriteLine();
-
- // Get physical memory usage of the associated process.
- Console::WriteLine( "Process's physical memory usage: {0}", myProcess->WorkingSet.ToString() );
-
- // Get base priority of the associated process.
- Console::WriteLine( "Base priority of the associated process: {0}", myProcess->BasePriority.ToString() );
-
- // Get priority class of the associated process.
- Console::WriteLine( "Priority class of the associated process: {0}", myProcess->PriorityClass );
-
- // Get user processor time for this process.
- Console::WriteLine( "User Processor Time: {0}", myProcess->UserProcessorTime.ToString() );
-
- // Get privileged processor time for this process.
- Console::WriteLine( "Privileged Processor Time: {0}", myProcess->PrivilegedProcessorTime.ToString() );
-
- // Get total processor time for this process.
- Console::WriteLine( "Total Processor Time: {0}", myProcess->TotalProcessorTime.ToString() );
-
- // Invoke overloaded ToString function.
- Console::WriteLine( "Process's Name: {0}", myProcess->ToString() );
- Console::WriteLine( "-------------------------------------" );
- if ( myProcess->Responding )
- {
- Console::WriteLine( "Status: Responding to user interface" );
- myProcess->Refresh();
- }
- else
- {
- Console::WriteLine( "Status: Not Responding" );
- }
- Thread::Sleep( 1000 );
- }
- Console::WriteLine();
- Console::WriteLine( "Process exit code: {0}", myProcess->ExitCode.ToString() );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following exception was raised: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp
deleted file mode 100644
index 7af27ada416..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// This example demonstrates the NativeDigits property.
-
-using namespace System;
-using namespace System::Globalization;
-using namespace System::Threading;
-
-int main()
-{
- CultureInfo^ currentCI = Thread::CurrentThread->CurrentCulture;
- NumberFormatInfo^ nfi = currentCI->NumberFormat;
- array^ nativeDigitList = nfi->NativeDigits;
-
- Console::WriteLine("The native digits for the {0} culture are:",
- currentCI->Name);
-
- for each (String^ nativeDigit in nativeDigitList)
- {
- Console::Write("\"{0}\" ", nativeDigit);
- }
-
- Console::WriteLine();
-}
-/*
-This code example produces the following results:
-
-The native digits for the en-US culture are:
-"0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp
deleted file mode 100644
index 415a49fc640..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-using namespace System;
-using namespace System::Globalization;
-
-namespace CalendarTypeExample
-{
- static void Display(Calendar^ genericCalendar)
- {
- String^ calendarName =
- genericCalendar->ToString()->PadRight(50, '.');
- Console::WriteLine("{0} {1}", calendarName, genericCalendar->GetType());
- }
-}
-
-int main()
-{
- GregorianCalendar^ gregorianCalendar = gcnew GregorianCalendar();
- HijriCalendar^ hijriCalendar = gcnew HijriCalendar();
- JapaneseLunisolarCalendar^ japaneseCalendar =
- gcnew JapaneseLunisolarCalendar();
- CalendarTypeExample::Display(gregorianCalendar);
- CalendarTypeExample::Display(hijriCalendar);
- CalendarTypeExample::Display(japaneseCalendar);
- return 0;
-}
-
-/* This code example produces the following output.
-
-System.Globalization.GregorianCalendar............ System.Globalization.GregorianCalendar
-System.Globalization.HijriCalendar................ System.Globalization.HijriCalendar
-System.Globalization.JapaneseLunisolarCalendar.... System.Globalization.JapaneseLunisolarCalendar
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp
deleted file mode 100644
index 0e754047e7d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// This example demonstrates a System.Globalization.Culture-
-// AndRegionInfoBuilder constructor and some of the properties
-// of a custom culture object created with the constructor.
-
-#using
-
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- CultureAndRegionInfoBuilder^ builder =
- gcnew CultureAndRegionInfoBuilder
- ("x-en-US-sample", CultureAndRegionModifiers::None);
-
- // Display some of the properties
- // for the en-US culture.
- Console::WriteLine("CultureName:. . . . . . . . . . {0}",
- builder->CultureName);
- Console::WriteLine("CultureEnglishName: . . . . . . {0}",
- builder->CultureEnglishName);
- Console::WriteLine("CultureNativeName:. . . . . . . {0}",
- builder->CultureNativeName);
- Console::WriteLine("GeoId:. . . . . . . . . . . . . {0}",
- builder->GeoId);
- Console::WriteLine("IsMetric: . . . . . . . . . . . {0}",
- builder->IsMetric);
- Console::WriteLine("ISOCurrencySymbol:. . . . . . . {0}",
- builder->ISOCurrencySymbol);
- Console::WriteLine("RegionEnglishName:. . . . . . . {0}",
- builder->RegionEnglishName);
- Console::WriteLine("RegionName: . . . . . . . . . . {0}",
- builder->RegionName);
- Console::WriteLine("RegionNativeName: . . . . . . . {0}",
- builder->RegionNativeName);
- Console::WriteLine("ThreeLetterISOLanguageName: . . {0}",
- builder->ThreeLetterISOLanguageName);
- Console::WriteLine("ThreeLetterISORegionName: . . . {0}",
- builder->ThreeLetterISORegionName);
- Console::WriteLine("ThreeLetterWindowsLanguageName: {0}",
- builder->ThreeLetterWindowsLanguageName);
- Console::WriteLine("ThreeLetterWindowsRegionName: . {0}",
- builder->ThreeLetterWindowsRegionName);
- Console::WriteLine("TwoLetterISOLanguageName: . . . {0}",
- builder->TwoLetterISOLanguageName);
- Console::WriteLine("TwoLetterISORegionName: . . . . {0}",
- builder->TwoLetterISORegionName);
-}
-
-/*
-This code example produces the following results:
-
-CultureName:. . . . . . . . . . en-US
-CultureEnglishName: . . . . . . English (United States)
-CultureNativeName:. . . . . . . English (United States)
-GeoId:. . . . . . . . . . . . . 244
-IsMetric: . . . . . . . . . . . False
-ISOCurrencySymbol:. . . . . . . USD
-RegionEnglishName:. . . . . . . United States
-RegionName: . . . . . . . . . . US
-RegionNativeName: . . . . . . . United States
-ThreeLetterISOLanguageName: . . eng
-ThreeLetterISORegionName: . . . USA
-ThreeLetterWindowsLanguageName: ENU
-ThreeLetterWindowsRegionName: . USA
-TwoLetterISOLanguageName: . . . en
-TwoLetterISORegionName: . . . . US
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp
deleted file mode 100644
index 846861d5752..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// This example demonstrates the GetConsoleFallbackUICulture() method
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- CultureInfo^ ci = gcnew CultureInfo("ar-DZ");
- Console::WriteLine("Culture name: . . . . . . . . . {0}", ci->Name);
- Console::WriteLine("Console fallback UI culture:. . {0}",
- ci->GetConsoleFallbackUICulture()->Name);
-}
-/*
-This code example produces the following results:
-
-Culture name: . . . . . . . . . ar-DZ
-Console fallback UI culture:. . fr-FR
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp
deleted file mode 100644
index 573d82f64eb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// This example demonstrates the RegionInfo.EnglishName, NativeName,
-// CurrencyEnglishName, CurrencyNativeName, and GeoId properties.
-
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Regional Info for Sweden
- RegionInfo^ ri = gcnew RegionInfo("SE");
-
- Console::WriteLine("Region English Name: . . . {0}", ri->EnglishName);
- Console::WriteLine("Native Name: . . . . . . . {0}", ri->NativeName);
- Console::WriteLine("Currency English Name: . . {0}",
- ri->CurrencyEnglishName);
- Console::WriteLine("Currency Native Name:. . . {0}",
- ri->CurrencyNativeName);
- Console::WriteLine("Geographical ID: . . . . . {0}", ri->GeoId);
-}
-/*
-This code example produces the following results:
-
-Region English Name: . . . Sweden
-Native Name: . . . . . . . Sverige
-Currency English Name: . . Swedish Krona
-Currency Native Name:. . . Svensk krona
-Geographical ID: . . . . . 221
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp
deleted file mode 100644
index de9be7b2fe4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Threading;
-
-public ref class SamplesStringDictionary
-{
-public:
- static void Main()
- {
- //
- StringDictionary^ myCollection = gcnew StringDictionary();
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection)
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- SamplesStringDictionary::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp
deleted file mode 100644
index 5423aa171ec..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-// The following code example demonstrates several of the properties and methods of StringDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues2( StringDictionary^ myCol );
-void PrintKeysAndValues3( StringDictionary^ myCol );
-
-int main()
-{
- // Creates and initializes a new StringDictionary.
- StringDictionary^ myCol = gcnew StringDictionary;
- myCol->Add( "red", "rojo" );
- myCol->Add( "green", "verde" );
- myCol->Add( "blue", "azul" );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Displays the elements using the IEnumerator:" );
- PrintKeysAndValues2( myCol );
-
- // Display the contents of the collection using the Keys, Values, Count, and Item properties.
- Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" );
- PrintKeysAndValues3( myCol );
-
- // Copies the StringDictionary to an array with DictionaryEntry elements.
- array^myArr = gcnew array(myCol->Count);
- myCol->CopyTo( myArr, 0 );
-
- // Displays the values in the array.
- Console::WriteLine( "Displays the elements in the array:" );
- Console::WriteLine( " KEY VALUE" );
- for ( int i = 0; i < myArr->Length; i++ )
- Console::WriteLine( " {0,-10} {1}", myArr[ i ].Key, myArr[ i ].Value );
- Console::WriteLine();
-
- // Searches for a value.
- if ( myCol->ContainsValue( "amarillo" ) )
- Console::WriteLine( "The collection contains the value \"amarillo\"." );
- else
- Console::WriteLine( "The collection does not contain the value \"amarillo\"." );
-
- Console::WriteLine();
-
- // Searches for a key and deletes it.
- if ( myCol->ContainsKey( "green" ) )
- myCol->Remove( "green" );
-
- Console::WriteLine( "The collection contains the following elements after removing \"green\":" );
- PrintKeysAndValues2( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "The collection contains the following elements after it is cleared:" );
- PrintKeysAndValues2( myCol );
-}
-
-// Uses the enumerator.
-void PrintKeysAndValues2( StringDictionary^ myCol )
-{
- IEnumerator^ myEnumerator = myCol->GetEnumerator();
- DictionaryEntry de;
- Console::WriteLine( " KEY VALUE" );
- while ( myEnumerator->MoveNext() )
- {
- de = *dynamic_cast(myEnumerator->Current);
- Console::WriteLine( " {0,-25} {1}", de.Key, de.Value );
- }
-
- Console::WriteLine();
-}
-
-// Uses the Keys, Values, Count, and Item properties.
-void PrintKeysAndValues3( StringDictionary^ myCol )
-{
- array^myKeys = gcnew array(myCol->Count);
- myCol->Keys->CopyTo( myKeys, 0 );
- Console::WriteLine( " INDEX KEY VALUE" );
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] );
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Displays the elements using the IEnumerator:
- KEY VALUE
- red rojo
- blue azul
- green verde
-
-Displays the elements using the Keys, Values, Count, and Item properties:
- INDEX KEY VALUE
- 0 red rojo
- 1 blue azul
- 2 green verde
-
-Displays the elements in the array:
- KEY VALUE
- red rojo
- blue azul
- green verde
-
-The collection does not contain the value "amarillo".
-
-The collection contains the following elements after removing "green":
- KEY VALUE
- red rojo
- blue azul
-
-The collection contains the following elements after it is cleared:
- KEY VALUE
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp
deleted file mode 100644
index c477bb3710f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-// The following code example demonstrates how to add and remove elements from a StringDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( StringDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ enum0 = myCol->GetEnumerator();
- while ( enum0->MoveNext() )
- {
- DictionaryEntry^ de = safe_cast(enum0->Current);
- Console::WriteLine( " {0,-10} {1}", de->Key, de->Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new StringDictionary.
- StringDictionary^ myCol = gcnew StringDictionary;
- myCol->Add( "red", "rojo" );
- myCol->Add( "green", "verde" );
- myCol->Add( "blue", "azul" );
-
- // Displays the values in the StringDictionary.
- Console::WriteLine( "Initial contents of the StringDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Deletes an element.
- myCol->Remove( "green" );
- Console::WriteLine( "The collection contains the following elements after removing \"green\":" );
- PrintKeysAndValues( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "The collection contains the following elements after it is cleared:" );
- PrintKeysAndValues( myCol );
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the StringDictionary:
- KEY VALUE
- green verde
- red rojo
- blue azul
-
-The collection contains the following elements after removing "green":
- KEY VALUE
- red rojo
- blue azul
-
-The collection contains the following elements after it is cleared:
- KEY VALUE
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp
deleted file mode 100644
index 854a898a04a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-// The following code example searches for an element in a StringDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( StringDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ enum0 = myCol->GetEnumerator();
- while ( enum0->MoveNext() )
- {
- DictionaryEntry^ de = safe_cast(enum0->Current);
- Console::WriteLine( " {0,-10} {1}", de->Key, de->Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new StringDictionary.
- StringDictionary^ myCol = gcnew StringDictionary;
- myCol->Add( "red", "rojo" );
- myCol->Add( "green", "verde" );
- myCol->Add( "blue", "azul" );
-
- // Displays the values in the StringDictionary.
- Console::WriteLine( "Initial contents of the StringDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Searches for a key.
- if ( myCol->ContainsKey( "red" ) )
- Console::WriteLine( "The collection contains the key \"red\"." );
- else
- Console::WriteLine( "The collection does not contain the key \"red\"." );
-
- Console::WriteLine();
-
- // Searches for a value.
- if ( myCol->ContainsValue( "amarillo" ) )
- Console::WriteLine( "The collection contains the value \"amarillo\"." );
- else
- Console::WriteLine( "The collection does not contain the value \"amarillo\"." );
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the StringDictionary:
- KEY VALUE
- green verde
- red rojo
- blue azul
-
-The collection contains the key "red".
-
-The collection does not contain the value "amarillo".
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp
deleted file mode 100644
index a7c20a92885..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// The following code example enumerates the elements of a StringDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-void PrintKeysAndValues1( StringDictionary^ myCol );
-void PrintKeysAndValues2( StringDictionary^ myCol );
-void PrintKeysAndValues3( StringDictionary^ myCol );
-
-int main()
-{
- // Creates and initializes a new StringDictionary.
- StringDictionary^ myCol = gcnew StringDictionary;
- myCol->Add( "red", "rojo" );
- myCol->Add( "green", "verde" );
- myCol->Add( "blue", "azul" );
-
- // Display the contents of the collection using for each. This is the preferred method.
- Console::WriteLine( "Displays the elements using for each:" );
- PrintKeysAndValues1( myCol );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Displays the elements using the IEnumerator:" );
- PrintKeysAndValues2( myCol );
-
- // Display the contents of the collection using the Keys, Values, Count, and Item properties.
- Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" );
- PrintKeysAndValues3( myCol );
-}
-
-// Uses the for each statement which hides the complexity of the enumerator.
-// NOTE: The for each statement is the preferred way of enumerating the contents of a collection.
-void PrintKeysAndValues1( StringDictionary^ myCol ) {
- Console::WriteLine( " KEY VALUE" );
- for each ( DictionaryEntry^ de in myCol )
- Console::WriteLine( " {0,-25} {1}", de->Key, de->Value );
- Console::WriteLine();
-}
-
-// Uses the enumerator.
-void PrintKeysAndValues2( StringDictionary^ myCol )
-{
- IEnumerator^ myEnumerator = myCol->GetEnumerator();
- DictionaryEntry^ de;
- Console::WriteLine( " KEY VALUE" );
- while ( myEnumerator->MoveNext() )
- {
- de = (DictionaryEntry^)(myEnumerator->Current);
- Console::WriteLine( " {0,-25} {1}", de->Key, de->Value );
- }
- Console::WriteLine();
-}
-
-// Uses the Keys, Values, Count, and Item properties.
-void PrintKeysAndValues3( StringDictionary^ myCol )
-{
- array^myKeys = gcnew array(myCol->Count);
- myCol->Keys->CopyTo( myKeys, 0 );
- Console::WriteLine( " INDEX KEY VALUE" );
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] );
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Displays the elements using for each:
- KEY VALUE
- red rojo
- blue azul
- green verde
-
-Displays the elements using the IEnumerator:
- KEY VALUE
- red rojo
- blue azul
- green verde
-
-Displays the elements using the Keys, Values, Count, and Item properties:
- INDEX KEY VALUE
- 0 red rojo
- 1 blue azul
- 2 green verde
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp
deleted file mode 100644
index b62ad64ac50..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// The following code example enumerates the elements of a StringDictionary.
-
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class SamplesStringDictionary
-{
-public:
- static void Main()
- {
- // Creates and initializes a new StringDictionary.
- StringDictionary^ myCol = gcnew StringDictionary();
- myCol->Add( "red", "rojo" );
- myCol->Add( "green", "verde" );
- myCol->Add( "blue", "azul" );
-
- Console::WriteLine("VALUES");
- for each (String^ val in myCol->Values)
- {
- Console::WriteLine(val);
- }
- }
-};
-
-int main()
-{
- SamplesStringDictionary::Main();
-}
-// This code produces the following output.
-// VALUES
-// verde
-// rojo
-// azul
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp
deleted file mode 100644
index a412d7c2739..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Create an empty ArrayList, and add some elements.
- ArrayList^ stringList = gcnew ArrayList();
-
- stringList->Add("a");
- stringList->Add("abc");
- stringList->Add("abcdef");
- stringList->Add("abcdefg");
-
- // The Item property is an indexer, so the property name is
- // not required.
- Console::WriteLine("Element {0} is \"{1}\"", 2, stringList[2]);
-
- // Assigning a value to the property changes the value of
- // the indexed element.
- stringList[2] = "abcd";
- Console::WriteLine("Element {0} is \"{1}\"", 2, stringList[2]);
-
- // Accessing an element outside the current element count
- // causes an exception.
- Console::WriteLine("Number of elements in the list: {0}",
- stringList->Count);
- try
- {
- Console::WriteLine("Element {0} is \"{1}\"",
- stringList->Count, stringList[stringList->Count]);
- }
- catch (ArgumentOutOfRangeException^ aoore)
- {
- Console::WriteLine("stringList({0}) is out of range.",
- stringList->Count);
- }
-
- // You cannot use the Item property to add new elements.
- try
- {
- stringList[stringList->Count] = "42";
- }
- catch (ArgumentOutOfRangeException^ aoore)
- {
- Console::WriteLine("stringList({0}) is out of range.",
- stringList->Count);
- }
-
- Console::WriteLine();
- for (int i = 0; i < stringList->Count; i++)
- {
- Console::WriteLine("Element {0} is \"{1}\"", i,
- stringList[i]);
- }
-
- Console::WriteLine();
- for each (Object^ o in stringList)
- {
- Console::WriteLine(o);
- }
- }
-};
-
-int main()
-{
- Example::Main();
-}
-/*
- This code example produces the following output:
-
-Element 2 is "abcdef"
-Element 2 is "abcd"
-Number of elements in the list: 4
-stringList(4) is out of range.
-stringList(4) is out of range.
-
-Element 0 is "a"
-Element 1 is "abc"
-Element 2 is "abcd"
-Element 3 is "abcdefg"
-
-a
-abc
-abcd
-abcdefg
- */
-//
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp
deleted file mode 100644
index 5a66b7c3b74..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections;
-
-public ref class ScrambleList : public ArrayList
-{
-public:
- static void Main()
- {
- // Create an empty ArrayList, and add some elements.
- ScrambleList^ integerList = gcnew ScrambleList();
-
- for (int i = 0; i < 10; i++)
- {
- integerList->Add(i);
- }
-
- Console::WriteLine("Ordered:\n");
- for each (int value in integerList)
- {
- Console::Write("{0}, ", value);
- }
- Console::WriteLine("\n\nScrambled:\n");
-
- // Scramble the order of the items in the list.
- integerList->Scramble();
-
- for each (int value in integerList)
- {
- Console::Write("{0}, ", value);
- }
- Console::WriteLine("\n");
- }
-
- void Scramble()
- {
- int limit = this->Count;
- int temp;
- int swapindex;
- Random^ rnd = gcnew Random();
- for (int i = 0; i < limit; i++)
- {
- // The Item property of ArrayList is the default indexer. Thus,
- // this->default[i] and this[i] are used interchangeably.
- temp = (int)this->default[i];
- swapindex = rnd->Next(0, limit - 1);
- this[i] = this->default[swapindex];
- this[swapindex] = temp;
- }
- }
-};
-
-int main()
-{
- ScrambleList::Main();
-}
-// The program produces output similar to the following:
-//
-// Ordered:
-//
-// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-//
-// Scrambled:
-//
-// 5, 2, 8, 9, 6, 1, 7, 0, 4, 3,
-//
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp
deleted file mode 100644
index c56559204dd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-// The following example shows how to sort the values in an using the default comparer and a custom comparer which reverses the sort order.
-//
-using namespace System;
-using namespace System::Collections;
-void PrintIndexAndValues( IEnumerable^ myList );
-ref class myReverserClass: public IComparer
-{
-private:
-
- // Calls CaseInsensitiveComparer.Compare with the parameters reversed.
- virtual int Compare( Object^ x, Object^ y ) sealed = IComparer::Compare
- {
- return ((gcnew CaseInsensitiveComparer)->Compare( y, x ));
- }
-
-};
-
-int main()
-{
-
- // Creates and initializes a new ArrayList.
- ArrayList^ myAL = gcnew ArrayList;
- myAL->Add( "The" );
- myAL->Add( "quick" );
- myAL->Add( "brown" );
- myAL->Add( "fox" );
- myAL->Add( "jumps" );
- myAL->Add( "over" );
- myAL->Add( "the" );
- myAL->Add( "lazy" );
- myAL->Add( "dog" );
-
- // Displays the values of the ArrayList.
- Console::WriteLine( "The ArrayList initially contains the following values:" );
- PrintIndexAndValues( myAL );
-
- // Sorts the values of the ArrayList using the default comparer.
- myAL->Sort();
- Console::WriteLine( "After sorting with the default comparer:" );
- PrintIndexAndValues( myAL );
-
- // Sorts the values of the ArrayList using the reverse case-insensitive comparer.
- IComparer^ myComparer = gcnew myReverserClass;
- myAL->Sort( myComparer );
- Console::WriteLine( "After sorting with the reverse case-insensitive comparer:" );
- PrintIndexAndValues( myAL );
-}
-
-void PrintIndexAndValues( IEnumerable^ myList )
-{
- int i = 0;
- IEnumerator^ myEnum = myList->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ obj = safe_cast(myEnum->Current);
- Console::WriteLine( "\t[{0}]:\t{1}", i++, obj );
- }
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-The ArrayList initially contains the following values:
- [0]: The
- [1]: quick
- [2]: brown
- [3]: fox
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
-
-After sorting with the default comparer:
- [0]: brown
- [1]: dog
- [2]: fox
- [3]: jumps
- [4]: lazy
- [5]: over
- [6]: quick
- [7]: the
- [8]: The
-
-After sorting with the reverse case-insensitive comparer:
- [0]: the
- [1]: The
- [2]: quick
- [3]: over
- [4]: lazy
- [5]: jumps
- [6]: fox
- [7]: dog
- [8]: brown
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp
deleted file mode 100644
index 41bde08602c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-// The following example shows how to sort the values in a section of an using the default comparer and a custom comparer which reverses the sort order.
-//
-using namespace System;
-using namespace System::Collections;
-void PrintIndexAndValues( IEnumerable^ myList );
-ref class myReverserClass: public IComparer
-{
-private:
-
- // Calls CaseInsensitiveComparer.Compare with the parameters reversed.
- virtual int Compare( Object^ x, Object^ y ) = IComparer::Compare
- {
- return ((gcnew CaseInsensitiveComparer)->Compare( y, x ));
- }
-
-};
-
-int main()
-{
-
- // Creates and initializes a new ArrayList.
- ArrayList^ myAL = gcnew ArrayList;
- myAL->Add( "The" );
- myAL->Add( "QUICK" );
- myAL->Add( "BROWN" );
- myAL->Add( "FOX" );
- myAL->Add( "jumps" );
- myAL->Add( "over" );
- myAL->Add( "the" );
- myAL->Add( "lazy" );
- myAL->Add( "dog" );
-
- // Displays the values of the ArrayList.
- Console::WriteLine( "The ArrayList initially contains the following values:" );
- PrintIndexAndValues( myAL );
-
- // Sorts the values of the ArrayList using the default comparer.
- myAL->Sort( 1, 3, nullptr );
- Console::WriteLine( "After sorting from index 1 to index 3 with the default comparer:" );
- PrintIndexAndValues( myAL );
-
- // Sorts the values of the ArrayList using the reverse case-insensitive comparer.
- IComparer^ myComparer = gcnew myReverserClass;
- myAL->Sort( 1, 3, myComparer );
- Console::WriteLine( "After sorting from index 1 to index 3 with the reverse case-insensitive comparer:" );
- PrintIndexAndValues( myAL );
-}
-
-void PrintIndexAndValues( IEnumerable^ myList )
-{
- int i = 0;
- IEnumerator^ myEnum = myList->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ obj = safe_cast(myEnum->Current);
- Console::WriteLine( "\t[{0}]:\t{1}", i++, obj );
- }
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-The ArrayList initially contains the following values:
- [0]: The
- [1]: QUICK
- [2]: BROWN
- [3]: FOX
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
-
-After sorting from index 1 to index 3 with the default comparer:
- [0]: The
- [1]: BROWN
- [2]: FOX
- [3]: QUICK
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
-
-After sorting from index 1 to index 3 with the reverse case-insensitive comparer:
- [0]: The
- [1]: QUICK
- [2]: FOX
- [3]: BROWN
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp
deleted file mode 100644
index 4ffd521bcd4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-// The following example shows how to copy the elements of an ArrayList to a string array.
-//
-using namespace System;
-using namespace System::Collections;
-void PrintIndexAndValues( ArrayList^ myList );
-void PrintIndexAndValues( array^myArr );
-int main()
-{
- // Creates and initializes a new ArrayList.
- ArrayList^ myAL = gcnew ArrayList;
- myAL->Add( "The" );
- myAL->Add( "quick" );
- myAL->Add( "brown" );
- myAL->Add( "fox" );
- myAL->Add( "jumps" );
- myAL->Add( "over" );
- myAL->Add( "the" );
- myAL->Add( "lazy" );
- myAL->Add( "dog" );
-
- // Displays the values of the ArrayList.
- Console::WriteLine( "The ArrayList contains the following values:" );
- PrintIndexAndValues( myAL );
-
- // Copies the elements of the ArrayList to a string array.
- array^myArr = reinterpret_cast^>(myAL->ToArray( String::typeid ));
-
- // Displays the contents of the string array.
- Console::WriteLine( "The string array contains the following values:" );
- PrintIndexAndValues( myArr );
-}
-
-void PrintIndexAndValues( ArrayList^ myList )
-{
- int i = 0;
- IEnumerator^ myEnum = myList->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ o = safe_cast(myEnum->Current);
- Console::WriteLine( "\t[{0}]:\t{1}", i++, o );
- }
-
- Console::WriteLine();
-}
-
-void PrintIndexAndValues( array^myArr )
-{
- for ( int i = 0; i < myArr->Length; i++ )
- Console::WriteLine( "\t[{0}]:\t{1}", i, myArr[ i ] );
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-The ArrayList contains the following values:
- [0]: The
- [1]: quick
- [2]: brown
- [3]: fox
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
-
-The string array contains the following values:
- [0]: The
- [1]: quick
- [2]: brown
- [3]: fox
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp
deleted file mode 100644
index 352f55da5ea..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following code example creates a case-sensitive hashtable and a case-insensitive hashtable
-// and demonstrates the difference in their behavior, even if both contain the same elements.
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-int main()
-{
-
- // Create a Hashtable using the default hash code provider and the default comparer.
- Hashtable^ myHT1 = gcnew Hashtable;
- myHT1->Add( "FIRST", "Hello" );
- myHT1->Add( "SECOND", "World" );
- myHT1->Add( "THIRD", "!" );
-
- // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer,
- // based on the culture of the current thread.
- Hashtable^ myHT2 = gcnew Hashtable( gcnew CaseInsensitiveHashCodeProvider,gcnew CaseInsensitiveComparer );
- myHT2->Add( "FIRST", "Hello" );
- myHT2->Add( "SECOND", "World" );
- myHT2->Add( "THIRD", "!" );
-
- // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer,
- // based on the InvariantCulture.
- Hashtable^ myHT3 = gcnew Hashtable( CaseInsensitiveHashCodeProvider::DefaultInvariant,CaseInsensitiveComparer::DefaultInvariant );
- myHT3->Add( "FIRST", "Hello" );
- myHT3->Add( "SECOND", "World" );
- myHT3->Add( "THIRD", "!" );
-
- // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer,
- // based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i".
- CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" );
- Hashtable^ myHT4 = gcnew Hashtable( gcnew CaseInsensitiveHashCodeProvider( myCul ),gcnew CaseInsensitiveComparer( myCul ) );
- myHT4->Add( "FIRST", "Hello" );
- myHT4->Add( "SECOND", "World" );
- myHT4->Add( "THIRD", "!" );
-
- // Search for a key in each hashtable.
- Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT4: {0}", myHT4->ContainsKey( "first" ) );
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-first is in myHT1: False
-first is in myHT2: True
-first is in myHT3: True
-first is in myHT4: False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp
deleted file mode 100644
index c12910d57c1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-
-
-// The following code example implements the CollectionBase class and uses that implementation to create a collection of Int16 objects.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-
-public ref class Int16Collection: public CollectionBase
-{
-public:
-
- property Int16 Item [int]
- {
- Int16 get( int index )
- {
- return ( (Int16)(List[ index ]));
- }
-
- void set( int index, Int16 value )
- {
- List[ index ] = value;
- }
- }
- int Add( Int16 value )
- {
- return (List->Add( value ));
- }
-
- int IndexOf( Int16 value )
- {
- return (List->IndexOf( value ));
- }
-
- void Insert( int index, Int16 value )
- {
- List->Insert( index, value );
- }
-
- void Remove( Int16 value )
- {
- List->Remove( value );
- }
-
- bool Contains( Int16 value )
- {
- // If value is not of type Int16, this will return false.
- return (List->Contains( value ));
- }
-
-protected:
- virtual void OnInsert( int /*index*/, Object^ /*value*/ ) override
- {
- // Insert additional code to be run only when inserting values.
- }
-
- virtual void OnRemove( int /*index*/, Object^ /*value*/ ) override
- {
- // Insert additional code to be run only when removing values.
- }
-
- virtual void OnSet( int /*index*/, Object^ /*oldValue*/, Object^ /*newValue*/ ) override
- {
- // Insert additional code to be run only when setting values.
- }
-
- virtual void OnValidate( Object^ value ) override
- {
- if ( value->GetType() != Type::GetType( "System.Int16" ) )
- throw gcnew ArgumentException( "value must be of type Int16.","value" );
- }
-
-};
-
-void PrintIndexAndValues( Int16Collection^ myCol );
-void PrintValues2( Int16Collection^ myCol );
-int main()
-{
- // Create and initialize a new CollectionBase.
- Int16Collection^ myI16 = gcnew Int16Collection;
-
- // Add elements to the collection.
- myI16->Add( (Int16)1 );
- myI16->Add( (Int16)2 );
- myI16->Add( (Int16)3 );
- myI16->Add( (Int16)5 );
- myI16->Add( (Int16)7 );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Contents of the collection (using enumerator):" );
- PrintValues2( myI16 );
-
- // Display the contents of the collection using the Count property and the Item property.
- Console::WriteLine( "Initial contents of the collection (using Count and Item):" );
- PrintIndexAndValues( myI16 );
-
- // Search the collection with Contains and IndexOf.
- Console::WriteLine( "Contains 3: {0}", myI16->Contains( 3 ) );
- Console::WriteLine( "2 is at index {0}.", myI16->IndexOf( 2 ) );
- Console::WriteLine();
-
- // Insert an element into the collection at index 3.
- myI16->Insert( 3, (Int16)13 );
- Console::WriteLine( "Contents of the collection after inserting at index 3:" );
- PrintIndexAndValues( myI16 );
-
- // Get and set an element using the index.
- myI16->Item[ 4 ] = 123;
- Console::WriteLine( "Contents of the collection after setting the element at index 4 to 123:" );
- PrintIndexAndValues( myI16 );
-
- // Remove an element from the collection.
- myI16->Remove( (Int16)2 );
-
- // Display the contents of the collection using the Count property and the Item property.
- Console::WriteLine( "Contents of the collection after removing the element 2:" );
- PrintIndexAndValues( myI16 );
-}
-
-// Uses the Count property and the Item property.
-void PrintIndexAndValues( Int16Collection^ myCol )
-{
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " [{0}]: {1}", i, myCol->Item[ i ] );
- Console::WriteLine();
-}
-
-// Uses the enumerator.
-void PrintValues2( Int16Collection^ myCol )
-{
- System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator();
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( " {0}", myEnumerator->Current );
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Contents of the collection (using enumerator):
- 1
- 2
- 3
- 5
- 7
-
-Initial contents of the collection (using Count and Item):
- [0]: 1
- [1]: 2
- [2]: 3
- [3]: 5
- [4]: 7
-
-Contains 3: True
-2 is at index 1.
-
-Contents of the collection after inserting at index 3:
- [0]: 1
- [1]: 2
- [2]: 3
- [3]: 13
- [4]: 5
- [5]: 7
-
-Contents of the collection after setting the element at index 4 to 123:
- [0]: 1
- [1]: 2
- [2]: 3
- [3]: 13
- [4]: 123
- [5]: 7
-
-Contents of the collection after removing the element 2:
- [0]: 1
- [1]: 3
- [2]: 13
- [3]: 123
- [4]: 7
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp
deleted file mode 100644
index 5c672dbc203..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-// The following code example implements the CollectionBase class and uses that implementation to create a collection of Int16 objects.
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Threading;
-
-public ref class Int16Collection: public CollectionBase
-{
-public:
-
- property Int16 Item [int]
- {
- Int16 get( int index )
- {
- return ( (Int16)(List[ index ]));
- }
-
- void set( int index, Int16 value )
- {
- List[ index ] = value;
- }
- }
- int Add( Int16 value )
- {
- return (List->Add( value ));
- }
-
- int IndexOf( Int16 value )
- {
- return (List->IndexOf( value ));
- }
-
- void Insert( int index, Int16 value )
- {
- List->Insert( index, value );
- }
-
- void Remove( Int16 value )
- {
- List->Remove( value );
- }
-
- bool Contains( Int16 value )
- {
- // If value is not of type Int16, this will return false.
- return (List->Contains( value ));
- }
-
-protected:
- virtual void OnInsert( int /*index*/, Object^ /*value*/ ) override
- {
- // Insert additional code to be run only when inserting values.
- }
-
- virtual void OnRemove( int /*index*/, Object^ /*value*/ ) override
- {
- // Insert additional code to be run only when removing values.
- }
-
- virtual void OnSet( int /*index*/, Object^ /*oldValue*/, Object^ /*newValue*/ ) override
- {
- // Insert additional code to be run only when setting values.
- }
-
- virtual void OnValidate( Object^ value ) override
- {
- if ( value->GetType() != Type::GetType( "System.Int16" ) )
- throw gcnew ArgumentException( "value must be of type Int16.","value" );
- }
-
-};
-
-public ref class SamplesCollectionBase
-{
-public:
- static void Main()
- {
- // Create and initialize a new CollectionBase.
- Int16Collection^ myCollectionBase = gcnew Int16Collection();
-
- // Add elements to the collection.
- myCollectionBase->Add( (Int16) 1 );
- myCollectionBase->Add( (Int16) 2 );
- myCollectionBase->Add( (Int16) 3 );
- myCollectionBase->Add( (Int16) 5 );
- myCollectionBase->Add( (Int16) 7 );
-
- //
- // Get the ICollection interface from the CollectionBase
- // derived class.
- ICollection^ myCollection = myCollectionBase;
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection);
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- SamplesCollectionBase::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp
deleted file mode 100644
index 8103ba2ad12..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example shows how Compare returns different values depending on the culture associated with the Comparer.
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates the strings to compare.
- String^ str1 = "llegar";
- String^ str2 = "lugar";
- Console::WriteLine( "Comparing \"{0}\" and \"{1}\" ...", str1, str2 );
-
- // Uses the DefaultInvariant Comparer.
- Console::WriteLine( " Invariant Comparer: {0}", Comparer::DefaultInvariant->Compare( str1, str2 ) );
-
- // Uses the Comparer based on the culture "es-ES" (Spanish - Spain, international sort).
- Comparer^ myCompIntl = gcnew Comparer( gcnew CultureInfo( "es-ES",false ) );
- Console::WriteLine( " International Sort: {0}", myCompIntl->Compare( str1, str2 ) );
-
- // Uses the Comparer based on the culture identifier 0x040A (Spanish - Spain, traditional sort).
- Comparer^ myCompTrad = gcnew Comparer( gcnew CultureInfo( 0x040A,false ) );
- Console::WriteLine( " Traditional Sort : {0}", myCompTrad->Compare( str1, str2 ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing "llegar" and "lugar" ...
- Invariant Comparer: -1
- International Sort: -1
- Traditional Sort : 1
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp
deleted file mode 100644
index f22de93e8e7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-
-// The following code example implements the DictionaryBase class and uses that implementation to create a dictionary of String keys and values that have a Length of 5 or less.
-//
-using namespace System;
-using namespace System::Collections;
-
-public ref class ShortStringDictionary: public DictionaryBase
-{
-public:
-
- property String^ Item [String^]
- {
- String^ get( String^ key )
- {
- return (dynamic_cast(Dictionary[ key ]));
- }
-
- void set( String^ value, String^ key )
- {
- Dictionary[ key ] = value;
- }
- }
-
- property ICollection^ Keys
- {
- ICollection^ get()
- {
- return (Dictionary->Keys);
- }
- }
-
- property ICollection^ Values
- {
- ICollection^ get()
- {
- return (Dictionary->Values);
- }
- }
- void Add( String^ key, String^ value )
- {
- Dictionary->Add( key, value );
- }
-
- bool Contains( String^ key )
- {
- return (Dictionary->Contains( key ));
- }
-
- void Remove( String^ key )
- {
- Dictionary->Remove( key );
- }
-
-
-protected:
- virtual void OnInsert( Object^ key, Object^ value ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
-
- if ( value->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "value must be of type String.","value" );
- else
- {
- String^ strValue = dynamic_cast(value);
- if ( strValue->Length > 5 )
- throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" );
- }
- }
-
- virtual void OnRemove( Object^ key, Object^ /*value*/ ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
- }
-
- virtual void OnSet( Object^ key, Object^ /*oldValue*/, Object^ newValue ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
-
- if ( newValue->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "newValue must be of type String.","newValue" );
- else
- {
- String^ strValue = dynamic_cast(newValue);
- if ( strValue->Length > 5 )
- throw gcnew ArgumentException( "newValue must be no more than 5 characters in length.","newValue" );
- }
- }
-
- virtual void OnValidate( Object^ key, Object^ value ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
-
- if ( value->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "value must be of type String.","value" );
- else
- {
- String^ strValue = dynamic_cast(value);
- if ( strValue->Length > 5 )
- throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" );
- }
- }
-
-};
-
-void PrintKeysAndValues2( ShortStringDictionary^ myCol );
-void PrintKeysAndValues3( ShortStringDictionary^ myCol );
-int main()
-{
- // Creates and initializes a new DictionaryBase.
- ShortStringDictionary^ mySSC = gcnew ShortStringDictionary;
-
- // Adds elements to the collection.
- mySSC->Add( "One", "a" );
- mySSC->Add( "Two", "ab" );
- mySSC->Add( "Three", "abc" );
- mySSC->Add( "Four", "abcd" );
- mySSC->Add( "Five", "abcde" );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Contents of the collection (using enumerator):" );
- PrintKeysAndValues2( mySSC );
-
- // Display the contents of the collection using the Keys property and the Item property.
- Console::WriteLine( "Initial contents of the collection (using Keys and Item):" );
- PrintKeysAndValues3( mySSC );
-
- // Tries to add a value that is too long.
- try
- {
- mySSC->Add( "Ten", "abcdefghij" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- // Tries to add a key that is too long.
- try
- {
- mySSC->Add( "Eleven", "ijk" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- Console::WriteLine();
-
- // Searches the collection with Contains.
- Console::WriteLine( "Contains \"Three\": {0}", mySSC->Contains( "Three" ) );
- Console::WriteLine( "Contains \"Twelve\": {0}", mySSC->Contains( "Twelve" ) );
- Console::WriteLine();
-
- // Removes an element from the collection.
- mySSC->Remove( "Two" );
-
- // Displays the contents of the collection.
- Console::WriteLine( "After removing \"Two\":" );
- PrintKeysAndValues2( mySSC );
-}
-
-// Uses the enumerator.
-void PrintKeysAndValues2( ShortStringDictionary^ myCol )
-{
- DictionaryEntry myDE;
- System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator();
- while ( myEnumerator->MoveNext() )
- if ( myEnumerator->Current != nullptr )
- {
- myDE = *dynamic_cast(myEnumerator->Current);
- Console::WriteLine( " {0,-5} : {1}", myDE.Key, myDE.Value );
- }
-
- Console::WriteLine();
-}
-
-
-// Uses the Keys property and the Item property.
-void PrintKeysAndValues3( ShortStringDictionary^ myCol )
-{
- ICollection^ myKeys = myCol->Keys;
- IEnumerator^ myEnum1 = myKeys->GetEnumerator();
- while ( myEnum1->MoveNext() )
- {
- String^ k = safe_cast(myEnum1->Current);
- Console::WriteLine( " {0,-5} : {1}", k, myCol->Item[ k ] );
- }
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Contents of the collection (using enumerator):
- Three : abc
- Five : abcde
- Two : ab
- One : a
- Four : abcd
-
-Initial contents of the collection (using Keys and Item):
- Three : abc
- Five : abcde
- Two : ab
- One : a
- Four : abcd
-
-System.ArgumentException: value must be no more than 5 characters in length.
-Parameter name: value
- at ShortStringDictionary.OnValidate(Object key, Object value)
- at System.Collections.DictionaryBase.System.Collections.IDictionary.Add(Object key, Object value)
- at SamplesDictionaryBase.Main()
-System.ArgumentException: key must be no more than 5 characters in length.
-Parameter name: key
- at ShortStringDictionary.OnValidate(Object key, Object value)
- at System.Collections.DictionaryBase.System.Collections.IDictionary.Add(Object key, Object value)
- at SamplesDictionaryBase.Main()
-
-Contains "Three": True
-Contains "Twelve": False
-
-After removing "Two":
- Three : abc
- Five : abcde
- One : a
- Four : abcd
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp
deleted file mode 100644
index 6d4bc281691..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Threading;
-
-public ref class ShortStringDictionary: public DictionaryBase
-{
-public:
-
- property String^ Item [String^]
- {
- String^ get( String^ key )
- {
- return (dynamic_cast(Dictionary[ key ]));
- }
-
- void set( String^ value, String^ key )
- {
- Dictionary[ key ] = value;
- }
- }
-
- property ICollection^ Keys
- {
- ICollection^ get()
- {
- return (Dictionary->Keys);
- }
- }
-
- property ICollection^ Values
- {
- ICollection^ get()
- {
- return (Dictionary->Values);
- }
- }
- void Add( String^ key, String^ value )
- {
- Dictionary->Add( key, value );
- }
-
- bool Contains( String^ key )
- {
- return (Dictionary->Contains( key ));
- }
-
- void Remove( String^ key )
- {
- Dictionary->Remove( key );
- }
-
-
-protected:
- virtual void OnInsert( Object^ key, Object^ value ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
-
- if ( value->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "value must be of type String.","value" );
- else
- {
- String^ strValue = dynamic_cast(value);
- if ( strValue->Length > 5 )
- throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" );
- }
- }
-
- virtual void OnRemove( Object^ key, Object^ /*value*/ ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
- }
-
- virtual void OnSet( Object^ key, Object^ /*oldValue*/, Object^ newValue ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
-
- if ( newValue->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "newValue must be of type String.","newValue" );
- else
- {
- String^ strValue = dynamic_cast(newValue);
- if ( strValue->Length > 5 )
- throw gcnew ArgumentException( "newValue must be no more than 5 characters in length.","newValue" );
- }
- }
-
- virtual void OnValidate( Object^ key, Object^ value ) override
- {
- if ( key->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "key must be of type String.","key" );
- else
- {
- String^ strKey = dynamic_cast(key);
- if ( strKey->Length > 5 )
- throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" );
- }
-
- if ( value->GetType() != Type::GetType( "System.String" ) )
- throw gcnew ArgumentException( "value must be of type String.","value" );
- else
- {
- String^ strValue = dynamic_cast(value);
- if ( strValue->Length > 5 )
- throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" );
- }
- }
-
-};
-
-public ref class SamplesDictionaryBase
-{
-public:
- static void Main()
- {
- DictionaryBase^ myDictionary = gcnew ShortStringDictionary();
-
- //
- for each (DictionaryEntry de in myDictionary)
- {
- //...
- }
- //
-
- //
- ICollection^ myCollection = gcnew ShortStringDictionary();
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection);
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- SamplesDictionaryBase::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp
deleted file mode 100644
index e7587a1e80f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// A simple example for the DictionaryEntry structure.
-using namespace System;
-using namespace System::Collections;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Create a new hash table.
- //
- Hashtable^ openWith = gcnew Hashtable();
-
- // Add some elements to the hash table. There are no
- // duplicate keys, but some of the values are duplicates.
- openWith->Add("txt", "notepad.exe");
- openWith->Add("bmp", "paint.exe");
- openWith->Add("dib", "paint.exe");
- openWith->Add("rtf", "wordpad.exe");
-
- // When you use foreach to enumerate hash table elements,
- // the elements are retrieved as DictionaryEntry objects.
- Console::WriteLine();
- //
- for each (DictionaryEntry de in openWith)
- {
- Console::WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
- }
- //
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
-/* This code example produces output similar to the following:
-
-Key = rtf, Value = wordpad.exe
-Key = txt, Value = notepad.exe
-Key = dib, Value = paint.exe
-Key = bmp, Value = paint.exe
- */
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp
deleted file mode 100644
index 4378b0f208a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-ref class Program
-{
-public:
- //
- static void Main()
- {
- HashSet^ lowNumbers = gcnew HashSet();
- HashSet^ highNumbers = gcnew HashSet();
-
- for (int i = 0; i < 6; i++)
- {
- lowNumbers->Add(i);
- }
-
- for (int i = 3; i < 10; i++)
- {
- highNumbers->Add(i);
- }
-
- Console::Write("lowNumbers contains {0} elements: ", lowNumbers->Count);
- DisplaySet(lowNumbers);
-
- Console::Write("highNumbers contains {0} elements: ", highNumbers->Count);
- DisplaySet(highNumbers);
-
- Console::WriteLine("highNumbers ExceptWith lowNumbers...");
- highNumbers->ExceptWith(lowNumbers);
-
- Console::Write("highNumbers contains {0} elements: ", highNumbers->Count);
- DisplaySet(highNumbers);
- }
- /* This example provides output similar to the following:
- * lowNumbers contains 6 elements: { 0 1 2 3 4 5 }
- * highNumbers contains 7 elements: { 3 4 5 6 7 8 9 }
- * highNumbers ExceptWith lowNumbers...
- * highNumbers contains 4 elements: { 6 7 8 9 }
- */
- //
-
-private:
- static void DisplaySet(HashSet^ set)
- {
- Console::Write("{");
- for each (int i in set)
- {
- Console::Write(" {0}", i);
- }
- Console::WriteLine(" }");
- }
-};
-
-int main()
-{
- Program::Main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp
deleted file mode 100644
index 2ff29223cc6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-ref class Program
-{
-public:
- static void Main()
- {
- HashSet ^allVehicles = gcnew HashSet(StringComparer::OrdinalIgnoreCase);
- List^ someVehicles = gcnew List();
-
- someVehicles->Add("Planes");
- someVehicles->Add("Trains");
- someVehicles->Add("Automobiles");
-
- // Add in the vehicles contained in the someVehicles list.
- allVehicles->UnionWith(someVehicles);
-
- Console::WriteLine("The current HashSet contains:\n");
- for each (String^ vehicle in allVehicles)
- {
- Console::WriteLine(vehicle);
- }
-
- allVehicles->Add("Ships");
- allVehicles->Add("Motorcycles");
- allVehicles->Add("Rockets");
- allVehicles->Add("Helicopters");
- allVehicles->Add("Submarines");
-
- Console::WriteLine("\nThe updated HashSet contains:\n");
- for each (String^ vehicle in allVehicles)
- {
- Console::WriteLine(vehicle);
- }
-
- // Verify that the 'All Vehicles' set contains at least the vehicles in
- // the 'Some Vehicles' list.
- if (allVehicles->IsSupersetOf(someVehicles))
- {
- Console::Write("\nThe 'All' vehicles set contains everything in ");
- Console::WriteLine("'Some' vechicles list.");
- }
-
- // Check for Rockets. Here the OrdinalIgnoreCase comparer will compare
- // true for the mixed-case vehicle type.
- if (allVehicles->Contains("roCKeTs"))
- {
- Console::WriteLine("\nThe 'All' vehicles set contains 'roCKeTs'");
- }
-
- allVehicles->ExceptWith(someVehicles);
- Console::WriteLine("\nThe excepted HashSet contains:\n");
- for each (String^ vehicle in allVehicles)
- {
- Console::WriteLine(vehicle);
- }
-
- // Remove all the vehicles that are not 'super cool'.
- allVehicles->RemoveWhere(gcnew Predicate(&isNotSuperCool));
-
- Console::WriteLine("\nThe super cool vehicles are:\n");
- for each (String^ vehicle in allVehicles)
- {
- Console::WriteLine(vehicle);
- }
- }
-
-private:
- // Predicate to determine vehicle 'coolness'.
- static bool isNotSuperCool(String^ vehicle)
- {
- bool superCool = (vehicle == "Helicopters") || (vehicle == "Motorcycles");
-
- return !superCool;
- }
-};
-
-int main()
-{
- Program::Main();
-}
-
-// The program writes the following output to the console::
-//
-// The current HashSet contains:
-//
-// Planes
-// Trains
-// Automobiles
-//
-// The updated HashSet contains:
-//
-// Planes
-// Trains
-// Automobiles
-// Ships
-// Motorcycles
-// Rockets
-// Helicopters
-// Submarines
-//
-// The 'All' vehicles set contains everything in 'Some' vechicles list.
-//
-// The 'All' vehicles set contains 'roCKeTs'
-//
-// The excepted HashSet contains:
-//
-// Ships
-// Motorcycles
-// Rockets
-// Helicopters
-// Submarines
-//
-// The super cool vehicles are:
-//
-// Motorcycles
-// Helicopters
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp
deleted file mode 100644
index 3533f81fe87..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-// The following code example creates and initializes a LinkedList of type String and then displays its contents.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Generic;
-
-void main()
-{
- // Create and initialize a new LinkedList.
- LinkedList< String^ > ^ ll = gcnew LinkedList< String^ >;
- ll->AddLast(L"red");
- ll->AddLast(L"orange");
- ll->AddLast(L"yellow");
- ll->AddLast(L"orange");
-
- // Display the contents of the LinkedList.
- if (ll->Count > 0)
- {
- Console::WriteLine(L"The first item in the list is {0}.", ll->First->Value);
- Console::WriteLine(L"The last item in the list is {0}.", ll->Last->Value);
- Console::WriteLine(L"The LinkedList contains:");
-
- for each (String^ s in ll)
- {
- Console::WriteLine(L" {0}", s);
- }
- }
- else
- {
- Console::WriteLine(L"The LinkedList is empty.");
- }
-}
-
-/* This code produces the following output.
-
-The first item in the list is red.
-The last item in the list is orange.
-The LinkedList contains:
- red
- orange
- yellow
- orange
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp
deleted file mode 100644
index e6f279e12f3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// The following code example creates a LinkedList node, adds it to a LinkedList, and tracks the values of its properties as the LinkedList changes.
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-public ref class GenericCollection {
-
-public:
- static void Main() {
-
- // Create a new LinkedListNode of type String and displays its properties.
- LinkedListNode^ lln = gcnew LinkedListNode( "orange" );
- Console::WriteLine( "After creating the node ...." );
- DisplayProperties( lln );
-
- // Create a new LinkedList.
- LinkedList^ ll = gcnew LinkedList();
-
- // Add the "orange" node and display its properties.
- ll->AddLast( lln );
- Console::WriteLine( "After adding the node to the empty LinkedList ...." );
- DisplayProperties( lln );
-
- // Add nodes before and after the "orange" node and display the "orange" node's properties.
- ll->AddFirst( "red" );
- ll->AddLast( "yellow" );
- Console::WriteLine( "After adding red and yellow ...." );
- DisplayProperties( lln );
-
- }
-
- static void DisplayProperties( LinkedListNode^ lln ) {
- if ( lln->List == nullptr )
- Console::WriteLine( " Node is not linked." );
- else
- Console::WriteLine( " Node belongs to a linked list with {0} elements.", lln->List->Count );
-
- if ( lln->Previous == nullptr )
- Console::WriteLine( " Previous node is null." );
- else
- Console::WriteLine( " Value of previous node: {0}", lln->Previous->Value );
-
- Console::WriteLine( " Value of current node: {0}", lln->Value );
-
- if ( lln->Next == nullptr )
- Console::WriteLine( " Next node is null." );
- else
- Console::WriteLine( " Value of next node: {0}", lln->Next->Value );
-
- Console::WriteLine();
- }
-
-};
-
-int main()
-{
- GenericCollection::Main();
-}
-
-/*
-
-This code produces the following output.
-
-After creating the node ....
- Node is not linked.
- Previous node is null.
- Value of current node: orange
- Next node is null.
-
-After adding the node to the empty LinkedList ....
- Node belongs to a linked list with 1 elements.
- Previous node is null.
- Value of current node: orange
- Next node is null.
-
-After adding red and yellow ....
- Node belongs to a linked list with 3 elements.
- Value of previous node: red
- Value of current node: orange
- Value of next node: yellow
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp
deleted file mode 100644
index 987e041929f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections;
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Create a new hash table.
- //
- Hashtable^ openWith = gcnew Hashtable();
-
- // Add some elements to the hash table. There are no
- // duplicate keys, but some of the values are duplicates.
- openWith->Add("txt", "notepad.exe");
- openWith->Add("bmp", "paint.exe");
- openWith->Add("dib", "paint.exe");
- openWith->Add("rtf", "wordpad.exe");
-
- // The Add method throws an exception if the new key is
- // already in the hash table.
- try
- {
- openWith->Add("txt", "winword.exe");
- }
- catch(...)
- {
- Console::WriteLine("An element with Key = \"txt\" already exists.");
- }
-
- // The Item property is the default property, so you
- // can omit its name when accessing elements.
- Console::WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]);
-
- // The default Item property can be used to change the value
- // associated with a key.
- openWith["rtf"] = "winword.exe";
- Console::WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]);
-
- // If a key does not exist, setting the default Item property
- // for that key adds a new key/value pair.
- openWith["doc"] = "winword.exe";
-
- // ContainsKey can be used to test keys before inserting
- // them.
- if (!openWith->ContainsKey("ht"))
- {
- openWith->Add("ht", "hypertrm.exe");
- Console::WriteLine("Value added for key = \"ht\": {0}", openWith["ht"]);
- }
-
- // When you use foreach to enumerate hash table elements,
- // the elements are retrieved as KeyValuePair objects.
- Console::WriteLine();
- for each( DictionaryEntry de in openWith )
- {
- Console::WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
- }
-
- // To get the values alone, use the Values property.
- ICollection^ valueColl = openWith->Values;
-
- // The elements of the ValueCollection are strongly typed
- // with the type that was specified for hash table values.
- Console::WriteLine();
- for each( String^ s in valueColl )
- {
- Console::WriteLine("Value = {0}", s);
- }
-
- // To get the keys alone, use the Keys property.
- ICollection^ keyColl = openWith->Keys;
-
- // The elements of the KeyCollection are strongly typed
- // with the type that was specified for hash table keys.
- Console::WriteLine();
- for each( String^ s in keyColl )
- {
- Console::WriteLine("Key = {0}", s);
- }
-
- // Use the Remove method to remove a key/value pair.
- Console::WriteLine("\nRemove(\"doc\")");
- openWith->Remove("doc");
-
- if (!openWith->ContainsKey("doc"))
- {
- Console::WriteLine("Key \"doc\" is not found.");
- }
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
-/* This code example produces the following output:
-
-An element with Key = "txt" already exists.
-For key = "rtf", value = wordpad.exe.
-For key = "rtf", value = winword.exe.
-Value added for key = "ht": hypertrm.exe
-
-Key = dib, Value = paint.exe
-Key = txt, Value = notepad.exe
-Key = ht, Value = hypertrm.exe
-Key = bmp, Value = paint.exe
-Key = rtf, Value = winword.exe
-Key = doc, Value = winword.exe
-
-Value = paint.exe
-Value = notepad.exe
-Value = hypertrm.exe
-Value = paint.exe
-Value = winword.exe
-Value = winword.exe
-
-Key = dib
-Key = txt
-Key = ht
-Key = bmp
-Key = rtf
-Key = doc
-
-Remove("doc")
-Key "doc" is not found.
- */
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp
deleted file mode 100644
index 5b410769391..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-using namespace System;
-using namespace System::Collections;
-
-public ref class Remarks
-{
-public:
- static void Main()
- {
- // Create a new hash table.
- //
- Hashtable^ myHashtable = gcnew Hashtable();
-
- // Add some elements to the hash table. There are no
- // duplicate keys, but some of the values are duplicates.
- myHashtable->Add("txt", "notepad.exe");
- myHashtable->Add("bmp", "paint.exe");
- myHashtable->Add("dib", "paint.exe");
- myHashtable->Add("rtf", "wordpad.exe");
-
-
- // When you use foreach to enumerate hash table elements,
- // the elements are retrieved as KeyValuePair objects.
- //
- for each(DictionaryEntry de in myHashtable)
- {
- // ...
- }
- //
- }
-};
-
-int main()
-{
- Remarks::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp
deleted file mode 100644
index a614056e17b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-
-// The following code example creates hash tables using different Hashtable constructors
-// and demonstrates the differences in the behavior of the hash tables,
-// even if each one contains the same elements.
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-
-ref class myComparer : IEqualityComparer
-{
-public:
- virtual bool Equals(Object^ x, Object^ y)
- {
- return x->Equals(y);
- }
-
- virtual int GetHashCode(Object^ obj)
- {
- return obj->ToString()->ToLower()->GetHashCode();
- }
-};
-
-//
-ref class myCultureComparer : IEqualityComparer
-{
-private:
- CaseInsensitiveComparer^ myComparer;
-
-public:
- myCultureComparer()
- {
- myComparer = CaseInsensitiveComparer::DefaultInvariant;
- }
-
- myCultureComparer(CultureInfo^ myCulture)
- {
- myComparer = gcnew CaseInsensitiveComparer(myCulture);
- }
-
- virtual bool Equals(Object^ x, Object^ y)
- {
- if (myComparer->Compare(x, y) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- virtual int GetHashCode(Object^ obj)
- {
- return obj->ToString()->ToLower()->GetHashCode();
- }
-};
-//
-
-int main()
-{
-
- // Create a hash table using the default hash code provider and the default comparer.
- Hashtable^ myHT1 = gcnew Hashtable((IEqualityComparer^)nullptr);
- myHT1->Add( "FIRST", "Hello" );
- myHT1->Add( "SECOND", "World" );
- myHT1->Add( "THIRD", "!" );
-
- // Create a hash table using the specified IEqualityComparer that uses
- // the default Object.Equals to determine equality.
- Hashtable^ myHT2 = gcnew Hashtable(gcnew myComparer());
- myHT2->Add( "FIRST", "Hello" );
- myHT2->Add( "SECOND", "World" );
- myHT2->Add( "THIRD", "!" );
-
- // Create a hash table using a case-insensitive hash code provider and
- // case-insensitive comparer based on the InvariantCulture.
- Hashtable^ myHT3 = gcnew Hashtable(
- CaseInsensitiveHashCodeProvider::DefaultInvariant,
- CaseInsensitiveComparer::DefaultInvariant);
- myHT3->Add( "FIRST", "Hello" );
- myHT3->Add( "SECOND", "World" );
- myHT3->Add( "THIRD", "!" );
-
- // Create a hash table using an IEqualityComparer that is based on
- // the Turkish culture (tr-TR) where "I" is not the uppercase
- // version of "i".
- CultureInfo^ myCul = gcnew CultureInfo("tr-TR");
- Hashtable^ myHT4 = gcnew Hashtable( gcnew myCultureComparer(myCul) );
- myHT4->Add( "FIRST", "Hello" );
- myHT4->Add( "SECOND", "World" );
- myHT4->Add( "THIRD", "!" );
-
- // Search for a key in each hash table.
- Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT4: {0}", myHT4->ContainsKey( "first" ) );
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-first is in myHT1: False
-first is in myHT2: False
-first is in myHT3: True
-first is in myHT4: False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp
deleted file mode 100644
index ddc083162d8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-// The following code example creates hash tables using different Hashtable
-// constructors and demonstrates the differences in the behavior of the hash
-// tables, even if each one contains the same elements.
-
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-
-ref class myCultureComparer : public IEqualityComparer
-{
-public:
- CaseInsensitiveComparer^ myComparer;
-
-public:
- myCultureComparer()
- {
- myComparer = CaseInsensitiveComparer::DefaultInvariant;
- }
-
-public:
- myCultureComparer(CultureInfo^ myCulture)
- {
- myComparer = gcnew CaseInsensitiveComparer(myCulture);
- }
-
-public:
- virtual bool Equals(Object^ x, Object^ y)
- {
- if (myComparer->Compare(x, y) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
-public:
- virtual int GetHashCode(Object^ obj)
- {
- // Compare the hash code for the lowercase versions of the strings.
- return obj->ToString()->ToLower()->GetHashCode();
- }
-};
-
-public ref class SamplesHashtable
-{
-
-public:
- static void Main()
- {
- // Create the dictionary.
- SortedList^ mySL = gcnew SortedList();
- mySL->Add("FIRST", "Hello");
- mySL->Add("SECOND", "World");
- mySL->Add("THIRD", "!");
-
- // Create a hash table using the default comparer.
- Hashtable^ myHT1 = gcnew Hashtable(mySL);
-
- // Create a hash table using the specified IEqualityComparer that uses
- // the CaseInsensitiveComparer.DefaultInvariant to determine equality.
- Hashtable^ myHT2 = gcnew Hashtable(mySL, gcnew myCultureComparer());
-
- // Create a hash table using an IEqualityComparer that is based on
- // the Turkish culture (tr-TR) where "I" is not the uppercase
- // version of "i".
- CultureInfo^ myCul = gcnew CultureInfo("tr-TR");
- Hashtable^ myHT3 = gcnew Hashtable(mySL, gcnew myCultureComparer(myCul));
-
- // Search for a key in each hash table.
- Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first"));
- Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first"));
- Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first"));
- }
-};
-
-int main()
-{
- SamplesHashtable::Main();
-};
-
-/*
-This code produces the following output.
-Results vary depending on the system's culture settings.
-
-first is in myHT1: False
-first is in myHT2: True
-first is in myHT3: False
-
-*/
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp
deleted file mode 100644
index aeefb15d534..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-
-// The following code example creates hash tables using different Hashtable constructors
-// and demonstrates the differences in the behavior of the hash tables,
-// even if each one contains the same elements.
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-
-ref class myCultureComparer : public IEqualityComparer
-{
-public:
- CaseInsensitiveComparer^ myComparer;
-
-public:
- myCultureComparer()
- {
- myComparer = CaseInsensitiveComparer::DefaultInvariant;
- }
-
-public:
- myCultureComparer(CultureInfo^ myCulture)
- {
- myComparer = gcnew CaseInsensitiveComparer(myCulture);
- }
-
-public:
- virtual bool Equals(Object^ x, Object^ y)
- {
- if (myComparer->Compare(x, y) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
-public:
- virtual int GetHashCode(Object^ obj)
- {
- // Compare the hash code for the lowercase versions of the strings.
- return obj->ToString()->ToLower()->GetHashCode();
- }
-};
-
-public ref class SamplesHashtable
-{
-
-public:
- static void Main()
- {
-
- // Create the dictionary.
- SortedList^ mySL = gcnew SortedList;
- mySL->Add( "FIRST", "Hello" );
- mySL->Add( "SECOND", "World" );
- mySL->Add( "THIRD", "!" );
-
- // Create a hash table using the default hash code provider and the default comparer.
- Hashtable^ myHT1 = gcnew Hashtable( mySL, .8f );
-
- // Create a hash table using the specified case-insensitive hash code provider and case-insensitive comparer.
- Hashtable^ myHT2 = gcnew Hashtable( mySL, .8f, gcnew myCultureComparer() );
-
- // Create a hash table using the specified KeyComparer.
- // The KeyComparer uses a case-insensitive hash code provider and a case-insensitive comparer,
- // which are based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i".
- CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" );
- Hashtable^ myHT3 = gcnew Hashtable( mySL, .8f, gcnew myCultureComparer( myCul ) );
-
- // Search for a key in each hash table.
- Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) );
- Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) );
- }
-};
-
-int main()
-{
- SamplesHashtable::Main();
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-first is in myHT1: False
-first is in myHT2: True
-first is in myHT3: False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp
deleted file mode 100644
index 90be7623a99..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-
-// The following code example creates hash tables using different Hashtable constructors
-// and demonstrates the differences in the behavior of the hash tables,
-// even if each one contains the same elements.
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-
-ref class myCultureComparer : public IEqualityComparer
-{
-public:
- CaseInsensitiveComparer^ myComparer;
-
-public:
- myCultureComparer()
- {
- myComparer = CaseInsensitiveComparer::DefaultInvariant;
- }
-
-public:
- myCultureComparer(CultureInfo^ myCulture)
- {
- myComparer = gcnew CaseInsensitiveComparer(myCulture);
- }
-
-public:
- virtual bool Equals(Object^ x, Object^ y)
- {
- if (myComparer->Compare(x, y) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
-public:
- virtual int GetHashCode(Object^ obj)
- {
- // Compare the hash code for the lowercase versions of the strings.
- return obj->ToString()->ToLower()->GetHashCode();
- }
-};
-
-public ref class SamplesHashtable
-{
-
-public:
- static void Main()
- {
- // Create a hash table using the default comparer.
- Hashtable^ myHT1 = gcnew Hashtable(3);
- myHT1->Add("FIRST", "Hello");
- myHT1->Add("SECOND", "World");
- myHT1->Add("THIRD", "!");
-
- // Create a hash table using the specified IEqualityComparer that uses
- // the CaseInsensitiveComparer.DefaultInvariant to determine equality.
- Hashtable^ myHT2 = gcnew Hashtable(3, gcnew myCultureComparer());
- myHT2->Add("FIRST", "Hello");
- myHT2->Add("SECOND", "World");
- myHT2->Add("THIRD", "!");
-
- // Create a hash table using an IEqualityComparer that is based on
- // the Turkish culture (tr-TR) where "I" is not the uppercase
- // version of "i".
- CultureInfo^ myCul = gcnew CultureInfo("tr-TR");
- Hashtable^ myHT3 = gcnew Hashtable(3, gcnew myCultureComparer(myCul));
- myHT3->Add("FIRST", "Hello");
- myHT3->Add("SECOND", "World");
- myHT3->Add("THIRD", "!");
-
- // Search for a key in each hash table.
- Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first"));
- Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first"));
- Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first"));
-
- }
-};
-
-int main()
-{
- SamplesHashtable::Main();
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-first is in myHT1: False
-first is in myHT2: True
-first is in myHT3: False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp
deleted file mode 100644
index a55776fd358..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-
-// The following code example creates hash tables using different Hashtable constructors
-// and demonstrates the differences in the behavior of the hash tables,
-// even if each one contains the same elements.
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-
-ref class myCultureComparer : public IEqualityComparer
-{
-public:
- CaseInsensitiveComparer^ myComparer;
-
-public:
- myCultureComparer()
- {
- myComparer = CaseInsensitiveComparer::DefaultInvariant;
- }
-
-public:
- myCultureComparer(CultureInfo^ myCulture)
- {
- myComparer = gcnew CaseInsensitiveComparer(myCulture);
- }
-
-public:
- virtual bool Equals(Object^ x, Object^ y)
- {
- if (myComparer->Compare(x, y) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
-public:
- virtual int GetHashCode(Object^ obj)
- {
- // Compare the hash code for the lowercase versions of the strings.
- return obj->ToString()->ToLower()->GetHashCode();
- }
-};
-
-public ref class SamplesHashtable
-{
-
-public:
- static void Main()
- {
- // Create a hash table using the default comparer.
- Hashtable^ myHT1 = gcnew Hashtable(3, .8f);
- myHT1->Add("FIRST", "Hello");
- myHT1->Add("SECOND", "World");
- myHT1->Add("THIRD", "!");
-
- // Create a hash table using the specified IEqualityComparer that uses
- // the CaseInsensitiveComparer.DefaultInvariant to determine equality.
- Hashtable^ myHT2 = gcnew Hashtable(3, .8f, gcnew myCultureComparer());
- myHT2->Add("FIRST", "Hello");
- myHT2->Add("SECOND", "World");
- myHT2->Add("THIRD", "!");
-
- // Create a hash table using an IEqualityComparer that is based on
- // the Turkish culture (tr-TR) where "I" is not the uppercase
- // version of "i".
- CultureInfo^ myCul = gcnew CultureInfo("tr-TR");
- Hashtable^ myHT3 = gcnew Hashtable(3, .8f, gcnew myCultureComparer(myCul));
- myHT3->Add("FIRST", "Hello");
- myHT3->Add("SECOND", "World");
- myHT3->Add("THIRD", "!");
-
- // Search for a key in each hash table.
- Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first"));
- Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first"));
- Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first"));
-
- }
-};
-
-int main()
-{
- SamplesHashtable::Main();
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-first is in myHT1: False
-first is in myHT2: True
-first is in myHT3: False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp
deleted file mode 100644
index f1919addfd6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-// The following code example implements the ReadOnlyCollectionBase class.
-//
-using namespace System;
-using namespace System::Collections;
-public ref class ROCollection: public ReadOnlyCollectionBase
-{
-public:
- ROCollection( IList^ sourceList )
- {
- InnerList->AddRange( sourceList );
- }
-
- property Object^ Item [int]
- {
- Object^ get( int index )
- {
- return (InnerList[ index ]);
- }
-
- }
- int IndexOf( Object^ value )
- {
- return (InnerList->IndexOf( value ));
- }
-
- bool Contains( Object^ value )
- {
- return (InnerList->Contains( value ));
- }
-
-};
-
-void PrintIndexAndValues( ROCollection^ myCol );
-void PrintValues2( ROCollection^ myCol );
-int main()
-{
- // Create an ArrayList.
- ArrayList^ myAL = gcnew ArrayList;
- myAL->Add( "red" );
- myAL->Add( "blue" );
- myAL->Add( "yellow" );
- myAL->Add( "green" );
- myAL->Add( "orange" );
- myAL->Add( "purple" );
-
- // Create a new ROCollection that contains the elements in myAL.
- ROCollection^ myCol = gcnew ROCollection( myAL );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Contents of the collection (using enumerator):" );
- PrintValues2( myCol );
-
- // Display the contents of the collection using the Count property and the Item property.
- Console::WriteLine( "Contents of the collection (using Count and Item):" );
- PrintIndexAndValues( myCol );
-
- // Search the collection with Contains and IndexOf.
- Console::WriteLine( "Contains yellow: {0}", myCol->Contains( "yellow" ) );
- Console::WriteLine( "orange is at index {0}.", myCol->IndexOf( "orange" ) );
- Console::WriteLine();
-}
-
-
-// Uses the Count property and the Item property.
-void PrintIndexAndValues( ROCollection^ myCol )
-{
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " [{0}]: {1}", i, myCol->Item[ i ] );
- Console::WriteLine();
-}
-
-
-// Uses the enumerator.
-void PrintValues2( ROCollection^ myCol )
-{
- System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator();
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( " {0}", myEnumerator->Current );
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Contents of the collection (using enumerator):
- red
- blue
- yellow
- green
- orange
- purple
-
-Contents of the collection (using Count and Item):
- [0]: red
- [1]: blue
- [2]: yellow
- [3]: green
- [4]: orange
- [5]: purple
-
-Contains yellow: True
-orange is at index 4.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp
deleted file mode 100644
index aea5c5a39cb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-// The following code example implements the ReadOnlyCollectionBase class.
-using namespace System;
-using namespace System::Collections;
-using namespace System::Threading;
-
-public ref class ROCollection: public ReadOnlyCollectionBase
-{
-public:
- ROCollection( IList^ sourceList )
- {
- InnerList->AddRange( sourceList );
- }
-
- property Object^ Item [int]
- {
- Object^ get( int index )
- {
- return (InnerList[ index ]);
- }
-
- }
- int IndexOf( Object^ value )
- {
- return (InnerList->IndexOf( value ));
- }
-
- bool Contains( Object^ value )
- {
- return (InnerList->Contains( value ));
- }
-
-};
-
-public ref class SamplesCollectionBase
-{
-public:
- static void Main()
- {
-
- // Create an ArrayList.
- ArrayList^ myAL = gcnew ArrayList();
- myAL->Add( "red" );
- myAL->Add( "blue" );
- myAL->Add( "yellow" );
- myAL->Add( "green" );
- myAL->Add( "orange" );
- myAL->Add( "purple" );
-
- // Create a new ROCollection that contains the elements in myAL.
- ROCollection^ myReadOnlyCollection = gcnew ROCollection( myAL );
-
- //
- // Get the ICollection interface from the ReadOnlyCollectionBase
- // derived class.
- ICollection^ myCollection = myReadOnlyCollection;
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection);
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- SamplesCollectionBase::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp
deleted file mode 100644
index 89c82b72244..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-
-//
-
-// The following code example creates SortedList instances using different constructors
-// and demonstrates the differences in the behavior of the SortedList instances.
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-
-void PrintKeysAndValues( SortedList^ myList )
-{
- Console::WriteLine( " -KEY- -VALUE-" );
- for ( int i = 0; i < myList->Count; i++ )
- {
- Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) );
-
- }
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Create a SortedList using the default comparer.
- SortedList^ mySL1 = gcnew SortedList;
- Console::WriteLine( "mySL1 (default):" );
- mySL1->Add( "FIRST", "Hello" );
- mySL1->Add( "SECOND", "World" );
- mySL1->Add( "THIRD", "!" );
-
- try { mySL1->Add( "first", "Ola!" ); }
- catch ( ArgumentException^ e ) { Console::WriteLine( e ); }
-
- PrintKeysAndValues( mySL1 );
-
- // Create a SortedList using the specified case-insensitive comparer.
- SortedList^ mySL2 = gcnew SortedList( gcnew CaseInsensitiveComparer );
- Console::WriteLine( "mySL2 (case-insensitive comparer):" );
- mySL2->Add( "FIRST", "Hello" );
- mySL2->Add( "SECOND", "World" );
- mySL2->Add( "THIRD", "!" );
-
- try { mySL2->Add( "first", "Ola!" ); }
- catch ( ArgumentException^ e ) { Console::WriteLine( e ); }
-
- PrintKeysAndValues( mySL2 );
-
- // Create a SortedList using the specified KeyComparer.
- // The KeyComparer uses a case-insensitive hash code provider and a case-insensitive comparer,
- // which are based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i".
- CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" );
- SortedList^ mySL3 = gcnew SortedList( gcnew CaseInsensitiveComparer( myCul ) );
- Console::WriteLine( "mySL3 (case-insensitive comparer, Turkish culture):" );
- mySL3->Add( "FIRST", "Hello" );
- mySL3->Add( "SECOND", "World" );
- mySL3->Add( "THIRD", "!" );
-
- try { mySL3->Add( "first", "Ola!" ); }
- catch ( ArgumentException^ e ) { Console::WriteLine( e ); }
-
- PrintKeysAndValues( mySL3 );
-
- // Create a SortedList using the ComparisonType.InvariantCultureIgnoreCase value.
- SortedList^ mySL4 = gcnew SortedList( StringComparer::InvariantCultureIgnoreCase );
- Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" );
- mySL4->Add( "FIRST", "Hello" );
- mySL4->Add( "SECOND", "World" );
- mySL4->Add( "THIRD", "!" );
-
- try { mySL4->Add( "first", "Ola!" ); }
- catch ( ArgumentException^ e ) { Console::WriteLine( e ); }
-
- PrintKeysAndValues( mySL4 );
-
- Console::WriteLine("\n\nHit ENTER to return");
- Console::ReadLine();
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-mySL1 (default):
- -KEY- -VALUE-
- first : Ola!
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-mySL2 (case-insensitive comparer):
-System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first'
- at System.Collections.SortedList.Add(Object key, Object value)
- at SamplesSortedList.Main()
- -KEY- -VALUE-
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-mySL3 (case-insensitive comparer, Turkish culture):
- -KEY- -VALUE-
- FIRST : Hello
- first : Ola!
- SECOND: World
- THIRD : !
-
-mySL4 (InvariantCultureIgnoreCase):
-System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first'
- at System.Collections.SortedList.Add(Object key, Object value)
- at SamplesSortedList.Main()
- -KEY- -VALUE-
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp
deleted file mode 100644
index 89748fd1f54..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-
-// The following code example creates SortedList instances using different constructors
-// and demonstrates the differences in the behavior of the SortedList instances.
-//
-
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-void PrintKeysAndValues( SortedList^ myList )
-{
- Console::WriteLine( " -KEY- -VALUE-" );
- for ( int i = 0; i < myList->Count; i++ )
- {
- Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) );
-
- }
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Create the dictionary.
- Hashtable^ myHT = gcnew Hashtable;
- myHT->Add( "FIRST", "Hello" );
- myHT->Add( "SECOND", "World" );
- myHT->Add( "THIRD", "!" );
-
- // Create a SortedList using the default comparer.
- SortedList^ mySL1 = gcnew SortedList( myHT );
- Console::WriteLine( "mySL1 (default):" );
- try
- {
- mySL1->Add( "first", "Ola!" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- PrintKeysAndValues( mySL1 );
-
- // Create a SortedList using the specified case-insensitive comparer.
- SortedList^ mySL2 = gcnew SortedList( myHT,gcnew CaseInsensitiveComparer );
- Console::WriteLine( "mySL2 (case-insensitive comparer):" );
- try
- {
- mySL2->Add( "first", "Ola!" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- PrintKeysAndValues( mySL2 );
-
- // Create a SortedList using the specified CaseInsensitiveComparer,
- // which is based on the Turkish culture (tr-TR), where "I" is not
- // the uppercase version of "i".
- CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" );
- SortedList^ mySL3 = gcnew SortedList( myHT, gcnew CaseInsensitiveComparer( myCul ) );
- Console::WriteLine( "mySL3 (case-insensitive comparer, Turkish culture):" );
- try
- {
- mySL3->Add( "first", "Ola!" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- PrintKeysAndValues( mySL3 );
-
- // Create a SortedList using the ComparisonType.InvariantCultureIgnoreCase value.
- SortedList^ mySL4 = gcnew SortedList( myHT, StringComparer::InvariantCultureIgnoreCase );
- Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" );
- try
- {
- mySL4->Add( "first", "Ola!" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- PrintKeysAndValues( mySL4 );
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-mySL1 (default):
- -KEY- -VALUE-
- first : Ola!
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-mySL2 (case-insensitive comparer):
-System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first'
- at System.Collections.SortedList.Add(Object key, Object value)
- at SamplesSortedList.Main()
- -KEY- -VALUE-
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-mySL3 (case-insensitive comparer, Turkish culture):
- -KEY- -VALUE-
- FIRST : Hello
- first : Ola!
- SECOND: World
- THIRD : !
-
-mySL4 (InvariantCultureIgnoreCase):
-System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first'
- at System.Collections.SortedList.Add(Object key, Object value)
- at SamplesSortedList.Main()
- -KEY- -VALUE-
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp
deleted file mode 100644
index 047062c6747..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-//
-// The following code example creates SortedList instances using different constructors
-// and demonstrates the differences in the behavior of the SortedList instances.
-
-
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-void PrintKeysAndValues( SortedList^ myList )
-{
- Console::WriteLine( " Capacity is {0}.", myList->Capacity );
- Console::WriteLine( " -KEY- -VALUE-" );
- for ( int i = 0; i < myList->Count; i++ )
- {
- Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) );
-
- }
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Create a SortedList using the default comparer.
- SortedList^ mySL1 = gcnew SortedList( 3 );
- Console::WriteLine( "mySL1 (default):" );
- mySL1->Add( "FIRST", "Hello" );
- mySL1->Add( "SECOND", "World" );
- mySL1->Add( "THIRD", "!" );
- try
- {
- mySL1->Add( "first", "Ola!" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- PrintKeysAndValues( mySL1 );
-
- // Create a SortedList using the specified case-insensitive comparer.
- SortedList^ mySL2 = gcnew SortedList( gcnew CaseInsensitiveComparer,3 );
- Console::WriteLine( "mySL2 (case-insensitive comparer):" );
- mySL2->Add( "FIRST", "Hello" );
- mySL2->Add( "SECOND", "World" );
- mySL2->Add( "THIRD", "!" );
- try
- {
- mySL2->Add( "first", "Ola!" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- PrintKeysAndValues( mySL2 );
-
- // Create a SortedList using the specified CaseInsensitiveComparer,
- // which is based on the Turkish culture (tr-TR), where "I" is not
- // the uppercase version of "i".
- CultureInfo^ myCul = gcnew CultureInfo("tr-TR");
- SortedList^ mySL3 = gcnew SortedList(gcnew CaseInsensitiveComparer(myCul), 3);
-
- Console::WriteLine("mySL3 (case-insensitive comparer, Turkish culture):");
-
- mySL3->Add("FIRST", "Hello");
- mySL3->Add("SECOND", "World");
- mySL3->Add("THIRD", "!");
- try
- {
- mySL3->Add("first", "Ola!");
- }
- catch (ArgumentException^ e)
- {
- Console::WriteLine(e);
- }
- PrintKeysAndValues(mySL3);
-
- // Create a SortedList using the
- // StringComparer.InvariantCultureIgnoreCase value.
- SortedList^ mySL4 = gcnew SortedList( StringComparer::InvariantCultureIgnoreCase, 3 );
- Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" );
- mySL4->Add( "FIRST", "Hello" );
- mySL4->Add( "SECOND", "World" );
- mySL4->Add( "THIRD", "!" );
- try
- {
- mySL4->Add( "first", "Ola!" );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- PrintKeysAndValues( mySL4 );
-}
-
-/*
-This code produces the following output. Results vary depending on the system's culture settings.
-
-mySL1 (default):
- Capacity is 6.
- -KEY- -VALUE-
- first : Ola!
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-mySL2 (case-insensitive comparer):
-System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first'
- at System.Collections.SortedList.Add(Object key, Object value)
- at SamplesSortedList.Main()
- Capacity is 3.
- -KEY- -VALUE-
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-mySL3 (case-insensitive comparer, Turkish culture):
- Capacity is 6.
- -KEY- -VALUE-
- FIRST : Hello
- first : Ola!
- SECOND: World
- THIRD : !
-
-mySL4 (InvariantCultureIgnoreCase):
-System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first'
- at System.Collections.SortedList.Add(Object key, Object value)
- at SamplesSortedList.Main()
- Capacity is 3.
- -KEY- -VALUE-
- FIRST : Hello
- SECOND: World
- THIRD : !
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp
deleted file mode 100644
index a4aa7596eb9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// The following code example shows how to create and use masks.
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Specialized;
-int main()
-{
- // Creates and initializes a BitVector32 with all bit flags set to FALSE.
- BitVector32 myBV;
-
- // Creates masks to isolate each of the first five bit flags.
- int myBit1 = BitVector32::CreateMask();
- int myBit2 = BitVector32::CreateMask( myBit1 );
- int myBit3 = BitVector32::CreateMask( myBit2 );
- int myBit4 = BitVector32::CreateMask( myBit3 );
- int myBit5 = BitVector32::CreateMask( myBit4 );
- Console::WriteLine( "Initial: \t {0}", myBV );
-
- // Sets the third bit to TRUE.
- myBV[ myBit3 ] = true;
- Console::WriteLine( "myBit3 = TRUE \t {0}", myBV );
-
- // Combines two masks to access multiple bits at a time.
- myBV[ myBit4 + myBit5 ] = true;
- Console::WriteLine( "myBit4 + myBit5 = TRUE \t {0}", myBV );
- myBV[ myBit1 | myBit2 ] = true;
- Console::WriteLine( "myBit1 | myBit2 = TRUE \t {0}", myBV );
-}
-
-/*
-This code produces the following output.
-
-Initial: BitVector32 {00000000000000000000000000000000}
-myBit3 = TRUE BitVector32 {00000000000000000000000000000100}
-myBit4 + myBit5 = TRUE BitVector32 {00000000000000000000000000011100}
-myBit1 | myBit2 = TRUE BitVector32 {00000000000000000000000000011111}
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp
deleted file mode 100644
index e3796e3bdc3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// The following code example compares a BitVector32 with another BitVector32 and with an Int32.
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Specialized;
-
-int main()
-{
- // Creates and initializes a BitVector32 with the value 123.
- // This is the BitVector32 that will be compared to different types.
- BitVector32 myBV(123);
-
- // Creates and initializes a new BitVector32 which will be set up as sections.
- BitVector32 myBVsect(0);
-
- // Compares myBV and myBVsect.
- Console::WriteLine( "myBV : {0}", myBV );
- Console::WriteLine( "myBVsect : {0}", myBVsect );
- if ( myBV.Equals( myBVsect ) )
- Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data );
- else
- Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data );
-
- Console::WriteLine();
-
- // Assigns values to the sections of myBVsect.
- BitVector32::Section mySect1 = BitVector32::CreateSection( 5 );
- BitVector32::Section mySect2 = BitVector32::CreateSection( 1, mySect1 );
- BitVector32::Section mySect3 = BitVector32::CreateSection( 20, mySect2 );
- myBVsect[ mySect1 ] = 3;
- myBVsect[ mySect2 ] = 1;
- myBVsect[ mySect3 ] = 7;
-
- // Compares myBV and myBVsect.
- Console::WriteLine( "myBV : {0}", myBV );
- Console::WriteLine( "myBVsect with values : {0}", myBVsect );
- if ( myBV.Equals( myBVsect ) )
- Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data );
- else
- Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data );
-
- Console::WriteLine();
-
- // Compare myBV with an Int32.
- Console::WriteLine( "Comparing myBV with an Int32: " );
- Int32 myInt32 = 123;
-
- // Using Equals will fail because Int32 is not compatible with BitVector32.
- if ( myBV.Equals( myInt32 ) )
- Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) equals myInt32( {1}).", myBV.Data, myInt32 );
- else
- Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 );
-
- // To compare a BitVector32 with an Int32, use the "==" operator.
- if ( myBV.Data == myInt32 )
- Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) equals myInt32( {1}).", myBV.Data, myInt32 );
- else
- Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 );
-}
-
-/*
-This code produces the following output.
-
-myBV : BitVector32 {00000000000000000000000001111011}
-myBVsect : BitVector32 {00000000000000000000000000000000}
- myBV(123) does not equal myBVsect(0).
-
-myBV : BitVector32 {00000000000000000000000001111011}
-myBVsect with values : BitVector32 {00000000000000000000000001111011}
- myBV(123) equals myBVsect(123).
-
-Comparing myBV with an Int32:
- Using BitVector32::Equals, myBV(123) does not equal myInt32(123).
- Using the "==" operator, myBV.Data(123) equals myInt32(123).
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp
deleted file mode 100644
index 43f50a3e1db..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// The following code example uses a BitVector32 as a collection of bit flags.
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Specialized;
-int main()
-{
-
- // Creates and initializes a BitVector32 with all bit flags set to FALSE.
- BitVector32 myBV(0);
-
- // Creates masks to isolate each of the first five bit flags.
- int myBit1 = BitVector32::CreateMask();
- int myBit2 = BitVector32::CreateMask( myBit1 );
- int myBit3 = BitVector32::CreateMask( myBit2 );
- int myBit4 = BitVector32::CreateMask( myBit3 );
- int myBit5 = BitVector32::CreateMask( myBit4 );
-
- // Sets the alternating bits to TRUE.
- Console::WriteLine( "Setting alternating bits to TRUE:" );
- Console::WriteLine( " Initial: {0}", myBV );
- myBV[ myBit1 ] = true;
- Console::WriteLine( " myBit1 = TRUE: {0}", myBV );
- myBV[ myBit3 ] = true;
- Console::WriteLine( " myBit3 = TRUE: {0}", myBV );
- myBV[ myBit5 ] = true;
- Console::WriteLine( " myBit5 = TRUE: {0}", myBV );
-}
-
-/*
-This code produces the following output.
-
-Setting alternating bits to TRUE:
-Initial: BitVector32 {00000000000000000000000000000000}
-myBit1 = TRUE: BitVector32 {00000000000000000000000000000001}
-myBit3 = TRUE: BitVector32 {00000000000000000000000000000101}
-myBit5 = TRUE: BitVector32 {00000000000000000000000000010101}
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp
deleted file mode 100644
index 91d45f3f84b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// The following code example uses a BitVector32 as a collection of sections.
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Specialized;
-
-int main()
-{
- // Creates and initializes a BitVector32.
- BitVector32 myBV(0);
-
- // Creates four sections in the BitVector32 with maximum values 6, 3, 1, and 15.
- // mySect3, which uses exactly one bit, can also be used as a bit flag.
- BitVector32::Section mySect1 = BitVector32::CreateSection( 6 );
- BitVector32::Section mySect2 = BitVector32::CreateSection( 3, mySect1 );
- BitVector32::Section mySect3 = BitVector32::CreateSection( 1, mySect2 );
- BitVector32::Section mySect4 = BitVector32::CreateSection( 15, mySect3 );
-
- // Displays the values of the sections.
- Console::WriteLine( "Initial values:" );
- Console::WriteLine( "\tmySect1: {0}", myBV[ mySect1 ] );
- Console::WriteLine( "\tmySect2: {0}", myBV[ mySect2 ] );
- Console::WriteLine( "\tmySect3: {0}", myBV[ mySect3 ] );
- Console::WriteLine( "\tmySect4: {0}", myBV[ mySect4 ] );
-
- // Sets each section to a new value and displays the value of the BitVector32 at each step.
- Console::WriteLine( "Changing the values of each section:" );
- Console::WriteLine( "\tInitial: \t {0}", myBV );
- myBV[ mySect1 ] = 5;
- Console::WriteLine( "\tmySect1 = 5:\t {0}", myBV );
- myBV[ mySect2 ] = 3;
- Console::WriteLine( "\tmySect2 = 3:\t {0}", myBV );
- myBV[ mySect3 ] = 1;
- Console::WriteLine( "\tmySect3 = 1:\t {0}", myBV );
- myBV[ mySect4 ] = 9;
- Console::WriteLine( "\tmySect4 = 9:\t {0}", myBV );
-
- // Displays the values of the sections.
- Console::WriteLine( "New values:" );
- Console::WriteLine( "\tmySect1: {0}", myBV[ mySect1 ] );
- Console::WriteLine( "\tmySect2: {0}", myBV[ mySect2 ] );
- Console::WriteLine( "\tmySect3: {0}", myBV[ mySect3 ] );
- Console::WriteLine( "\tmySect4: {0}", myBV[ mySect4 ] );
-}
-
-/*
-This code produces the following output.
-
-Initial values:
- mySect1: 0
- mySect2: 0
- mySect3: 0
- mySect4: 0
-Changing the values of each section:
- Initial: BitVector32 {00000000000000000000000000000000}
- mySect1 = 5: BitVector32 {00000000000000000000000000000101}
- mySect2 = 3: BitVector32 {00000000000000000000000000011101}
- mySect3 = 1: BitVector32 {00000000000000000000000000111101}
- mySect4 = 9: BitVector32 {00000000000000000000001001111101}
-New values:
- mySect1: 5
- mySect2: 3
- mySect3: 1
- mySect4: 9
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp
deleted file mode 100644
index f4a12c16ce9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-// The following code example demonstrates several of the properties and methods of HybridDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-void PrintKeysAndValues1( IDictionary^ myCol );
-void PrintKeysAndValues2( IDictionary^ myCol );
-void PrintKeysAndValues3( HybridDictionary^ myCol );
-int main()
-{
-
- // Creates and initializes a new HybridDictionary.
- HybridDictionary^ myCol = gcnew HybridDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
- myCol->Add( "Plantain Bananas", "1.49" );
- myCol->Add( "Yellow Bananas", "0.79" );
- myCol->Add( "Strawberries", "3.33" );
- myCol->Add( "Cranberries", "5.98" );
- myCol->Add( "Navel Oranges", "1.29" );
- myCol->Add( "Grapes", "1.99" );
- myCol->Add( "Honeydew Melon", "0.59" );
- myCol->Add( "Seedless Watermelon", "0.49" );
- myCol->Add( "Pineapple", "1.49" );
- myCol->Add( "Nectarine", "1.99" );
- myCol->Add( "Plums", "1.69" );
- myCol->Add( "Peaches", "1.99" );
-
- // Display the contents of the collection using for each. This is the preferred method.
- Console::WriteLine( "Displays the elements using for each:" );
- PrintKeysAndValues1( myCol );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" );
- PrintKeysAndValues2( myCol );
-
- // Display the contents of the collection using the Keys, Values, Count, and Item properties.
- Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" );
- PrintKeysAndValues3( myCol );
-
- // Copies the HybridDictionary to an array with DictionaryEntry elements.
- array^myArr = gcnew array(myCol->Count);
- myCol->CopyTo( myArr, 0 );
-
- // Displays the values in the array.
- Console::WriteLine( "Displays the elements in the array:" );
- Console::WriteLine( " KEY VALUE" );
- for ( int i = 0; i < myArr->Length; i++ )
- Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value );
- Console::WriteLine();
-
- // Searches for a key.
- if ( myCol->Contains( "Kiwis" ) )
- Console::WriteLine( "The collection contains the key \"Kiwis\"." );
- else
- Console::WriteLine( "The collection does not contain the key \"Kiwis\"." );
-
- Console::WriteLine();
-
- // Deletes a key.
- myCol->Remove( "Plums" );
- Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" );
- PrintKeysAndValues1( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "The collection contains the following elements after it is cleared:" );
- PrintKeysAndValues1( myCol );
-}
-
-// Uses the for each statement which hides the complexity of the enumerator.
-// NOTE: The for each statement is the preferred way of enumerating the contents of a collection.
-void PrintKeysAndValues1( IDictionary^ myCol ) {
- Console::WriteLine( " KEY VALUE" );
- for each ( DictionaryEntry^ de in myCol )
- Console::WriteLine( " {0,-25} {1}", de->Key, de->Value );
- Console::WriteLine();
-}
-
-// Uses the enumerator.
-void PrintKeysAndValues2( IDictionary^ myCol )
-{
- IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator();
- Console::WriteLine( " KEY VALUE" );
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value );
-
- Console::WriteLine();
-}
-
-// Uses the Keys, Values, Count, and Item properties.
-void PrintKeysAndValues3( HybridDictionary^ myCol )
-{
- array^myKeys = gcnew array(myCol->Count);
- myCol->Keys->CopyTo( myKeys, 0 );
- Console::WriteLine( " INDEX KEY VALUE" );
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] );
- Console::WriteLine();
-}
-
-/*
-This code produces output similar to the following:
-
-Displays the elements using for each:
- KEY VALUE
- Strawberries 3.33
- Yellow Bananas 0.79
- Cranberries 5.98
- Grapes 1.99
- Granny Smith Apples 0.89
- Seedless Watermelon 0.49
- Honeydew Melon 0.59
- Red Delicious Apples 0.99
- Navel Oranges 1.29
- Fuji Apples 1.29
- Plantain Bananas 1.49
- Gala Apples 1.49
- Pineapple 1.49
- Plums 1.69
- Braeburn Apples 1.49
- Peaches 1.99
- Golden Delicious Apples 1.29
- Nectarine 1.99
-
-Displays the elements using the IDictionaryEnumerator:
- KEY VALUE
- Strawberries 3.33
- Yellow Bananas 0.79
- Cranberries 5.98
- Grapes 1.99
- Granny Smith Apples 0.89
- Seedless Watermelon 0.49
- Honeydew Melon 0.59
- Red Delicious Apples 0.99
- Navel Oranges 1.29
- Fuji Apples 1.29
- Plantain Bananas 1.49
- Gala Apples 1.49
- Pineapple 1.49
- Plums 1.69
- Braeburn Apples 1.49
- Peaches 1.99
- Golden Delicious Apples 1.29
- Nectarine 1.99
-
-Displays the elements using the Keys, Values, Count, and Item properties:
- INDEX KEY VALUE
- 0 Strawberries 3.33
- 1 Yellow Bananas 0.79
- 2 Cranberries 5.98
- 3 Grapes 1.99
- 4 Granny Smith Apples 0.89
- 5 Seedless Watermelon 0.49
- 6 Honeydew Melon 0.59
- 7 Red Delicious Apples 0.99
- 8 Navel Oranges 1.29
- 9 Fuji Apples 1.29
- 10 Plantain Bananas 1.49
- 11 Gala Apples 1.49
- 12 Pineapple 1.49
- 13 Plums 1.69
- 14 Braeburn Apples 1.49
- 15 Peaches 1.99
- 16 Golden Delicious Apples 1.29
- 17 Nectarine 1.99
-
-Displays the elements in the array:
- KEY VALUE
- Strawberries 3.33
- Yellow Bananas 0.79
- Cranberries 5.98
- Grapes 1.99
- Granny Smith Apples 0.89
- Seedless Watermelon 0.49
- Honeydew Melon 0.59
- Red Delicious Apples 0.99
- Navel Oranges 1.29
- Fuji Apples 1.29
- Plantain Bananas 1.49
- Gala Apples 1.49
- Pineapple 1.49
- Plums 1.69
- Braeburn Apples 1.49
- Peaches 1.99
- Golden Delicious Apples 1.29
- Nectarine 1.99
-
-The collection does not contain the key "Kiwis".
-
-The collection contains the following elements after removing "Plums":
- KEY VALUE
- Strawberries 3.33
- Yellow Bananas 0.79
- Cranberries 5.98
- Grapes 1.99
- Granny Smith Apples 0.89
- Seedless Watermelon 0.49
- Honeydew Melon 0.59
- Red Delicious Apples 0.99
- Navel Oranges 1.29
- Fuji Apples 1.29
- Plantain Bananas 1.49
- Gala Apples 1.49
- Pineapple 1.49
- Braeburn Apples 1.49
- Peaches 1.99
- Golden Delicious Apples 1.29
- Nectarine 1.99
-
-The collection contains the following elements after it is cleared:
- KEY VALUE
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp
deleted file mode 100644
index 5b82c8e92c1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Threading;
-
-public ref class HybridDictSample
-{
-public:
- static void Main()
- {
- // Creates and initializes a new HybridDictionary.
- HybridDictionary^ myHybridDictionary = gcnew HybridDictionary();
-
- //
- for each (DictionaryEntry^ de in myHybridDictionary)
- {
- //...
- }
- //
-
- //
- HybridDictionary^ myCollection = gcnew HybridDictionary();
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection)
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- HybridDictSample::Main();
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp
deleted file mode 100644
index 1afdca2ae97..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-// The following code example adds to and removes elements from a HybridDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( IDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry de = safe_cast(myEnum->Current);
- Console::WriteLine( " {0,-25} {1}", de.Key, de.Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new HybridDictionary.
- HybridDictionary^ myCol = gcnew HybridDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
- myCol->Add( "Plantain Bananas", "1.49" );
- myCol->Add( "Yellow Bananas", "0.79" );
- myCol->Add( "Strawberries", "3.33" );
- myCol->Add( "Cranberries", "5.98" );
- myCol->Add( "Navel Oranges", "1.29" );
- myCol->Add( "Grapes", "1.99" );
- myCol->Add( "Honeydew Melon", "0.59" );
- myCol->Add( "Seedless Watermelon", "0.49" );
- myCol->Add( "Pineapple", "1.49" );
- myCol->Add( "Nectarine", "1.99" );
- myCol->Add( "Plums", "1.69" );
- myCol->Add( "Peaches", "1.99" );
-
- // Displays the values in the HybridDictionary in three different ways.
- Console::WriteLine( "Initial contents of the HybridDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Deletes a key.
- myCol->Remove( "Plums" );
- Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" );
- PrintKeysAndValues( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "The collection contains the following elements after it is cleared:" );
- PrintKeysAndValues( myCol );
-}
-
-/*
-This code produces output similar to the following:
-
-Initial contents of the HybridDictionary:
- KEY VALUE
- Seedless Watermelon 0.49
- Nectarine 1.99
- Cranberries 5.98
- Plantain Bananas 1.49
- Honeydew Melon 0.59
- Pineapple 1.49
- Strawberries 3.33
- Grapes 1.99
- Braeburn Apples 1.49
- Peaches 1.99
- Red Delicious Apples 0.99
- Golden Delicious Apples 1.29
- Yellow Bananas 0.79
- Granny Smith Apples 0.89
- Gala Apples 1.49
- Plums 1.69
- Navel Oranges 1.29
- Fuji Apples 1.29
-
-The collection contains the following elements after removing "Plums":
- KEY VALUE
- Seedless Watermelon 0.49
- Nectarine 1.99
- Cranberries 5.98
- Plantain Bananas 1.49
- Honeydew Melon 0.59
- Pineapple 1.49
- Strawberries 3.33
- Grapes 1.99
- Braeburn Apples 1.49
- Peaches 1.99
- Red Delicious Apples 0.99
- Golden Delicious Apples 1.29
- Yellow Bananas 0.79
- Granny Smith Apples 0.89
- Gala Apples 1.49
- Navel Oranges 1.29
- Fuji Apples 1.29
-
-The collection contains the following elements after it is cleared:
- KEY VALUE
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp
deleted file mode 100644
index 831a5749541..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-// The following code example searches for an element in a HybridDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( IDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry de = safe_cast(myEnum->Current);
- Console::WriteLine( " {0,-25} {1}", de.Key, de.Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new HybridDictionary.
- HybridDictionary^ myCol = gcnew HybridDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
- myCol->Add( "Plantain Bananas", "1.49" );
- myCol->Add( "Yellow Bananas", "0.79" );
- myCol->Add( "Strawberries", "3.33" );
- myCol->Add( "Cranberries", "5.98" );
- myCol->Add( "Navel Oranges", "1.29" );
- myCol->Add( "Grapes", "1.99" );
- myCol->Add( "Honeydew Melon", "0.59" );
- myCol->Add( "Seedless Watermelon", "0.49" );
- myCol->Add( "Pineapple", "1.49" );
- myCol->Add( "Nectarine", "1.99" );
- myCol->Add( "Plums", "1.69" );
- myCol->Add( "Peaches", "1.99" );
-
- // Displays the values in the HybridDictionary in three different ways.
- Console::WriteLine( "Initial contents of the HybridDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Searches for a key.
- if ( myCol->Contains( "Kiwis" ) )
- Console::WriteLine( "The collection contains the key \"Kiwis\"." );
- else
- Console::WriteLine( "The collection does not contain the key \"Kiwis\"." );
-
- Console::WriteLine();
-}
-
-/*
-This code produces output similar to the following:
-
-Initial contents of the HybridDictionary:
- KEY VALUE
- Seedless Watermelon 0.49
- Nectarine 1.99
- Cranberries 5.98
- Plantain Bananas 1.49
- Honeydew Melon 0.59
- Pineapple 1.49
- Strawberries 3.33
- Grapes 1.99
- Braeburn Apples 1.49
- Peaches 1.99
- Red Delicious Apples 0.99
- Golden Delicious Apples 1.29
- Yellow Bananas 0.79
- Granny Smith Apples 0.89
- Gala Apples 1.49
- Plums 1.69
- Navel Oranges 1.29
- Fuji Apples 1.29
-
-The collection does not contain the key "Kiwis".
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp
deleted file mode 100644
index b50664695a8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-// The following code example copies the elements of a HybridDictionary to an array.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( IDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry de = safe_cast(myEnum->Current);
- Console::WriteLine( " {0,-25} {1}", de.Key, de.Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new HybridDictionary.
- HybridDictionary^ myCol = gcnew HybridDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
- myCol->Add( "Plantain Bananas", "1.49" );
- myCol->Add( "Yellow Bananas", "0.79" );
- myCol->Add( "Strawberries", "3.33" );
- myCol->Add( "Cranberries", "5.98" );
- myCol->Add( "Navel Oranges", "1.29" );
- myCol->Add( "Grapes", "1.99" );
- myCol->Add( "Honeydew Melon", "0.59" );
- myCol->Add( "Seedless Watermelon", "0.49" );
- myCol->Add( "Pineapple", "1.49" );
- myCol->Add( "Nectarine", "1.99" );
- myCol->Add( "Plums", "1.69" );
- myCol->Add( "Peaches", "1.99" );
-
- // Displays the values in the HybridDictionary in three different ways.
- Console::WriteLine( "Initial contents of the HybridDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Copies the HybridDictionary to an array with DictionaryEntry elements.
- array^myArr = gcnew array(myCol->Count);
- myCol->CopyTo( myArr, 0 );
-
- // Displays the values in the array.
- Console::WriteLine( "Displays the elements in the array:" );
- Console::WriteLine( " KEY VALUE" );
- for ( int i = 0; i < myArr->Length; i++ )
- Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value );
- Console::WriteLine();
-}
-
-/*
-This code produces output similar to the following:
-
-Initial contents of the HybridDictionary:
- KEY VALUE
- Seedless Watermelon 0.49
- Nectarine 1.99
- Cranberries 5.98
- Plantain Bananas 1.49
- Honeydew Melon 0.59
- Pineapple 1.49
- Strawberries 3.33
- Grapes 1.99
- Braeburn Apples 1.49
- Peaches 1.99
- Red Delicious Apples 0.99
- Golden Delicious Apples 1.29
- Yellow Bananas 0.79
- Granny Smith Apples 0.89
- Gala Apples 1.49
- Plums 1.69
- Navel Oranges 1.29
- Fuji Apples 1.29
-
-Displays the elements in the array:
- KEY VALUE
- Seedless Watermelon 0.49
- Nectarine 1.99
- Cranberries 5.98
- Plantain Bananas 1.49
- Honeydew Melon 0.59
- Pineapple 1.49
- Strawberries 3.33
- Grapes 1.99
- Braeburn Apples 1.49
- Peaches 1.99
- Red Delicious Apples 0.99
- Golden Delicious Apples 1.29
- Yellow Bananas 0.79
- Granny Smith Apples 0.89
- Gala Apples 1.49
- Plums 1.69
- Navel Oranges 1.29
- Fuji Apples 1.29
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp
deleted file mode 100644
index 1966022fe36..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-// The following code example enumerates the elements of a HybridDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-void PrintKeysAndValues1( IDictionary^ myCol );
-void PrintKeysAndValues2( IDictionary^ myCol );
-void PrintKeysAndValues3( HybridDictionary^ myCol );
-
-int main()
-{
- // Creates and initializes a new HybridDictionary.
- HybridDictionary^ myCol = gcnew HybridDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
- myCol->Add( "Plantain Bananas", "1.49" );
- myCol->Add( "Yellow Bananas", "0.79" );
- myCol->Add( "Strawberries", "3.33" );
- myCol->Add( "Cranberries", "5.98" );
- myCol->Add( "Navel Oranges", "1.29" );
- myCol->Add( "Grapes", "1.99" );
- myCol->Add( "Honeydew Melon", "0.59" );
- myCol->Add( "Seedless Watermelon", "0.49" );
- myCol->Add( "Pineapple", "1.49" );
- myCol->Add( "Nectarine", "1.99" );
- myCol->Add( "Plums", "1.69" );
- myCol->Add( "Peaches", "1.99" );
-
- // Display the contents of the collection using for each. This is the preferred method.
- Console::WriteLine( "Displays the elements using for each:" );
- PrintKeysAndValues1( myCol );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" );
- PrintKeysAndValues2( myCol );
-
- // Display the contents of the collection using the Keys, Values, Count, and Item properties.
- Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" );
- PrintKeysAndValues3( myCol );
-}
-
-// Uses the foreach statement which hides the complexity of the enumerator.
-// NOTE: The foreach statement is the preferred way of enumerating the contents of a collection.
-void PrintKeysAndValues1( IDictionary^ myCol ) {
- Console::WriteLine( " KEY VALUE" );
- for each ( DictionaryEntry^ de in myCol )
- Console::WriteLine( " {0,-25} {1}", de->Key, de->Value );
- Console::WriteLine();
-}
-
-// Uses the enumerator.
-void PrintKeysAndValues2( IDictionary^ myCol )
-{
- IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator();
- Console::WriteLine( " KEY VALUE" );
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value );
-
- Console::WriteLine();
-}
-
-// Uses the Keys, Values, Count, and Item properties.
-void PrintKeysAndValues3( HybridDictionary^ myCol )
-{
- array^myKeys = gcnew array(myCol->Count);
- myCol->Keys->CopyTo( myKeys, 0 );
- Console::WriteLine( " INDEX KEY VALUE" );
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] );
- Console::WriteLine();
-}
-
-/*
-This code produces output similar to the following:
-
-Displays the elements using for each:
- KEY VALUE
- Seedless Watermelon 0.49
- Nectarine 1.99
- Cranberries 5.98
- Plantain Bananas 1.49
- Honeydew Melon 0.59
- Pineapple 1.49
- Strawberries 3.33
- Grapes 1.99
- Braeburn Apples 1.49
- Peaches 1.99
- Red Delicious Apples 0.99
- Golden Delicious Apples 1.29
- Yellow Bananas 0.79
- Granny Smith Apples 0.89
- Gala Apples 1.49
- Plums 1.69
- Navel Oranges 1.29
- Fuji Apples 1.29
-
-Displays the elements using the IDictionaryEnumerator:
- KEY VALUE
- Seedless Watermelon 0.49
- Nectarine 1.99
- Cranberries 5.98
- Plantain Bananas 1.49
- Honeydew Melon 0.59
- Pineapple 1.49
- Strawberries 3.33
- Grapes 1.99
- Braeburn Apples 1.49
- Peaches 1.99
- Red Delicious Apples 0.99
- Golden Delicious Apples 1.29
- Yellow Bananas 0.79
- Granny Smith Apples 0.89
- Gala Apples 1.49
- Plums 1.69
- Navel Oranges 1.29
- Fuji Apples 1.29
-
-Displays the elements using the Keys, Values, Count, and Item properties:
- INDEX KEY VALUE
- 0 Seedless Watermelon 0.49
- 1 Nectarine 1.99
- 2 Cranberries 5.98
- 3 Plantain Bananas 1.49
- 4 Honeydew Melon 0.59
- 5 Pineapple 1.49
- 6 Strawberries 3.33
- 7 Grapes 1.99
- 8 Braeburn Apples 1.49
- 9 Peaches 1.99
- 10 Red Delicious Apples 0.99
- 11 Golden Delicious Apples 1.29
- 12 Yellow Bananas 0.79
- 13 Granny Smith Apples 0.89
- 14 Gala Apples 1.49
- 15 Plums 1.69
- 16 Navel Oranges 1.29
- 17 Fuji Apples 1.29
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp
deleted file mode 100644
index 641e2daadd9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-//
-
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-//
-public ref class PeopleEnum : IDictionaryEnumerator
-{
-private:
- // Enumerators are positioned before the first element
- // until the first MoveNext() call.
- int position;
- ArrayList^ _people;
-
-public:
- PeopleEnum(ArrayList^ list)
- {
- this->Reset();
- _people = list;
- }
-
- virtual bool MoveNext()
- {
- position++;
- return (position < _people->Count);
- }
-
- virtual void Reset()
- {
- position = -1;
- }
-
- virtual property Object^ Current
- {
- Object^ get()
- {
- try
- {
- return _people[position];
- }
- catch (IndexOutOfRangeException^)
- {
- throw gcnew InvalidOperationException();
- }
- }
- }
-
- virtual property DictionaryEntry Entry
- {
- DictionaryEntry get()
- {
- return (DictionaryEntry)(Current);
- }
- }
-
- virtual property Object^ Key
- {
- Object^ get()
- {
- try
- {
- return ((DictionaryEntry^)_people[position])->Key;
- }
- catch (IndexOutOfRangeException^)
- {
- throw gcnew InvalidOperationException();
- }
- }
- }
-
- virtual property Object^ Value
- {
- Object^ get()
- {
- try
- {
- return ((DictionaryEntry^)_people[position])->Value;
- }
- catch (IndexOutOfRangeException^)
- {
- throw gcnew InvalidOperationException();
- }
- }
- }
-};
-
-public ref class People : IOrderedDictionary
-{
-private:
- ArrayList^ _people;
-
-public:
- People(int numItems)
- {
- _people = gcnew ArrayList(numItems);
- }
-
- int IndexOfKey(Object^ key)
- {
- for (int i = 0; i < _people->Count; i++)
- {
- if (((DictionaryEntry^)_people[i])->Key == key)
- return i;
- }
-
- // key not found, return -1.
- return -1;
- }
-
- virtual property Object^ default[Object^]
- {
- Object^ get(Object^ key)
- {
- return ((DictionaryEntry^)_people[IndexOfKey(key)])->Value;
- }
- void set(Object^ key, Object^ value)
- {
- _people[IndexOfKey(key)] = gcnew DictionaryEntry(key, value);
- }
- }
-
- // IOrderedDictionary Members
- virtual IDictionaryEnumerator^ GetEnumerator()
- {
- return gcnew PeopleEnum(_people);
- }
-
- virtual void Insert(int index, Object^ key, Object^ value)
- {
- if (IndexOfKey(key) != -1)
- {
- throw gcnew ArgumentException("An element with the same key already exists in the collection.");
- }
- _people->Insert(index, gcnew DictionaryEntry(key, value));
- }
-
- virtual void RemoveAt(int index)
- {
- _people->RemoveAt(index);
- }
-
- virtual property Object^ default[int]
- {
- Object^ get(int index)
- {
- return ((DictionaryEntry^)_people[index])->Value;
- }
- void set(int index, Object^ value)
- {
- Object^ key = ((DictionaryEntry^)_people[index])->Key;
- _people[index] = gcnew DictionaryEntry(key, value);
- }
- }
-
- // IDictionary Members
-
- virtual void Add(Object^ key, Object^ value)
- {
- if (IndexOfKey(key) != -1)
- {
- throw gcnew ArgumentException("An element with the same key already exists in the collection.");
- }
- _people->Add(gcnew DictionaryEntry(key, value));
- }
-
- virtual void Clear()
- {
- _people->Clear();
- }
-
- virtual bool Contains(Object^ key)
- {
- if (IndexOfKey(key) == -1)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- virtual property bool IsFixedSize
- {
- bool get()
- {
- return false;
- }
- }
-
- virtual property bool IsReadOnly
- {
- bool get()
- {
- return false;
- }
- }
-
- virtual property ICollection^ Keys
- {
- ICollection^ get()
- {
- ArrayList^ KeyCollection = gcnew ArrayList(_people->Count);
- for (int i = 0; i < _people->Count; i++)
- {
- KeyCollection->Add( ((DictionaryEntry^)_people[i])->Key );
- }
- return KeyCollection;
- }
- }
-
- virtual void Remove(Object^ key)
- {
- _people->RemoveAt(IndexOfKey(key));
- }
-
- virtual property ICollection^ Values
- {
- ICollection ^get()
- {
- ArrayList^ ValueCollection = gcnew ArrayList(_people->Count);
- for (int i = 0; i < _people->Count; i++)
- {
- ValueCollection->Add( ((DictionaryEntry^)_people[i])->Value );
- }
- return ValueCollection;
- }
- }
-
- // ICollection Members
-
- virtual void CopyTo(Array^ array, int index)
- {
- _people->CopyTo(array, index);
- }
-
- virtual property int Count
- {
- int get()
- {
- return _people->Count;
- }
- }
-
- virtual property bool IsSynchronized
- {
- bool get()
- {
- return _people->IsSynchronized;
- }
- }
-
- virtual property Object^ SyncRoot
- {
- Object^ get()
- {
- return _people->SyncRoot;
- }
- }
-
- // IEnumerable Members
-
- virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator
- {
- return (IEnumerator^) gcnew PeopleEnum(_people);
- }
-};
-//
-
-class App
-{
-public:
- static void Main()
- {
- People^ peopleCollection = gcnew People(3);
- peopleCollection->Add("John", "Smith");
- peopleCollection->Add("Jim", "Johnson");
- peopleCollection->Add("Sue", "Rabon");
-
- Console::WriteLine("Displaying the entries in peopleCollection:");
- for each (DictionaryEntry^ de in peopleCollection)
- {
- Console::WriteLine("{0} {1}", de->Key, de->Value);
- }
- Console::WriteLine();
- Console::WriteLine("Displaying the entries in the modified peopleCollection:");
- peopleCollection["Jim"] = "Jackson";
- peopleCollection->Remove("Sue");
- peopleCollection->Insert(0, "Fred", "Anderson");
-
- for each (DictionaryEntry^ de in peopleCollection)
- {
- Console::WriteLine("{0} {1}", de->Key, de->Value);
- }
-
- }
-};
-
-int main()
-{
- App::Main();
-}
-/* This code produces output similar to the following:
- *
- * Displaying the entries in peopleCollection:
- * John Smith
- * Jim Johnson
- * Sue Rabon
- *
- * Displaying the entries in the modified peopleCollection:
- * Fred Anderson
- * John Smith
- * Jim Jackson
- */
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp
deleted file mode 100644
index 05fe0cdd917..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class ODEnum : IDictionaryEnumerator
-{
-private:
- // Enumerators are positioned before the first element
- // until the first MoveNext() call.
- int position;
- ArrayList^ itemlist;
-
-public:
- ODEnum(ArrayList^ list)
- {
- this->Reset();
- itemlist = list;
- }
-
- virtual bool MoveNext()
- {
- position++;
- return (position < itemlist->Count);
- }
-
- virtual void Reset()
- {
- position = -1;
- }
-
- virtual property Object^ Current
- {
- Object^ get()
- {
- try
- {
- return itemlist[position];
- }
- catch (IndexOutOfRangeException^)
- {
- throw gcnew InvalidOperationException();
- }
- }
- }
-
- virtual property DictionaryEntry Entry
- {
- DictionaryEntry get()
- {
- return (DictionaryEntry)(Current);
- }
- }
-
- virtual property Object^ Key
- {
- Object^ get()
- {
- try
- {
- return ((DictionaryEntry^)itemlist[position])->Key;
- }
- catch (IndexOutOfRangeException^)
- {
- throw gcnew InvalidOperationException();
- }
- }
- }
-
- virtual property Object^ Value
- {
- Object^ get()
- {
- try
- {
- return ((DictionaryEntry^)itemlist[position])->Value;
- }
- catch (IndexOutOfRangeException^)
- {
- throw gcnew InvalidOperationException();
- }
- }
- }
-};
-
-public ref class SimpleOD : IOrderedDictionary
-{
-private:
- ArrayList^ itemlist;
-
-public:
- SimpleOD(int numItems)
- {
- itemlist = gcnew ArrayList(numItems);
- }
-
- int IndexOfKey(Object^ key)
- {
- for (int i = 0; i < itemlist->Count; i++)
- {
- if (((DictionaryEntry^)itemlist[i])->Key == key)
- return i;
- }
-
- // key not found, return -1.
- return -1;
- }
-
- virtual property Object^ default[Object^]
- {
- Object^ get(Object^ key)
- {
- return ((DictionaryEntry^)itemlist[IndexOfKey(key)])->Value;
- }
- void set(Object^ key, Object^ value)
- {
- itemlist[IndexOfKey(key)] = gcnew DictionaryEntry(key, value);
- }
- }
-
- // IOrderedDictionary Members
- virtual IDictionaryEnumerator^ GetEnumerator()
- {
- return gcnew ODEnum(itemlist);
- }
-
- virtual void Insert(int index, Object^ key, Object^ value)
- {
- if (IndexOfKey(key) != -1)
- {
- throw gcnew ArgumentException("An element with the same key already exists in the collection.");
- }
- itemlist->Insert(index, gcnew DictionaryEntry(key, value));
- }
-
- virtual void RemoveAt(int index)
- {
- itemlist->RemoveAt(index);
- }
-
- virtual property Object^ default[int]
- {
- Object^ get(int index)
- {
- return ((DictionaryEntry^)itemlist[index])->Value;
- }
- void set(int index, Object^ value)
- {
- Object^ key = ((DictionaryEntry^)itemlist[index])->Key;
- itemlist[index] = gcnew DictionaryEntry(Keys, value);
- }
- }
-
- // IDictionary Members
-
- virtual void Add(Object^ key, Object^ value)
- {
- if (IndexOfKey(key) != -1)
- {
- throw gcnew ArgumentException("An element with the same key already exists in the collection.");
- }
- itemlist->Add(gcnew DictionaryEntry(key, value));
- }
-
- virtual void Clear()
- {
- itemlist->Clear();
- }
-
- virtual bool Contains(Object^ key)
- {
- if (IndexOfKey(key) == -1)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- virtual property bool IsFixedSize
- {
- bool get()
- {
- return false;
- }
- }
-
- virtual property bool IsReadOnly
- {
- bool get()
- {
- return false;
- }
- }
-
- virtual property ICollection^ Keys
- {
- ICollection^ get()
- {
- ArrayList^ KeyCollection = gcnew ArrayList(itemlist->Count);
- for (int i = 0; i < itemlist->Count; i++)
- {
- KeyCollection[i] = ((DictionaryEntry^)itemlist[i])->Key;
- }
- return KeyCollection;
- }
- }
-
- virtual void Remove(Object^ key)
- {
- itemlist->RemoveAt(IndexOfKey(key));
- }
-
- virtual property ICollection^ Values
- {
- ICollection ^get()
- {
- ArrayList^ ValueCollection = gcnew ArrayList(itemlist->Count);
- for (int i = 0; i < itemlist->Count; i++)
- {
- ValueCollection[i] = ((DictionaryEntry^)itemlist[i])->Value;
- }
- return ValueCollection;
- }
- }
-
- // ICollection Members
-
- virtual void CopyTo(Array^ array, int index)
- {
- itemlist->CopyTo(array, index);
- }
-
- virtual property int Count
- {
- int get()
- {
- return itemlist->Count;
- }
- }
-
- virtual property bool IsSynchronized
- {
- bool get()
- {
- return itemlist->IsSynchronized;
- }
- }
-
- virtual property Object^ SyncRoot
- {
- Object^ get()
- {
- return itemlist->SyncRoot;
- }
- }
-
- // IEnumerable Members
-
- virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator
- {
- return (IEnumerator^) gcnew ODEnum(itemlist);
- }
-};
-
-class App
-{
-public:
- static void Main()
- {
- int index = 1;
-
- SimpleOD^ myOrderedDictionary = gcnew SimpleOD(2);
- myOrderedDictionary->Add("Way", "ToGo");
- myOrderedDictionary->Add("Far", "Out");
-
- Object^ obj;
- //
- obj = myOrderedDictionary[index];
- //
- //
- for each (DictionaryEntry de in myOrderedDictionary)
- {
- //...
- }
- //
- }
-};
-
-int main()
-{
- App::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp
deleted file mode 100644
index d1760135b98..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-// The following code example demonstrates several of the properties and methods of ListDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-void PrintKeysAndValues1( IDictionary^ myCol );
-void PrintKeysAndValues2( IDictionary^ myCol );
-void PrintKeysAndValues3( ListDictionary^ myCol );
-
-int main()
-{
- // Creates and initializes a new ListDictionary.
- ListDictionary^ myCol = gcnew ListDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
-
- // Display the contents of the collection using for each. This is the preferred method.
- Console::WriteLine( "Displays the elements using for each:" );
- PrintKeysAndValues1( myCol );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" );
- PrintKeysAndValues2( myCol );
-
- // Display the contents of the collection using the Keys, Values, Count, and Item properties.
- Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" );
- PrintKeysAndValues3( myCol );
-
- // Copies the ListDictionary to an array with DictionaryEntry elements.
- array^myArr = gcnew array(myCol->Count);
- myCol->CopyTo( myArr, 0 );
-
- // Displays the values in the array.
- Console::WriteLine( "Displays the elements in the array:" );
- Console::WriteLine( " KEY VALUE" );
- for ( int i = 0; i < myArr->Length; i++ )
- Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value );
- Console::WriteLine();
-
- // Searches for a key.
- if ( myCol->Contains( "Kiwis" ) )
- Console::WriteLine( "The collection contains the key \"Kiwis\"." );
- else
- Console::WriteLine( "The collection does not contain the key \"Kiwis\"." );
-
- Console::WriteLine();
-
- // Deletes a key.
- myCol->Remove( "Plums" );
- Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" );
- PrintKeysAndValues2( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "The collection contains the following elements after it is cleared:" );
- PrintKeysAndValues2( myCol );
-}
-
-// Uses the for each statement which hides the complexity of the enumerator.
-// NOTE: The for each statement is the preferred way of enumerating the contents of a collection.
-void PrintKeysAndValues1( IDictionary^ myCol ) {
- Console::WriteLine( " KEY VALUE" );
- for each ( DictionaryEntry^ de in myCol )
- Console::WriteLine( " {0,-25} {1}", de->Key, de->Value );
- Console::WriteLine();
-}
-
-// Uses the enumerator.
-void PrintKeysAndValues2( IDictionary^ myCol )
-{
- IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator();
- Console::WriteLine( " KEY VALUE" );
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value );
- Console::WriteLine();
-}
-
-// Uses the Keys, Values, Count, and Item properties.
-void PrintKeysAndValues3( ListDictionary^ myCol )
-{
- array^myKeys = gcnew array(myCol->Count);
- myCol->Keys->CopyTo( myKeys, 0 );
- Console::WriteLine( " INDEX KEY VALUE" );
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] );
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Displays the elements using for each:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-Displays the elements using the IDictionaryEnumerator:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-Displays the elements using the Keys, Values, Count, and Item properties:
- INDEX KEY VALUE
- 0 Braeburn Apples 1.49
- 1 Fuji Apples 1.29
- 2 Gala Apples 1.49
- 3 Golden Delicious Apples 1.29
- 4 Granny Smith Apples 0.89
- 5 Red Delicious Apples 0.99
-
-Displays the elements in the array:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-The collection does not contain the key "Kiwis".
-
-The collection contains the following elements after removing "Plums":
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-The collection contains the following elements after it is cleared:
- KEY VALUE
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp
deleted file mode 100644
index 0f3452dcd52..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Threading;
-
-public ref class SamplesListDictionary
-{
-public:
- static void Main()
- {
- //
- ListDictionary^ myCollection = gcnew ListDictionary();
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection)
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-
- static void Dummy()
- {
- ListDictionary^ myListDictionary = gcnew ListDictionary();
- //
- for each (DictionaryEntry de in myListDictionary)
- {
- //...
- }
- //
- }
-};
-
-int main()
-{
- SamplesListDictionary::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp
deleted file mode 100644
index ef13cdd9540..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-// The following code example adds to and removes elements from a ListDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( IDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry de = safe_cast(myEnum->Current);
- Console::WriteLine( " {0,-25} {1}", de.Key, de.Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new ListDictionary.
- ListDictionary^ myCol = gcnew ListDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
-
- // Displays the values in the ListDictionary in three different ways.
- Console::WriteLine( "Initial contents of the ListDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Deletes a key.
- myCol->Remove( "Gala Apples" );
- Console::WriteLine( "The collection contains the following elements after removing \"Gala Apples\":" );
- PrintKeysAndValues( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "The collection contains the following elements after it is cleared:" );
- PrintKeysAndValues( myCol );
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the ListDictionary:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-The collection contains the following elements after removing "Gala Apples":
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-The collection contains the following elements after it is cleared:
- KEY VALUE
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp
deleted file mode 100644
index ba69388921b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-// The following code example searches for an element in a ListDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( IDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry de = safe_cast(myEnum->Current);
- Console::WriteLine( " {0,-25} {1}", de.Key, de.Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new ListDictionary.
- ListDictionary^ myCol = gcnew ListDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
-
- // Displays the values in the ListDictionary in three different ways.
- Console::WriteLine( "Initial contents of the ListDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Searches for a key.
- if ( myCol->Contains( "Kiwis" ) )
- Console::WriteLine( "The collection contains the key \"Kiwis\"." );
- else
- Console::WriteLine( "The collection does not contain the key \"Kiwis\"." );
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the ListDictionary:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-The collection does not contain the key "Kiwis".
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp
deleted file mode 100644
index 772edf629f0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-// The following code example copies the elements of a ListDictionary to an array.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintKeysAndValues( IDictionary^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry de = safe_cast(myEnum->Current);
- Console::WriteLine( " {0,-25} {1}", de.Key, de.Value );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Creates and initializes a new ListDictionary.
- ListDictionary^ myCol = gcnew ListDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
-
- // Displays the values in the ListDictionary in three different ways.
- Console::WriteLine( "Initial contents of the ListDictionary:" );
- PrintKeysAndValues( myCol );
-
- // Copies the ListDictionary to an array with DictionaryEntry elements.
- array^myArr = gcnew array(myCol->Count);
- myCol->CopyTo( myArr, 0 );
-
- // Displays the values in the array.
- Console::WriteLine( "Displays the elements in the array:" );
- Console::WriteLine( " KEY VALUE" );
- for ( int i = 0; i < myArr->Length; i++ )
- Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value );
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the ListDictionary:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-Displays the elements in the array:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp
deleted file mode 100644
index 2a525d94ac8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// The following code example enumerates the elements of a ListDictionary.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-void PrintKeysAndValues1( IDictionary^ myCol );
-void PrintKeysAndValues2( IDictionary^ myCol );
-void PrintKeysAndValues3( ListDictionary^ myCol );
-
-int main()
-{
- // Creates and initializes a new ListDictionary.
- ListDictionary^ myCol = gcnew ListDictionary;
- myCol->Add( "Braeburn Apples", "1.49" );
- myCol->Add( "Fuji Apples", "1.29" );
- myCol->Add( "Gala Apples", "1.49" );
- myCol->Add( "Golden Delicious Apples", "1.29" );
- myCol->Add( "Granny Smith Apples", "0.89" );
- myCol->Add( "Red Delicious Apples", "0.99" );
-
- // Display the contents of the collection using for each. This is the preferred method.
- Console::WriteLine( "Displays the elements using for each:" );
- PrintKeysAndValues1( myCol );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" );
- PrintKeysAndValues2( myCol );
-
- // Display the contents of the collection using the Keys, Values, Count, and Item properties.
- Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" );
- PrintKeysAndValues3( myCol );
-}
-
-// Uses the for each statement which hides the complexity of the enumerator.
-// NOTE: The for each statement is the preferred way of enumerating the contents of a collection.
-void PrintKeysAndValues1( IDictionary^ myCol ) {
- Console::WriteLine( " KEY VALUE" );
- for each ( DictionaryEntry^ de in myCol )
- Console::WriteLine( " {0,-25} {1}", de->Key, de->Value );
- Console::WriteLine();
-}
-
-// Uses the enumerator.
-void PrintKeysAndValues2( IDictionary^ myCol )
-{
- IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator();
- Console::WriteLine( " KEY VALUE" );
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value );
-
- Console::WriteLine();
-}
-
-// Uses the Keys, Values, Count, and Item properties.
-void PrintKeysAndValues3( ListDictionary^ myCol )
-{
- array^myKeys = gcnew array(myCol->Count);
- myCol->Keys->CopyTo( myKeys, 0 );
- Console::WriteLine( " INDEX KEY VALUE" );
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] );
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Displays the elements using for each:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-Displays the elements using the IDictionaryEnumerator:
- KEY VALUE
- Braeburn Apples 1.49
- Fuji Apples 1.29
- Gala Apples 1.49
- Golden Delicious Apples 1.29
- Granny Smith Apples 0.89
- Red Delicious Apples 0.99
-
-Displays the elements using the Keys, Values, Count, and Item properties:
- INDEX KEY VALUE
- 0 Braeburn Apples 1.49
- 1 Fuji Apples 1.29
- 2 Gala Apples 1.49
- 3 Golden Delicious Apples 1.29
- 4 Granny Smith Apples 0.89
- 5 Red Delicious Apples 0.99
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp
deleted file mode 100644
index e3a242ae17f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-// The following example uses BaseAdd to create a new NameObjectCollectionBase with elements from another dictionary.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-public ref class MyCollection: public NameObjectCollectionBase
-{
-private:
- DictionaryEntry _de;
-
-public:
-
- property DictionaryEntry Item [ int ]
- {
- // Gets a key-and-value pair (DictionaryEntry) using an index.
- DictionaryEntry get( int index )
- {
- _de.Key = this->BaseGetKey( index );
- _de.Value = this->BaseGet( index );
- return (_de);
- }
- }
-
- // Adds elements from an IDictionary* into the new collection.
- MyCollection( IDictionary^ d )
- {
- IEnumerator^ myEnum = d->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry^ de = safe_cast(myEnum->Current);
- this->BaseAdd( safe_cast(de->Key), de->Value );
- }
- }
-};
-
-int main()
-{
- // Creates and initializes a new MyCollection instance.
- IDictionary^ d = gcnew ListDictionary;
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myCol = gcnew MyCollection( d );
-
- // Displays the keys and values of the MyCollection instance.
- for ( int i = 0; i < myCol->Count; i++ )
- {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol->Item[ i ].Key, myCol->Item[ i ].Value );
- }
-}
-
-/*
-This code produces the following output.
-
-[0] : red, apple
-[1] : yellow, banana
-[2] : green, pear
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp
deleted file mode 100644
index 7dfd2cf7f8b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-// The following example uses BaseClear to remove all elements from a NameObjectCollectionBase.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-public ref class MyCollection: public NameObjectCollectionBase
-{
-private:
- DictionaryEntry _de;
-
-public:
-
- property DictionaryEntry Item [ int ]
- {
- // Gets a key-and-value pair (DictionaryEntry) using an index.
- DictionaryEntry get( int index )
- {
- _de.Key = this->BaseGetKey( index );
- _de.Value = this->BaseGet( index );
- return (_de);
- }
- }
-
- // Adds elements from an IDictionary* into the new collection.
- MyCollection( IDictionary^ d )
- {
- IEnumerator^ myEnum = d->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry^ de = safe_cast(myEnum->Current);
- this->BaseAdd( safe_cast(de->Key), de->Value );
- }
- }
-
- // Clears all the elements in the collection.
- void Clear()
- {
- this->BaseClear();
- }
-};
-
-static void PrintKeysAndValues( MyCollection^ myCol )
-{
- for ( int i = 0; i < myCol->Count; i++ )
- {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol->Item[ i ].Key, myCol->Item[ i ].Value );
-
- }
-}
-
-int main()
-{
- // Creates and initializes a new MyCollection instance.
- IDictionary^ d = gcnew ListDictionary;
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myCol = gcnew MyCollection( d );
- Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
-
- // Removes all elements from the collection.
- myCol->Clear();
- Console::WriteLine( "After clearing the collection (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
-}
-
-/*
-This code produces the following output.
-
-Initial state of the collection (Count = 3):
-[0] : red, apple
-[1] : yellow, banana
-[2] : green, pear
-After clearing the collection (Count = 0):
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp
deleted file mode 100644
index d7954215945..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-
-// The following example uses BaseGetKey and BaseGet to get specific keys and values.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-
-//
-#using
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class MyCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
-public:
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get( int index ) {
- _de->Key = this->BaseGetKey( index );
- _de->Value = this->BaseGet( index );
- return( _de );
- }
- }
-
- // Gets or sets the value associated with the specified key.
- property Object^ default[ String^ ] {
- Object^ get(String^ key) {
- return( this->BaseGet( key ) );
- }
- void set( String^ key, Object^ value ) {
- this->BaseSet( key, value );
- }
- }
-
- // Adds elements from an IDictionary into the new collection.
- MyCollection( IDictionary^ d ) {
-
- _de = gcnew DictionaryEntry();
-
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- }
-};
-
-public ref class SamplesNameObjectCollectionBase {
-
-public:
- static void Main() {
-
- // Creates and initializes a new MyCollection instance.
- IDictionary^ d = gcnew ListDictionary();
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myCol = gcnew MyCollection( d );
- Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
-
- // Gets specific keys and values.
- Console::WriteLine( "The key at index 0 is {0}.", myCol[0]->Key );
- Console::WriteLine( "The value at index 0 is {0}.", myCol[0]->Value );
- Console::WriteLine( "The value associated with the key \"green\" is {0}.", myCol["green"] );
-
- }
-
- static void PrintKeysAndValues( MyCollection^ myCol ) {
- for ( int i = 0; i < myCol->Count; i++ ) {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value );
- }
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBase::Main();
-}
-
-/*
-This code produces the following output.
-
-Initial state of the collection (Count = 3):
-[0] : red, apple
-[1] : yellow, banana
-[2] : green, pear
-The key at index 0 is red.
-The value at index 0 is apple.
-The value associated with the key "green" is pear.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp
deleted file mode 100644
index c96322f4cfa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// The following example uses BaseGetAllKeys and BaseGetAllValues to get an array of the keys or an array of the values.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-
-//
-#using
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class MyCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
-public:
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get(int index) {
- _de->Key = this->BaseGetKey( index );
- _de->Value = this->BaseGet( index );
- return( _de );
- }
- }
-
- // Adds elements from an IDictionary into the new collection.
- MyCollection( IDictionary^ d ) {
-
- _de = gcnew DictionaryEntry();
-
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- }
-
- // Gets a String array that contains all the keys in the collection.
- property array^ AllKeys {
- array^ get() {
- return( this->BaseGetAllKeys() );
- }
- }
-
- // Gets an Object array that contains all the values in the collection.
- property Array^ AllValues {
- Array^ get() {
- return( this->BaseGetAllValues() );
- }
- }
-
- // Gets a String array that contains all the values in the collection.
- property array^ AllStringValues {
- array^ get() {
- return( (array^) this->BaseGetAllValues( System::String::typeid ) );
- }
- }
-};
-
-public ref class SamplesNameObjectCollectionBase {
-
-public:
- static void Main() {
-
- // Creates and initializes a new MyCollection instance.
- IDictionary^ d = gcnew ListDictionary();
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myCol = gcnew MyCollection( d );
- Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
-
- // Displays the list of keys.
- Console::WriteLine( "The list of keys:" );
- for each ( String^ s in myCol->AllKeys ) {
- Console::WriteLine( " {0}", s );
- }
-
- // Displays the list of values of type Object.
- Console::WriteLine( "The list of values (Object):" );
- for each ( Object^ o in myCol->AllValues ) {
- Console::WriteLine( " {0}", o->ToString() );
- }
-
- // Displays the list of values of type String.
- Console::WriteLine( "The list of values (String):" );
- for each ( String^ s in myCol->AllValues ) {
- Console::WriteLine( " {0}", s );
- }
- }
-
-public:
- static void PrintKeysAndValues( MyCollection^ myCol ) {
- for ( int i = 0; i < myCol->Count; i++ ) {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value );
- }
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBase::Main();
-}
-
-/*
-This code produces the following output.
-
-Initial state of the collection (Count = 3):
-[0] : red, apple
-[1] : yellow, banana
-[2] : green, pear
-The list of keys:
- red
- yellow
- green
-The list of values (Object):
- apple
- banana
- pear
-The list of values (String):
- apple
- banana
- pear
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp
deleted file mode 100644
index 663a6cd5536..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// The following example uses BaseHasKeys to determine if the collection contains keys that are not a null reference.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-
-//
-#using
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class MyCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
-public:
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get(int index) {
- _de->Key = this->BaseGetKey( index );
- _de->Value = this->BaseGet( index );
- return( _de );
- }
- }
-
- // Creates an empty collection.
- MyCollection() {
- _de = gcnew DictionaryEntry();
- }
-
- // Adds an entry to the collection.
- void Add( String^ key, Object^ value ) {
- this->BaseAdd( key, value );
- }
-
- // Gets a value indicating whether the collection contains keys that are not a null reference.
- property Boolean HasKeys {
- Boolean get() {
- return( this->BaseHasKeys() );
- }
- }
-};
-
-void PrintKeysAndValues( MyCollection^ myCol ) {
- for ( int i = 0; i < myCol->Count; i++ ) {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value );
- }
-}
-
-int main() {
-
- // Creates an empty MyCollection instance.
- MyCollection^ myCol = gcnew MyCollection();
- Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
- Console::WriteLine( "HasKeys? {0}", myCol->HasKeys );
-
- Console::WriteLine();
-
- // Adds an item to the collection.
- myCol->Add( "blue", "sky" );
- Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
- Console::WriteLine( "HasKeys? {0}", myCol->HasKeys );
-
-}
-
-/*
-This code produces the following output.
-
-Initial state of the collection (Count = 0):
-HasKeys? False
-
-Initial state of the collection (Count = 1):
-[0] : blue, sky
-HasKeys? True
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp
deleted file mode 100644
index de50b6634e1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// The following example uses BaseRemove and BaseRemoveAt to remove elements from a NameObjectCollectionBase.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-
-//
-#using
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class MyCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
-public:
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get(int index) {
- _de->Key = this->BaseGetKey( index );
- _de->Value = this->BaseGet( index );
- return( _de );
- }
- }
-
- // Adds elements from an IDictionary into the new collection.
- MyCollection( IDictionary^ d ) {
-
- _de = gcnew DictionaryEntry();
-
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- }
-
- // Removes an entry with the specified key from the collection.
- void Remove( String^ key ) {
- this->BaseRemove( key );
- }
-
- // Removes an entry in the specified index from the collection.
- void Remove( int index ) {
- this->BaseRemoveAt( index );
- }
-};
-
-public ref class SamplesNameObjectCollectionBase {
-
-public:
- static void Main() {
-
- // Creates and initializes a new MyCollection instance.
- IDictionary^ d = gcnew ListDictionary();
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myCol = gcnew MyCollection( d );
- Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
-
- // Removes an element at a specific index.
- myCol->Remove( 1 );
- Console::WriteLine( "After removing the element at index 1 (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
-
- // Removes an element with a specific key.
- myCol->Remove( "red" );
- Console::WriteLine( "After removing the element with the key \"red\" (Count = {0}):", myCol->Count );
- PrintKeysAndValues( myCol );
-
- }
-
- static void PrintKeysAndValues( MyCollection^ myCol ) {
- for ( int i = 0; i < myCol->Count; i++ ) {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value );
- }
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBase::Main();
-}
-
-/*
-This code produces the following output.
-
-Initial state of the collection (Count = 3):
-[0] : red, apple
-[1] : yellow, banana
-[2] : green, pear
-After removing the element at index 1 (Count = 2):
-[0] : red, apple
-[1] : green, pear
-After removing the element with the key "red" (Count = 1):
-[0] : green, pear
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp
deleted file mode 100644
index e9c37f870ef..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// The following example uses BaseSet to set the value of a specific element.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-
-//
-#using
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class MyCollection : public NameObjectCollectionBase {
-
- // Gets or sets the value at the specified index.
-public:
- property Object^ default[ int ] {
- Object^ get(int index) {
- return( this->BaseGet( index ) );
- }
- void set( int index, Object^ value ) {
- this->BaseSet( index, value );
- }
- }
-
- // Gets or sets the value associated with the specified key.
- property Object^ default[ String^ ] {
- Object^ get(String^ key) {
- return( this->BaseGet( key ) );
- }
- void set( String^ key, Object^ value ) {
- this->BaseSet( key, value );
- }
- }
-
- // Gets a String array that contains all the keys in the collection.
- property array^ AllKeys {
- array^ get() {
- return( this->BaseGetAllKeys() );
- }
- }
-
- // Adds elements from an IDictionary into the new collection.
- MyCollection( IDictionary^ d ) {
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- }
-
-};
-
-public ref class SamplesNameObjectCollectionBase {
-
-public:
- static void Main() {
-
- // Creates and initializes a new MyCollection instance.
- IDictionary^ d = gcnew ListDictionary();
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myCol = gcnew MyCollection( d );
- Console::WriteLine( "Initial state of the collection:" );
- PrintKeysAndValues2( myCol );
- Console::WriteLine();
-
- // Sets the value at index 1.
- myCol[1] = "sunflower";
- Console::WriteLine( "After setting the value at index 1:" );
- PrintKeysAndValues2( myCol );
- Console::WriteLine();
-
- // Sets the value associated with the key "red".
- myCol["red"] = "tulip";
- Console::WriteLine( "After setting the value associated with the key \"red\":" );
- PrintKeysAndValues2( myCol );
-
- }
-
- static void PrintKeysAndValues2( MyCollection^ myCol ) {
- for each ( String^ s in myCol->AllKeys ) {
- Console::WriteLine( "{0}, {1}", s, myCol[s] );
- }
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBase::Main();
-}
-
-/*
-This code produces the following output.
-
-Initial state of the collection:
-red, apple
-yellow, banana
-green, pear
-
-After setting the value at index 1:
-red, apple
-yellow, sunflower
-green, pear
-
-After setting the value associated with the key "red":
-red, tulip
-yellow, sunflower
-green, pear
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp
deleted file mode 100644
index c7f2f6f2036..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// The following example creates a read-only collection.
-// For an expanded version of this example, see the NameObjectCollectionBase class topic.
-
-//
-#using
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class MyCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
-public:
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get( int index ) {
- _de->Key = this->BaseGetKey( index );
- _de->Value = this->BaseGet( index );
- return( _de );
- }
- }
-
- // Adds elements from an IDictionary into the new collection.
- MyCollection( IDictionary^ d, Boolean bReadOnly ) {
-
- _de = gcnew DictionaryEntry();
-
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- this->IsReadOnly = bReadOnly;
- }
-
- // Adds an entry to the collection.
- void Add( String^ key, Object^ value ) {
- this->BaseAdd( key, value );
- }
-};
-
-public ref class SamplesNameObjectCollectionBase {
-
-public:
- static void Main() {
-
- // Creates and initializes a new MyCollection that is read-only.
- IDictionary^ d = gcnew ListDictionary();
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myROCol = gcnew MyCollection( d, true );
-
- // Tries to add a new item.
- try {
- myROCol->Add( "blue", "sky" );
- }
- catch ( NotSupportedException^ e ) {
- Console::WriteLine( e->ToString() );
- }
-
- // Displays the keys and values of the MyCollection.
- Console::WriteLine( "Read-Only Collection:" );
- PrintKeysAndValues( myROCol );
- }
-
- static void PrintKeysAndValues( MyCollection^ myCol ) {
- for ( int i = 0; i < myCol->Count; i++ ) {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value );
- }
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBase::Main();
-}
-
-/*
-This code produces the following output.
-
-System.NotSupportedException: Collection is read-only.
- at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value)
- at SamplesNameObjectCollectionBase.Main()
-Read-Only Collection:
-[0] : red, apple
-[1] : yellow, banana
-[2] : green, pear
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp
deleted file mode 100644
index 8f68c652453..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-// The following example shows how to implement and use the NameObjectCollectionBase class.
-
-//
-#using
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class MyCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Creates an empty collection.
-public:
- MyCollection() {
- _de = gcnew DictionaryEntry();
- }
-
- // Adds elements from an IDictionary into the new collection.
- MyCollection( IDictionary^ d, Boolean bReadOnly ) {
-
- _de = gcnew DictionaryEntry();
-
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- this->IsReadOnly = bReadOnly;
- }
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get(int index) {
- _de->Key = this->BaseGetKey(index);
- _de->Value = this->BaseGet(index);
- return( _de );
- }
- }
-
- // Gets or sets the value associated with the specified key.
- property Object^ default[ String^ ] {
- Object^ get(String^ key) {
- return( this->BaseGet( key ) );
- }
- void set( String^ key, Object^ value ) {
- this->BaseSet( key, value );
- }
- }
-
- // Gets a String array that contains all the keys in the collection.
- property array^ AllKeys {
- array^ get() {
- return( (array^)this->BaseGetAllKeys() );
- }
- }
-
- // Gets an Object array that contains all the values in the collection.
- property Array^ AllValues {
- Array^ get() {
- return( this->BaseGetAllValues() );
- }
- }
-
- // Gets a String array that contains all the values in the collection.
- property array^ AllStringValues {
- array^ get() {
- return( (array^) this->BaseGetAllValues( String ::typeid ));
- }
- }
-
- // Gets a value indicating if the collection contains keys that are not null.
- property Boolean HasKeys {
- Boolean get() {
- return( this->BaseHasKeys() );
- }
- }
-
- // Adds an entry to the collection.
- void Add( String^ key, Object^ value ) {
- this->BaseAdd( key, value );
- }
-
- // Removes an entry with the specified key from the collection.
- void Remove( String^ key ) {
- this->BaseRemove( key );
- }
-
- // Removes an entry in the specified index from the collection.
- void Remove( int index ) {
- this->BaseRemoveAt( index );
- }
-
- // Clears all the elements in the collection.
- void Clear() {
- this->BaseClear();
- }
-};
-
-public ref class SamplesNameObjectCollectionBase {
-
-public:
- static void Main() {
- // Creates and initializes a new MyCollection that is read-only.
- IDictionary^ d = gcnew ListDictionary();
- d->Add( "red", "apple" );
- d->Add( "yellow", "banana" );
- d->Add( "green", "pear" );
- MyCollection^ myROCol = gcnew MyCollection( d, true );
-
- // Tries to add a new item.
- try {
- myROCol->Add( "blue", "sky" );
- }
- catch ( NotSupportedException^ e ) {
- Console::WriteLine( e->ToString() );
- }
-
- // Displays the keys and values of the MyCollection.
- Console::WriteLine( "Read-Only Collection:" );
- PrintKeysAndValues( myROCol );
-
- // Creates and initializes an empty MyCollection that is writable.
- MyCollection^ myRWCol = gcnew MyCollection();
-
- // Adds new items to the collection.
- myRWCol->Add( "purple", "grape" );
- myRWCol->Add( "orange", "tangerine" );
- myRWCol->Add( "black", "berries" );
- Console::WriteLine( "Writable Collection (after adding values):" );
- PrintKeysAndValues( myRWCol );
-
- // Changes the value of one element.
- myRWCol["orange"] = "grapefruit";
- Console::WriteLine( "Writable Collection (after changing one value):" );
- PrintKeysAndValues( myRWCol );
-
- // Removes one item from the collection.
- myRWCol->Remove( "black" );
- Console::WriteLine( "Writable Collection (after removing one value):" );
- PrintKeysAndValues( myRWCol );
-
- // Removes all elements from the collection.
- myRWCol->Clear();
- Console::WriteLine( "Writable Collection (after clearing the collection):" );
- PrintKeysAndValues( myRWCol );
- }
-
- // Prints the indexes, keys, and values.
- static void PrintKeysAndValues( MyCollection^ myCol ) {
- for ( int i = 0; i < myCol->Count; i++ ) {
- Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value );
- }
- }
-
- // Prints the keys and values using AllKeys.
- static void PrintKeysAndValues2( MyCollection^ myCol ) {
- for each ( String^ s in myCol->AllKeys ) {
- Console::WriteLine( "{0}, {1}", s, myCol[s] );
- }
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBase::Main();
-}
-
-/*
-This code produces the following output.
-
-System.NotSupportedException: Collection is read-only.
- at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value)
- at SamplesNameObjectCollectionBase.Main()
-Read-Only Collection:
-[0] : red, apple
-[1] : yellow, banana
-[2] : green, pear
-Writable Collection (after adding values):
-[0] : purple, grape
-[1] : orange, tangerine
-[2] : black, berries
-Writable Collection (after changing one value):
-[0] : purple, grape
-[1] : orange, grapefruit
-[2] : black, berries
-Writable Collection (after removing one value):
-[0] : purple, grape
-[1] : orange, grapefruit
-Writable Collection (after clearing the collection):
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp
deleted file mode 100644
index 7865c4fe20e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Threading;
-
-public ref class DerivedCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Creates an empty collection.
-public:
- DerivedCollection() {
- _de = gcnew DictionaryEntry();
- }
-
- // Adds elements from an IDictionary into the new collection.
- DerivedCollection( IDictionary^ d, Boolean bReadOnly ) {
-
- _de = gcnew DictionaryEntry();
-
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- this->IsReadOnly = bReadOnly;
- }
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get(int index) {
- _de->Key = this->BaseGetKey(index);
- _de->Value = this->BaseGet(index);
- return( _de );
- }
- }
-
- // Gets or sets the value associated with the specified key.
- property Object^ default[ String^ ] {
- Object^ get(String^ key) {
- return( this->BaseGet( key ) );
- }
- void set( String^ key, Object^ value ) {
- this->BaseSet( key, value );
- }
- }
-
- // Gets a String array that contains all the keys in the collection.
- property array^ AllKeys {
- array^ get() {
- return( (array^)this->BaseGetAllKeys() );
- }
- }
-
- // Gets an Object array that contains all the values in the collection.
- property Array^ AllValues {
- Array^ get() {
- return( this->BaseGetAllValues() );
- }
- }
-
- // Gets a String array that contains all the values in the collection.
- property array^ AllStringValues {
- array^ get() {
- return( (array^) this->BaseGetAllValues( String ::typeid ));
- }
- }
-
- // Gets a value indicating if the collection contains keys that are not null.
- property Boolean HasKeys {
- Boolean get() {
- return( this->BaseHasKeys() );
- }
- }
-
- // Adds an entry to the collection.
- void Add( String^ key, Object^ value ) {
- this->BaseAdd( key, value );
- }
-
- // Removes an entry with the specified key from the collection.
- void Remove( String^ key ) {
- this->BaseRemove( key );
- }
-
- // Removes an entry in the specified index from the collection.
- void Remove( int index ) {
- this->BaseRemoveAt( index );
- }
-
- // Clears all the elements in the collection.
- void Clear() {
- this->BaseClear();
- }
-};
-
-public ref class SamplesNameObjectCollectionBase
-{
-public:
- static void Main()
- {
- //
- // Create a collection derived from NameObjectCollectionBase
- ICollection^ myCollection = gcnew DerivedCollection();
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection)
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBase::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp
deleted file mode 100644
index 6d13a5bf9be..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// The following code example demonstrates several of the properties and methods of NameValueCollection.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-void PrintKeysAndValues( NameValueCollection^ myCol );
-void PrintKeysAndValues2( NameValueCollection^ myCol );
-
-int main()
-{
- // Creates and initializes a new NameValueCollection.
- NameValueCollection^ myCol = gcnew NameValueCollection;
- myCol->Add( "red", "rojo" );
- myCol->Add( "green", "verde" );
- myCol->Add( "blue", "azul" );
- myCol->Add( "red", "rouge" );
-
- // Displays the values in the NameValueCollection in two different ways.
- Console::WriteLine( "Displays the elements using the AllKeys property and the Item (indexer) property:" );
- PrintKeysAndValues( myCol );
- Console::WriteLine( "Displays the elements using GetKey and Get:" );
- PrintKeysAndValues2( myCol );
-
- // Gets a value either by index or by key.
- Console::WriteLine( "Index 1 contains the value {0}.", myCol[ 1 ] );
- Console::WriteLine( "Key \"red\" has the value {0}.", myCol[ "red" ] );
- Console::WriteLine();
-
- // Copies the values to a string array and displays the string array.
- array^myStrArr = gcnew array(myCol->Count);
- myCol->CopyTo( myStrArr, 0 );
- Console::WriteLine( "The string array contains:" );
- for each ( String^ s in myStrArr )
- Console::WriteLine( " {0}", s );
- Console::WriteLine();
-
- // Searches for a key and deletes it.
- myCol->Remove( "green" );
- Console::WriteLine( "The collection contains the following elements after removing \"green\":" );
- PrintKeysAndValues( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "The collection contains the following elements after it is cleared:" );
- PrintKeysAndValues( myCol );
-}
-
-void PrintKeysAndValues( NameValueCollection^ myCol )
-{
- Console::WriteLine( " KEY VALUE" );
- for each ( String^ s in myCol->AllKeys )
- Console::WriteLine( " {0,-10} {1}", s, myCol[s] );
- Console::WriteLine();
-}
-
-void PrintKeysAndValues2( NameValueCollection^ myCol )
-{
- Console::WriteLine( " [INDEX] KEY VALUE" );
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " [{0}] {1,-10} {2}", i, myCol->GetKey( i ), myCol->Get( i ) );
- Console::WriteLine();
-}
-
-/*
-
-This code produces the following output.
-
-Displays the elements using the AllKeys property and the Item (indexer) property:
- KEY VALUE
- red rojo,rouge
- green verde
- blue azul
-
-Displays the elements using GetKey and Get:
- [INDEX] KEY VALUE
- [0] red rojo,rouge
- [1] green verde
- [2] blue azul
-
-Index 1 contains the value verde.
-Key "red" has the value rojo,rouge.
-
-The string array contains:
- rojo,rouge
- verde
- azul
-
-The collection contains the following elements after removing "green":
- KEY VALUE
- red rojo,rouge
- blue azul
-
-The collection contains the following elements after it is cleared:
- KEY VALUE
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp
deleted file mode 100644
index c59ed515e67..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// The following code example enumerates the elements of a OrderedDictionary.
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class OrderedDictionarySample
-{
-public:
- static void Main()
- {
- //
- // Creates and initializes a OrderedDictionary.
- OrderedDictionary^ myOrderedDictionary = gcnew OrderedDictionary();
- myOrderedDictionary->Add("testKey1", "testValue1");
- myOrderedDictionary->Add("testKey2", "testValue2");
- myOrderedDictionary->Add("keyToDelete", "valueToDelete");
- myOrderedDictionary->Add("testKey3", "testValue3");
-
- ICollection^ keyCollection = myOrderedDictionary->Keys;
- ICollection^ valueCollection = myOrderedDictionary->Values;
-
- // Display the contents using the key and value collections
- DisplayContents(keyCollection, valueCollection, myOrderedDictionary->Count);
- //
-
- //
- // Modifying the OrderedDictionary
- if (!myOrderedDictionary->IsReadOnly)
- {
- // Insert a new key to the beginning of the OrderedDictionary
- myOrderedDictionary->Insert(0, "insertedKey1", "insertedValue1");
-
- // Modify the value of the entry with the key "testKey2"
- myOrderedDictionary["testKey2"] = "modifiedValue";
-
- // Remove the last entry from the OrderedDictionary: "testKey3"
- myOrderedDictionary->RemoveAt(myOrderedDictionary->Count - 1);
-
- // Remove the "keyToDelete" entry, if it exists
- if (myOrderedDictionary->Contains("keyToDelete"))
- {
- myOrderedDictionary->Remove("keyToDelete");
- }
- }
- //
-
- Console::WriteLine(
- "{0}Displaying the entries of a modified OrderedDictionary.",
- Environment::NewLine);
- DisplayContents(keyCollection, valueCollection, myOrderedDictionary->Count);
-
- //
- // Clear the OrderedDictionary and add new values
- myOrderedDictionary->Clear();
- myOrderedDictionary->Add("newKey1", "newValue1");
- myOrderedDictionary->Add("newKey2", "newValue2");
- myOrderedDictionary->Add("newKey3", "newValue3");
-
- // Display the contents of the "new" Dictionary using an enumerator
- IDictionaryEnumerator^ myEnumerator =
- myOrderedDictionary->GetEnumerator();
-
- Console::WriteLine(
- "{0}Displaying the entries of a \"new\" OrderedDictionary.",
- Environment::NewLine);
-
- DisplayEnumerator(myEnumerator);
- //
- }
-
- //
- // Displays the contents of the OrderedDictionary from its keys and values
- static void DisplayContents(
- ICollection^ keyCollection, ICollection^ valueCollection, int dictionarySize)
- {
- array^ myKeys = gcnew array(dictionarySize);
- array^ myValues = gcnew array(dictionarySize);
- keyCollection->CopyTo(myKeys, 0);
- valueCollection->CopyTo(myValues, 0);
-
- // Displays the contents of the OrderedDictionary
- Console::WriteLine(" INDEX KEY VALUE");
- for (int i = 0; i < dictionarySize; i++)
- {
- Console::WriteLine(" {0,-5} {1,-25} {2}",
- i, myKeys[i], myValues[i]);
- }
- Console::WriteLine();
- }
- //
-
- //
- // Displays the contents of the OrderedDictionary using its enumerator
- static void DisplayEnumerator(IDictionaryEnumerator^ myEnumerator)
- {
- Console::WriteLine(" KEY VALUE");
- while (myEnumerator->MoveNext())
- {
- Console::WriteLine(" {0,-25} {1}",
- myEnumerator->Key, myEnumerator->Value);
- }
- }
- //
-};
-
-int main()
-{
- OrderedDictionarySample::Main();
-}
-
-/*
-This code produces the following output.
-
- INDEX KEY VALUE
- 0 testKey1 testValue1
- 1 testKey2 testValue2
- 2 keyToDelete valueToDelete
- 3 testKey3 testValue3
-
-
-Displaying the entries of a modified OrderedDictionary.
- INDEX KEY VALUE
- 0 insertedKey1 insertedValue1
- 1 testKey1 testValue1
- 2 testKey2 modifiedValue
-
-
-Displaying the entries of a "new" OrderedDictionary.
- KEY VALUE
- newKey1 newValue1
- newKey2 newValue2
- newKey3 newValue3
-
-*/
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp
deleted file mode 100644
index 42c6ceb624c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-public ref class OrderedDictionarySample
-{
-public:
- static void Main()
- {
- OrderedDictionary^ myOrderedDictionary = gcnew OrderedDictionary();
- //
- for each (DictionaryEntry de in myOrderedDictionary)
- {
- //...
- }
- //
- }
-};
-
-int main()
-{
- OrderedDictionarySample::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp
deleted file mode 100644
index 427029d212e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Threading;
-
-public ref class SamplesStringCollection
-{
-public:
- static void Main()
- {
- //
- StringCollection^ myCollection = gcnew StringCollection();
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myCollection->SyncRoot, lockTaken);
- for each (Object^ item in myCollection)
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- SamplesStringCollection::Main();
-}
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp
deleted file mode 100644
index c05a22e2367..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-// The following code example demonstrates several of the properties and methods of StringCollection.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-void PrintValues1( StringCollection^ myCol );
-void PrintValues2( StringCollection^ myCol );
-void PrintValues3( StringCollection^ myCol );
-
-int main()
-{
-
- // Create and initializes a new StringCollection.
- StringCollection^ myCol = gcnew StringCollection;
-
- // Add a range of elements from an array to the end of the StringCollection.
- array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"};
- myCol->AddRange( myArr );
-
- // Display the contents of the collection using for each. This is the preferred method.
- Console::WriteLine( "Displays the elements using for each:" );
- PrintValues1( myCol );
-
- // Display the contents of the collection using the enumerator.
- Console::WriteLine( "Displays the elements using the IEnumerator:" );
- PrintValues2( myCol );
-
- // Display the contents of the collection using the Count and Item properties.
- Console::WriteLine( "Displays the elements using the Count and Item properties:" );
- PrintValues3( myCol );
-
- // Add one element to the end of the StringCollection and insert another at index 3.
- myCol->Add( "* white" );
- myCol->Insert( 3, "* gray" );
- Console::WriteLine( "After adding \"* white\" to the end and inserting \"* gray\" at index 3:" );
- PrintValues1( myCol );
-
- // Remove one element from the StringCollection.
- myCol->Remove( "yellow" );
- Console::WriteLine( "After removing \"yellow\":" );
- PrintValues1( myCol );
-
- // Remove all occurrences of a value from the StringCollection.
- int i = myCol->IndexOf( "RED" );
- while ( i > -1 )
- {
- myCol->RemoveAt( i );
- i = myCol->IndexOf( "RED" );
- }
-
-
- // Verify that all occurrences of "RED" are gone.
- if ( myCol->Contains( "RED" ) )
- Console::WriteLine( "*** The collection still contains \"RED\"." );
-
- Console::WriteLine( "After removing all occurrences of \"RED\":" );
- PrintValues1( myCol );
-
- // Copy the collection to a new array starting at index 0.
- array^myArr2 = gcnew array(myCol->Count);
- myCol->CopyTo( myArr2, 0 );
- Console::WriteLine( "The new array contains:" );
- for ( i = 0; i < myArr2->Length; i++ )
- {
- Console::WriteLine( " [{0}] {1}", i, myArr2[ i ] );
-
- }
- Console::WriteLine();
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "After clearing the collection:" );
- PrintValues1( myCol );
-}
-
-
-// Uses the for each statement which hides the complexity of the enumerator.
-// NOTE: The for each statement is the preferred way of enumerating the contents of a collection.
-void PrintValues1( StringCollection^ myCol ) {
- for each ( Object^ obj in myCol )
- Console::WriteLine( " {0}", obj );
- Console::WriteLine();
-}
-
-// Uses the enumerator.
-void PrintValues2( StringCollection^ myCol )
-{
- StringEnumerator^ myEnumerator = myCol->GetEnumerator();
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( " {0}", myEnumerator->Current );
-
- Console::WriteLine();
-}
-
-
-// Uses the Count and Item properties.
-void PrintValues3( StringCollection^ myCol )
-{
- for ( int i = 0; i < myCol->Count; i++ )
- Console::WriteLine( " {0}", myCol[ i ] );
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Displays the elements using the IEnumerator:
- RED
- orange
- yellow
- RED
- green
- blue
- RED
- indigo
- violet
- RED
-
-Displays the elements using the Count and Item properties:
- RED
- orange
- yellow
- RED
- green
- blue
- RED
- indigo
- violet
- RED
-
-After adding "* white" to the end and inserting "* gray" at index 3:
- RED
- orange
- yellow
- * gray
- RED
- green
- blue
- RED
- indigo
- violet
- RED
- * white
-
-After removing "yellow":
- RED
- orange
- * gray
- RED
- green
- blue
- RED
- indigo
- violet
- RED
- * white
-
-After removing all occurrences of "RED":
- orange
- * gray
- green
- blue
- indigo
- violet
- * white
-
-The new array contains:
- [0] orange
- [1] * gray
- [2] green
- [3] blue
- [4] indigo
- [5] violet
- [6] * white
-
-After clearing the collection:
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp
deleted file mode 100644
index 841b997b1e1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-// The following code example adds new elements to the StringCollection.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintValues( IEnumerable^ myCol );
-int main()
-{
-
- // Creates and initializes a new StringCollection.
- StringCollection^ myCol = gcnew StringCollection;
- Console::WriteLine( "Initial contents of the StringCollection:" );
- PrintValues( myCol );
-
- // Adds a range of elements from an array to the end of the StringCollection.
- array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"};
- myCol->AddRange( myArr );
- Console::WriteLine( "After adding a range of elements:" );
- PrintValues( myCol );
-
- // Adds one element to the end of the StringCollection and inserts another at index 3.
- myCol->Add( "* white" );
- myCol->Insert( 3, "* gray" );
- Console::WriteLine( "After adding \"* white\" to the end and inserting \"* gray\" at index 3:" );
- PrintValues( myCol );
-}
-
-void PrintValues( IEnumerable^ myCol )
-{
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ obj = safe_cast(myEnum->Current);
- Console::WriteLine( " {0}", obj );
- }
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the StringCollection:
-
-After adding a range of elements:
- RED
- orange
- yellow
- RED
- green
- blue
- RED
- indigo
- violet
- RED
-
-After adding "* white" to the end and inserting "* gray" at index 3:
- RED
- orange
- yellow
- * gray
- RED
- green
- blue
- RED
- indigo
- violet
- RED
- * white
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp
deleted file mode 100644
index 9d9a32b8e90..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-// The following code example searches the StringCollection for an element.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintValues( IEnumerable^ myCol );
-int main()
-{
-
- // Creates and initializes a new StringCollection.
- StringCollection^ myCol = gcnew StringCollection;
- array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"};
- myCol->AddRange( myArr );
- Console::WriteLine( "Initial contents of the StringCollection:" );
- PrintValues( myCol );
-
- // Checks whether the collection contains "orange" and, if so, displays its index.
- if ( myCol->Contains( "orange" ) )
- Console::WriteLine( "The collection contains \"orange\" at index {0}.", myCol->IndexOf( "orange" ) );
- else
- Console::WriteLine( "The collection does not contain \"orange\"." );
-}
-
-void PrintValues( IEnumerable^ myCol )
-{
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ obj = safe_cast(myEnum->Current);
- Console::WriteLine( " {0}", obj );
- }
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the StringCollection:
- RED
- orange
- yellow
- RED
- green
- blue
- RED
- indigo
- violet
- RED
-
-The collection contains "orange" at index 1.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp
deleted file mode 100644
index f90440e4676..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-// The following code example copies a StringCollection to an array.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintValues( IEnumerable^ myCol );
-int main()
-{
-
- // Creates and initializes a new StringCollection.
- StringCollection^ myCol = gcnew StringCollection;
- array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"};
- myCol->AddRange( myArr );
- Console::WriteLine( "Initial contents of the StringCollection:" );
- PrintValues( myCol );
-
- // Copies the collection to a new array starting at index 0.
- array^myArr2 = gcnew array(myCol->Count);
- myCol->CopyTo( myArr2, 0 );
- Console::WriteLine( "The new array contains:" );
- for ( int i = 0; i < myArr2->Length; i++ )
- {
- Console::WriteLine( " [{0}] {1}", i, myArr2[ i ] );
-
- }
- Console::WriteLine();
-}
-
-void PrintValues( IEnumerable^ myCol )
-{
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ obj = safe_cast(myEnum->Current);
- Console::WriteLine( " {0}", obj );
- }
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the StringCollection:
- RED
- orange
- yellow
- RED
- green
- blue
- RED
- indigo
- violet
- RED
-
-The new array contains:
- [0] RED
- [1] orange
- [2] yellow
- [3] RED
- [4] green
- [5] blue
- [6] RED
- [7] indigo
- [8] violet
- [9] RED
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp
deleted file mode 100644
index 98e049d1393..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-// The following code example removes elements from the StringCollection.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void PrintValues( IEnumerable^ myCol );
-int main()
-{
-
- // Creates and initializes a new StringCollection.
- StringCollection^ myCol = gcnew StringCollection;
- array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"};
- myCol->AddRange( myArr );
- Console::WriteLine( "Initial contents of the StringCollection:" );
- PrintValues( myCol );
-
- // Removes one element from the StringCollection.
- myCol->Remove( "yellow" );
- Console::WriteLine( "After removing \"yellow\":" );
- PrintValues( myCol );
-
- // Removes all occurrences of a value from the StringCollection.
- int i = myCol->IndexOf( "RED" );
- while ( i > -1 )
- {
- myCol->RemoveAt( i );
- i = myCol->IndexOf( "RED" );
- }
-
- Console::WriteLine( "After removing all occurrences of \"RED\":" );
- PrintValues( myCol );
-
- // Clears the entire collection.
- myCol->Clear();
- Console::WriteLine( "After clearing the collection:" );
- PrintValues( myCol );
-}
-
-void PrintValues( IEnumerable^ myCol )
-{
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ obj = safe_cast(myEnum->Current);
- Console::WriteLine( " {0}", obj );
- }
-
- Console::WriteLine();
-}
-
-/*
-This code produces the following output.
-
-Initial contents of the StringCollection:
- RED
- orange
- yellow
- RED
- green
- blue
- RED
- indigo
- violet
- RED
-
-After removing "yellow":
- RED
- orange
- RED
- green
- blue
- RED
- indigo
- violet
- RED
-
-After removing all occurrences of "RED":
- orange
- green
- blue
- indigo
- violet
-
-After clearing the collection:
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp
deleted file mode 100644
index 5bf34579a7f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-// The following code example shows how a StringDictionary can be copied to an array.
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-void main()
-{
-
- // Creates and initializes a new StringDictionary.
- StringDictionary^ myCol = gcnew StringDictionary;
- myCol->Add( "red", "rojo" );
- myCol->Add( "green", "verde" );
- myCol->Add( "blue", "azul" );
-
- // Displays the values in the StringDictionary.
- Console::WriteLine( "KEYS\tVALUES in the StringDictionary" );
- IEnumerator^ myEnum = myCol->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- DictionaryEntry^ myDE = safe_cast(myEnum->Current);
- Console::WriteLine( "{0}\t{1}", myDE->Key, myDE->Value );
- Console::WriteLine();
-
- // Creates an array with DictionaryEntry elements.
- array^myArr = gcnew array(3);
-
- // Copies the StringDictionary to the array.
- myCol->CopyTo( myArr, 0 );
-
- // Displays the values in the array.
- Console::WriteLine( "KEYS\tVALUES in the array" );
- for ( int i = 0; i < myArr->Length; i++ )
- Console::WriteLine( "{0}\t{1}", myArr[ i ].Key, myArr[ i ].Value );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-KEYS VALUES in the StringDictionary
-green verde
-red rojo
-blue azul
-
-KEYS VALUES in the array
-green verde
-red rojo
-blue azul
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp
deleted file mode 100644
index c6cea926c77..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-// The following code example demonstrates several of the properties and methods of StringEnumerator.
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Specialized;
-int main()
-{
-
- // Creates and initializes a StringCollection.
- StringCollection^ myCol = gcnew StringCollection;
- array^myArr = {"red","orange","yellow","green","blue","indigo","violet"};
- myCol->AddRange( myArr );
-
- // Enumerates the elements in the StringCollection.
- StringEnumerator^ myEnumerator = myCol->GetEnumerator();
- while ( myEnumerator->MoveNext() )
- Console::WriteLine( "{0}", myEnumerator->Current );
-
- Console::WriteLine();
-
- // Resets the enumerator and displays the first element again.
- myEnumerator->Reset();
- if ( myEnumerator->MoveNext() )
- Console::WriteLine( "The first element is {0}.", myEnumerator->Current );
-}
-
-/*
-This code produces the following output.
-
-red
-orange
-yellow
-green
-blue
-indigo
-violet
-
-The first element is red.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp
deleted file mode 100644
index 5c947137978..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-// CorrelationManager.cpp : main project file.
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Collections::Generic;
-using namespace System::Text;
-using namespace System::Diagnostics;
-using namespace System::Threading;
-
-void ThreadProc()
-{
- TraceSource^ ts = gcnew TraceSource("MyApp");
- int i = ts->Listeners->Add(gcnew ConsoleTraceListener());
- ts->Listeners[i]->TraceOutputOptions = TraceOptions::LogicalOperationStack;
- ts->Switch = gcnew SourceSwitch("MyAPP", "Verbose");
- // Add another logical operation.
- Trace::CorrelationManager->StartLogicalOperation("WorkerThread");
-
- ts->TraceEvent(TraceEventType::Error, 1, "Trace an error event.");
- Trace::CorrelationManager->StopLogicalOperation();
-}
-
-void main()
-{
- TraceSource^ ts = gcnew TraceSource("MyApp");
- int i = ts->Listeners->Add(gcnew ConsoleTraceListener());
- ts->Listeners[i]->TraceOutputOptions = TraceOptions::LogicalOperationStack;
- ts->Switch = gcnew SourceSwitch("MyAPP", "Verbose");
- // Start the logical operation on the Main thread.
- Trace::CorrelationManager->StartLogicalOperation("MainThread");
-
- ts->TraceEvent(TraceEventType::Error, 1, "Trace an error event.");
- Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc));
-// Start the worker thread.
- t->Start();
-// Give the worker thread a chance to execute.
- Thread::Sleep(1000);
- Trace::CorrelationManager->StopLogicalOperation();}
-
-
-
-// This sample generates the following output:
-//MyApp Error: 1 : Trace an error event.
-// LogicalOperationStack=MainThread
-//MyApp Error: 1 : Trace an error event.
-// LogicalOperationStack=WorkerThread, MainThread
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp
deleted file mode 100644
index 519ff58fbcd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Diagnostics;
-using namespace System::Reflection;
-
-ref class HashtableDebugView;
-
-//
-[DebuggerDisplay("{value}", Name = "{key}")]
-ref class KeyValuePairs
-{
-private:
- IDictionary^ dictionary;
- Object^ key;
- Object^ value;
-
-public:
- KeyValuePairs(IDictionary^ dictionary, Object^ key, Object^ value)
- {
- this->value = value;
- this->key = key;
- this->dictionary = dictionary;
- }
-};
-//
-
-//
-[DebuggerDisplay("Count = {Count}")]
-//
-[DebuggerTypeProxy(HashtableDebugView::typeid)]
-ref class MyHashtable : Hashtable
-//
-{
-private:
- static const String^ TestString = "This should not appear in the debug window.";
-
-internal:
- ref class HashtableDebugView
- {
- private:
- Hashtable^ hashtable;
- public:
- static const String^ TestString = "This should appear in the debug window.";
- HashtableDebugView(Hashtable^ hashtable)
- {
- this->hashtable = hashtable;
- }
-
- //
- [DebuggerBrowsable(DebuggerBrowsableState::RootHidden)]
- property array^ Keys
- {
- array^ get()
- {
- array^ keys = gcnew array(hashtable->Count);
-
- IEnumerator^ ie = hashtable->Keys->GetEnumerator();
- int i = 0;
- Object^ key;
- while (ie->MoveNext())
- {
- key = ie->Current;
- keys[i] = gcnew KeyValuePairs(hashtable, key, hashtable[key]);
- i++;
- }
- return keys;
- }
- }
- //
- };
-};
-//
-
-public ref class DebugViewTest
-{
-private:
- // The following constant will appear in the debug window for DebugViewTest.
- static const String^ TabString = " ";
-public:
- //
- // The following DebuggerBrowsableAttribute prevents the property following it
- // from appearing in the debug window for the class.
- [DebuggerBrowsable(DebuggerBrowsableState::Never)]
- static String^ y = "Test String";
- //
-
- static void Main()
- {
- MyHashtable^ myHashTable = gcnew MyHashtable();
- myHashTable->Add("one", 1);
- myHashTable->Add("two", 2);
- Console::WriteLine(myHashTable->ToString());
- Console::WriteLine("In Main.");
- }
-};
-
-int main()
-{
- DebugViewTest::Main();
-}
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp
deleted file mode 100644
index 6ac933cf809..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-
-///////////////////////////////////////////////////////////////////////
-//
-// EventSchemaTraceListener.cpp : main project file.
-// Expected Output:
-// 1)
-// EventSchemaTraceListener CPP Sample
-//
-// IsThreadSafe? True
-// BufferSize = 65536
-// MaximumFileSize = 20480000
-// MaximumNumberOfFiles = 2
-// Name = eventListener
-// TraceLogRetentionOption = LimitedCircularFiles
-// TraceOutputOptions = DateTime, Timestamp, ProcessId
-//
-// Press the enter key to exit
-//
-// 2) An output file is created named TraceOutput.xml. It will be
-// opened and displayed in Microsoft Notepad.
-//
-// NOTE 1:
-// Under certain circumstances, the VS C++ compiler will treat
-// Console::WriteLine("MyText = " + MyVar);
-// differently then the VS CSharp compiler.
-// The C++ compiler will produce error C3063, whereas the
-// CSharp compiler accepts the statement.
-// This occurs when the VS C++ compiler cannot determine the
-// datatype of "MyVar" because it is an enumeration type.
-// The solution is:
-// Use either of the following two methods:
-// Console::WriteLine("MyText = {0} " , MyVar);
-// Console::WriteLine("MyText = " + MyVar.ToString());
-//
-// Although not specific to this particular pieces of code,
-// this is demonstrated below in the Display function: The
-// last two members, TraceLogRetentionOption, and
-// TraceOutputOptions, are enumerations, and cannot simply be
-// concatenated into Console::WriteLine.
-//
-///////////////////////////////////////////////////////////////////////
-#using
-#using
-
-#define NOCONFIGFILE 1
-using namespace System;
-using namespace System::IO;
-using namespace System::Diagnostics;
-
-
-[STAThreadAttribute]
-void main()
-{
- Console::WriteLine("EventSchemaTraceListener CPP Sample\n");
-
- File::Delete("TraceOutput.xml");
- TraceSource ^ ts = gcnew TraceSource("TestSource");
-
-
-#if NOCONFIGFILE
- ts->Listeners->Add(gcnew EventSchemaTraceListener("TraceOutput.xml",
- "eventListener", 65536,
- TraceLogRetentionOption::LimitedCircularFiles,
- 20480000, 2));
- ts->Listeners["eventListener"]->TraceOutputOptions =
- TraceOptions::DateTime |
- TraceOptions::ProcessId |
- TraceOptions::Timestamp;
-#endif
-
- EventSchemaTraceListener ^ ESTL =
- (EventSchemaTraceListener^)(ts->Listeners["eventListener"]);
-
-
- Console::WriteLine("IsThreadSafe? = " + ESTL->IsThreadSafe);
- Console::WriteLine("BufferSize = " + ESTL->BufferSize);
- Console::WriteLine("MaximumFileSize = " + ESTL->MaximumFileSize);
- Console::WriteLine("MaximumNumberOfFiles = " + ESTL->MaximumNumberOfFiles);
- Console::WriteLine("Name = " + ESTL->Name);
- Console::WriteLine("TraceLogRetentionOption = " + ESTL->TraceLogRetentionOption.ToString());
- Console::WriteLine("TraceOutputOptions = {0}\n", ESTL->TraceOutputOptions);
-
- ts->Switch->Level = SourceLevels::All;
- String ^ testString = ""
- + ""
- + "11";
-
- UnescapedXmlDiagnosticData ^ unXData = gcnew UnescapedXmlDiagnosticData(testString);
- ts->TraceData(TraceEventType::Error, 38, unXData);
- ts->TraceEvent(TraceEventType::Error, 38, testString);
- ts->Flush();
- ts->Close();
-
- Process::Start("notepad.exe", "TraceOutput.xml");
- Console::WriteLine("\nPress the enter key to exit");
- Console::ReadLine();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp
deleted file mode 100644
index 07d517d64ac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-//
-// InstanceData_CopyTo.cpp : main project file.
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-
-///////////////////////////////////////////////////////////////////////
-//
-// FORWARD DECLARATIONS
-//
-///////////////////////////////////////////////////////////////////////
-
-// Console Utility Functions:
-void InitConsole(); // Init console size
-void TitleBlock(); // Write the title block
-void CW(String^strText , // Write a colored string
- String^ C = "", int LF = 1);
-
-
-// InstanceData subroutines
-// Display the contents of an InstanceData object.
-void ProcessInstanceDataObject(String^ name, CounterSample CSRef);
-
-// Display the contents of an InstanceDataCollection.
-void ProcessInstanceDataCollection(InstanceDataCollection^ idCol);
-
-
-
-
-///////////////////////////////////////////////////////////////////////
-//
-// MAIN PROGRAM
-//
-///////////////////////////////////////////////////////////////////////
-
-void main()
-{
- InitConsole();
- TitleBlock();
-
- String^ categoryName;
- String^ catNumStr;
- int categoryNum;
-
-
- array^ categories =
- PerformanceCounterCategory::GetCategories();
-
- // Create and sort an array of category names.
- array^ categoryNames = gcnew array(categories->Length);
- int catX;
- for(catX=0; catX < categories->Length; catX++)
- categoryNames[catX] = categories[catX]->CategoryName;
- Array::Sort(categoryNames);
-
- while(1)
- {
- CW("These PerformanceCounterCategory categories are registered \n"
- +"on this computer:","Red");
-
- for(catX=0; catX < categories->Length; catX++)
- Console::WriteLine("{0,4} - {1}", catX+1, categoryNames[catX]);
-
- // Ask the user to choose a category.
- Console::Write("\nEnter a category number from the above list: ");
- catNumStr = Console::ReadLine();
-
- // Validate the entered category number.
- try {
- categoryNum = int::Parse(catNumStr);
- if (categoryNum < 1 || categoryNum > categories->Length)
- throw gcnew Exception(String::Format("The category number "+
- " must be in the range 1..{0}.", categories->Length));
- categoryName = categoryNames[(categoryNum-1)];
-
- // Process the InstanceDataCollectionCollection for this category.
- PerformanceCounterCategory^ pcc =
- gcnew PerformanceCounterCategory(categoryName);
- InstanceDataCollectionCollection^ idColCol = pcc->ReadCategory();
- array^ idColArray =
- gcnew array(idColCol->Count);
-
- CW("\nInstanceDataCollectionCollection for \"" +categoryName+"\" "
- +"has "+idColCol->Count+" elements.","Blue");
-
- idColCol->CopyTo(idColArray, 0);
-
- for each ( InstanceDataCollection ^ idCol in idColArray )
- ProcessInstanceDataCollection(idCol);
- }
- catch(Exception^ ex)
- {
- Console::WriteLine("\"{0}\" is not a valid category number." +
- "\n{1}", catNumStr, ex->Message);
- }
-
- CW("\n\nRun again (Y,N)?","Yellow");
- catNumStr = Console::ReadLine();
- if ("Y" != catNumStr && "y" != catNumStr) break;
- }
-}
-
-
-///////////////////////////////////////////////////////////////////////
-//
-// SUBROUTINES
-//
-///////////////////////////////////////////////////////////////////////
-
-void InitConsole()
-{
- Console::BufferHeight = 4000;
- Console::WindowHeight = 40;
-}
-
-void TitleBlock()
-{
-Console::Title = "InstDataCopyTo.cpp Sample";
-
-CW(
- "///////////////////////////////////////////////////////////////////\n"
-+"//\n"
-+"// PROGRAM instdatacopyto.cpp\n"
-+"// PURPOSE Show how to use InstanceData objects\n"
-+"// OUTPUT 1) Displays a numbered list of PerformanceCounter\n"
-+"// categories that exist on the local computer.\n"
-+"// 2) Prompts the user to select a category.\n"
-+"// 3) Displays the instance data associated with each\n"
-+"// instance of the PerformanceCounter in the\n"
-+"// selected PerformanceCounterCategory\n"
-+"//\n"
-+ "///////////////////////////////////////////////////////////////////\n"
-,"Yellow");
-}
-
-
-// Utility function: ConsoleWrite: Write a colored string
-void CW(String^ strText , String^ C, int LF)
-{
- if (C != "") Console::ForegroundColor = *dynamic_cast
- (Enum::Parse(ConsoleColor::typeid, C));
- Console::Write(strText);
- Console::ResetColor();
- Console::Write("\n{0}",LF?"\n":"");
-}
-
-// Display the contents of an InstanceDataCollection.
-void ProcessInstanceDataCollection(InstanceDataCollection ^ idCol)
-{
- array^ instDataArray = gcnew array(idCol->Count);
-
- CW("\n InstanceDataCollection for \""
- + idCol->CounterName + "\" has " + idCol->Count + " elements.", "Red");
-
- // Copy and process the InstanceData array.
- idCol->CopyTo(instDataArray, 0);
-
- int idX;
- for(idX=0; idX < instDataArray->Length; idX++)
- ProcessInstanceDataObject(instDataArray[idX]->InstanceName,
- instDataArray[idX]->Sample);
-}
-
-
-// Display the contents of an InstanceData object.
-void ProcessInstanceDataObject(String ^ name, CounterSample CSRef)
-{
- InstanceData ^ instData = gcnew InstanceData(name, CSRef);
- CW(" Data from InstanceData object:","Red",0);
-
- CW(" InstanceName: "+instData->InstanceName,"Green",0);
- CW(" RawValue: " + instData->RawValue);
-
- CounterSample sample = instData->Sample;
- Console::Write(" Data from CounterSample object:\n" +
- " CounterType: {0,-27} SystemFrequency: {1}\n" +
- " BaseValue: {2,-27} RawValue: {3}\n" +
- " CounterFrequency: {4,-27} CounterTimeStamp: {5}\n" +
- " TimeStamp: {6,-27} TimeStamp100nSec: {7}\n\n",
- sample.CounterType, sample.SystemFrequency, sample.BaseValue,
- sample.RawValue, sample.CounterFrequency, sample.CounterTimeStamp,
- sample.TimeStamp, sample.TimeStamp100nSec);
-}
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp
deleted file mode 100644
index 63ae0eabe00..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-ref class PerfCounterCatGetCountMod
-{
- //
-public:
- static void Main(array^ args)
- {
- String^ categoryName = "";
- String^ machineName = "";
- String^ instanceName = "";
- PerformanceCounterCategory^ pcc;
- array^ counters;
-
- // Copy the supplied arguments into the local variables.
- try
- {
- categoryName = args[1];
- machineName = args[2]=="."? "": args[2];
- instanceName = args[3];
- }
- catch (...)
- {
- // Ignore the exception from non-supplied arguments.
- }
-
- try
- {
- // Create the appropriate PerformanceCounterCategory object.
- if (machineName->Length>0)
- {
- pcc = gcnew PerformanceCounterCategory(categoryName, machineName);
- }
- else
- {
- pcc = gcnew PerformanceCounterCategory(categoryName);
- }
-
- // Get the counters for this instance or a single instance
- // of the selected category.
- if (instanceName->Length > 0)
- {
- counters = pcc->GetCounters(instanceName);
- }
- else
- {
- counters = pcc->GetCounters();
- }
-
- }
- catch (Exception^ ex)
- {
- Console::WriteLine("Unable to get counter information for " +
- (instanceName->Length>0? "instance \"{2}\" in ": "single-instance ") +
- "category \"{0}\" on " + (machineName->Length>0? "computer \"{1}\":": "this computer:"),
- categoryName, machineName, instanceName);
- Console::WriteLine(ex->Message);
- return;
- }
-
- // Display the counter names if GetCounters was successful.
- if (counters != nullptr)
- {
- Console::WriteLine("These counters exist in " +
- (instanceName->Length > 0 ? "instance \"{1}\" of" : "single instance") +
- " category {0} on " + (machineName->Length > 0 ? "computer \"{2}\":": "this computer:"),
- categoryName, instanceName, machineName);
-
- // Display a numbered list of the counter names.
- int objX;
- for(objX = 0; objX < counters->Length; objX++)
- {
- Console::WriteLine("{0,4} - {1}", objX + 1, counters[objX]->CounterName);
- }
- }
- }
- //
-};
-
-int main()
-{
- PerfCounterCatGetCountMod::Main(Environment::GetCommandLineArgs());
-}
-//
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp
deleted file mode 100644
index 3a2934fc5ec..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-ref class PerfCounterCatGetInstMod
-{
- //
-public:
- static void Main(array^ args)
- {
- String^ categoryName = "";
- String^ machineName = "";
- PerformanceCounterCategory^ pcc;
- array^ instances;
-
- // Copy the supplied arguments into the local variables.
- try
- {
- categoryName = args[1];
- machineName = args[2]=="."? "": args[2];
- }
- catch (...)
- {
- // Ignore the exception from non-supplied arguments.
- }
-
- try
- {
- // Create the appropriate PerformanceCounterCategory object.
- if (machineName->Length > 0)
- {
- pcc = gcnew PerformanceCounterCategory(categoryName, machineName);
- }
- else
- {
- pcc = gcnew PerformanceCounterCategory(categoryName);
- }
-
- // Get the instances associated with this category.
- instances = pcc->GetInstanceNames();
-
- }
- catch (Exception^ ex)
- {
- Console::WriteLine("Unable to get instance information for " +
- "category \"{0}\" on " +
- (machineName->Length>0? "computer \"{1}\":": "this computer:"),
- categoryName, machineName);
- Console::WriteLine(ex->Message);
- return;
- }
-
- //If an empty array is returned, the category has a single instance.
- if (instances->Length==0)
- {
- Console::WriteLine("Category \"{0}\" on " +
- (machineName->Length>0? "computer \"{1}\"": "this computer") +
- " is single-instance.", pcc->CategoryName, pcc->MachineName);
- }
- else
- {
- // Otherwise, display the instances.
- Console::WriteLine("These instances exist in category \"{0}\" on " +
- (machineName->Length>0? "computer \"{1}\".": "this computer:"),
- pcc->CategoryName, pcc->MachineName);
-
- Array::Sort(instances);
- int objX;
- for (objX = 0; objX < instances->Length; objX++)
- {
- Console::WriteLine("{0,4} - {1}", objX+1, instances[objX]);
- }
- }
- }
- //
-};
-
-int main()
-{
- PerfCounterCatGetInstMod::Main(Environment::GetCommandLineArgs());
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp
deleted file mode 100644
index 598438b1a46..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-ref class PerfCounterCatGetCatMod
-{
- //
-public:
- static void Main(array^ args)
- {
- String^ machineName = "";
- array^ categories;
-
- // Copy the machine name argument into the local variable.
- try
- {
- machineName = args[1]=="."? "": args[1];
- }
- catch (...)
- {
- }
-
- // Generate a list of categories registered on the specified computer.
- try
- {
- if (machineName->Length > 0)
- {
- categories = PerformanceCounterCategory::GetCategories(machineName);
- }
- else
- {
- categories = PerformanceCounterCategory::GetCategories();
- }
- }
- catch(Exception^ ex)
- {
- Console::WriteLine("Unable to get categories on " +
- (machineName->Length > 0 ? "computer \"{0}\":": "this computer:"), machineName);
- Console::WriteLine(ex->Message);
- return;
- }
-
- Console::WriteLine("These categories are registered on " +
- (machineName->Length > 0 ? "computer \"{0}\":": "this computer:"), machineName);
-
- // Create and sort an array of category names.
- array^ categoryNames = gcnew array(categories->Length);
- int objX;
- for (objX = 0; objX < categories->Length; objX++)
- {
- categoryNames[objX] = categories[objX]->CategoryName;
- }
- Array::Sort(categoryNames);
-
- for (objX = 0; objX < categories->Length; objX++)
- {
- Console::WriteLine("{0,4} - {1}", objX + 1, categoryNames[objX]);
- }
- }
- //
-};
-
-int main()
-{
- PerfCounterCatGetCatMod::Main(Environment::GetCommandLineArgs());
-}
-//
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp
deleted file mode 100644
index 43756bed5b8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-/////////////////////////////////////////////////////////////////////////////////
-//
-// NAME TraceSource2.cpp : main project file
-//
-/////////////////////////////////////////////////////////////////////////////////
-
-
-
-// The following configuration file can be used with this sample.
-// When using a configuration file #define ConfigFile.
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-
-#define TRACE
-//#define ConfigFile
-
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Diagnostics;
-using namespace System::Reflection;
-using namespace System::IO;
-using namespace System::Security::Permissions;
-
-void DisplayProperties(TraceSource^ ts); // Forward Declaration
-
-
-int main()
-{
- TraceSource^ ts = gcnew TraceSource("TraceTest");
-
- try
- {
- // Initialize trace switches.
-#if(!ConfigFile)
- SourceSwitch^ sourceSwitch = gcnew SourceSwitch("SourceSwitch", "Verbose");
- ts->Switch = sourceSwitch;
- int idxConsole = ts->Listeners->Add(gcnew System::Diagnostics::ConsoleTraceListener());
- ts->Listeners[idxConsole]->Name = "console";
-#endif
- DisplayProperties(ts);
- ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::Callstack;
- ts->TraceEvent(TraceEventType::Warning, 1);
- ts->Listeners["console"]->TraceOutputOptions = TraceOptions::DateTime;
- // Issue file not found message as a warning.
- ts->TraceEvent(TraceEventType::Warning, 2, "File Test not found");
- // Issue file not found message as a verbose event using a formatted string.
- ts->TraceEvent(TraceEventType::Verbose, 3, "File {0} not found.", "test");
- // Issue file not found message as information.
- ts->TraceInformation("File {0} not found.", "test");
- ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::LogicalOperationStack;
- // Issue file not found message as an error event.
- ts->TraceEvent(TraceEventType::Error, 4, "File {0} not found.", "test");
-
- // Test the filter on the ConsoleTraceListener.
- ts->Listeners["console"]->Filter = gcnew SourceFilter("No match");
- ts->TraceData(TraceEventType::Error, 5,
- "SourceFilter should reject this message for the console trace listener.");
- ts->Listeners["console"]->Filter = gcnew SourceFilter("TraceTest");
- ts->TraceData(TraceEventType::Error, 6,
- "SourceFilter should let this message through on the console trace listener.");
- ts->Listeners["console"]->Filter = nullptr;
-
- // Use the TraceData method.
- ts->TraceData(TraceEventType::Warning, 7, gcnew array{ "Message 1", "Message 2" });
-
- // Activity tests.
- ts->TraceEvent(TraceEventType::Start, 9, "Will not appear until the switch is changed.");
- ts->Switch->Level = SourceLevels::ActivityTracing | SourceLevels::Critical;
- ts->TraceEvent(TraceEventType::Suspend, 10, "Switch includes ActivityTracing, this should appear");
- ts->TraceEvent(TraceEventType::Critical, 11, "Switch includes Critical, this should appear");
- ts->Flush();
- ts->Close();
- Console::WriteLine("Press enter key to exit.");
- Console::Read();
- }
- catch (Exception ^e)
- {
- // Catch any unexpected exception.
- Console::WriteLine("Unexpected exception: " + e->ToString());
- Console::Read();
- }
-}
-
-
-void DisplayProperties(TraceSource^ ts)
-{
- Console::WriteLine("TraceSource name = " + ts->Name);
-// Console::WriteLine("TraceSource switch level = " + ts->Switch->Level); // error C3063: operator '+': all operands must have the same enumeration type
- Console::WriteLine("TraceSource switch level = {0}", ts->Switch->Level); // SUCCESS: does compile. Weird
- Console::WriteLine("TraceSource Attributes Count " + ts->Attributes->Count); // SUCCESS: also compiles. Really weird
- Console::WriteLine("TraceSource Attributes Count = {0}", ts->Attributes->Count); // SUCCESS: okay, I give up. Somebody call me a cab.
-
- Console::WriteLine("TraceSource switch = " + ts->Switch->DisplayName);
- array^ switches = SwitchAttribute::GetAll(TraceSource::typeid->Assembly);
-
- for (int i = 0; i < switches->Length; i++)
- {
- Console::WriteLine("Switch name = " + switches[i]->SwitchName);
- Console::WriteLine("Switch type = " + switches[i]->SwitchType);
- }
-
-#if(ConfigFile)
- // Get the custom attributes for the TraceSource.
- Console::WriteLine("Number of custom trace source attributes = "
- + ts.Attributes.Count);
- foreach (DictionaryEntry de in ts.Attributes)
- Console::WriteLine("Custom trace source attribute = "
- + de.Key + " " + de.Value);
- // Get the custom attributes for the trace source switch.
- foreach (DictionaryEntry de in ts.Switch.Attributes)
- Console::WriteLine("Custom switch attribute = "
- + de.Key + " " + de.Value);
-#endif
- Console::WriteLine("Number of listeners = " + ts->Listeners->Count);
- for each (TraceListener ^ traceListener in ts->Listeners)
- {
- Console::Write("TraceListener: " + traceListener->Name + "\t");
- // The following output can be used to update the configuration file.
- Console::WriteLine("AssemblyQualifiedName = " +
- (traceListener->GetType()->AssemblyQualifiedName));
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp
deleted file mode 100644
index 4e3179203c5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-// The following code example shows how the result of GetWeekOfYear varies depending on the
-// FirstDayOfWeek and the CalendarWeekRule used.
-// If the specified date is the last day of the year, GetWeekOfYear returns the total number of weeks in that year.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Gets the Calendar instance associated with a CultureInfo.
- CultureInfo^ myCI = gcnew CultureInfo( "en-US" );
- Calendar^ myCal = myCI->Calendar;
-
- // Gets the DTFI properties required by GetWeekOfYear.
- CalendarWeekRule myCWR = myCI->DateTimeFormat->CalendarWeekRule;
- DayOfWeek myFirstDOW = myCI->DateTimeFormat->FirstDayOfWeek;
-
- // Displays the number of the current week relative to the beginning of the year.
- Console::WriteLine( "The CalendarWeekRule used for the en-US culture is {0}.", myCWR );
- Console::WriteLine( "The FirstDayOfWeek used for the en-US culture is {0}.", myFirstDOW );
- Console::WriteLine( "Therefore, the current week is Week {0} of the current year.", myCal->GetWeekOfYear( DateTime::Now, myCWR, myFirstDOW ) );
-
- // Displays the total number of weeks in the current year.
- DateTime LastDay = System::DateTime( DateTime::Now.Year, 12, 31 );
- Console::WriteLine( "There are {0} weeks in the current year ( {1}).", myCal->GetWeekOfYear( LastDay, myCWR, myFirstDOW ), LastDay.Year );
-}
-
-/*
-This code produces the following output. Results vary depending on the system date.
-
-The CalendarWeekRule used for the en-US culture is FirstDay.
-The FirstDayOfWeek used for the en-US culture is Sunday.
-Therefore, the current week is Week 1 of the current year.
-There are 53 weeks in the current year (2001).
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp
deleted file mode 100644
index 0df7a5a06b3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-
-// The following code example demonstrates the members of the Calendar class.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine( " Hour: {0}", myCal->GetHour( myDT ) );
- Console::WriteLine( " Minute: {0}", myCal->GetMinute( myDT ) );
- Console::WriteLine( " Second: {0}", myCal->GetSecond( myDT ) );
- Console::WriteLine( " Milliseconds: {0}", myCal->GetMilliseconds( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Uses the default calendar of the InvariantCulture.
- Calendar^ myCal = CultureInfo::InvariantCulture->Calendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds 5 to every component of the DateTime.
- myDT = myCal->AddYears( myDT, 5 );
- myDT = myCal->AddMonths( myDT, 5 );
- myDT = myCal->AddWeeks( myDT, 5 );
- myDT = myCal->AddDays( myDT, 5 );
- myDT = myCal->AddHours( myDT, 5 );
- myDT = myCal->AddMinutes( myDT, 5 );
- myDT = myCal->AddSeconds( myDT, 5 );
- myDT = myCal->AddMilliseconds( myDT, 5 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding 5 to each component of the DateTime:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar:
-Era: 1
-Year: 2002
-Month: 4
-DayOfYear: 93
-DayOfMonth: 3
-DayOfWeek: Wednesday
-Hour: 0
-Minute: 0
-Second: 0
-Milliseconds: 0
-
-After adding 5 to each component of the DateTime:
-Era: 1
-Year: 2007
-Month: 10
-DayOfYear: 286
-DayOfMonth: 13
-DayOfWeek: Saturday
-Hour: 5
-Minute: 5
-Second: 5
-Milliseconds: 5
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp
deleted file mode 100644
index 865e7a9526e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-
-// The following code example compares different implementations of the Calendar class.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates an instance of every Calendar type.
- array^myCals = gcnew array(8);
- myCals[ 0 ] = gcnew GregorianCalendar;
- myCals[ 1 ] = gcnew HebrewCalendar;
- myCals[ 2 ] = gcnew HijriCalendar;
- myCals[ 3 ] = gcnew JapaneseCalendar;
- myCals[ 4 ] = gcnew JulianCalendar;
- myCals[ 5 ] = gcnew KoreanCalendar;
- myCals[ 6 ] = gcnew TaiwanCalendar;
- myCals[ 7 ] = gcnew ThaiBuddhistCalendar;
-
- // For each calendar, displays the current year, the number of months in that year,
- // and the number of days in each month of that year.
- int i;
- int j;
- int iYear;
- int iMonth;
- int iDay;
- DateTime myDT = DateTime::Today;
- for ( i = 0; i < myCals->Length; i++ )
- {
- iYear = myCals[ i ]->GetYear( myDT );
- Console::WriteLine();
- Console::WriteLine( " {0}, Year: {1}", myCals[ i ]->GetType(), myCals[ i ]->GetYear( myDT ) );
- Console::WriteLine( " MonthsInYear: {0}", myCals[ i ]->GetMonthsInYear( iYear ) );
- Console::WriteLine( " DaysInYear: {0}", myCals[ i ]->GetDaysInYear( iYear ) );
- Console::WriteLine( " Days in each month:" );
- Console::Write( " " );
- for ( j = 1; j <= myCals[ i ]->GetMonthsInYear( iYear ); j++ )
- Console::Write( " {0, -5}", myCals[ i ]->GetDaysInMonth( iYear, j ) );
- Console::WriteLine();
- iMonth = myCals[ i ]->GetMonth( myDT );
- iDay = myCals[ i ]->GetDayOfMonth( myDT );
- Console::WriteLine( " IsLeapDay: {0}", myCals[ i ]->IsLeapDay( iYear, iMonth, iDay ) );
- Console::WriteLine( " IsLeapMonth: {0}", myCals[ i ]->IsLeapMonth( iYear, iMonth ) );
- Console::WriteLine( " IsLeapYear: {0}", myCals[ i ]->IsLeapYear( iYear ) );
-
- }
-}
-
-/*
-This code produces the following output. The results vary depending on the date.
-
-System::Globalization::GregorianCalendar, Year: 2002
-MonthsInYear: 12
-DaysInYear: 365
-Days in each month:
-31 28 31 30 31 30 31 31 30 31 30 31
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: False
-
-System::Globalization::HebrewCalendar, Year: 5763
-MonthsInYear: 13
-DaysInYear: 385
-Days in each month:
-30 30 30 29 30 30 29 30 29 30 29 30 29
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: True
-
-System::Globalization::HijriCalendar, Year: 1423
-MonthsInYear: 12
-DaysInYear: 355
-Days in each month:
-30 29 30 29 30 29 30 29 30 29 30 30
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: True
-
-System::Globalization::JapaneseCalendar, Year: 14
-MonthsInYear: 12
-DaysInYear: 365
-Days in each month:
-31 28 31 30 31 30 31 31 30 31 30 31
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: False
-
-System::Globalization::JulianCalendar, Year: 2002
-MonthsInYear: 12
-DaysInYear: 365
-Days in each month:
-31 28 31 30 31 30 31 31 30 31 30 31
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: False
-
-System::Globalization::KoreanCalendar, Year: 4335
-MonthsInYear: 12
-DaysInYear: 365
-Days in each month:
-31 28 31 30 31 30 31 31 30 31 30 31
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: False
-
-System::Globalization::TaiwanCalendar, Year: 91
-MonthsInYear: 12
-DaysInYear: 365
-Days in each month:
-31 28 31 30 31 30 31 31 30 31 30 31
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: False
-
-System::Globalization::ThaiBuddhistCalendar, Year: 2545
-MonthsInYear: 12
-DaysInYear: 365
-Days in each month:
-31 28 31 30 31 30 31 31 30 31 30 31
-IsLeapDay: False
-IsLeapMonth: False
-IsLeapYear: False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp
deleted file mode 100644
index 868fb637de7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-// The following code example shows the values returned by each method for different types of characters.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintProperties( Char c );
-int main()
-{
- Console::WriteLine( " c Num Dig Dec UnicodeCategory" );
- Console::Write( "U+0061 LATIN SMALL LETTER A " );
- PrintProperties( L'a' );
- Console::Write( "U+0393 GREEK CAPITAL LETTER GAMMA " );
- PrintProperties( L'\u0393' );
- Console::Write( "U+0039 DIGIT NINE " );
- PrintProperties( L'9' );
- Console::Write( "U+00B2 SUPERSCRIPT TWO " );
- PrintProperties( L'\u00B2' );
- Console::Write( "U+00BC VULGAR FRACTION ONE QUARTER " );
- PrintProperties( L'\u00BC' );
- Console::Write( "U+0BEF TAMIL DIGIT NINE " );
- PrintProperties( L'\u0BEF' );
- Console::Write( "U+0BF0 TAMIL NUMBER TEN " );
- PrintProperties( L'\u0BF0' );
- Console::Write( "U+0F33 TIBETAN DIGIT HALF ZERO " );
- PrintProperties( L'\u0F33' );
- Console::Write( "U+2788 CIRCLED SANS-SERIF DIGIT NINE " );
- PrintProperties( L'\u2788' );
-}
-
-void PrintProperties( Char c )
-{
- Console::Write( " {0,-3}", c );
- Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( c ) );
- Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( c ) );
- Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( c ) );
- Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( c ) );
-}
-
-/*
-This code produces the following output. Some characters might not display at the console.
-
- c Num Dig Dec UnicodeCategory
-U+0061 LATIN SMALL LETTER A a -1 -1 -1 LowercaseLetter
-U+0393 GREEK CAPITAL LETTER GAMMA Γ -1 -1 -1 UppercaseLetter
-U+0039 DIGIT NINE 9 9 9 9 DecimalDigitNumber
-U+00B2 SUPERSCRIPT TWO ² 2 2 -1 OtherNumber
-U+00BC VULGAR FRACTION ONE QUARTER ¼ 0.25 -1 -1 OtherNumber
-U+0BEF TAMIL DIGIT NINE ௯ 9 9 9 DecimalDigitNumber
-U+0BF0 TAMIL NUMBER TEN ௰ 10 -1 -1 OtherNumber
-U+0F33 TIBETAN DIGIT HALF ZERO ༳ -0.5 -1 -1 OtherNumber
-U+2788 CIRCLED SANS-SERIF DIGIT NINE ➈ 9 9 -1 OtherNumber
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp
deleted file mode 100644
index 1ff91fb5a7e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-// The following code example shows the values returned by each method for different types of characters.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // The String to get information for.
- String^ s = "a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788";
- Console::WriteLine( "String: {0}", s );
-
- // Print the values for each of the characters in the string.
- Console::WriteLine( "index c Num Dig Dec UnicodeCategory" );
- for ( int i = 0; i < s->Length; i++ )
- {
- Console::Write( "{0,-5} {1,-3}", i, s[ i ] );
- Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( s, i ) );
- Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( s, i ) );
- Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( s, i ) );
- Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( s, i ) );
-
- }
-}
-
-/*
-This code produces the following output. Some characters might not display at the console.
-
-String: a9Γ²¼௯௰➈
-index c Num Dig Dec UnicodeCategory
-0 a -1 -1 -1 LowercaseLetter
-1 9 9 9 9 DecimalDigitNumber
-2 Γ -1 -1 -1 UppercaseLetter
-3 ² 2 2 -1 OtherNumber
-4 ¼ 0.25 -1 -1 OtherNumber
-5 ௯ 9 9 9 DecimalDigitNumber
-6 ௰ 10 -1 -1 OtherNumber
-7 ➈ 9 9 -1 OtherNumber
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp
deleted file mode 100644
index 96de17a4d52..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-// The following code example compares portions of two strings using the different CompareInfo instances:
-// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort,
-// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and
-// a CompareInfo instance associated with the InvariantCulture.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "calle";
- String^ myStr2 = "calor";
-
- // Uses GetCompareInfo to create the CompareInfo that uses the S"es-ES" culture with international sort.
- CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" );
-
- // Uses GetCompareInfo to create the CompareInfo that uses the S"es-ES" culture with traditional sort.
- CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A );
-
- // Uses the CompareInfo property of the InvariantCulture.
- CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo;
-
- // Compares two strings using myCompIntl.
- Console::WriteLine( "Comparing \" {0}\" and \" {1}\"", myStr1->Substring( 2, 2 ), myStr2->Substring( 2, 2 ) );
- Console::WriteLine( " With myCompIntl->Compare: {0}", myCompIntl->Compare( myStr1, 2, 2, myStr2, 2, 2 ) );
- Console::WriteLine( " With myCompTrad->Compare: {0}", myCompTrad->Compare( myStr1, 2, 2, myStr2, 2, 2 ) );
- Console::WriteLine( " With myCompInva->Compare: {0}", myCompInva->Compare( myStr1, 2, 2, myStr2, 2, 2 ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing S"ll" and S"lo"
-With myCompIntl.Compare: -1
-With myCompTrad.Compare: 1
-With myCompInva.Compare: -1
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp
deleted file mode 100644
index 4c7273f97da..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-// The following code example compares portions of two strings using different CompareOptions settings.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "My Uncle Bill's clients";
- String^ myStr2 = "My uncle bills clients";
-
- // Creates a CompareInfo that uses the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
-
- // Compares two strings using myComp.
- Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 3, 10 ), myStr2->Substring( 3, 10 ) );
- Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10 ) );
- Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::None ) );
- Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::Ordinal ) );
- Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::StringSort ) );
- Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::IgnoreCase ) );
- Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::IgnoreSymbols ) );
- Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing "Uncle Bill" and "uncle bill"
- With no CompareOptions : 1
- With None : 1
- With Ordinal : -32
- With StringSort : 1
- With IgnoreCase : 0
- With IgnoreSymbols : 1
- With IgnoreCase and IgnoreSymbols : 0
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp
deleted file mode 100644
index 678b54b5912..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-// The following code example compares portions of two strings using the different CompareInfo instances:
-// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort,
-// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and
-// a CompareInfo instance associated with the InvariantCulture.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "calle";
- String^ myStr2 = "calor";
-
- // Uses GetCompareInfo to create the CompareInfo that
- // uses the S"es-ES" culture with international sort.
- CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" );
-
- // Uses GetCompareInfo to create the CompareInfo that
- // uses the S"es-ES" culture with traditional sort.
- CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A );
-
- // Uses the CompareInfo property of the InvariantCulture.
- CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo;
-
- // Compares two strings using myCompIntl.
- Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 2 ), myStr2->Substring( 2 ) );
- Console::WriteLine( " With myCompIntl::Compare: {0}", myCompIntl->Compare( myStr1, 2, myStr2, 2 ) );
- Console::WriteLine( " With myCompTrad::Compare: {0}", myCompTrad->Compare( myStr1, 2, myStr2, 2 ) );
- Console::WriteLine( " With myCompInva::Compare: {0}", myCompInva->Compare( myStr1, 2, myStr2, 2 ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing "lle" and "lor"
- With myCompIntl::Compare: -1
- With myCompTrad::Compare: 1
- With myCompInva::Compare: -1
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp
deleted file mode 100644
index b180520da7d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-// The following code example compares portions of two strings using different CompareOptions settings.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "My Uncle Bill's clients";
- String^ myStr2 = "My uncle bills clients";
-
- // Creates a CompareInfo that uses the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
-
- // Compares two strings using myComp.
- Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 10 ), myStr2->Substring( 10 ) );
- Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, 10, myStr2, 10 ) );
- Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::None ) );
- Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::Ordinal ) );
- Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::StringSort ) );
- Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::IgnoreCase ) );
- Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::IgnoreSymbols ) );
- Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, 10, myStr2, 10, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing "ill's clients" and "ills clients"
- With no CompareOptions : 1
- With None : 1
- With Ordinal : -76
- With StringSort : -1
- With IgnoreCase : 1
- With IgnoreSymbols : 0
- With IgnoreCase and IgnoreSymbols : 0
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp
deleted file mode 100644
index f479b4c5433..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// The following code example compares two strings using the different CompareInfo instances:
-// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort,
-// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and
-// a CompareInfo instance associated with the InvariantCulture.
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "calle";
- String^ myStr2 = "calor";
-
- // Uses GetCompareInfo to create the CompareInfo that
- // uses the S"es-ES" culture with international sort.
- CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" );
-
- // Uses GetCompareInfo to create the CompareInfo that
- // uses the S"es-ES" culture with traditional sort.
- CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A );
-
- // Uses the CompareInfo property of the InvariantCulture.
- CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo;
-
- // Compares two strings using myCompIntl.
- Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 );
- Console::WriteLine( " With myCompIntl::Compare: {0}", myCompIntl->Compare( myStr1, myStr2 ) );
- Console::WriteLine( " With myCompTrad::Compare: {0}", myCompTrad->Compare( myStr1, myStr2 ) );
- Console::WriteLine( " With myCompInva::Compare: {0}", myCompInva->Compare( myStr1, myStr2 ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing "calle" and "calor"
- With myCompIntl::Compare: -1
- With myCompTrad::Compare: 1
- With myCompInva::Compare: -1
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp
deleted file mode 100644
index 2e1193e0288..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-// The following code example compares two strings using different CompareOptions settings.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "My Uncle Bill's clients";
- String^ myStr2 = "My uncle bills clients";
-
- // Creates a CompareInfo which uses the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
-
- // Compares two strings using myComp.
- Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 );
- Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, myStr2 ) );
- Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::None ) );
- Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::Ordinal ) );
- Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::StringSort ) );
- Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::IgnoreCase ) );
- Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::IgnoreSymbols ) );
- Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, myStr2, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing "My Uncle Bill's clients" and "My uncle bills clients"
- With no CompareOptions : 1
- With None : 1
- With Ordinal : -32
- With StringSort : -1
- With IgnoreCase : 1
- With IgnoreSymbols : 1
- With IgnoreCase and IgnoreSymbols : 0
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp
deleted file mode 100644
index b82a9f2e5ef..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-
-// The following code example determines the indexes of the first and last occurrences of a character or a substring within a string.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintMarker( String^ Prefix, int First, int Last )
-{
-
- // Determines the size of the array to create.
- int mySize;
- if ( Last > First )
- mySize = Last;
- else
- mySize = First;
-
- if ( mySize > -1 )
- {
-
- // Creates an array of Char to hold the markers.
- array^myCharArr = gcnew array(mySize + 1);
-
- // Inserts the appropriate markers.
- if ( First > -1 )
- myCharArr[ First ] = 'f';
- if ( Last > -1 )
- myCharArr[ Last ] = 'l';
- if ( First == Last )
- myCharArr[ First ] = 'b';
-
- // Displays the array of Char as a String.
- Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) );
- }
- else
- Console::WriteLine( Prefix );
-}
-
-int main()
-{
-
- // Creates CompareInfo for the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
-
- // Searches for the ligature Æ.
- String^ myStr = "Is AE or ae the same as Æ or æ?";
- Console::WriteLine();
- Console::WriteLine( "No options : {0}", myStr );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE" ), myComp->LastIndexOf( myStr, "AE" ) );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae" ), myComp->LastIndexOf( myStr, "ae" ) );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ' ), myComp->LastIndexOf( myStr, L'Æ' ) );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ' ), myComp->LastIndexOf( myStr, L'æ' ) );
- Console::WriteLine( "Ordinal : {0}", myStr );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "AE", CompareOptions::Ordinal ) );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "ae", CompareOptions::Ordinal ) );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Æ', CompareOptions::Ordinal ) );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'æ', CompareOptions::Ordinal ) );
- Console::WriteLine( "IgnoreCase : {0}", myStr );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "AE", CompareOptions::IgnoreCase ) );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "ae", CompareOptions::IgnoreCase ) );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Æ', CompareOptions::IgnoreCase ) );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'æ', CompareOptions::IgnoreCase ) );
-
- // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis.
- myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?";
- Console::WriteLine();
- Console::WriteLine( "No options : {0}", myStr );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308" ), myComp->LastIndexOf( myStr, "U\u0308" ) );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308" ), myComp->LastIndexOf( myStr, "u\u0308" ) );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü' ), myComp->LastIndexOf( myStr, L'Ü' ) );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü' ), myComp->LastIndexOf( myStr, L'ü' ) );
- Console::WriteLine( "Ordinal : {0}", myStr );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "U\u0308", CompareOptions::Ordinal ) );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "u\u0308", CompareOptions::Ordinal ) );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Ü', CompareOptions::Ordinal ) );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'ü', CompareOptions::Ordinal ) );
- Console::WriteLine( "IgnoreCase : {0}", myStr );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "U\u0308", CompareOptions::IgnoreCase ) );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "u\u0308", CompareOptions::IgnoreCase ) );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Ü', CompareOptions::IgnoreCase ) );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'ü', CompareOptions::IgnoreCase ) );
-}
-
-/*
-This code produces the following output.
-
-No options : Is AE or ae the same as Æ or æ?
- AE : f l
- ae : f l
- Æ : f l
- æ : f l
-Ordinal : Is AE or ae the same as Æ or æ?
- AE : b
- ae : b
- Æ : b
- æ : b
-IgnoreCase : Is AE or ae the same as Æ or æ?
- AE : f l
- ae : f l
- Æ : f l
- æ : f l
-
-No options : Is U" or u" the same as Ü or ü?
- U" : f l
- u" : f l
- Ü : f l
- ü : f l
-Ordinal : Is U" or u" the same as Ü or ü?
- U" : b
- u" : b
- Ü : b
- ü : b
-IgnoreCase : Is U" or u" the same as Ü or ü?
- U" : f l
- u" : f l
- Ü : f l
- ü : f l
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp
deleted file mode 100644
index f5d3d8ae905..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-
-// The following code example determines the indexes of the first and last occurrences of a character or a substring within a portion of a string.
-// Note that IndexOf and LastIndexOf are searching in different portions of the string, even with the same StartIndex parameter.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintMarker( String^ Prefix, int First, int Last )
-{
-
- // Determines the size of the array to create.
- int mySize;
- if ( Last > First )
- mySize = Last;
- else
- mySize = First;
-
- if ( mySize > -1 )
- {
-
- // Creates an array of Char to hold the markers.
- array^myCharArr = gcnew array(mySize + 1);
-
- // Inserts the appropriate markers.
- if ( First > -1 )
- myCharArr[ First ] = 'f';
- if ( Last > -1 )
- myCharArr[ Last ] = 'l';
- if ( First == Last )
- myCharArr[ First ] = 'b';
-
- // Displays the array of Char as a String.
- Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) );
- }
- else
- Console::WriteLine( Prefix );
-}
-
-int main()
-{
-
- // Creates CompareInfo for the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
-
- // iS is the starting index of the substring.
- int iS = 20;
-
- // myT1 is the string used for padding.
- String^ myT1;
-
- // Searches for the ligature Æ.
- String^ myStr = "Is AE or ae the same as Æ or æ?";
- Console::WriteLine();
- myT1 = gcnew String( '-',iS );
- Console::WriteLine( "IndexOf( String, *, {0}, * )", iS );
- Console::WriteLine( "Original : {0}", myStr );
- Console::WriteLine( "No options : {0}{1}", myT1, myStr->Substring( iS ) );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS ), -1 );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS ), -1 );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS ), -1 );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS ), -1 );
- Console::WriteLine( "Ordinal : {0}{1}", myT1, myStr->Substring( iS ) );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, CompareOptions::Ordinal ), -1 );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, CompareOptions::Ordinal ), -1 );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, CompareOptions::Ordinal ), -1 );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, CompareOptions::Ordinal ), -1 );
- Console::WriteLine( "IgnoreCase : {0}{1}", myT1, myStr->Substring( iS ) );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, CompareOptions::IgnoreCase ), -1 );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, CompareOptions::IgnoreCase ), -1 );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, CompareOptions::IgnoreCase ), -1 );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, CompareOptions::IgnoreCase ), -1 );
- myT1 = gcnew String( '-',myStr->Length - iS - 1 );
- Console::WriteLine( "LastIndexOf( String, *, {0}, * )", iS );
- Console::WriteLine( "Original : {0}", myStr );
- Console::WriteLine( "No options : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 );
- PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS ) );
- PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS ) );
- PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS ) );
- PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS ) );
- Console::WriteLine( "Ordinal : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 );
- PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS, CompareOptions::Ordinal ) );
- PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS, CompareOptions::Ordinal ) );
- PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS, CompareOptions::Ordinal ) );
- PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS, CompareOptions::Ordinal ) );
- Console::WriteLine( "IgnoreCase : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 );
- PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS, CompareOptions::IgnoreCase ) );
- PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS, CompareOptions::IgnoreCase ) );
- PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS, CompareOptions::IgnoreCase ) );
- PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS, CompareOptions::IgnoreCase ) );
-
- // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis.
- myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?";
- Console::WriteLine();
- myT1 = gcnew String( '-',iS );
- Console::WriteLine( "IndexOf( String, *, {0}, * )", iS );
- Console::WriteLine( "Original : {0}", myStr );
- Console::WriteLine( "No options : {0}{1}", myT1, myStr->Substring( iS ) );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS ), -1 );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS ), -1 );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS ), -1 );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS ), -1 );
- Console::WriteLine( "Ordinal : {0}{1}", myT1, myStr->Substring( iS ) );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, CompareOptions::Ordinal ), -1 );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, CompareOptions::Ordinal ), -1 );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, CompareOptions::Ordinal ), -1 );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, CompareOptions::Ordinal ), -1 );
- Console::WriteLine( "IgnoreCase : {0}{1}", myT1, myStr->Substring( iS ) );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, CompareOptions::IgnoreCase ), -1 );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, CompareOptions::IgnoreCase ), -1 );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, CompareOptions::IgnoreCase ), -1 );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, CompareOptions::IgnoreCase ), -1 );
- myT1 = gcnew String( '-',myStr->Length - iS - 1 );
- Console::WriteLine( "LastIndexOf( String, *, {0}, * )", iS );
- Console::WriteLine( "Original : {0}", myStr );
- Console::WriteLine( "No options : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 );
- PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS ) );
- PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS ) );
- PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS ) );
- PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS ) );
- Console::WriteLine( "Ordinal : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 );
- PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS, CompareOptions::Ordinal ) );
- PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS, CompareOptions::Ordinal ) );
- PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS, CompareOptions::Ordinal ) );
- PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS, CompareOptions::Ordinal ) );
- Console::WriteLine( "IgnoreCase : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 );
- PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS, CompareOptions::IgnoreCase ) );
- PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS, CompareOptions::IgnoreCase ) );
- PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS, CompareOptions::IgnoreCase ) );
- PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS, CompareOptions::IgnoreCase ) );
-}
-
-/*
-This code produces the following output.
-
-IndexOf( String, *, 20, * )
-Original : Is AE or ae the same as Æ or æ?
-No options : -------------------- as Æ or æ?
- AE : f
- ae : f
- Æ : f
- æ : f
-Ordinal : -------------------- as Æ or æ?
- AE :
- ae :
- Æ : f
- æ : f
-IgnoreCase : -------------------- as Æ or æ?
- AE : f
- ae : f
- Æ : f
- æ : f
-LastIndexOf( String, *, 20, * )
-Original : Is AE or ae the same as Æ or æ?
-No options : Is AE or ae the same ----------
- AE : l
- ae : l
- Æ : l
- æ : l
-Ordinal : Is AE or ae the same ----------
- AE : l
- ae : l
- Æ :
- æ :
-IgnoreCase : Is AE or ae the same ----------
- AE : l
- ae : l
- Æ : l
- æ : l
-
-IndexOf( String, *, 20, * )
-Original : Is U" or u" the same as Ü or ü?
-No options : -------------------- as Ü or ü?
- U" : f
- u" : f
- Ü : f
- ü : f
-Ordinal : -------------------- as Ü or ü?
- U" :
- u" :
- Ü : f
- ü : f
-IgnoreCase : -------------------- as Ü or ü?
- U" : f
- u" : f
- Ü : f
- ü : f
-LastIndexOf( String, *, 20, * )
-Original : Is U" or u" the same as Ü or ü?
-No options : Is U" or u" the same ----------
- U" : l
- u" : l
- Ü : l
- ü : l
-Ordinal : Is U" or u" the same ----------
- U" : l
- u" : l
- Ü :
- ü :
-IgnoreCase : Is U" or u" the same ----------
- U" : l
- u" : l
- Ü : l
- ü : l
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp
deleted file mode 100644
index 381970926e1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-
-// The following code example determines the indexes of the first and last occurrences of a character or a substring within a portion of a string.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintMarker( String^ Prefix, int First, int Last )
-{
-
- // Determines the size of the array to create.
- int mySize;
- if ( Last > First )
- mySize = Last;
- else
- mySize = First;
-
- if ( mySize > -1 )
- {
-
- // Creates an array of Char to hold the markers.
- array^myCharArr = gcnew array(mySize + 1);
-
- // Inserts the appropriate markers.
- if ( First > -1 )
- myCharArr[ First ] = 'f';
- if ( Last > -1 )
- myCharArr[ Last ] = 'l';
- if ( First == Last )
- myCharArr[ First ] = 'b';
-
- // Displays the array of Char as a String.
- Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) );
- }
- else
- Console::WriteLine( Prefix );
-}
-
-int main()
-{
-
- // Creates CompareInfo for the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
-
- // iS is the starting index of the substring.
- int iS = 8;
-
- // iL is the length of the substring.
- int iL = 18;
-
- // myT1 and myT2 are the strings used for padding.
- String^ myT1 = gcnew String( '-',iS );
- String^ myT2;
-
- // Searches for the ligature Æ.
- String^ myStr = "Is AE or ae the same as Æ or æ?";
- myT2 = gcnew String( '-',myStr->Length - iS - iL );
- Console::WriteLine();
- Console::WriteLine( "Original : {0}", myStr );
- Console::WriteLine( "No options : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL ) );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL ) );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL ) );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL ) );
- Console::WriteLine( "Ordinal : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL, CompareOptions::Ordinal ) );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL, CompareOptions::Ordinal ) );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL, CompareOptions::Ordinal ) );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL, CompareOptions::Ordinal ) );
- Console::WriteLine( "IgnoreCase : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 );
- PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
- PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
- PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
- PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
-
- // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis.
- myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?";
- myT2 = gcnew String( '-',myStr->Length - iS - iL );
- Console::WriteLine();
- Console::WriteLine( "Original : {0}", myStr );
- Console::WriteLine( "No options : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL ) );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL ) );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL ) );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL ) );
- Console::WriteLine( "Ordinal : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL, CompareOptions::Ordinal ) );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL, CompareOptions::Ordinal ) );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL, CompareOptions::Ordinal ) );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL, CompareOptions::Ordinal ) );
- Console::WriteLine( "IgnoreCase : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 );
- PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
- PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
- PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
- PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL, CompareOptions::IgnoreCase ) );
-}
-
-/*
-This code produces the following output.
-
-Original : Is AE or ae the same as Æ or æ?
-No options : -------- ae the same as Æ -----
- AE : b
- ae : b
- Æ : b
- æ : b
-Ordinal : -------- ae the same as Æ -----
- AE :
- ae : b
- Æ : b
- æ :
-IgnoreCase : -------- ae the same as Æ -----
- AE : f l
- ae : f l
- Æ : f l
- æ : f l
-
-Original : Is U" or u" the same as Ü or ü?
-No options : -------- u" the same as Ü -----
- U" : b
- u" : b
- Ü : b
- ü : b
-Ordinal : -------- u" the same as Ü -----
- U" :
- u" : b
- Ü : b
- ü :
-IgnoreCase : -------- u" the same as Ü -----
- U" : f l
- u" : f l
- Ü : f l
- ü : f l
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp
deleted file mode 100644
index 67bd06172ff..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-// The following code example determines whether a String* is the prefix or suffix of another String*.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "calle";
- String^ myStr2 = "llegar";
- String^ myXfix = "lle";
-
- // Uses the CompareInfo property of the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
-
- // Determines whether myXfix is a prefix of S"calle" and S"llegar".
- Console::WriteLine( "IsPrefix( {0}, {1}) : {2}", myStr1, myXfix, myComp->IsPrefix( myStr1, myXfix ) );
- Console::WriteLine( "IsPrefix( {0}, {1}) : {2}", myStr2, myXfix, myComp->IsPrefix( myStr2, myXfix ) );
-
- // Determines whether myXfix is a suffix of S"calle" and S"llegar".
- Console::WriteLine( "IsSuffix( {0}, {1}) : {2}", myStr1, myXfix, myComp->IsSuffix( myStr1, myXfix ) );
- Console::WriteLine( "IsSuffix( {0}, {1}) : {2}", myStr2, myXfix, myComp->IsSuffix( myStr2, myXfix ) );
-}
-
-/*
-This code produces the following output.
-
-IsPrefix(calle, lle) : False
-IsPrefix(llegar, lle) : True
-IsSuffix(calle, lle) : True
-IsSuffix(llegar, lle) : False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp
deleted file mode 100644
index 4873c4342d0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-// The following code example determines whether a String* is the prefix or suffix of another String* using CompareOptions.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the strings to compare.
- String^ myStr1 = "calle";
- String^ myStr2 = "llegar";
- String^ myXfix = "LLE";
-
- // Uses the CompareInfo property of the InvariantCulture.
- CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo;
- Console::WriteLine( "IsSuffix \"{0}\", \"{1}\"", myStr1, myXfix );
- Console::WriteLine( " With no CompareOptions : {0}", myComp->IsSuffix( myStr1, myXfix ) );
- Console::WriteLine( " With None : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::None ) );
- Console::WriteLine( " With Ordinal : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::Ordinal ) );
- Console::WriteLine( " With IgnoreCase : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::IgnoreCase ) );
- Console::WriteLine( "IsPrefix \"{0}\", \"{1}\"", myStr2, myXfix );
- Console::WriteLine( " With no CompareOptions : {0}", myComp->IsPrefix( myStr2, myXfix ) );
- Console::WriteLine( " With None : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::None ) );
- Console::WriteLine( " With Ordinal : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::Ordinal ) );
- Console::WriteLine( " With IgnoreCase : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::IgnoreCase ) );
-}
-
-/*
-This code produces the following output.
-
-IsSuffix "calle", "LLE"
- With no CompareOptions : False
- With None : False
- With Ordinal : False
- With IgnoreCase : True
-IsPrefix "llegar", "LLE"
- With no CompareOptions : False
- With None : False
- With Ordinal : False
- With IgnoreCase : True
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp
deleted file mode 100644
index 36c0e20d3fc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-// The following code example shows that CultureInfo::Clone also clones the DateTimeFormatInfo and
-// NumberFormatInfo instances associated with the CultureInfo.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a CultureInfo.
- CultureInfo^ myCI = gcnew CultureInfo( "en-US",false );
-
- // Clones myCI and modifies the DTFI and NFI instances associated with the clone.
- CultureInfo^ myCIclone = dynamic_cast(myCI->Clone());
- myCIclone->DateTimeFormat->AMDesignator = "a.m.";
- myCIclone->DateTimeFormat->DateSeparator = "-";
- myCIclone->NumberFormat->CurrencySymbol = "USD";
- myCIclone->NumberFormat->NumberDecimalDigits = 4;
-
- // Displays the properties of the DTFI and NFI instances associated with the original and with the clone.
- Console::WriteLine( "DTFI/NFI PROPERTY\tORIGINAL\tMODIFIED CLONE" );
- Console::WriteLine( "DTFI.AMDesignator\t{0}\t\t{1}", myCI->DateTimeFormat->AMDesignator, myCIclone->DateTimeFormat->AMDesignator );
- Console::WriteLine( "DTFI.DateSeparator\t{0}\t\t{1}", myCI->DateTimeFormat->DateSeparator, myCIclone->DateTimeFormat->DateSeparator );
- Console::WriteLine( "NFI.CurrencySymbol\t{0}\t\t{1}", myCI->NumberFormat->CurrencySymbol, myCIclone->NumberFormat->CurrencySymbol );
- Console::WriteLine( "NFI.NumberDecimalDigits\t{0}\t\t{1}", myCI->NumberFormat->NumberDecimalDigits, myCIclone->NumberFormat->NumberDecimalDigits );
-}
-
-/*
-This code produces the following output.
-
-DTFI/NFI PROPERTY ORIGINAL MODIFIED CLONE
-DTFI.AMDesignator AM a.m.
-DTFI.DateSeparator / -
-NFI.CurrencySymbol $ USD
-NFI.NumberDecimalDigits 2 4
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp
deleted file mode 100644
index 39d0500f201..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Globalization;
-using namespace System::Threading;
-
-int main()
-{
- // Display the name of the current thread culture.
- Console::WriteLine("CurrentCulture is {0}.", CultureInfo::CurrentCulture->Name);
-
- // Change the current culture to th-TH.
- CultureInfo::CurrentCulture = gcnew CultureInfo("th-TH",false);
- Console::WriteLine("CurrentCulture is now {0}.", CultureInfo::CurrentCulture->Name);
-
- // Displays the name of the CurrentUICulture of the current thread.
- Console::WriteLine("CurrentUICulture is {0}.", CultureInfo::CurrentCulture->Name);
-
- // Changes the CurrentUICulture of the current thread to ja-JP.
- CultureInfo::CurrentUICulture = gcnew CultureInfo("ja-JP",false);
- Console::WriteLine("CurrentUICulture is now {0}.", CultureInfo::CurrentCulture->Name);
-}
-// The example displays the following output:
-// CurrentCulture is en-US.
-// CurrentCulture is now th-TH.
-// CurrentUICulture is en-US.
-// CurrentUICulture is now ja-JP.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp
deleted file mode 100644
index 895e3754d36..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-// The following code example displays several properties of the neutral cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Displays several properties of the neutral cultures.
- Console::WriteLine( "CULTURE ISO ISO WIN DISPLAYNAME ENGLISHNAME" );
- System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::NeutralCultures )->GetEnumerator();
- while ( enum0->MoveNext() )
- {
- CultureInfo^ ci = safe_cast(enum0->Current);
- Console::Write( "{0,-7}", ci->Name );
- Console::Write( " {0,-3}", ci->TwoLetterISOLanguageName );
- Console::Write( " {0,-3}", ci->ThreeLetterISOLanguageName );
- Console::Write( " {0,-3}", ci->ThreeLetterWindowsLanguageName );
- Console::Write( " {0,-40}", ci->DisplayName );
- Console::WriteLine( " {0,-40}", ci->EnglishName );
- }
-}
-
-/*
-This code produces the following output. This output has been cropped for brevity.
-
-CULTURE ISO ISO WIN DISPLAYNAME ENGLISHNAME
-ar ar ara ARA Arabic Arabic
-bg bg bul BGR Bulgarian Bulgarian
-ca ca cat CAT Catalan Catalan
-zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified)
-cs cs ces CSY Czech Czech
-da da dan DAN Danish Danish
-de de deu DEU German German
-el el ell ELL Greek Greek
-en en eng ENU English English
-es es spa ESP Spanish Spanish
-fi fi fin FIN Finnish Finnish
-zh zh zho CHS Chinese Chinese
-zh-Hant zh zho CHT Chinese (Traditional) Chinese (Traditional)
-zh-CHS zh zho CHS Chinese (Simplified) Legacy Chinese (Simplified) Legacy
-zh-CHT zh zho CHT Chinese (Traditional) Legacy Chinese (Traditional) Legacy
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp
deleted file mode 100644
index c7d200f5865..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example determines which cultures using the Chinese language are neutral cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Lists the cultures that use the Chinese language and determines if each is a neutral culture.
- System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::AllCultures )->GetEnumerator();
- while ( enum0->MoveNext() )
- {
- CultureInfo^ ci = safe_cast(enum0->Current);
- if ( ci->TwoLetterISOLanguageName->Equals( "zh" ) )
- {
- Console::Write( "{0,-7} {1,-40}", ci->Name, ci->EnglishName );
- if ( ci->IsNeutralCulture )
- {
- Console::WriteLine( ": neutral" );
- }
- else
- {
- Console::WriteLine( ": specific" );
- }
- }
- }
-}
-
-/*
-This code produces the following output.
-
-zh-Hans Chinese (Simplified) : neutral
-zh-TW Chinese (Traditional, Taiwan) : specific
-zh-CN Chinese (Simplified, PRC) : specific
-zh-HK Chinese (Traditional, Hong Kong S.A.R.) : specific
-zh-SG Chinese (Simplified, Singapore) : specific
-zh-MO Chinese (Traditional, Macao S.A.R.) : specific
-zh Chinese : neutral
-zh-Hant Chinese (Traditional) : neutral
-zh-CHS Chinese (Simplified) Legacy : neutral
-zh-CHT Chinese (Traditional) Legacy : neutral
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp
deleted file mode 100644
index bc3ff941693..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-// The following code example displays the parent culture of each specific
-// culture using the Chinese language.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Prints the header.
- Console::WriteLine( "SPECIFIC CULTURE PARENT CULTURE" );
-
- // Determines the specific cultures that use the Chinese language,
- // and displays the parent culture.
- System::Collections::IEnumerator^ en = CultureInfo::GetCultures( CultureTypes::SpecificCultures )->GetEnumerator();
- while ( en->MoveNext() )
- {
- CultureInfo^ ci = safe_cast(en->Current);
- if ( ci->TwoLetterISOLanguageName->Equals( "zh" ) )
- {
- Console::Write( "0x{0} {1} {2,-40}", ci->LCID.ToString( "X4" ), ci->Name, ci->EnglishName );
- Console::WriteLine( "0x{0} {1} {2}", ci->Parent->LCID.ToString( "X4" ), ci->Parent->Name, ci->Parent->EnglishName );
- }
- }
-}
-
-/*
-This code produces the following output.
-
-SPECIFIC CULTURE PARENT CULTURE
-0x0404 zh-TW Chinese (Traditional, Taiwan) 0x7C04 zh-CHT Chinese (Traditional) Legacy
-0x0804 zh-CN Chinese (Simplified, PRC) 0x0004 zh-CHS Chinese (Simplified) Legacy
-0x0C04 zh-HK Chinese (Traditional, Hong Kong S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy
-0x1004 zh-SG Chinese (Simplified, Singapore) 0x0004 zh-CHS Chinese (Simplified) Legacy
-0x1404 zh-MO Chinese (Traditional, Macao S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp
deleted file mode 100644
index c2e98b06394..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-// The following code example shows that CultureInfo::ReadOnly also protects the
-// DateTimeFormatInfo and NumberFormatInfo instances associated with the CultureInfo.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates a CultureInfo.
- CultureInfo^ myCI = gcnew CultureInfo( "en-US" );
-
- // Creates a read-only CultureInfo based on myCI ->
- CultureInfo^ myReadOnlyCI = CultureInfo::ReadOnly( myCI );
-
- // Display the read-only status of each CultureInfo and their DateTimeFormat and NumberFormat properties.
- Console::WriteLine( "myCI is {0}.", myCI->IsReadOnly ? (String^)"read only" : "writable" );
- Console::WriteLine( "myCI -> DateTimeFormat is {0}.", myCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" );
- Console::WriteLine( "myCI -> NumberFormat is {0}.", myCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" );
- Console::WriteLine( "myReadOnlyCI is {0}.", myReadOnlyCI->IsReadOnly ? (String^)"read only" : "writable" );
- Console::WriteLine( "myReadOnlyCI -> DateTimeFormat is {0}.", myReadOnlyCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" );
- Console::WriteLine( "myReadOnlyCI -> NumberFormat is {0}.", myReadOnlyCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" );
-}
-
-/*
-This code produces the following output.
-
-myCI is writable.
-myCI -> DateTimeFormat is writable.
-myCI -> NumberFormat is writable.
-myReadOnlyCI is read only.
-myReadOnlyCI -> DateTimeFormat is read only.
-myReadOnlyCI -> NumberFormat is read only.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp
deleted file mode 100644
index 5a683e17740..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-
-// The following code example shows how to create a CultureInfo for S"Spanish - Spain"
-// with the international sort and another with the traditional sort.
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes the CultureInfo which uses the international sort.
- CultureInfo^ myCIintl = gcnew CultureInfo( "es-ES",false );
-
- // Creates and initializes the CultureInfo which uses the traditional sort.
- CultureInfo^ myCItrad = gcnew CultureInfo( 0x040A,false );
-
- // Displays the properties of each culture.
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL" );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl->CompareInfo, myCItrad->CompareInfo );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl->DisplayName, myCItrad->DisplayName );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl->EnglishName, myCItrad->EnglishName );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl->IsNeutralCulture, myCItrad->IsNeutralCulture );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl->IsReadOnly, myCItrad->IsReadOnly );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "LCID", myCIintl->LCID, myCItrad->LCID );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Name", myCIintl->Name, myCItrad->Name );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl->NativeName, myCItrad->NativeName );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Parent", myCIintl->Parent, myCItrad->Parent );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl->TextInfo, myCItrad->TextInfo );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl->ThreeLetterISOLanguageName, myCItrad->ThreeLetterISOLanguageName );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl->ThreeLetterWindowsLanguageName, myCItrad->ThreeLetterWindowsLanguageName );
- Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "TwoLetterISOLanguageName", myCIintl->TwoLetterISOLanguageName, myCItrad->TwoLetterISOLanguageName );
- Console::WriteLine();
-
- // Compare two strings using myCIintl ->
- Console::WriteLine( "Comparing \"llegar\" and \"lugar\"" );
- Console::WriteLine( " With myCIintl -> CompareInfo -> Compare: {0}", myCIintl->CompareInfo->Compare( "llegar", "lugar" ) );
- Console::WriteLine( " With myCItrad -> CompareInfo -> Compare: {0}", myCItrad->CompareInfo->Compare( "llegar", "lugar" ) );
-}
-
-/*
-This code produces the following output.
-
-PROPERTY INTERNATIONAL TRADITIONAL
-CompareInfo CompareInfo - es-ES CompareInfo - es-ES_tradnl
-DisplayName Spanish (Spain) Spanish (Spain)
-EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort)
-IsNeutralCulture False False
-IsReadOnly False False
-LCID 3082 1034
-Name es-ES es-ES
-NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional)
-Parent es es
-TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl
-ThreeLetterISOLanguageName spa spa
-ThreeLetterWindowsLanguageName ESN ESP
-TwoLetterISOLanguageName es es
-
-Comparing "llegar" and "lugar"
- With myCIintl -> CompareInfo -> Compare: -1
- With myCItrad -> CompareInfo -> Compare: 1
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp
deleted file mode 100644
index c9f0bdb0a61..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of FullDateTimePattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->FullDateTimePattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output. The question marks take the place of native script characters.
-
-CULTURE PROPERTY VALUE
-en-US dddd, MMMM dd, yyyy h:mm:ss tt
-ja-JP yyyy'年'M'月'd'日' H:mm:ss
-fr-FR dddd d MMMM yyyy HH:mm:ss
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp
deleted file mode 100644
index 64fb0d7708a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of LongDatePattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->LongDatePattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output:
-
-CULTURE PROPERTY VALUE
-en-US dddd, MMMM dd, yyyy
-ja-JP yyyy'年'M'月'd'日'
-fr-FR dddd d MMMM yyyy
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp
deleted file mode 100644
index 035bc98e2a0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of LongTimePattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->LongTimePattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output.
-
-CULTURE PROPERTY VALUE
-en-US h:mm:ss tt
-ja-JP H:mm:ss
-fr-FR HH:mm:ss
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp
deleted file mode 100644
index 29e0b173c0f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of MonthDayPattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->MonthDayPattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output. The question marks take the place of native script characters.
-
-CULTURE PROPERTY VALUE
-en-US MMMM dd
-ja-JP M'?'d'?'
-fr-FR d MMMM
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp
deleted file mode 100644
index 6f5088a4914..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of RFC1123Pattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->RFC1123Pattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output.
-
-CULTURE PROPERTY VALUE
-en-US ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
-ja-JP ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
-fr-FR ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp
deleted file mode 100644
index 7bc1dc8a065..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of ShortTimePattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->ShortTimePattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output.
-
-CULTURE PROPERTY VALUE
-en-US h:mm tt
-ja-JP H:mm
-fr-FR HH:mm
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp
deleted file mode 100644
index e49b6b214a2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of SortableDateTimePattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->SortableDateTimePattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output.
-
-CULTURE PROPERTY VALUE
-en-US yyyy'-'MM'-'dd'T'HH':'mm':'ss
-ja-JP yyyy'-'MM'-'dd'T'HH':'mm':'ss
-fr-FR yyyy'-'MM'-'dd'T'HH':'mm':'ss
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp
deleted file mode 100644
index f3e77ca4e46..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-// The following code example displays the value of UniversalSortableDateTimePattern
-// for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->UniversalSortableDateTimePattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output.
-
-CULTURE PROPERTY VALUE
-en-US yyyy'-'MM'-'dd HH':'mm':'ss'Z'
-ja-JP yyyy'-'MM'-'dd HH':'mm':'ss'Z'
-fr-FR yyyy'-'MM'-'dd HH':'mm':'ss'Z'
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp
deleted file mode 100644
index 549fe6aecfd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// The following code example displays the value of YearMonthPattern for selected cultures.
-//
-using namespace System;
-using namespace System::Globalization;
-void PrintPattern( String^ myCulture )
-{
- CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
- DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
- Console::WriteLine( " {0} {1}", myCulture, myDTFI->YearMonthPattern );
-}
-
-int main()
-{
-
- // Displays the values of the pattern properties.
- Console::WriteLine( " CULTURE PROPERTY VALUE" );
- PrintPattern( "en-US" );
- PrintPattern( "ja-JP" );
- PrintPattern( "fr-FR" );
-}
-
-/*
-This code produces the following output. The question marks take the place of native script characters.
-
- CULTURE PROPERTY VALUE
- en-US MMMM yyyy
- ja-JP yyyy年M月
- fr-FR MMMM yyyy
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp
deleted file mode 100644
index cde0e811c88..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the second month in each of
-// 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a GregorianCalendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, GregorianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: 28 28 28 29 28
-Era 1: 28 28 28 29 28
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp
deleted file mode 100644
index a15e780eff2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a GregorianCalendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, GregorianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: 365 365 365 366 365
-Era 1: 365 365 365 366 365
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp
deleted file mode 100644
index 990c729f21e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-// The following code example shows that DTFI ignores the punctuation in the
-// era name only if the calendar is Gregorian and the culture uses the era name "A.D.".
-//
-using namespace System;
-using namespace System::Globalization;
-using namespace System::Collections;
-int main()
-{
-
- // Creates strings with punctuation and without.
- String^ strADPunc = "A.D.";
- String^ strADNoPunc = "AD";
- String^ strCEPunc = "C.E.";
- String^ strCENoPunc = "CE";
-
- // Calls DTFI::GetEra for each culture that uses GregorianCalendar as the default calendar.
- Console::WriteLine( " ----- AD ----- ----- CE -----" );
- Console::WriteLine( "CULTURE PUNC NO PUNC PUNC NO PUNC CALENDAR" );
- IEnumerator^ en = CultureInfo::GetCultures( CultureTypes::SpecificCultures )->GetEnumerator();
- while ( en->MoveNext() )
- {
- CultureInfo^ myCI = safe_cast(en->Current);
- Console::Write( "{0, -12}", myCI );
- Console::Write( "{0,-7}{1,-9}", myCI->DateTimeFormat->GetEra( strADPunc ), myCI->DateTimeFormat->GetEra( strADNoPunc ) );
- Console::Write( "{0, -7}{1, -9}", myCI->DateTimeFormat->GetEra( strCEPunc ), myCI->DateTimeFormat->GetEra( strCENoPunc ) );
- Console::Write( "{0}", myCI->Calendar );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output. This output has been cropped for brevity.
-
- ----- AD ----- ----- CE -----
-CULTURE PUNC NO PUNC PUNC NO PUNC CALENDAR
-ar-SA -1 -1 -1 -1 System.Globalization.HijriCalendar
-ar-IQ 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-EG 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-LY 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-DZ 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-MA 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-TN 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-OM 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-YE 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-SY 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-JO 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-LB 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-KW 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-AE 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-BH 1 1 -1 -1 System.Globalization.GregorianCalendar
-ar-QA 1 1 -1 -1 System.Globalization.GregorianCalendar
-bg-BG 1 1 -1 -1 System.Globalization.GregorianCalendar
-ca-ES -1 -1 -1 -1 System.Globalization.GregorianCalendar
-zh-TW -1 -1 -1 -1 System.Globalization.GregorianCalendar
-zh-CN -1 -1 -1 -1 System.Globalization.GregorianCalendar
-zh-HK 1 1 -1 -1 System.Globalization.GregorianCalendar
-zh-SG 1 1 -1 -1 System.Globalization.GregorianCalendar
-zh-MO 1 1 -1 -1 System.Globalization.GregorianCalendar
-cs-CZ -1 -1 -1 -1 System.Globalization.GregorianCalendar
-da-DK 1 1 -1 -1 System.Globalization.GregorianCalendar
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp
deleted file mode 100644
index dfe3801afab..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetMonthsInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a GregorianCalendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, GregorianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: 12 12 12 12 12
-Era 1: 12 12 12 12 12
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp
deleted file mode 100644
index e69e21eeaba..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following code example calls IsLeapDay for the last day of the second
-// month (February) for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a GregorianCalendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
-
- // Creates a holder for the last day of the second month (February).
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, GregorianCalendar::CurrentEra );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, GregorianCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
-
- }
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp
deleted file mode 100644
index 140956b9f7f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months in five years
-// in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a GregorianCalendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 2001; y <= 2005; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, GregorianCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, GregorianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-2001: False False False False False False False False False False False False
-2002: False False False False False False False False False False False False
-2003: False False False False False False False False False False False False
-2004: False False False False False False False False False False False False
-2005: False False False False False False False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp
deleted file mode 100644
index 6331dd01784..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls IsLeapYear for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a GregorianCalendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, GregorianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp
deleted file mode 100644
index 1a0b6a1e910..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-// The following code example prints a DateTime using a GregorianCalendar that is localized.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes three different CultureInfo.
- CultureInfo^ myCIdeDE = gcnew CultureInfo( "de-DE",false );
- CultureInfo^ myCIenUS = gcnew CultureInfo( "en-US",false );
- CultureInfo^ myCIfrFR = gcnew CultureInfo( "fr-FR",false );
- CultureInfo^ myCIruRU = gcnew CultureInfo( "ru-RU",false );
-
- // Creates a Localized GregorianCalendar.
- // GregorianCalendarTypes::Localized is the default when using the GregorianCalendar constructor with->Item[Out] parameters.
- Calendar^ myCal = gcnew GregorianCalendar;
-
- // Sets the DateTimeFormatInfo::Calendar property to a Localized GregorianCalendar.
- // Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR,
- myCIruRU->DateTimeFormat->Calendar = myCal;
-
- // Creates a DateTime.
- DateTime myDT = DateTime(2002,1,3,13,30,45);
-
- // Displays the DateTime.
- Console::WriteLine( "de-DE: {0}", myDT.ToString( "F", myCIdeDE ) );
- Console::WriteLine( "en-US: {0}", myDT.ToString( "F", myCIenUS ) );
- Console::WriteLine( "fr-FR: {0}", myDT.ToString( "F", myCIfrFR ) );
- Console::WriteLine( "ru-RU: {0}", myDT.ToString( "F", myCIruRU ) );
-}
-
-/*
-The example displays the following output:
- de-DE: Donnerstag, 3. Januar 2002 13:30:45
- en-US: Thursday, January 03, 2002 1:30:45 PM
- fr-FR: jeudi 3 janvier 2002 13:30:45
- ru-RU: 3 января 2002 г. 13:30:45
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp
deleted file mode 100644
index 698b5b3e06f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example demonstrates how to determine the GregorianCalendar
-// version supported by the culture.
-//
-using namespace System;
-using namespace System::Globalization;
-using namespace System::Collections;
-int main()
-{
-
- // Calendar* myOptCals[] = new CultureInfo(S"ar-SA") -> OptionalCalendars;
- CultureInfo^ MyCI = gcnew CultureInfo( "ar-SA" );
- array^myOptCals = MyCI->OptionalCalendars;
-
- // Checks which ones are GregorianCalendar then determines the GregorianCalendar version.
- Console::WriteLine( "The ar-SA culture supports the following calendars:" );
- IEnumerator^ myEnum = myOptCals->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Calendar^ cal = safe_cast(myEnum->Current);
- if ( cal->GetType() == GregorianCalendar::typeid )
- {
- GregorianCalendar^ myGreCal = dynamic_cast(cal);
- GregorianCalendarTypes calType = myGreCal->CalendarType;
- Console::WriteLine( " {0} ( {1})", cal, calType );
- }
- else
- Console::WriteLine( " {0}", cal );
- }
-}
-
-/*
-This code produces the following output.
-
-The ar-SA culture supports the following calendars:
- System.Globalization.HijriCalendar
- System.Globalization.GregorianCalendar ( USEnglish)
- System.Globalization.GregorianCalendar ( MiddleEastFrench)
- System.Globalization.GregorianCalendar ( Arabic)
- System.Globalization.GregorianCalendar ( Localized)
- System.Globalization.GregorianCalendar ( TransliteratedFrench)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp
deleted file mode 100644
index 372b38993c5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the Gregorian calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the GregorianCalendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar:
- Era: 1
- Year: 2002
- Month: 4
- DayOfYear: 93
- DayOfMonth: 3
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 1
- Year: 2005
- Month: 2
- DayOfYear: 34
- DayOfMonth: 3
- DayOfWeek: Thursday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp
deleted file mode 100644
index f3640634df9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// The following code example gets the minimum date and the maximum date of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Create an instance of the calendar.
- GregorianCalendar^ myCal = gcnew GregorianCalendar;
- Console::WriteLine( myCal );
-
- // Display the MinSupportedDateTime.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::WriteLine( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::WriteLine( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.GregorianCalendar
-MinSupportedDateTime: 01/01/0001
-MaxSupportedDateTime: 12/31/9999
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp
deleted file mode 100644
index bc4213e8f2e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the second month in each of
-// 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HebrewCalendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, HebrewCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 5761 5762 5763 5764 5765
-CurrentEra: 29 29 30 30 29
-Era 1: 29 29 30 30 29
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp
deleted file mode 100644
index 57e2ea00d8c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetMonthsInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HebrewCalendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, HebrewCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 5761 5762 5763 5764 5765
-CurrentEra: 12 12 13 12 13
-Era 1: 12 12 13 12 13
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp
deleted file mode 100644
index 9c1c73168c4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following code example calls IsLeapDay for the last day of the second month
-// (February) for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HebrewCalendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
-
- // Creates a holder for the last day of the second month (February).
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 5761; y <= 5765; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, HebrewCalendar::CurrentEra );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, HebrewCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 5761; y <= 5765; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
-
- }
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 5761 5762 5763 5764 5765
-CurrentEra: False False False False False
-Era 1: False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp
deleted file mode 100644
index 1da1268009b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months in five years
-// in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HebrewCalendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 5761; y <= 5765; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, HebrewCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, HebrewCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-5761: False False False False False False False False False False False False
-5762: False False False False False False False False False False False False
-5763: False False False False False False True False False False False False False
-5764: False False False False False False False False False False False False
-5765: False False False False False False True False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp
deleted file mode 100644
index f7458927a3b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls IsLeapYear for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HebrewCalendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, HebrewCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 5761 5762 5763 5764 5765
-CurrentEra: False False True False True
-Era 1: False False True False True
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp
deleted file mode 100644
index cadc36701b1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the Hebrew calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the HebrewCalendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Hebrew calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar equals the following in the Hebrew calendar:
- Era: 1
- Year: 5762
- Month: 7
- DayOfYear: 198
- DayOfMonth: 21
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 1
- Year: 5765
- Month: 5
- DayOfYear: 138
- DayOfMonth: 21
- DayOfWeek: Monday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp
deleted file mode 100644
index d739184677c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HebrewCalendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, HebrewCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 5761; y <= 5765; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 5761 5762 5763 5764 5765
-CurrentEra: 353 354 385 355 383
-Era 1: 353 354 385 355 383
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp
deleted file mode 100644
index 6355880b6f4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// The following code example gets the minimum date and the maximum date of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Create an instance of the calendar.
- HebrewCalendar^ myCal = gcnew HebrewCalendar;
- Console::WriteLine( myCal );
-
- // Create an instance of the GregorianCalendar.
- GregorianCalendar^ myGre = gcnew GregorianCalendar;
-
- // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.HebrewCalendar
-MinSupportedDateTime: 04/07/5343 (in Gregorian, 01/01/1583)
-MaxSupportedDateTime: 13/29/5999 (in Gregorian, 09/29/2239)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp
deleted file mode 100644
index b31c1af503b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the twelfth month in
-// each of 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 12, HijriCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 12, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output. The results might vary depending on
-the settings in Regional and Language Options (or Regional Options or Regional Settings).
-
-YEAR 1421 1422 1423 1424 1425
-CurrentEra: 29 29 30 29 29
-Era 1: 29 29 30 29 29
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp
deleted file mode 100644
index 036e38f6962..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, HijriCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output. The results might vary depending on
-the settings in Regional and Language Options (or Regional Options or Regional Settings).
-
-YEAR 1421 1422 1423 1424 1425
-CurrentEra: 354 354 355 354 354
-Era 1: 354 354 355 354 354
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp
deleted file mode 100644
index f922542fad0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetMonthsInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, HijriCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output. The results might vary depending on
-the settings in Regional and Language Options (or Regional Options or Regional Settings).
-
-YEAR 1421 1422 1423 1424 1425
-CurrentEra: 12 12 12 12 12
-Era 1: 12 12 12 12 12
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp
deleted file mode 100644
index 8ad91079056..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-// The following code example shows how HijriAdjustment affects the date.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Creates a DateTime and initializes it to the second day of the first month of the year 1422.
- DateTime myDT = DateTime(1422,1,2,myCal);
-
- // Displays the current values of the DateTime.
- Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment );
- Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) );
- Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) );
-
- // Sets the HijriAdjustment property to 2.
- myCal->HijriAdjustment = 2;
- Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment );
- Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) );
- Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) );
-
- // Sets the HijriAdjustment property to -2.
- myCal->HijriAdjustment = -2;
- Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment );
- Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) );
- Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) );
-}
-
-/*
-This code produces the following output. Results vary depending on the registry settings.
-
-HijriAdjustment is 0.
-Year is 1422.
-Month is 1.
-Day is 2.
-HijriAdjustment is 2.
-Year is 1422.
-Month is 1.
-Day is 4.
-HijriAdjustment is -2.
-Year is 1421.
-Month is 12.
-Day is 29.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp
deleted file mode 100644
index 374dfbf3d96..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following code example calls IsLeapDay for the last day of the second
-// month (February) for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Creates a holder for the last day of the second month (February).
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 1421; y <= 1425; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, HijriCalendar::CurrentEra );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, HijriCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1421; y <= 1425; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
-
- }
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 1421 1422 1423 1424 1425
-CurrentEra: False False False False False
-Era 1: False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp
deleted file mode 100644
index aa01d2f822d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months in
-// five years in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 1421; y <= 1425; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, HijriCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, HijriCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-1421: False False False False False False False False False False False False
-1422: False False False False False False False False False False False False
-1423: False False False False False False False False False False False False
-1424: False False False False False False False False False False False False
-1425: False False False False False False False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp
deleted file mode 100644
index e3896e85af1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls IsLeapYear for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, HijriCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1421; y <= 1425; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 1421 1422 1423 1424 1425
-CurrentEra: False False True False False
-Era 1: False False True False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp
deleted file mode 100644
index 8585d7966f6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the Hijri calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the HijriCalendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Hijri calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar equals the following in the Hijri calendar:
- Era: 1
- Year: 1423
- Month: 1
- DayOfYear: 21
- DayOfMonth: 21
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 1
- Year: 1425
- Month: 11
- DayOfYear: 316
- DayOfMonth: 21
- DayOfWeek: Saturday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp
deleted file mode 100644
index 4c8f361ea5f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// The following code example gets the minimum date and the maximum date of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Create an instance of the calendar.
- HijriCalendar^ myCal = gcnew HijriCalendar;
- Console::WriteLine( myCal );
-
- // Create an instance of the GregorianCalendar.
- GregorianCalendar^ myGre = gcnew GregorianCalendar;
-
- // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.HijriCalendar
-MinSupportedDateTime: 01/01/0001 (in Gregorian, 07/18/0622)
-MaxSupportedDateTime: 04/03/9666 (in Gregorian, 12/31/9999)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp
deleted file mode 100644
index 41a3f5fffa3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-// The following code example displays the values contained in the Eras property.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::WriteLine( "Eras[ {0}] = {1}", i, myCal->Eras[ i ] );
-
- }
-}
-
-/*
-This code produces the following output.
-
-Eras->Item[0] = 4
-Eras->Item[1] = 3
-Eras->Item[2] = 2
-Eras->Item[3] = 1
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp
deleted file mode 100644
index 18dc3f18f24..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the second month in each
-// of 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, JapaneseCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 1 2 3 4 5
-CurrentEra: 28 28 28 29 28
-Era 4: 28 28 28 29 28
-Era 3: 28 28 29 28 28
-Era 2: 29 28 28 28 29
-Era 1: 29 28 28 28 29
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp
deleted file mode 100644
index b7c757179f0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, JapaneseCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 1 2 3 4 5
-CurrentEra: 365 365 365 366 365
-Era 4: 365 365 365 366 365
-Era 3: 365 365 366 365 365
-Era 2: 366 365 365 365 366
-Era 1: 366 365 365 365 366
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp
deleted file mode 100644
index 8fff71ba264..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Creates and initializes a JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, JapaneseCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp
deleted file mode 100644
index 085173db873..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Creates and initializes a JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Creates a holder for the last day of the second month (February)->
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 1; y <= 5; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, JapaneseCalendar::CurrentEra );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, JapaneseCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1; y <= 5; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
- }
- Console::WriteLine();
- }
-}
-/*
-This code produces the following output.
-
-YEAR 1 2 3 4 5
-CurrentEra: False True False False False
-Era 5: False True False False False
-Era 4: False False False True False
-Era 3: False False True False False
-Era 2: True False False False True
-Era 1: True False False False True
-
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp
deleted file mode 100644
index de254b59da9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months
-// in five years in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 1; y <= 5; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, JapaneseCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, JapaneseCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-1: False False False False False False False False False False False False
-2: False False False False False False False False False False False False
-3: False False False False False False False False False False False False
-4: False False False False False False False False False False False False
-5: False False False False False False False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp
deleted file mode 100644
index 5a922425510..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Creates and initializes a JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, JapaneseCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 1; y <= 5; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
- }
-}
-/*
-This code produces the following output.
-
-YEAR 1 2 3 4 5
-CurrentEra: False True False False False
-Era 5: False True False False False
-Era 4: False False False True False
-Era 3: False False True False False
-Era 2: True False False False True
-Era 1: True False False False True
-
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp
deleted file mode 100644
index b5ce5f316e5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the Japanese calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the JapaneseCalendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Japanese calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar equals the following in the Japanese calendar:
- Era: 4
- Year: 14
- Month: 4
- DayOfYear: 93
- DayOfMonth: 3
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 4
- Year: 17
- Month: 2
- DayOfYear: 34
- DayOfMonth: 3
- DayOfWeek: Thursday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp
deleted file mode 100644
index d982671caed..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// The following code example gets the minimum date and the maximum date of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Create an instance of the calendar.
- JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
- Console::WriteLine( myCal );
-
- // Create an instance of the GregorianCalendar.
- GregorianCalendar^ myGre = gcnew GregorianCalendar;
-
- // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.JapaneseCalendar
-MinSupportedDateTime: 09/08/0001 (in Gregorian, 09/08/1868)
-MaxSupportedDateTime: 12/31/8011 (in Gregorian, 12/31/9999)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp
deleted file mode 100644
index 34d49e99fe2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the second month in
-// each of 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JulianCalendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, JulianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: 28 28 28 29 28
-Era 1: 28 28 28 29 28
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp
deleted file mode 100644
index 3e36971f4c5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JulianCalendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, JulianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: 365 365 365 366 365
-Era 1: 365 365 365 366 365
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp
deleted file mode 100644
index 113ce8b1c77..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetMonthsInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JulianCalendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, JulianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: 12 12 12 12 12
-Era 1: 12 12 12 12 12
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp
deleted file mode 100644
index b8036ac7e05..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following code example calls IsLeapDay for the last day of the
-// second month (February) for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JulianCalendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
-
- // Creates a holder for the last day of the second month (February).
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, JulianCalendar::CurrentEra );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, JulianCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
-
- }
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp
deleted file mode 100644
index b2d0997f2f8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months in
-// five years in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JulianCalendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 2001; y <= 2005; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, JulianCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, JulianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-2001: False False False False False False False False False False False False
-2002: False False False False False False False False False False False False
-2003: False False False False False False False False False False False False
-2004: False False False False False False False False False False False False
-2005: False False False False False False False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp
deleted file mode 100644
index 5436dfbd8b5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls IsLeapYear for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a JulianCalendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, JulianCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2001; y <= 2005; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2001 2002 2003 2004 2005
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp
deleted file mode 100644
index e14dd6e99a2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the Julian calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the JulianCalendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:
- Era: 1
- Year: 2002
- Month: 3
- DayOfYear: 80
- DayOfMonth: 21
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 1
- Year: 2005
- Month: 1
- DayOfYear: 21
- DayOfMonth: 21
- DayOfWeek: Thursday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp
deleted file mode 100644
index 5aa56fb4924..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// The following code example gets the minimum date and the maximum date of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Create an instance of the calendar.
- JulianCalendar^ myCal = gcnew JulianCalendar;
- Console::WriteLine( myCal );
-
- // Create an instance of the GregorianCalendar.
- GregorianCalendar^ myGre = gcnew GregorianCalendar;
-
- // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.JulianCalendar
-MinSupportedDateTime: 01/03/0001 (in Gregorian, 01/01/0001)
-MaxSupportedDateTime: 10/19/9999 (in Gregorian, 12/31/9999)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp
deleted file mode 100644
index 6b3c77a66da..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the second month
-// in each of 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a KoreanCalendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, KoreanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 4334 4335 4336 4337 4338
-CurrentEra: 28 28 28 29 28
-Era 1: 28 28 28 29 28
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp
deleted file mode 100644
index 5211726ccf0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a KoreanCalendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, KoreanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 4334 4335 4336 4337 4338
-CurrentEra: 365 365 365 366 365
-Era 1: 365 365 365 366 365
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp
deleted file mode 100644
index 33b5c948bd3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetMonthsInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a KoreanCalendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, KoreanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 4334 4335 4336 4337 4338
-CurrentEra: 12 12 12 12 12
-Era 1: 12 12 12 12 12
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp
deleted file mode 100644
index d973b468e66..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following code example calls IsLeapDay for the last day of the second
-// month (February) for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a KoreanCalendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
-
- // Creates a holder for the last day of the second month (February).
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 4334; y <= 4338; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, KoreanCalendar::CurrentEra );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, KoreanCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 4334; y <= 4338; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
-
- }
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 4334 4335 4336 4337 4338
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp
deleted file mode 100644
index 3446270064d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months in five years in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a KoreanCalendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 4334; y <= 4338; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, KoreanCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, KoreanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-4334: False False False False False False False False False False False False
-4335: False False False False False False False False False False False False
-4336: False False False False False False False False False False False False
-4337: False False False False False False False False False False False False
-4338: False False False False False False False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp
deleted file mode 100644
index 5e2e16c671d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls IsLeapYear for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a KoreanCalendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, KoreanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 4334; y <= 4338; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 4334 4335 4336 4337 4338
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp
deleted file mode 100644
index 0af45b0db54..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the Korean calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the KoreanCalendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Korean calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar equals the following in the Korean calendar:
- Era: 1
- Year: 4335
- Month: 4
- DayOfYear: 93
- DayOfMonth: 3
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 1
- Year: 4338
- Month: 2
- DayOfYear: 34
- DayOfMonth: 3
- DayOfWeek: Thursday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp
deleted file mode 100644
index 00de6b90a65..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// The following code example gets the minimum date and the maximum date of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
-
- // Create an instance of the calendar.
- KoreanCalendar^ myCal = gcnew KoreanCalendar;
- Console::WriteLine( myCal );
-
- // Create an instance of the GregorianCalendar.
- GregorianCalendar^ myGre = gcnew GregorianCalendar;
-
- // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.KoreanCalendar
-MinSupportedDateTime: 01/01/2334 (in Gregorian, 01/01/0001)
-MaxSupportedDateTime: 12/31/12332 (in Gregorian, 12/31/9999)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp
deleted file mode 100644
index 0725c178ee9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Globalization;
-using namespace System::Text;
-int main()
-{
-
- // Gets the InvariantInfo.
- NumberFormatInfo^ myInv = NumberFormatInfo::InvariantInfo;
-
- // Gets a UnicodeEncoding to display the Unicode value of symbols.
- UnicodeEncoding^ myUE = gcnew UnicodeEncoding( true,false );
- array^myCodes;
-
- // Displays the default values for each of the properties.
- Console::WriteLine( "InvariantInfo:\nNote: Symbols might not display correctly on the console, \ntherefore, Unicode values are included." );
- Console::WriteLine( "\tCurrencyDecimalDigits\t\t {0}", myInv->CurrencyDecimalDigits );
- Console::WriteLine( "\tCurrencyDecimalSeparator\t {0}", myInv->CurrencyDecimalSeparator );
- Console::WriteLine( "\tCurrencyGroupSeparator\t\t {0}", myInv->CurrencyGroupSeparator );
- Console::WriteLine( "\tCurrencyGroupSizes\t\t {0}", myInv->CurrencyGroupSizes[ 0 ] );
- Console::WriteLine( "\tCurrencyNegativePattern\t\t {0}", myInv->CurrencyNegativePattern );
- Console::WriteLine( "\tCurrencyPositivePattern\t\t {0}", myInv->CurrencyPositivePattern );
- myCodes = myUE->GetBytes( myInv->CurrencySymbol );
- Console::WriteLine( "\tCurrencySymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->CurrencySymbol, myCodes[ 0 ], myCodes[ 1 ] );
- Console::WriteLine( "\tNaNSymbol\t\t\t {0}", myInv->NaNSymbol );
- Console::WriteLine( "\tNegativeInfinitySymbol\t\t {0}", myInv->NegativeInfinitySymbol );
- Console::WriteLine( "\tNegativeSign\t\t\t {0}", myInv->NegativeSign );
- Console::WriteLine( "\tNumberDecimalDigits\t\t {0}", myInv->NumberDecimalDigits );
- Console::WriteLine( "\tNumberDecimalSeparator\t\t {0}", myInv->NumberDecimalSeparator );
- Console::WriteLine( "\tNumberGroupSeparator\t\t {0}", myInv->NumberGroupSeparator );
- Console::WriteLine( "\tNumberGroupSizes\t\t {0}", myInv->NumberGroupSizes[ 0 ] );
- Console::WriteLine( "\tNumberNegativePattern\t\t {0}", myInv->NumberNegativePattern );
- Console::WriteLine( "\tPercentDecimalDigits\t\t {0}", myInv->PercentDecimalDigits );
- Console::WriteLine( "\tPercentDecimalSeparator\t\t {0}", myInv->PercentDecimalSeparator );
- Console::WriteLine( "\tPercentGroupSeparator\t\t {0}", myInv->PercentGroupSeparator );
- Console::WriteLine( "\tPercentGroupSizes\t\t {0}", myInv->PercentGroupSizes[ 0 ] );
- Console::WriteLine( "\tPercentNegativePattern\t\t {0}", myInv->PercentNegativePattern );
- Console::WriteLine( "\tPercentPositivePattern\t\t {0}", myInv->PercentPositivePattern );
- myCodes = myUE->GetBytes( myInv->PercentSymbol );
- Console::WriteLine( "\tPercentSymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->PercentSymbol, myCodes[ 0 ], myCodes[ 1 ] );
- myCodes = myUE->GetBytes( myInv->PerMilleSymbol );
- Console::WriteLine( "\tPerMilleSymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->PerMilleSymbol, myCodes[ 0 ], myCodes[ 1 ] );
- Console::WriteLine( "\tPositiveInfinitySymbol\t\t {0}", myInv->PositiveInfinitySymbol );
- Console::WriteLine( "\tPositiveSign\t\t\t {0}", myInv->PositiveSign );
-}
-
-/*
-
-This code produces the following output.
-
-InvariantInfo:
-Note: Symbols might not display correctly on the console,
-therefore, Unicode values are included.
-CurrencyDecimalDigits 2
-CurrencyDecimalSeparator .
-CurrencyGroupSeparator ,
-CurrencyGroupSizes 3
-CurrencyNegativePattern 0
-CurrencyPositivePattern 0
-CurrencySymbol (U+00a4)
-NaNSymbol NaN
-NegativeInfinitySymbol -Infinity
-NegativeSign -
-NumberDecimalDigits 2
-NumberDecimalSeparator .
-NumberGroupSeparator ,
-NumberGroupSizes 3
-NumberNegativePattern 1
-PercentDecimalDigits 2
-PercentDecimalSeparator .
-PercentGroupSeparator ,
-PercentGroupSizes 3
-PercentNegativePattern 0
-PercentPositivePattern 0
-PercentSymbol % (U+0025)
-PerMilleSymbol % (U+2030)
-PositiveInfinitySymbol Infinity
-PositiveSign +
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp
deleted file mode 100644
index 1a0bf689d64..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// The following code example creates instances of
-// T:System.Globalization.RegionInfo using culture names.
-
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Globalization;
-
-namespace Sample
-{
- public ref class SamplesRegionInfo
- {
- public:
- static void Work()
- {
-
- // Creates an array containing culture names.
- array ^ commonCultures =
- {"", "ar", "ar-DZ", "en", "en-US"};
-
- // Creates a RegionInfo for each of the culture names.
- // Note that "ar" is the culture name for the neutral
- // culture "Arabic", but it is also the region name for
- // the country/region "Argentina"; therefore, it does not
- // fail as expected.
- Console::WriteLine("Without checks...");
- for each (String^ cultureID in commonCultures)
- {
- try
- {
- RegionInfo^ region =
- gcnew RegionInfo(cultureID);
- }
-
- catch (ArgumentException^ ex)
- {
- Console::WriteLine(ex);
- }
- }
-
- Console::WriteLine();
-
- Console::WriteLine("Checking the culture"
- " names first...");
-
- for each (String^ cultureID in commonCultures)
- {
- if (cultureID->Length == 0)
- {
- Console::WriteLine(
- "The culture is the invariant culture.");
- }
- else
- {
- CultureInfo^ culture =
- gcnew CultureInfo(cultureID, false);
- if (culture->IsNeutralCulture)
- {
- Console::WriteLine("The culture {0} is "
- "a neutral culture.", cultureID);
- }
- else
- {
- Console::WriteLine("The culture {0} is "
- "a specific culture.", cultureID);
- try
- {
- RegionInfo^ region =
- gcnew RegionInfo(cultureID);
- }
- catch (ArgumentException^ ex)
- {
- Console::WriteLine(ex);
- }
- }
- }
- }
- Console::ReadLine();
- }
- };
-}
-
-int main()
-{
- Sample::SamplesRegionInfo::Work();
- return 0;
-}
-
-/*
-This code produces the following output.
-
-Without checks...
-System.ArgumentException: Region name '' is not supported.
-Parameter name: name
-at System.Globalization.RegionInfo..ctor(String name)
-at SamplesRegionInfo.Main()
-System.ArgumentException: Region name 'en' is not supported.
-Parameter name: name
-at System.Globalization.CultureTableRecord..ctor(String regionName,
- Boolean useUserOverride)
-at System.Globalization.RegionInfo..ctor(String name)
-at SamplesRegionInfo.Main()
-
-Checking the culture names first...
-The culture is the invariant culture.
-The culture ar is a neutral culture.
-The culture ar-DZ is a specific culture.
-The culture en is a neutral culture.
-The culture en-US is a specific culture.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp
deleted file mode 100644
index afae697de7f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-// The following code example demonstrates several members of the RegionInfo class.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Displays the property values of the RegionInfo for "US".
- RegionInfo^ myRI1 = gcnew RegionInfo( "US" );
- Console::WriteLine( " Name: {0}", myRI1->Name );
- Console::WriteLine( " DisplayName: {0}", myRI1->DisplayName );
- Console::WriteLine( " EnglishName: {0}", myRI1->EnglishName );
- Console::WriteLine( " IsMetric: {0}", myRI1->IsMetric );
- Console::WriteLine( " ThreeLetterISORegionName: {0}", myRI1->ThreeLetterISORegionName );
- Console::WriteLine( " ThreeLetterWindowsRegionName: {0}", myRI1->ThreeLetterWindowsRegionName );
- Console::WriteLine( " TwoLetterISORegionName: {0}", myRI1->TwoLetterISORegionName );
- Console::WriteLine( " CurrencySymbol: {0}", myRI1->CurrencySymbol );
- Console::WriteLine( " ISOCurrencySymbol: {0}", myRI1->ISOCurrencySymbol );
- Console::WriteLine();
-
- // Compares the RegionInfo above with another RegionInfo created using CultureInfo.
- RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID );
- if ( myRI1->Equals( myRI2 ) )
- Console::WriteLine( "The two RegionInfo instances are equal." );
- else
- Console::WriteLine( "The two RegionInfo instances are NOT equal." );
-}
-
-/*
-This code produces the following output.
-
- Name: US
- DisplayName: United States
- EnglishName: United States
- IsMetric: False
- ThreeLetterISORegionName: USA
- ThreeLetterWindowsRegionName: USA
- TwoLetterISORegionName: US
- CurrencySymbol: $
- ISOCurrencySymbol: USD
-
-The two RegionInfo instances are equal.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp
deleted file mode 100644
index 59f19db370c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-// The following code example compares two instances of RegionInfo that were created differently.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates a RegionInfo using the ISO 3166 two-letter code.
- RegionInfo^ myRI1 = gcnew RegionInfo( "US" );
-
- // Creates a RegionInfo using a CultureInfo.LCID.
- RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID );
-
- // Compares the two instances.
- if ( myRI1->Equals( myRI2 ) )
- Console::WriteLine( "The two RegionInfo instances are equal." );
- else
- Console::WriteLine( "The two RegionInfo instances are NOT equal." );
-}
-
-/*
-This code produces the following output.
-
-The two RegionInfo instances are equal.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp
deleted file mode 100644
index b61096e79cc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example displays the properties of the RegionInfo class.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Displays the property values of the RegionInfo for "US".
- RegionInfo^ myRI1 = gcnew RegionInfo( "US" );
- Console::WriteLine( " Name: {0}", myRI1->Name );
- Console::WriteLine( " DisplayName: {0}", myRI1->DisplayName );
- Console::WriteLine( " EnglishName: {0}", myRI1->EnglishName );
- Console::WriteLine( " IsMetric: {0}", myRI1->IsMetric );
- Console::WriteLine( " ThreeLetterISORegionName: {0}", myRI1->ThreeLetterISORegionName );
- Console::WriteLine( " ThreeLetterWindowsRegionName: {0}", myRI1->ThreeLetterWindowsRegionName );
- Console::WriteLine( " TwoLetterISORegionName: {0}", myRI1->TwoLetterISORegionName );
- Console::WriteLine( " CurrencySymbol: {0}", myRI1->CurrencySymbol );
- Console::WriteLine( " ISOCurrencySymbol: {0}", myRI1->ISOCurrencySymbol );
-}
-
-/*
-This code produces the following output.
-
- Name: US
- DisplayName: United States
- EnglishName: United States
- IsMetric: False
- ThreeLetterISORegionName: USA
- ThreeLetterWindowsRegionName: USA
- TwoLetterISORegionName: US
- CurrencySymbol: $
- ISOCurrencySymbol: USD
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp
deleted file mode 100644
index 1b59bd014bf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example compares SortKey objects created with
-// cultures that have different sort orders.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates a SortKey using the en-US culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- CompareInfo^ myComp_enUS = MyCI->CompareInfo;
- SortKey^ mySK1 = myComp_enUS->GetSortKey( "llama" );
-
- // Creates a SortKey using the es-ES culture with international sort.
- MyCI = gcnew CultureInfo( "es-ES",false );
- CompareInfo^ myComp_esES = MyCI->CompareInfo;
- SortKey^ mySK2 = myComp_esES->GetSortKey( "llama" );
-
- // Creates a SortKey using the es-ES culture with traditional sort.
- MyCI = gcnew CultureInfo( 0x040A,false );
- CompareInfo^ myComp_es = MyCI->CompareInfo;
- SortKey^ mySK3 = myComp_es->GetSortKey( "llama" );
-
- // Compares the en-US SortKey with each of the es-ES SortKey objects.
- Console::WriteLine( "Comparing \"llama\" in en-US and in es-ES with international sort : {0}", SortKey::Compare( mySK1, mySK2 ) );
- Console::WriteLine( "Comparing \"llama\" in en-US and in es-ES with traditional sort : {0}", SortKey::Compare( mySK1, mySK3 ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing S"llama" in en-US and in es-ES with international sort : 0
-Comparing S"llama" in en-US and in es-ES with traditional sort : -1
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp
deleted file mode 100644
index 3f300f6813f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-// The following code example shows the results of SortKey->Equals
-// when compared with different SortKey objects.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates two identical en-US cultures and one de-DE culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- CompareInfo^ myComp_enUS1 = MyCI->CompareInfo;
- MyCI = gcnew CultureInfo( "en-US",false );
- CompareInfo^ myComp_enUS2 = MyCI->CompareInfo;
- MyCI = gcnew CultureInfo( "de-DE",false );
- CompareInfo^ myComp_deDE = MyCI->CompareInfo;
-
- // Creates the base SortKey to compare with all the others.
- SortKey^ mySK1 = myComp_enUS1->GetSortKey( "cant", CompareOptions::StringSort );
-
- // Creates a SortKey that is derived exactly the same way as the base SortKey.
- SortKey^ mySK2 = myComp_enUS1->GetSortKey( "cant", CompareOptions::StringSort );
-
- // Creates a SortKey that uses word sort, which is the default sort.
- SortKey^ mySK3 = myComp_enUS1->GetSortKey( "cant" );
-
- // Creates a SortKey for a different String*.
- SortKey^ mySK4 = myComp_enUS1->GetSortKey( "can't", CompareOptions::StringSort );
-
- // Creates a SortKey from a different CompareInfo with the same culture.
- SortKey^ mySK5 = myComp_enUS2->GetSortKey( "cant", CompareOptions::StringSort );
-
- // Creates a SortKey from a different CompareInfo with a different culture.
- SortKey^ mySK6 = myComp_deDE->GetSortKey( "cant", CompareOptions::StringSort );
-
- // Compares the base SortKey with itself.
- Console::WriteLine( "Comparing the base SortKey with itself: {0}", mySK1->Equals( mySK1 ) );
- Console::WriteLine();
-
- // Prints the header for the table.
- Console::WriteLine( "CompareInfo Culture OriginalString CompareOptions Equals()" );
-
- // Compares the base SortKey with a SortKey that is
- // created from the same CompareInfo with the same String* and the same CompareOptions.
- Console::WriteLine( "same same same same {0}", mySK1->Equals( mySK2 ) );
-
- // Compares the base SortKey with a SortKey that is
- // created from the same CompareInfo with the same String* but with different CompareOptions.
- Console::WriteLine( "same same same different {0}", mySK1->Equals( mySK3 ) );
-
- // Compares the base SortKey with a SortKey that is
- // created from the same CompareInfo with the different String*
- // but with the same CompareOptions.
- Console::WriteLine( "same same different same {0}", mySK1->Equals( mySK4 ) );
-
- // Compares the base SortKey with a SortKey that is
- // created from a different CompareInfo (same culture)
- // with the same String* and the same CompareOptions.
- Console::WriteLine( "different same same same {0}", mySK1->Equals( mySK5 ) );
-
- // Compares the base SortKey with a SortKey that is
- // created from a different CompareInfo (different culture)
- // with the same String* and the same CompareOptions.
- Console::WriteLine( "different different same same {0}", mySK1->Equals( mySK6 ) );
-}
-
-/*
-This code produces the following output.
-
-Comparing the base SortKey with itself: True
-
-CompareInfo Culture OriginalString CompareOptions Equals()
-same same same same True
-same same same different False
-same same different same False
-different same same same True
-different different same same False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp
deleted file mode 100644
index 59e7fbd6cec..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the second month in each
-// of 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a TaiwanCalendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, TaiwanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 90 91 92 93 94
-CurrentEra: 28 28 28 29 28
-Era 1: 28 28 28 29 28
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp
deleted file mode 100644
index be31d941d3e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a TaiwanCalendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, TaiwanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 90 91 92 93 94
-CurrentEra: 365 365 365 366 365
-Era 1: 365 365 365 366 365
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp
deleted file mode 100644
index 5dd8e46be7e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetMonthsInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a TaiwanCalendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, TaiwanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 90 91 92 93 94
-CurrentEra: 12 12 12 12 12
-Era 1: 12 12 12 12 12
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp
deleted file mode 100644
index 89fc7fb7e6f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-// The following code example calls IsLeapDay for the last day of the second month (February) for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a TaiwanCalendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
-
- // Creates a holder for the last day of the second month (February).
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t{0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 90; y <= 94; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, TaiwanCalendar::CurrentEra );
- Console::Write( "\t{0}", myCal->IsLeapDay( y, 2, iLastDay, TaiwanCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 90; y <= 94; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t{0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
-
- }
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 90 91 92 93 94
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp
deleted file mode 100644
index 914453cabe8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months in five years in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a TaiwanCalendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 90; y <= 94; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, TaiwanCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, TaiwanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-90: False False False False False False False False False False False False
-91: False False False False False False False False False False False False
-92: False False False False False False False False False False False False
-93: False False False False False False False False False False False False
-94: False False False False False False False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp
deleted file mode 100644
index dc8bffdcf80..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls IsLeapYear for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a TaiwanCalendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, TaiwanCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 90; y <= 94; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 90 91 92 93 94
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp
deleted file mode 100644
index 99c84b107ab..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the Taiwan calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the TaiwanCalendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Taiwan calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar equals the following in the Taiwan calendar:
- Era: 1
- Year: 91
- Month: 4
- DayOfYear: 93
- DayOfMonth: 3
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 1
- Year: 94
- Month: 2
- DayOfYear: 34
- DayOfMonth: 3
- DayOfWeek: Thursday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp
deleted file mode 100644
index 3deda76056f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-// The following code example gets the minimum value and the maximum value of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Create an instance of the calendar.
- TaiwanCalendar^ myCal = gcnew TaiwanCalendar;
- Console::WriteLine( myCal );
-
- // Create an instance of the GregorianCalendar.
- GregorianCalendar^ myGre = gcnew GregorianCalendar;
-
- // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.TaiwanCalendar
-MinSupportedDateTime: 01/01/0001 (in Gregorian, 01/01/1912)
-MaxSupportedDateTime: 12/31/8088 (in Gregorian, 12/31/9999)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp
deleted file mode 100644
index 9e73e264824..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-// The following code example shows the values returned by TextElementEnumerator.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a String containing the following:
- // - a surrogate pair (high surrogate U+D800 and low surrogate U+DC00)
- // - a combining character sequence (the Latin small letter S"a" followed by the combining grave accent)
- // - a base character (the ligature S"")
- String^ myString = L"\xD800\xDC00"
- L"a\u0300\u00C6";
-
- // Creates and initializes a TextElementEnumerator for myString.
- TextElementEnumerator^ myTEE = StringInfo::GetTextElementEnumerator( myString );
-
- // Displays the values returned by ElementIndex, Current and GetTextElement.
- // Current and GetTextElement return a String* containing the entire text element.
- Console::WriteLine( "Index\tCurrent\tGetTextElement" );
- myTEE->Reset();
- while ( myTEE->MoveNext() )
- Console::WriteLine( "[{0}]:\t {1}\t {2}", myTEE->ElementIndex, myTEE->Current, myTEE->GetTextElement() );
-}
-
-/*
-This code produces the following output. The question marks take the place of high and low surrogates.
-
-Index Current GetTextElement
-[0]: 𐀀 𐀀
-[2]: à à
-[4]: Æ Æ
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp
deleted file mode 100644
index c77a0736012..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-// The following code example changes the casing of a String*.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Defines the String* with mixed casing.
- String^ myString = "wAr aNd pEaCe";
-
- // Creates a TextInfo based on the S"en-US" culture.
- CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
- TextInfo^ myTI = MyCI->TextInfo;
-
- // Changes a String* to lowercase.
- Console::WriteLine( "\"{0}\" to lowercase: {1}", myString, myTI->ToLower( myString ) );
-
- // Changes a String* to uppercase.
- Console::WriteLine( "\"{0}\" to uppercase: {1}", myString, myTI->ToUpper( myString ) );
-
- // Changes a String* to titlecase.
- Console::WriteLine( "\"{0}\" to titlecase: {1}", myString, myTI->ToTitleCase( myString ) );
-}
-
-/*
-This code produces the following output.
-
-S"wAr aNd pEaCe" to lowercase: war and peace
-S"wAr aNd pEaCe" to uppercase: WAR AND PEACE
-S"wAr aNd pEaCe" to titlecase: War And Peace
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp
deleted file mode 100644
index 88271b26c94..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example calls GetDaysInMonth for the second month in each of 5
-// years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a ThaiBuddhistCalendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, ThaiBuddhistCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2544 2545 2546 2547 2548
-CurrentEra: 28 28 28 29 28
-Era 1: 28 28 28 29 28
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp
deleted file mode 100644
index 9aa2d9d8dee..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetDaysInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a ThaiBuddhistCalendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, ThaiBuddhistCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2544 2545 2546 2547 2548
-CurrentEra: 365 365 365 366 365
-Era 1: 365 365 365 366 365
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp
deleted file mode 100644
index 3a8a6d35a73..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls GetMonthsInYear for 5 years in each era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a ThaiBuddhistCalendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Displays the value of the CurrentEra property.
- Console::Write( "CurrentEra:" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, ThaiBuddhistCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Displays the values in the Eras property.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2544 2545 2546 2547 2548
-CurrentEra: 12 12 12 12 12
-Era 1: 12 12 12 12 12
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp
deleted file mode 100644
index 356591167c0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-// The following code example calls IsLeapDay for the last day of the
-// second month (February) for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a ThaiBuddhistCalendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
-
- // Creates a holder for the last day of the second month (February).
- int iLastDay;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 2544; y <= 2548; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, ThaiBuddhistCalendar::CurrentEra );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, ThaiBuddhistCalendar::CurrentEra ) );
-
- }
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2544; y <= 2548; y++ )
- {
- iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
- Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
-
- }
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2544 2545 2546 2547 2548
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp
deleted file mode 100644
index 23dd963fa16..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-// The following code example calls IsLeapMonth for all the months in five years in the current era.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a ThaiBuddhistCalendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
-
- // Checks all the months in five years in the current era.
- int iMonthsInYear;
- for ( int y = 2544; y <= 2548; y++ )
- {
- Console::Write( " {0}:\t", y );
- iMonthsInYear = myCal->GetMonthsInYear( y, ThaiBuddhistCalendar::CurrentEra );
- for ( int m = 1; m <= iMonthsInYear; m++ )
- Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, ThaiBuddhistCalendar::CurrentEra ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-2544: False False False False False False False False False False False False
-2545: False False False False False False False False False False False False
-2546: False False False False False False False False False False False False
-2547: False False False False False False False False False False False False
-2548: False False False False False False False False False False False False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp
deleted file mode 100644
index f8db76f0cbb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// The following code example calls IsLeapYear for five years in each of the eras.
-//
-using namespace System;
-using namespace System::Globalization;
-int main()
-{
-
- // Creates and initializes a ThaiBuddhistCalendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
-
- // Displays the header.
- Console::Write( "YEAR\t" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", y );
- Console::WriteLine();
-
- // Checks five years in the current era.
- Console::Write( "CurrentEra:" );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, ThaiBuddhistCalendar::CurrentEra ) );
- Console::WriteLine();
-
- // Checks five years in each of the eras.
- for ( int i = 0; i < myCal->Eras->Length; i++ )
- {
- Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
- for ( int y = 2544; y <= 2548; y++ )
- Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
- Console::WriteLine();
-
- }
-}
-
-/*
-This code produces the following output.
-
-YEAR 2544 2545 2546 2547 2548
-CurrentEra: False False False True False
-Era 1: False False False True False
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp
deleted file mode 100644
index 814657e163c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// The following code example displays the values of several components of a DateTime in terms of the ThaiBuddhist calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-void DisplayValues( Calendar^ myCal, DateTime myDT )
-{
- Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) );
- Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) );
- Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) );
- Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) );
- Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) );
- Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
- DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
-
- // Creates an instance of the ThaiBuddhistCalendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
-
- // Displays the values of the DateTime.
- Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the ThaiBuddhist calendar:" );
- DisplayValues( myCal, myDT );
-
- // Adds two years and ten months.
- myDT = myCal->AddYears( myDT, 2 );
- myDT = myCal->AddMonths( myDT, 10 );
-
- // Displays the values of the DateTime.
- Console::WriteLine( "After adding two years and ten months:" );
- DisplayValues( myCal, myDT );
-}
-
-/*
-This code produces the following output.
-
-April 3, 2002 of the Gregorian calendar equals the following in the ThaiBuddhist calendar:
- Era: 1
- Year: 2545
- Month: 4
- DayOfYear: 93
- DayOfMonth: 3
- DayOfWeek: Wednesday
-
-After adding two years and ten months:
- Era: 1
- Year: 2548
- Month: 2
- DayOfYear: 34
- DayOfMonth: 3
- DayOfWeek: Thursday
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp
deleted file mode 100644
index a3628cd7019..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// The following code example gets the minimum date and the maximum date of the calendar.
-//
-using namespace System;
-using namespace System::Globalization;
-
-int main()
-{
- // Create an instance of the calendar.
- ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar;
- Console::WriteLine( myCal );
-
- // Create an instance of the GregorianCalendar.
- GregorianCalendar^ myGre = gcnew GregorianCalendar;
-
- // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMin = myCal->MinSupportedDateTime;
- Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) );
-
- // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
- DateTime myMax = myCal->MaxSupportedDateTime;
- Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) );
- Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) );
-}
-
-/*
-This code produces the following output.
-
-System.Globalization.ThaiBuddhistCalendar
-MinSupportedDateTime: 01/01/0544 (in Gregorian, 01/01/0001)
-MaxSupportedDateTime: 12/31/10542 (in Gregorian, 12/31/9999)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp
deleted file mode 100644
index f1c0b919c12..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- int i = 0;
-
- // Create random data to write to the stream.
- array^writeArray = gcnew array(1000);
- (gcnew Random)->NextBytes( writeArray );
- BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream );
- BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream );
- try
- {
-
- // Write the data to the stream.
- Console::WriteLine( "Writing the data." );
- for ( i = 0; i < writeArray->Length; i++ )
- {
- binWriter->Write( writeArray[ i ] );
-
- }
-
- // Set the stream position to the beginning of the stream.
- binReader->BaseStream->Position = 0;
-
- // Read and verify the data from the stream.
- for ( i = 0; i < writeArray->Length; i++ )
- {
- if ( binReader->ReadByte() != writeArray[ i ] )
- {
- Console::WriteLine( "Error writing the data." );
- return -1;
- }
-
- }
- Console::WriteLine( "The data was written and verified." );
- }
- // Catch the EndOfStreamException and write an error message.
- catch ( EndOfStreamException^ e )
- {
- Console::WriteLine( "Error writing the data.\n{0}", e->GetType()->Name );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp
deleted file mode 100644
index a47e5998074..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- const int arrayLength = 1000;
-
- // Create random data to write to the stream.
- array^dataArray = gcnew array(arrayLength);
- (gcnew Random)->NextBytes( dataArray );
- BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream );
-
- // Write the data to the stream.
- Console::WriteLine( "Writing the data." );
- binWriter->Write( dataArray );
-
- // Create the reader using the stream from the writer.
- BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream );
-
- // Set the stream position to the beginning of the stream.
- binReader->BaseStream->Position = 0;
-
- // Read and verify the data.
- array^verifyArray = binReader->ReadBytes( arrayLength );
- if ( verifyArray->Length != arrayLength )
- {
- Console::WriteLine( "Error writing the data." );
- return -1;
- }
-
- for ( int i = 0; i < arrayLength; i++ )
- {
- if ( verifyArray[ i ] != dataArray[ i ] )
- {
- Console::WriteLine( "Error writing the data." );
- return -1;
- }
-
- }
- Console::WriteLine( "The data was written and verified." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp
deleted file mode 100644
index f77f117e2d3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- int i;
- array^invalidPathChars = Path::InvalidPathChars;
- MemoryStream^ memStream = gcnew MemoryStream;
- BinaryWriter^ binWriter = gcnew BinaryWriter( memStream );
-
- // Write to memory.
- binWriter->Write( "Invalid file path characters are: " );
- for ( i = 0; i < invalidPathChars->Length; i++ )
- {
- binWriter->Write( invalidPathChars[ i ] );
-
- }
-
- // Create the reader using the same MemoryStream
- // as used with the writer.
- BinaryReader^ binReader = gcnew BinaryReader( memStream );
-
- // Set Position to the beginning of the stream.
- binReader->BaseStream->Position = 0;
-
- // Read the data from memory and write it to the console.
- Console::Write( binReader->ReadString() );
- array^memoryData = gcnew array(memStream->Length - memStream->Position);
- for ( i = 0; i < memoryData->Length; i++ )
- {
- memoryData[ i ] = binReader->ReadChar();
-
- }
- Console::WriteLine( memoryData );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp
deleted file mode 100644
index 1e60a82c46f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- int i;
- array^invalidPathChars = Path::InvalidPathChars;
- MemoryStream^ memStream = gcnew MemoryStream;
- BinaryWriter^ binWriter = gcnew BinaryWriter( memStream );
-
- // Write to memory.
- binWriter->Write( "Invalid file path characters are: " );
- for ( i = 0; i < invalidPathChars->Length; i++ )
- {
- binWriter->Write( invalidPathChars[ i ] );
-
- }
-
- // Create the reader using the same MemoryStream
- // as used with the writer.
- BinaryReader^ binReader = gcnew BinaryReader( memStream );
-
- // Set Position to the beginning of the stream.
- binReader->BaseStream->Position = 0;
-
- // Read the data from memory and write it to the console.
- Console::Write( binReader->ReadString() );
- array^memoryData = gcnew array(memStream->Length - memStream->Position);
- for ( i = 0; i < memoryData->Length; i++ )
- {
- memoryData[ i ] = Convert::ToChar( binReader->Read() );
-
- }
- Console::WriteLine( memoryData );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp
deleted file mode 100644
index 18e3d52cf62..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- array^invalidPathChars = Path::InvalidPathChars;
- MemoryStream^ memStream = gcnew MemoryStream;
- BinaryWriter^ binWriter = gcnew BinaryWriter( memStream );
-
- // Write to memory.
- binWriter->Write( "Invalid file path characters are: " );
- binWriter->Write( Path::InvalidPathChars );
-
- // Create the reader using the same MemoryStream
- // as used with the writer.
- BinaryReader^ binReader = gcnew BinaryReader( memStream );
-
- // Set Position to the beginning of the stream.
- binReader->BaseStream->Position = 0;
-
- // Read the data from memory and write it to the console.
- Console::Write( binReader->ReadString() );
- Console::WriteLine( binReader->ReadChars( (int)(memStream->Length - memStream->Position) ) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp
deleted file mode 100644
index 591906554cb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- array^invalidPathChars = Path::InvalidPathChars;
- MemoryStream^ memStream = gcnew MemoryStream;
- BinaryWriter^ binWriter = gcnew BinaryWriter( memStream );
-
- // Write to memory.
- binWriter->Write( "Invalid file path characters are: " );
- binWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length );
-
- // Create the reader using the same MemoryStream
- // as used with the writer.
- BinaryReader^ binReader = gcnew BinaryReader( memStream );
-
- // Set Position to the beginning of the stream.
- binReader->BaseStream->Position = 0;
-
- // Read the data from memory and write it to the console.
- Console::Write( binReader->ReadString() );
- int arraySize = (int)(memStream->Length - memStream->Position);
- array^memoryData = gcnew array(arraySize);
- binReader->Read( memoryData, 0, arraySize );
- Console::WriteLine( memoryData );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp
deleted file mode 100644
index 68e90396c8a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- int i;
- const int arrayLength = 1000;
-
- // Create random data to write to the stream.
- array^dataArray = gcnew array(arrayLength);
- Random^ randomGenerator = gcnew Random;
- for ( i = 0; i < arrayLength; i++ )
- {
- dataArray[ i ] = 100.1 * randomGenerator->NextDouble();
-
- }
- BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream );
- try
- {
-
- // Write data to the stream.
- Console::WriteLine( "Writing data to the stream." );
- i = 0;
- for ( i = 0; i < arrayLength; i++ )
- {
- binWriter->Write( dataArray[ i ] );
-
- }
-
- // Create a reader using the stream from the writer.
- BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream );
-
- // Return to the beginning of the stream.
- binReader->BaseStream->Position = 0;
- try
- {
-
- // Read and verify the data.
- i = 0;
- Console::WriteLine( "Verifying the written data." );
- for ( i = 0; i < arrayLength; i++ )
- {
- if ( binReader->ReadDouble() != dataArray[ i ] )
- {
- Console::WriteLine( "Error writing data." );
- break;
- }
-
- }
- Console::WriteLine( "The data was written and verified." );
- }
- catch ( EndOfStreamException^ e )
- {
- Console::WriteLine( "Error writing data: {0}.", e->GetType()->Name );
- }
-
- }
- finally
- {
- binWriter->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp
deleted file mode 100644
index 432c26e3d9c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-public ref class BinReadWrite
-{
-public:
- static void Main()
- {
- String^ testfile = "C:\\temp\\testfile.bin";
-
- // create a test file using BinaryWriter
- FileStream^ fs = File::Create(testfile);
- UTF8Encoding^ utf8 = gcnew UTF8Encoding();
-
- BinaryWriter^ bw = gcnew BinaryWriter(fs, utf8);
- // write a series of bytes to the file, each time incrementing
- // the value from 0 - 127
- int pos;
-
- for (pos = 0; pos < 128; pos++)
- {
- bw->Write((Byte)pos);
- }
-
- // reset the stream position for the next write pass
- bw->Seek(0, SeekOrigin::Begin);
- // write marks in file with the value of 255 going forward
- for (pos = 0; pos < 120; pos += 8)
- {
- bw->Seek(7, SeekOrigin::Current);
- bw->Write((Byte)255);
- }
-
- // reset the stream position for the next write pass
- bw->Seek(0, SeekOrigin::End);
- // write marks in file with the value of 254 going backward
- for (pos = 128; pos > 6; pos -= 6)
- {
- bw->Seek(-6, SeekOrigin::Current);
- bw->Write((Byte)254);
- bw->Seek(-1, SeekOrigin::Current);
- }
-
- // now dump the contents of the file using the original file stream
- fs->Seek(0, SeekOrigin::Begin);
- array^ rawbytes = gcnew array(fs->Length);
- fs->Read(rawbytes, 0, (int)fs->Length);
-
- int i = 0;
- for each (Byte b in rawbytes)
- {
- switch (b)
- {
- case 254:
- {
- Console::Write("-%- ");
- }
- break;
-
- case 255:
- {
- Console::Write("-*- ");
- }
- break;
-
- default:
- {
- Console::Write("{0:d3} ", b);
- }
- break;
- }
- i++;
- if (i == 16)
- {
- Console::WriteLine();
- i = 0;
- }
- }
- fs->Close();
- }
-};
-
-int main()
-{
- BinReadWrite::Main();
-}
-
-//The output from the program is this:
-//
-// 000 001 -%- 003 004 005 006 -*- -%- 009 010 011 012 013 -%- -*-
-// 016 017 018 019 -%- 021 022 -*- 024 025 -%- 027 028 029 030 -*-
-// -%- 033 034 035 036 037 -%- -*- 040 041 042 043 -%- 045 046 -*-
-// 048 049 -%- 051 052 053 054 -*- -%- 057 058 059 060 061 -%- -*-
-// 064 065 066 067 -%- 069 070 -*- 072 073 -%- 075 076 077 078 -*-
-// -%- 081 082 083 084 085 -%- -*- 088 089 090 091 -%- 093 094 -*-
-// 096 097 -%- 099 100 101 102 -*- -%- 105 106 107 108 109 -%- -*-
-// 112 113 114 115 -%- 117 118 -*- 120 121 -%- 123 124 125 126 127
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp
deleted file mode 100644
index c0d99cbb370..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Globalization;
-using namespace System::Net;
-using namespace System::Net::Sockets;
-static const int streamBufferSize = 1000;
-public ref class Client
-{
-private:
- literal int dataArraySize = 100;
- literal int numberOfLoops = 10000;
- Client(){}
-
-
-public:
- static void ReceiveData( Stream^ netStream, Stream^ bufStream )
- {
- DateTime startTime;
- Double networkTime;
- Double bufferedTime = 0;
- int bytesReceived = 0;
- array^receivedData = gcnew array(dataArraySize);
-
- // Receive data using the NetworkStream.
- Console::WriteLine( "Receiving data using NetworkStream." );
- startTime = DateTime::Now;
- while ( bytesReceived < numberOfLoops * receivedData->Length )
- {
- bytesReceived += netStream->Read( receivedData, 0, receivedData->Length );
- }
-
- networkTime = (DateTime::Now - startTime).TotalSeconds;
- Console::WriteLine( "{0} bytes received in {1} seconds.\n", bytesReceived.ToString(), networkTime.ToString( "F1" ) );
-
- //
- // Receive data using the BufferedStream.
- Console::WriteLine( "Receiving data using BufferedStream." );
- bytesReceived = 0;
- startTime = DateTime::Now;
- while ( bytesReceived < numberOfLoops * receivedData->Length )
- {
- bytesReceived += bufStream->Read( receivedData, 0, receivedData->Length );
- }
-
- bufferedTime = (DateTime::Now - startTime).TotalSeconds;
- Console::WriteLine( "{0} bytes received in {1} seconds.\n", bytesReceived.ToString(), bufferedTime.ToString( "F1" ) );
-
- //
- // Print the ratio of read times.
- Console::WriteLine( "Receiving data using the buffered "
- "network stream was {0} {1} than using the network "
- "stream alone.", (networkTime / bufferedTime).ToString( "P0" ), bufferedTime < networkTime ? (String^)"faster" : "slower" );
- }
-
- static void SendData( Stream^ netStream, Stream^ bufStream )
- {
- DateTime startTime;
- Double networkTime;
- Double bufferedTime;
-
- // Create random data to send to the server.
- array^dataToSend = gcnew array(dataArraySize);
- (gcnew Random)->NextBytes( dataToSend );
-
- // Send the data using the NetworkStream.
- Console::WriteLine( "Sending data using NetworkStream." );
- startTime = DateTime::Now;
- for ( int i = 0; i < numberOfLoops; i++ )
- {
- netStream->Write( dataToSend, 0, dataToSend->Length );
-
- }
- networkTime = (DateTime::Now - startTime).TotalSeconds;
- Console::WriteLine( "{0} bytes sent in {1} seconds.\n", (numberOfLoops * dataToSend->Length).ToString(), networkTime.ToString( "F1" ) );
-
- //
- // Send the data using the BufferedStream.
- Console::WriteLine( "Sending data using BufferedStream." );
- startTime = DateTime::Now;
- for ( int i = 0; i < numberOfLoops; i++ )
- {
- bufStream->Write( dataToSend, 0, dataToSend->Length );
-
- }
- bufStream->Flush();
- bufferedTime = (DateTime::Now - startTime).TotalSeconds;
- Console::WriteLine( "{0} bytes sent in {1} seconds.\n", (numberOfLoops * dataToSend->Length).ToString(), bufferedTime.ToString( "F1" ) );
-
- //
- // Print the ratio of write times.
- Console::WriteLine( "Sending data using the buffered "
- "network stream was {0} {1} than using the network "
- "stream alone.\n", (networkTime / bufferedTime).ToString( "P0" ), bufferedTime < networkTime ? (String^)"faster" : "slower" );
- }
-
-};
-
-int main( int argc, char *argv[] )
-{
-
- // Check that an argument was specified when the
- // program was invoked.
- if ( argc == 1 )
- {
- Console::WriteLine( "Error: The name of the host computer"
- " must be specified when the program is invoked." );
- return -1;
- }
-
- String^ remoteName = gcnew String( argv[ 1 ] );
-
- // Create the underlying socket and connect to the server.
- Socket^ clientSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp );
- clientSocket->Connect( gcnew IPEndPoint( Dns::Resolve( remoteName )->AddressList[ 0 ],1800 ) );
- Console::WriteLine( "Client is connected.\n" );
-
- //
- // Create a NetworkStream that owns clientSocket and
- // then create a BufferedStream on top of the NetworkStream.
- NetworkStream^ netStream = gcnew NetworkStream( clientSocket,true );
- BufferedStream^ bufStream = gcnew BufferedStream( netStream,streamBufferSize );
-
- //
- try
- {
-
- //
- // Check whether the underlying stream supports seeking.
- Console::WriteLine( "NetworkStream {0} seeking.\n", bufStream->CanSeek ? (String^)"supports" : "does not support" );
-
- //
- // Send and receive data.
- //
- if ( bufStream->CanWrite )
- {
- Client::SendData( netStream, bufStream );
- }
-
- //
- //
- if ( bufStream->CanRead )
- {
- Client::ReceiveData( netStream, bufStream );
- }
-
- //
- }
- finally
- {
-
- //
- // When bufStream is closed, netStream is in turn closed,
- // which in turn shuts down the connection and closes
- // clientSocket.
- Console::WriteLine( "\nShutting down connection." );
- bufStream->Close();
-
- //
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp
deleted file mode 100644
index fef12f4fa47..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Net;
-using namespace System::Net::Sockets;
-int main()
-{
-
- // This is a Windows Sockets 2 error code.
- const int WSAETIMEDOUT = 10060;
- Socket^ serverSocket;
- int bytesReceived;
- int totalReceived = 0;
- array^receivedData = gcnew array(2000000);
-
- // Create random data to send to the client.
- array^dataToSend = gcnew array(2000000);
- (gcnew Random)->NextBytes( dataToSend );
- IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ];
- IPEndPoint^ ipEndpoint = gcnew IPEndPoint( ipAddress,1800 );
-
- // Create a socket and listen for incoming connections.
- Socket^ listenSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp );
- try
- {
- listenSocket->Bind( ipEndpoint );
- listenSocket->Listen( 1 );
-
- // Accept a connection and create a socket to handle it.
- serverSocket = listenSocket->Accept();
- Console::WriteLine( "Server is connected.\n" );
- }
- finally
- {
- listenSocket->Close();
- }
-
- try
- {
-
- // Send data to the client.
- Console::Write( "Sending data ... " );
- int bytesSent = serverSocket->Send( dataToSend, 0, dataToSend->Length, SocketFlags::None );
- Console::WriteLine( "{0} bytes sent.\n", bytesSent.ToString() );
-
- // Set the timeout for receiving data to 2 seconds.
- serverSocket->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::ReceiveTimeout, 2000 );
-
- // Receive data from the client.
- Console::Write( "Receiving data ... " );
- try
- {
- do
- {
- bytesReceived = serverSocket->Receive( receivedData, 0, receivedData->Length, SocketFlags::None );
- totalReceived += bytesReceived;
- }
- while ( bytesReceived != 0 );
- }
- catch ( SocketException^ e )
- {
- if ( e->ErrorCode == WSAETIMEDOUT )
- {
-
- // Data was not received within the given time.
- // Assume that the transmission has ended.
- }
- else
- {
- Console::WriteLine( "{0}: {1}\n", e->GetType()->Name, e->Message );
- }
- }
- finally
- {
- Console::WriteLine( "{0} bytes received.\n", totalReceived.ToString() );
- }
-
- }
- finally
- {
- serverSocket->Shutdown( SocketShutdown::Both );
- Console::WriteLine( "Connection shut down." );
- serverSocket->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp
deleted file mode 100644
index c11186b5225..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-
-//
-//
-//
-//
-//
-using namespace System;
-class Class1
-{
-public:
- void PrintFileSystemEntries( String^ path )
- {
- try
- {
-
- // Obtain the file system entries in the directory path.
- array^directoryEntries = System::IO::Directory::GetFileSystemEntries( path );
- for ( int i = 0; i < directoryEntries->Length; i++ )
- {
- System::Console::WriteLine( directoryEntries[ i ] );
-
- }
- }
- catch ( ArgumentNullException^ )
- {
- System::Console::WriteLine( "Path is a null reference." );
- }
- catch ( System::Security::SecurityException^ )
- {
- System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." );
- }
- catch ( ArgumentException^ )
- {
- System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." );
- }
- catch ( System::IO::DirectoryNotFoundException^ )
- {
- System::Console::WriteLine( "The path encapsulated in the \HelloServer' Directory object does not exist." );
- }
-
- }
-
- void PrintFileSystemEntries( String^ path, String^ pattern )
- {
- try
- {
-
- // Obtain the file system entries in the directory
- // path that match the pattern.
- array^directoryEntries = System::IO::Directory::GetFileSystemEntries( path, pattern );
- for ( int i = 0; i < directoryEntries->Length; i++ )
- {
- System::Console::WriteLine( directoryEntries[ i ] );
-
- }
- }
- catch ( ArgumentNullException^ )
- {
- System::Console::WriteLine( "Path is a null reference." );
- }
- catch ( System::Security::SecurityException^ )
- {
- System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." );
- }
- catch ( ArgumentException^ )
- {
- System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." );
- }
- catch ( System::IO::DirectoryNotFoundException^ )
- {
- System::Console::WriteLine( "The path encapsulated in the \HelloServer' Directory object does not exist." );
- }
-
- }
-
-
- // Print out all logical drives on the system.
- void GetLogicalDrives()
- {
- try
- {
- array^drives = System::IO::Directory::GetLogicalDrives();
- for ( int i = 0; i < drives->Length; i++ )
- {
- System::Console::WriteLine( drives[ i ] );
-
- }
- }
- catch ( System::IO::IOException^ )
- {
- System::Console::WriteLine( "An I/O error occurs." );
- }
- catch ( System::Security::SecurityException^ )
- {
- System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." );
- }
-
- }
-
- void GetParent( String^ path )
- {
- try
- {
- System::IO::DirectoryInfo^ directoryInfo = System::IO::Directory::GetParent( path );
- System::Console::WriteLine( directoryInfo->FullName );
- }
- catch ( ArgumentNullException^ )
- {
- System::Console::WriteLine( "Path is a null reference." );
- }
- catch ( ArgumentException^ )
- {
- System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, or \HelloServer' contains invalid characters." );
- }
-
- }
-
- void Move( String^ sourcePath, String^ destinationPath )
- {
- try
- {
- System::IO::Directory::Move( sourcePath, destinationPath );
- System::Console::WriteLine( "The directory move is complete." );
- }
- catch ( ArgumentNullException^ )
- {
- System::Console::WriteLine( "Path is a null reference." );
- }
- catch ( System::Security::SecurityException^ )
- {
- System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." );
- }
- catch ( ArgumentException^ )
- {
- System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." );
- }
- catch ( System::IO::IOException^ )
- {
- System::Console::WriteLine( "An attempt was made to move a \HelloServer' directory to a different \HelloServer' volume, or destDirName \HelloServer' already exists." );
- }
-
- }
-
-};
-
-int main()
-{
- Class1 * snippets = new Class1;
- String^ path = System::IO::Directory::GetCurrentDirectory();
- String^ filter = "*.exe";
- snippets->PrintFileSystemEntries( path );
- snippets->PrintFileSystemEntries( path, filter );
- snippets->GetLogicalDrives();
- snippets->GetParent( path );
- snippets->Move( "C:\\proof", "C:\\Temp" );
- return 0;
-}
-
-//
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp
deleted file mode 100644
index 4223289ec56..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-
-ref class App
-{
-public:
- static void Main()
- {
- // Specify the directory you want to manipulate.
- String^ path = "c:\\";
- String^ searchPattern = "c*";
-
- DirectoryInfo^ di = gcnew DirectoryInfo(path);
- array^ directories =
- di->GetDirectories(searchPattern, SearchOption::TopDirectoryOnly);
-
- array^ files =
- di->GetFiles(searchPattern, SearchOption::TopDirectoryOnly);
-
- Console::WriteLine(
- "Directories that begin with the letter \"c\" in {0}", path);
- for each (DirectoryInfo^ dir in directories)
- {
- Console::WriteLine(
- "{0,-25} {1,25}", dir->FullName, dir->LastWriteTime);
- }
-
- Console::WriteLine();
- Console::WriteLine(
- "Files that begin with the letter \"c\" in {0}", path);
- for each (FileInfo^ file in files)
- {
- Console::WriteLine(
- "{0,-25} {1,25}", file->Name, file->LastWriteTime);
- }
- } // Main()
-}; // App()
-
-int main()
-{
- App::Main();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp
deleted file mode 100644
index 5bae2a921c4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-// This sample shows how to set the current directory and how to determine
-// the root directory.
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Create string for a directory. This value should be an existing directory
- // or the sample will throw a DirectoryNotFoundException.
- String^ dir = "C:\\test";
- try
- {
-
- //Set the current directory.
- Directory::SetCurrentDirectory( dir );
- }
- catch ( DirectoryNotFoundException^ e )
- {
- Console::WriteLine( "The specified directory does not exist. {0}", e );
- }
-
-
- // Print to console the results.
- Console::WriteLine( "Root directory: {0}", Directory::GetDirectoryRoot( dir ) );
- Console::WriteLine( "Current directory: {0}", Directory::GetCurrentDirectory() );
-}
-
-// The output of this sample depends on what value you assign to the variable dir.
-// If the directory c:\test exists, the output for this sample is:
-// Root directory: C:\
-// Current directory: C:\test
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp
deleted file mode 100644
index fc1124722e1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ fileName = "Test@##@.dat";
-
- // Create random data to write to the file.
- array^dataArray = gcnew array(100000);
- (gcnew Random)->NextBytes( dataArray );
- FileStream^ fileStream = gcnew FileStream( fileName,FileMode::Create );
- try
- {
-
- // Write the data to the file, byte by byte.
- for ( int i = 0; i < dataArray->Length; i++ )
- {
- fileStream->WriteByte( dataArray[ i ] );
-
- }
-
- // Set the stream position to the beginning of the file.
- fileStream->Seek( 0, SeekOrigin::Begin );
-
- // Read and verify the data.
- for ( int i = 0; i < fileStream->Length; i++ )
- {
- if ( dataArray[ i ] != fileStream->ReadByte() )
- {
- Console::WriteLine( "Error writing data." );
- return -1;
- }
-
- }
- Console::WriteLine( "The data was written to {0} "
- "and verified.", fileStream->Name );
- }
- finally
- {
- fileStream->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp
deleted file mode 100644
index e6d0b8b59b5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Threading;
-
-// Maintain state information to be passed to
-// EndWriteCallback and EndReadCallback.
-ref class State
-{
-private:
-
- // fStream is used to read and write to the file.
- FileStream^ fStream;
-
- // writeArray stores data that is written to the file.
- array^writeArray;
-
- // readArray stores data that is read from the file.
- array^readArray;
-
- // manualEvent signals the main thread
- // when verification is complete.
- ManualResetEvent^ manualEvent;
-
-public:
- State( FileStream^ fStream, array^writeArray, ManualResetEvent^ manualEvent )
- {
- this->fStream = fStream;
- this->writeArray = writeArray;
- this->manualEvent = manualEvent;
- readArray = gcnew array(writeArray->Length);
- }
-
-
- property FileStream^ FStream
- {
- FileStream^ get()
- {
- return fStream;
- }
-
- }
-
- property array^ WriteArray
- {
- array^ get()
- {
- return writeArray;
- }
-
- }
-
- property array^ ReadArray
- {
- array^ get()
- {
- return readArray;
- }
-
- }
-
- property ManualResetEvent^ ManualEvent
- {
- ManualResetEvent^ get()
- {
- return manualEvent;
- }
-
- }
-
-};
-
-ref class FStream
-{
-private:
-
- // When BeginRead is finished reading data from the file, the
- // EndReadCallback method is called to end the asynchronous
- // read operation and then verify the data.
- //
- static void EndReadCallback( IAsyncResult^ asyncResult )
- {
- State^ tempState = dynamic_cast(asyncResult->AsyncState);
- int readCount = tempState->FStream->EndRead( asyncResult );
- int i = 0;
- while ( i < readCount )
- {
- if ( tempState->ReadArray[ i ] != tempState->WriteArray[ i++ ] )
- {
- Console::WriteLine( "Error writing data." );
- tempState->FStream->Close();
- return;
- }
- }
-
- Console::WriteLine( "The data was written to {0} "
- "and verified.", tempState->FStream->Name );
- tempState->FStream->Close();
-
- // Signal the main thread that the verification is finished.
- tempState->ManualEvent->Set();
- }
-
-
-public:
-
- //
- // When BeginWrite is finished writing data to the file, the
- // EndWriteCallback method is called to end the asynchronous
- // write operation and then read back and verify the data.
- //
- static void EndWriteCallback( IAsyncResult^ asyncResult )
- {
- State^ tempState = dynamic_cast(asyncResult->AsyncState);
- FileStream^ fStream = tempState->FStream;
- fStream->EndWrite( asyncResult );
-
- // Asynchronously read back the written data.
- fStream->Position = 0;
- asyncResult = fStream->BeginRead( tempState->ReadArray, 0, tempState->ReadArray->Length, gcnew AsyncCallback( &FStream::EndReadCallback ), tempState );
-
- // Concurrently do other work, such as
- // logging the write operation.
- }
-
-};
-
-
-//
-//
-int main()
-{
-
- // Create a synchronization object that gets
- // signaled when verification is complete.
- ManualResetEvent^ manualEvent = gcnew ManualResetEvent( false );
-
- // Create the data to write to the file.
- array^writeArray = gcnew array(100000);
- (gcnew Random)->NextBytes( writeArray );
- FileStream^ fStream = gcnew FileStream( "Test#@@#.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::None,4096,true );
-
- // Check that the FileStream was opened asynchronously.
- Console::WriteLine( "fStream was {0}opened asynchronously.", fStream->IsAsync ? (String^)"" : "not " );
-
- // Asynchronously write to the file.
- IAsyncResult^ asyncResult = fStream->BeginWrite( writeArray, 0, writeArray->Length, gcnew AsyncCallback( &FStream::EndWriteCallback ), gcnew State( fStream,writeArray,manualEvent ) );
-
- // Concurrently do other work and then wait
- // for the data to be written and verified.
- manualEvent->WaitOne( 5000, false );
-}
-
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp
deleted file mode 100644
index c9d04e24506..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-int main()
-{
- UnicodeEncoding^ uniEncoding = gcnew UnicodeEncoding;
- String^ lastRecordText = "The last processed record number was: ";
- int textLength = uniEncoding->GetByteCount( lastRecordText );
- int recordNumber = 13;
- int byteCount = uniEncoding->GetByteCount( recordNumber.ToString() );
- String^ tempString;
-
- //
- FileStream^ fileStream = gcnew FileStream( "Test#@@#.dat",FileMode::OpenOrCreate,FileAccess::ReadWrite,FileShare::ReadWrite );
-
- //
- try
- {
-
- //
- // Write the original file data.
- if ( fileStream->Length == 0 )
- {
- tempString = String::Concat( lastRecordText, recordNumber.ToString() );
- fileStream->Write( uniEncoding->GetBytes( tempString ), 0, uniEncoding->GetByteCount( tempString ) );
- }
-
- //
- // Allow the user to choose the operation.
- Char consoleInput = 'R';
- array^readText = gcnew array(fileStream->Length);
- while ( consoleInput != 'X' )
- {
- Console::Write( "\nEnter 'R' to read, 'W' to write, 'L' to "
- "lock, 'U' to unlock, anything else to exit: " );
- if ( (tempString = Console::ReadLine())->Length == 0 )
- {
- break;
- }
- consoleInput = Char::ToUpper( tempString[0] );
- switch ( consoleInput )
- {
- case 'R':
- try
- {
- fileStream->Seek( 0, SeekOrigin::Begin );
- fileStream->Read( readText, 0, (int)fileStream->Length );
- tempString = gcnew String( uniEncoding->GetChars( readText, 0, readText->Length ) );
- Console::WriteLine( tempString );
- recordNumber = Int32::Parse( tempString->Substring( tempString->IndexOf( ':' ) + 2 ) );
- }
- // Catch the IOException generated if the
- // specified part of the file is locked.
- catch ( IOException^ e )
- {
- Console::WriteLine( "{0}: The read "
- "operation could not be performed "
- "because the specified part of the "
- "file is locked.", e->GetType()->Name );
- }
-
- break;
-
- //
- // Update the file.
- case 'W':
- try
- {
- fileStream->Seek( textLength, SeekOrigin::Begin );
- fileStream->Read( readText, textLength - 1, byteCount );
- tempString = gcnew String( uniEncoding->GetChars( readText, textLength - 1, byteCount ) );
- recordNumber = Int32::Parse( tempString ) + 1;
- fileStream->Seek( textLength, SeekOrigin::Begin );
- fileStream->Write( uniEncoding->GetBytes( recordNumber.ToString() ), 0, byteCount );
- fileStream->Flush();
- Console::WriteLine( "Record has been updated." );
- }
- //
- //
- // Catch the IOException generated if the
- // specified part of the file is locked.
- catch ( IOException^ e )
- {
- Console::WriteLine( "{0}: The write operation could not "
- "be performed because the specified "
- "part of the file is locked.", e->GetType()->Name );
- }
-
-
- //
- break;
-
- // Lock the specified part of the file.
- case 'L':
- try
- {
- fileStream->Lock( textLength - 1, byteCount );
- Console::WriteLine( "The specified part "
- "of file has been locked." );
- }
- catch ( IOException^ e )
- {
- Console::WriteLine( "{0}: The specified part of file is"
- " already locked.", e->GetType()->Name );
- }
-
- break;
-
- //
- // Unlock the specified part of the file.
- case 'U':
- try
- {
- fileStream->Unlock( textLength - 1, byteCount );
- Console::WriteLine( "The specified part "
- "of file has been unlocked." );
- }
- catch ( IOException^ e )
- {
- Console::WriteLine( "{0}: The specified part of file is "
- "not locked by the current process.", e->GetType()->Name );
- }
-
- break;
-
- default:
-
- //
- // Exit the program.
- consoleInput = 'X';
- break;
- }
- }
- }
- finally
- {
- fileStream->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp
deleted file mode 100644
index af3bee22a32..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-using namespace System;
-using namespace System::IO;
-using namespace System::IO::IsolatedStorage;
-
-public ref class IsoFileGetStoreSample
-{
-public:
- static void Main()
- {
- IsolatedStorageFile^ isoFile;
-
- // remarks for GetMachineStoreForApplication()
- //
- isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application |
- IsolatedStorageScope::Machine, (Type^)nullptr);
- //
- isoFile->Close();
-
- // remarks for GetMachineStoreForAssembly()
- //
- isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly |
- IsolatedStorageScope::Machine, (Type^)nullptr, (Type^)nullptr);
- //
- isoFile->Close();
-
- // remarks for GetMachineStoreForDomain()
- //
- isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly |
- IsolatedStorageScope::Domain | IsolatedStorageScope::Machine,
- (Type^)nullptr, (Type^)nullptr);
- //
- isoFile->Close();
-
- // remarks for GetUserStoreForApplication()
- //
- isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application |
- IsolatedStorageScope::User, (Type^)nullptr);
- //
- isoFile->Close();
-
- // remarks for GetUserStoreForAssembly()
- //
- isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly |
- IsolatedStorageScope::User, (Type^)nullptr, (Type^)nullptr);
- //
- isoFile->Close();
-
- // remarks for GetUserStoreForDomain()
- //
- isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly |
- IsolatedStorageScope::Domain | IsolatedStorageScope::User,
- (Type^)nullptr, (Type^)nullptr);
- //
- isoFile->Close();
- }
-};
-
-int main()
-{
- IsoFileGetStoreSample::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp
deleted file mode 100644
index daaf6e6e7ea..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-
-//
-// This sample demonstrates methods of classes found in the System.IO IsolatedStorage namespace.
-using namespace System;
-using namespace System::IO;
-using namespace System::IO::IsolatedStorage;
-using namespace System::Security::Policy;
-using namespace System::Security::Permissions;
-
-public ref class LoginPrefs
-{
-private:
- String^ userName;
- String^ newsUrl;
- String^ sportsUrl;
- bool newPrefs;
-
-public:
-
- //
- [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)]
- bool GetPrefsForUser()
- {
- try
- {
-
- //
- // Retrieve an IsolatedStorageFile for the current Domain and Assembly.
- IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), (Type^)nullptr, nullptr );
- IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::Open,FileAccess::ReadWrite,isoFile );
-
- //
- // farThe code executes to this point only if a file corresponding to the username exists.
- // Though you can perform operations on the stream, you cannot get a handle to the file.
- try
- {
- IntPtr aFileHandle = isoStream->Handle;
- Console::WriteLine( "A pointer to a file handle has been obtained. {0} {1}", aFileHandle, aFileHandle.GetHashCode() );
- }
- catch ( Exception^ e )
- {
-
- // Handle the exception.
- Console::WriteLine( "Expected exception" );
- Console::WriteLine( e->ToString() );
- }
-
- StreamReader^ reader = gcnew StreamReader( isoStream );
-
- // Read the data.
- this->NewsUrl = reader->ReadLine();
- this->SportsUrl = reader->ReadLine();
- reader->Close();
- isoFile->Close();
- isoStream->Close();
- return false;
- }
- catch ( Exception^ e )
- {
-
- // Expected exception if a file cannot be found. This indicates that we have a new user.
- String^ errorMessage = e->ToString();
- return true;
- }
-
- }
-
-
- //
- //
- bool GetIsoStoreInfo()
- {
-
- // Get a User store with type evidence for the current Domain and the Assembly.
- IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid );
-
- //
- array^dirNames = isoFile->GetDirectoryNames( "*" );
- array^fileNames = isoFile->GetFileNames( "*" );
-
- // List directories currently in this Isolated Storage.
- if ( dirNames->Length > 0 )
- {
- for ( int i = 0; i < dirNames->Length; ++i )
- {
- Console::WriteLine( "Directory Name: {0}", dirNames[ i ] );
-
- }
- }
-
-
- // List the files currently in this Isolated Storage.
- // The list represents all users who have personal preferences stored for this application.
- if ( fileNames->Length > 0 )
- {
- for ( int i = 0; i < fileNames->Length; ++i )
- {
- Console::WriteLine( "File Name: {0}", fileNames[ i ] );
-
- }
- }
-
-
- //
- isoFile->Close();
- return true;
- }
-
-
- //
- //
- double SetPrefsForUser()
- {
- try
- {
-
- //
- IsolatedStorageFile^ isoFile;
- isoFile = IsolatedStorageFile::GetUserStoreForDomain();
-
- // Open or create a writable file.
- IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,isoFile );
- StreamWriter^ writer = gcnew StreamWriter( isoStream );
- writer->WriteLine( this->NewsUrl );
- writer->WriteLine( this->SportsUrl );
-
- // Calculate the amount of space used to record the user's preferences.
- double d = isoFile->CurrentSize / isoFile->MaximumSize;
- Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() );
- Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() );
- writer->Close();
- isoFile->Close();
- isoStream->Close();
- return d;
-
- //
- }
- catch ( Exception^ e )
- {
- // Add code here to handle the exception.
- Console::WriteLine( e->ToString() );
- return 0.0;
- }
-
- }
-
-
- //
- //
- void DeleteFiles()
- {
-
- //
- try
- {
- IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid );
- array^dirNames = isoFile->GetDirectoryNames( "*" );
- array^fileNames = isoFile->GetFileNames( "*" );
-
- //
- // List the files currently in this Isolated Storage.
- // The list represents all users who have personal
- // preferences stored for this application.
- if ( fileNames->Length > 0 )
- {
- for ( int i = 0; i < fileNames->Length; ++i )
- {
-
- //Delete the files.
- isoFile->DeleteFile( fileNames[ i ] );
-
- }
- fileNames = isoFile->GetFileNames( "*" );
- }
- isoFile->Close();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->ToString() );
- }
-
- }
-
-
- //
- //
- // This method deletes directories in the specified Isolated Storage, after first
- // deleting the files they contain. In this example, the Archive directory is deleted.
- // There should be no other directories in this Isolated Storage.
- void DeleteDirectories()
- {
- try
- {
- IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid );
- array^dirNames = isoFile->GetDirectoryNames( "*" );
- array^fileNames = isoFile->GetFileNames( "Archive\\*" );
-
- // Delete the current files within the Archive directory.
- if ( fileNames->Length > 0 )
- {
- for ( int i = 0; i < fileNames->Length; ++i )
- {
-
- //delete files
- isoFile->DeleteFile( String::Concat("Archive\\", fileNames[ i ]) );
-
- }
- fileNames = isoFile->GetFileNames( "Archive\\*" );
- }
- if ( dirNames->Length > 0 )
- {
- for ( int i = 0; i < dirNames->Length; ++i )
- {
-
- // Delete the Archive directory.
- isoFile->DeleteDirectory( dirNames[ i ] );
-
- }
- }
- dirNames = isoFile->GetDirectoryNames( "*" );
- isoFile->Remove();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->ToString() );
- }
-
- }
-
-
- //
- //
- double SetNewPrefsForUser()
- {
- try
- {
- Byte inputChar;
- IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid );
-
- // If this is not a new user, archive the old preferences and
- // overwrite them using the new preferences.
- if ( !this->NewPrefs )
- {
- if ( isoFile->GetDirectoryNames( "Archive" )->Length == 0 )
- isoFile->CreateDirectory( "Archive" );
- else
- {
-
- //
- // This is the stream to which data will be written.
- IsolatedStorageFileStream^ source = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,isoFile );
-
- // This is the stream from which data will be read.
- Console::WriteLine( "Is the source file readable? {0}", (source->CanRead ? (String^)"true" : "false") );
- Console::WriteLine( "Creating new IsolatedStorageFileStream for Archive." );
-
- // Open or create a writable file.
- IsolatedStorageFileStream^ target = gcnew IsolatedStorageFileStream( String::Concat("Archive\\",this->userName),FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,isoFile );
-
- //
- //
- Console::WriteLine( "Is the target file writable? {0}", (target->CanWrite ? (String^)"true" : "false") );
-
- //
- // Stream the old file to a new file in the Archive directory.
- if ( source->IsAsync && target->IsAsync )
- {
-
- // IsolatedStorageFileStreams cannot be asynchronous. However, you
- // can use the asynchronous BeginRead and BeginWrite functions
- // with some possible performance penalty.
- Console::WriteLine( "IsolatedStorageFileStreams cannot be asynchronous." );
- }
- else
- {
-
- //
- Console::WriteLine( "Writing data to the new file." );
- while ( source->Position < source->Length )
- {
- inputChar = (Byte)source->ReadByte();
- target->WriteByte( (Byte)source->ReadByte() );
- }
-
- // Determine the size of the IsolatedStorageFileStream
- // by checking its Length property.
- Console::WriteLine( "Total Bytes Read: {0}", source->Length.ToString() );
-
- //
- }
-
- // After you have read and written to the streams, close them.
- target->Close();
- source->Close();
- }
- }
-
- //
- // Open or create a writable file, no larger than 10k
- IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,10240,isoFile );
-
- //
- isoStream->Position = 0; // Position to overwrite the old data.
-
- //
- //
- StreamWriter^ writer = gcnew StreamWriter( isoStream );
-
- // Update the data based on the new inputs.
- writer->WriteLine( this->NewsUrl );
- writer->WriteLine( this->SportsUrl );
-
- // Calculate the amount of space used to record this user's preferences.
- double d = isoFile->CurrentSize / isoFile->MaximumSize;
- Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() );
- Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() );
-
- //
- // StreamWriter.Close implicitly closes isoStream.
- writer->Close();
- isoFile->Close();
- return d;
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->ToString() );
- return 0.0;
- }
-
- }
-
- LoginPrefs( String^ aUserName )
- {
- userName = aUserName;
- newPrefs = GetPrefsForUser();
- }
-
-
- property String^ NewsUrl
- {
- String^ get()
- {
- return newsUrl;
- }
-
- void set( String^ value )
- {
- newsUrl = value;
- }
-
- }
-
- property String^ SportsUrl
- {
- String^ get()
- {
- return sportsUrl;
- }
-
- void set( String^ value )
- {
- sportsUrl = value;
- }
-
- }
-
- property bool NewPrefs
- {
- bool get()
- {
- return newPrefs;
- }
-
- }
-
-};
-
-void GatherInfoFromUser( LoginPrefs^ lp )
-{
- Console::WriteLine( "Please enter the URL of your news site." );
- lp->NewsUrl = Console::ReadLine();
- Console::WriteLine( "Please enter the URL of your sports site." );
- lp->SportsUrl = Console::ReadLine();
-}
-
-int main()
-{
-
- // Prompt the user for their username.
- Console::WriteLine( "Enter your login ID:" );
-
- // Does no error checking.
- LoginPrefs^ lp = gcnew LoginPrefs( Console::ReadLine() );
- if ( lp->NewPrefs )
- {
- Console::WriteLine( "Please set preferences for a new user." );
- GatherInfoFromUser( lp );
-
- // Write the new preferences to storage.
- double percentUsed = lp->SetPrefsForUser();
- Console::WriteLine( "Your preferences have been written. Current space used is {0}%", percentUsed );
- }
- else
- {
- Console::WriteLine( "Welcome back." );
- Console::WriteLine( "Your preferences have expired, please reset them." );
- GatherInfoFromUser( lp );
- lp->SetNewPrefsForUser();
- Console::WriteLine( "Your news site has been set to {0}\n and your sports site has been set to {1}.", lp->NewsUrl, lp->SportsUrl );
- }
-
- lp->GetIsoStoreInfo();
- Console::WriteLine( "Enter 'd' to delete the IsolatedStorage files and exit, or press any other key to exit without deleting files." );
- String^ consoleInput = Console::ReadLine();
- if ( consoleInput->Equals( "d" ) )
- {
- lp->DeleteFiles();
- lp->DeleteDirectories();
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp
deleted file mode 100644
index 6d60f8f19f3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-
-int main()
-{
- int count;
- array^byteArray;
- array^charArray;
- UnicodeEncoding^ uniEncoding = gcnew UnicodeEncoding;
-
- // Create the data to write to the stream.
- array^firstString = uniEncoding->GetBytes( "Invalid file path characters are: " );
- array^secondString = uniEncoding->GetBytes( Path::InvalidPathChars );
-
- //
- MemoryStream^ memStream = gcnew MemoryStream( 100 );
- //
- try
- {
- //
- // Write the first string to the stream.
- memStream->Write( firstString, 0, firstString->Length );
- //
-
- //
- // Write the second string to the stream, byte by byte.
- count = 0;
- while ( count < secondString->Length )
- {
- memStream->WriteByte( secondString[ count++ ] );
- }
- //
-
-
- //
- // Write the stream properties to the console.
- Console::WriteLine( "Capacity = {0}, Length = {1}, "
- "Position = {2}\n", memStream->Capacity.ToString(), memStream->Length.ToString(), memStream->Position.ToString() );
- //
-
- //
- // Set the stream position to the beginning of the stream.
- memStream->Seek( 0, SeekOrigin::Begin );
- //
-
- //
- // Read the first 20 bytes from the stream.
- byteArray = gcnew array(memStream->Length);
- count = memStream->Read( byteArray, 0, 20 );
- //
-
- //
- // Read the remaining bytes, byte by byte.
- while ( count < memStream->Length )
- {
- byteArray[ count++ ] = Convert::ToByte( memStream->ReadByte() );
- }
- //
-
- // Decode the Byte array into a Char array
- // and write it to the console.
- charArray = gcnew array(uniEncoding->GetCharCount( byteArray, 0, count ));
- uniEncoding->GetDecoder()->GetChars( byteArray, 0, count, charArray, 0 );
- Console::WriteLine( charArray );
- }
- finally
- {
- memStream->Close();
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp
deleted file mode 100644
index ea4a47ab8ca..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-void ChangeExtension()
-{
- String^ goodFileName = "C:\\mydir\\myfile.com.extension";
- String^ badFileName = "C:\\mydir\\";
- String^ result;
- result = Path::ChangeExtension( goodFileName, ".old" );
- Console::WriteLine( "ChangeExtension({0}, '.old') returns '{1}'", goodFileName, result );
- result = Path::ChangeExtension( goodFileName, "" );
- Console::WriteLine( "ChangeExtension({0}, '') returns '{1}'", goodFileName, result );
- result = Path::ChangeExtension( badFileName, ".old" );
- Console::WriteLine( "ChangeExtension({0}, '.old') returns '{1}'", badFileName, result );
-
- // This code produces output similar to the following:
- //
- // ChangeExtension(C:\mydir\myfile.com.extension, '.old') returns 'C:\mydir\myfile.com.old'
- // ChangeExtension(C:\mydir\myfile.com.extension, '') returns 'C:\mydir\myfile.com.'
- // ChangeExtension(C:\mydir\, '.old') returns 'C:\mydir\.old'
- //
- Console::WriteLine();
-}
-
-void Combine()
-{
- //
- String^ path1 = " C:\\mydir1";
- String^ path2 = "mydir2";
- String^ path3 = " mydir3";
- String^ combinedPaths;
- combinedPaths = Path::Combine( path1, path2 );
- Console::WriteLine( "Combine('{0}', '{1}') returns '{2}'", path1, path2, combinedPaths );
- combinedPaths = Path::Combine( path1, path3 );
- Console::WriteLine( "Combine('{0}', '{1}') returns '{2}'", path1, path3, combinedPaths );
-
- // This code produces output similar to the following:
- //
- // Combine(' C:\mydir1', 'mydir2') returns ' C:\mydir1\mydir2'
- // Combine(' C:\mydir1', ' mydir3') returns ' C:\mydir1\ mydir3'
- //
- Console::WriteLine();
-}
-
-void GetDirectoryName()
-{
- //
- String^ filePath = "C:\\MyDir\\MySubDir\\myfile.ext";
- String^ directoryName;
- int i = 0;
-
- while (filePath != nullptr)
- {
- directoryName = Path::GetDirectoryName(filePath);
- Console::WriteLine("GetDirectoryName('{0}') returns '{1}'",
- filePath, directoryName);
- filePath = directoryName;
- if (i == 1)
- {
- filePath = directoryName + "\\"; // this will preserve the previous path
- }
- i++;
- }
- /*
- This code produces the following output:
-
- GetDirectoryName('C:\MyDir\MySubDir\myfile.ext') returns 'C:\MyDir\MySubDir'
- GetDirectoryName('C:\MyDir\MySubDir') returns 'C:\MyDir'
- GetDirectoryName('C:\MyDir\') returns 'C:\MyDir'
- GetDirectoryName('C:\MyDir') returns 'C:\'
- GetDirectoryName('C:\') returns ''
- */
- //
- Console::WriteLine();
-}
-
-void GetExtension()
-{
- //
- String^ fileName = "C:\\mydir.old\\myfile.ext";
- String^ path = "C:\\mydir.old\\";
- String^ extension;
- extension = Path::GetExtension( fileName );
- Console::WriteLine( "GetExtension('{0}') returns '{1}'", fileName, extension );
- extension = Path::GetExtension( path );
- Console::WriteLine( "GetExtension('{0}') returns '{1}'", path, extension );
-
- // This code produces output similar to the following:
- //
- // GetExtension('C:\mydir.old\myfile.ext') returns '.ext'
- // GetExtension('C:\mydir.old\') returns ''
- //
- Console::WriteLine();
-}
-
-void GetFileName()
-{
- //
- String^ fileName = "C:\\mydir\\myfile.ext";
- String^ path = "C:\\mydir\\";
- String^ result;
- result = Path::GetFileName( fileName );
- Console::WriteLine( "GetFileName('{0}') returns '{1}'", fileName, result );
- result = Path::GetFileName( path );
- Console::WriteLine( "GetFileName('{0}') returns '{1}'", path, result );
-
- // This code produces output similar to the following:
- //
- // GetFileName('C:\mydir\myfile.ext') returns 'myfile.ext'
- // GetFileName('C:\mydir\') returns ''
- //
- Console::WriteLine();
-}
-
-void GetFileNameWithoutExtension()
-{
- //
- String^ fileName = "C:\\mydir\\myfile.ext";
- String^ path = "C:\\mydir\\";
- String^ result;
- result = Path::GetFileNameWithoutExtension( fileName );
- Console::WriteLine( "GetFileNameWithoutExtension('{0}') returns '{1}'", fileName, result );
- result = Path::GetFileName( path );
- Console::WriteLine( "GetFileName('{0}') returns '{1}'", path, result );
-
- // This code produces output similar to the following:
- //
- // GetFileNameWithoutExtension('C:\mydir\myfile.ext') returns 'myfile'
- // GetFileName('C:\mydir\') returns ''
- //
- Console::WriteLine();
-}
-
-void GetFullPath()
-{
- //
- String^ fileName = "myfile.ext";
- String^ path = "\\mydir\\";
- String^ fullPath;
- fullPath = Path::GetFullPath( path );
- Console::WriteLine( "GetFullPath('{0}') returns '{1}'", path, fullPath );
- fullPath = Path::GetFullPath( fileName );
- Console::WriteLine( "GetFullPath('{0}') returns '{1}'", fileName, fullPath );
-
- // Output is based on your current directory, except
- // in the last case, where it is based on the root drive
- // GetFullPath('mydir') returns 'C:\temp\Demo\mydir'
- // GetFullPath('myfile.ext') returns 'C:\temp\Demo\myfile.ext'
- // GetFullPath('\mydir') returns 'C:\mydir'
- //
- Console::WriteLine();
-}
-
-void GetPathRoot()
-{
- //
- String^ path = "\\mydir\\";
- String^ fileName = "myfile.ext";
- String^ fullPath = "C:\\mydir\\myfile.ext";
- String^ pathRoot;
- pathRoot = Path::GetPathRoot( path );
- Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", path, pathRoot );
- pathRoot = Path::GetPathRoot( fileName );
- Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", fileName, pathRoot );
- pathRoot = Path::GetPathRoot( fullPath );
- Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", fullPath, pathRoot );
-
- // This code produces output similar to the following:
- //
- // GetPathRoot('\mydir\') returns '\'
- // GetPathRoot('myfile.ext') returns ''
- // GetPathRoot('C:\mydir\myfile.ext') returns 'C:\'
- //
- Console::WriteLine();
-}
-
-void GetTempFileName()
-{
- //
- String^ fileName = Path::GetTempFileName();
- FileInfo^ fileInfo = gcnew FileInfo( fileName );
- Console::WriteLine( "File '{0}' created of size {1} bytes", fileName, (fileInfo->Length).ToString() );
-
- // Write some text to the file.
- FileStream^ f = gcnew FileStream( fileName,FileMode::Open );
- StreamWriter^ s = gcnew StreamWriter( f );
- s->WriteLine( "Output to the file" );
- s->Close();
- f->Close();
- fileInfo->Refresh();
- Console::WriteLine( "File '{0}' now has size {1} bytes", fileName, (fileInfo->Length).ToString() );
-
- // This code produces output similar to the following:
- //
- // File 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp38.tmp' created of size 0 bytes
- // File 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp38.tmp' now has size 20 bytes
- //
- Console::WriteLine();
-}
-
-void GetTempPath()
-{
- //
- String^ tempPath = Path::GetTempPath();
- Console::WriteLine( "Temporary path is '{0}'", tempPath );
- DirectoryInfo^ tempDir = gcnew DirectoryInfo( tempPath );
- Console::WriteLine( "{0} contains {1} files", tempPath, (tempDir->GetFiles()->Length).ToString() );
-
- // This code produces output similar to the following:
- //
- // Temporary path is 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\'
- // D:\Documents and Settings\cliffc\Local Settings\Temp\8\ contains 6 files
- //
- Console::WriteLine();
-}
-
-void HasExtension()
-{
- //
- String^ fileName1 = "myfile.ext";
- String^ fileName2 = "mydir\\myfile";
- String^ path = "C:\\mydir.ext\\";
- bool result;
- result = Path::HasExtension( fileName1 );
- Console::WriteLine( "HasExtension('{0}') returns {1}", fileName1, result.ToString() );
- result = Path::HasExtension( fileName2 );
- Console::WriteLine( "HasExtension('{0}') returns {1}", fileName2, result.ToString() );
- result = Path::HasExtension( path );
- Console::WriteLine( "HasExtension('{0}') returns {1}", path, result.ToString() );
-
- // This code produces output similar to the following:
- //
- // HasExtension('myfile.ext') returns True
- // HasExtension('mydir\myfile') returns False
- // HasExtension('C:\mydir.ext\') returns False
- //
- Console::WriteLine();
-}
-
-void IsPathRooted()
-{
- //
- String^ fileName = "C:\\mydir\\myfile.ext";
- String^ UncPath = "\\\\myPc\\mydir\\myfile";
- String^ relativePath = "mydir\\sudir\\";
- bool result;
- result = Path::IsPathRooted( fileName );
- Console::WriteLine( "IsPathRooted('{0}') returns {1}", fileName, result.ToString() );
- result = Path::IsPathRooted( UncPath );
- Console::WriteLine( "IsPathRooted('{0}') returns {1}", UncPath, result.ToString() );
- result = Path::IsPathRooted( relativePath );
- Console::WriteLine( "IsPathRooted('{0}') returns {1}", relativePath, result.ToString() );
-
- // This code produces output similar to the following:
- //
- // IsPathRooted('C:\mydir\myfile.ext') returns True
- // IsPathRooted('\\myPc\mydir\myfile') returns True
- // IsPathRooted('mydir\sudir\') returns False
- //
- Console::WriteLine();
-}
-
-void StaticProperties()
-{
- //
- Console::WriteLine( "Path::AltDirectorySeparatorChar={0}", (Path::AltDirectorySeparatorChar).ToString() );
- Console::WriteLine( "Path::DirectorySeparatorChar={0}", (Path::DirectorySeparatorChar).ToString() );
- Console::WriteLine( "Path::PathSeparator={0}", (Path::PathSeparator).ToString() );
- Console::WriteLine( "Path::VolumeSeparatorChar={0}", (Path::VolumeSeparatorChar).ToString() );
- Console::Write( "Path::InvalidPathChars=" );
- for ( int i = 0; i < Path::InvalidPathChars->Length; i++ )
- Console::Write( Path::InvalidPathChars[ i ] );
- Console::WriteLine();
-
- // This code produces output similar to the following:
- // Note that the InvalidPathCharacters contain characters
- // outside of the printable character set.
- //
- // Path.AltDirectorySeparatorChar=/
- // Path.DirectorySeparatorChar=\
- // Path.PathSeparator=;
- // Path.VolumeSeparatorChar=:
- //
- Console::WriteLine();
-}
-
-int main( void )
-{
- Console::WriteLine();
- StaticProperties();
- ChangeExtension();
- Combine();
- GetDirectoryName();
- GetExtension();
- GetFileName();
- GetFileNameWithoutExtension();
- GetFullPath();
- GetPathRoot();
- GetTempFileName();
- GetTempPath();
- HasExtension();
- IsPathRooted();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp
deleted file mode 100644
index 2aed9679b07..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::IO::Pipes;
-
-ref class PipeClient
-{
-public:
- static void Main(array^ args)
- {
- if (args->Length > 1)
- {
- PipeStream^ pipeClient = gcnew AnonymousPipeClientStream(PipeDirection::In, args[1]);
-
- Console::WriteLine("[CLIENT] Current TransmissionMode: {0}.",
- pipeClient->TransmissionMode);
-
- StreamReader^ sr = gcnew StreamReader(pipeClient);
-
- // Display the read text to the console
- String^ temp;
-
- // Wait for 'sync message' from the server.
- do
- {
- Console::WriteLine("[CLIENT] Wait for sync...");
- temp = sr->ReadLine();
- }
- while (!temp->StartsWith("SYNC"));
-
- // Read the server data and echo to the console.
- while ((temp = sr->ReadLine()) != nullptr)
- {
- Console::WriteLine("[CLIENT] Echo: " + temp);
- }
- sr->Close();
- pipeClient->Close();
- }
- Console::Write("[CLIENT] Press Enter to continue...");
- Console::ReadLine();
- }
-};
-
-int main()
-{
- array^ args = Environment::GetCommandLineArgs();
- PipeClient::Main(args);
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp
deleted file mode 100644
index 26174ff6fe9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::IO::Pipes;
-using namespace System::Diagnostics;
-
-ref class PipeServer
-{
-public:
- static void Main()
- {
- Process^ pipeClient = gcnew Process();
-
- pipeClient->StartInfo->FileName = "pipeClient.exe";
-
- AnonymousPipeServerStream^ pipeServer =
- gcnew AnonymousPipeServerStream(PipeDirection::Out,
- HandleInheritability::Inheritable);
-
- Console::WriteLine("[SERVER] Current TransmissionMode: {0}.",
- pipeServer->TransmissionMode);
-
- // Pass the client process a handle to the server.
- pipeClient->StartInfo->Arguments =
- pipeServer->GetClientHandleAsString();
- pipeClient->StartInfo->UseShellExecute = false;
- pipeClient->Start();
-
- pipeServer->DisposeLocalCopyOfClientHandle();
-
- try
- {
- // Read user input and send that to the client process.
- StreamWriter^ sw = gcnew StreamWriter(pipeServer);
-
- sw->AutoFlush = true;
- // Send a 'sync message' and wait for client to receive it.
- sw->WriteLine("SYNC");
- pipeServer->WaitForPipeDrain();
- // Send the console input to the client process.
- Console::Write("[SERVER] Enter text: ");
- sw->WriteLine(Console::ReadLine());
- sw->Close();
- }
- // Catch the IOException that is raised if the pipe is broken
- // or disconnected.
- catch (IOException^ e)
- {
- Console::WriteLine("[SERVER] Error: {0}", e->Message);
- }
- pipeServer->Close();
- pipeClient->WaitForExit();
- pipeClient->Close();
- Console::WriteLine("[SERVER] Client quit. Server terminating.");
- }
-};
-
-int main()
-{
- PipeServer::Main();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp
deleted file mode 100644
index 8908a781218..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::IO::Pipes;
-using namespace System::Text;
-using namespace System::Threading;
-
-// Defines the data protocol for reading and writing strings on our stream
-public ref class StreamString
-{
-private:
- Stream^ ioStream;
- UnicodeEncoding^ streamEncoding;
-
-public:
- StreamString(Stream^ ioStream)
- {
- this->ioStream = ioStream;
- streamEncoding = gcnew UnicodeEncoding();
- }
-
- String^ ReadString()
- {
- int len;
-
- len = ioStream->ReadByte() * 256;
- len += ioStream->ReadByte();
- array^ inBuffer = gcnew array(len);
- ioStream->Read(inBuffer, 0, len);
-
- return streamEncoding->GetString(inBuffer);
- }
-
- int WriteString(String^ outString)
- {
- array^ outBuffer = streamEncoding->GetBytes(outString);
- int len = outBuffer->Length;
- if (len > UInt16::MaxValue)
- {
- len = (int)UInt16::MaxValue;
- }
- ioStream->WriteByte((Byte)(len / 256));
- ioStream->WriteByte((Byte)(len & 255));
- ioStream->Write(outBuffer, 0, len);
- ioStream->Flush();
-
- return outBuffer->Length + 2;
- }
-};
-
-// Contains the method executed in the context of the impersonated user
-public ref class ReadFileToStream
-{
-private:
- String^ fn;
- StreamString ^ss;
-
-public:
- ReadFileToStream(StreamString^ str, String^ filename)
- {
- fn = filename;
- ss = str;
- }
-
- void Start()
- {
- String^ contents = File::ReadAllText(fn);
- ss->WriteString(contents);
- }
-};
-
-public ref class PipeServer
-{
-private:
- static int numThreads = 4;
-
-public:
- static void Main()
- {
- int i;
- array^ servers = gcnew array(numThreads);
-
- Console::WriteLine("\n*** Named pipe server stream with impersonation example ***\n");
- Console::WriteLine("Waiting for client connect...\n");
- for (i = 0; i < numThreads; i++)
- {
- servers[i] = gcnew Thread(gcnew ThreadStart(&ServerThread));
- servers[i]->Start();
- }
- Thread::Sleep(250);
- while (i > 0)
- {
- for (int j = 0; j < numThreads; j++)
- {
- if (servers[j] != nullptr)
- {
- if (servers[j]->Join(250))
- {
- Console::WriteLine("Server thread[{0}] finished.", servers[j]->ManagedThreadId);
- servers[j] = nullptr;
- i--; // decrement the thread watch count
- }
- }
- }
- }
- Console::WriteLine("\nServer threads exhausted, exiting.");
- }
-
-private:
- static void ServerThread()
- {
- NamedPipeServerStream^ pipeServer =
- gcnew NamedPipeServerStream("testpipe", PipeDirection::InOut, numThreads);
-
- int threadId = Thread::CurrentThread->ManagedThreadId;
-
- // Wait for a client to connect
- pipeServer->WaitForConnection();
-
- Console::WriteLine("Client connected on thread[{0}].", threadId);
- try
- {
- //
- // Read the request from the client. Once the client has
- // written to the pipe its security token will be available.
-
- StreamString^ ss = gcnew StreamString(pipeServer);
-
- // Verify our identity to the connected client using a
- // string that the client anticipates.
-
- ss->WriteString("I am the one true server!");
- String^ filename = ss->ReadString();
-
- // Read in the contents of the file while impersonating the client.
- ReadFileToStream^ fileReader = gcnew ReadFileToStream(ss, filename);
-
- // Display the name of the user we are impersonating.
- Console::WriteLine("Reading file: {0} on thread[{1}] as user: {2}.",
- filename, threadId, pipeServer->GetImpersonationUserName());
- pipeServer->RunAsClient(gcnew PipeStreamImpersonationWorker(fileReader, &ReadFileToStream::Start));
- //
- }
- // Catch the IOException that is raised if the pipe is broken
- // or disconnected.
- catch (IOException^ e)
- {
- Console::WriteLine("ERROR: {0}", e->Message);
- }
- pipeServer->Close();
- }
-};
-
-int main()
-{
- PipeServer::Main();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp
deleted file mode 100644
index 17fffe2f8bb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO::Ports;
-
-ref class PortDataReceived
-{
-public:
- static void Main()
- {
- //
- SerialPort^ mySerialPort = gcnew SerialPort("COM1");
-
- mySerialPort->BaudRate = 9600;
- mySerialPort->Parity = Parity::None;
- mySerialPort->StopBits = StopBits::One;
- mySerialPort->DataBits = 8;
- mySerialPort->Handshake = Handshake::None;
- mySerialPort->RtsEnable = true;
- //
-
- mySerialPort->DataReceived += gcnew SerialDataReceivedEventHandler(DataReceivedHandler);
-
- mySerialPort->Open();
-
- Console::WriteLine("Press any key to continue...");
- Console::WriteLine();
- Console::ReadKey();
- mySerialPort->Close();
- }
-
-private:
- static void DataReceivedHandler(
- Object^ sender,
- SerialDataReceivedEventArgs^ e)
- {
- SerialPort^ sp = (SerialPort^)sender;
- String^ indata = sp->ReadExisting();
- Console::WriteLine("Data Received:");
- Console::Write(indata);
- }
-};
-
-int main()
-{
- PortDataReceived::Main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp
deleted file mode 100644
index 86631d9ff20..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO::Ports;
-using namespace System::Threading;
-
-public ref class PortChat
-{
-private:
- static bool _continue;
- static SerialPort^ _serialPort;
-
- //
-public:
- static void Main()
- {
- String^ name;
- String^ message;
- StringComparer^ stringComparer = StringComparer::OrdinalIgnoreCase;
- Thread^ readThread = gcnew Thread(gcnew ThreadStart(PortChat::Read));
-
- // Create a new SerialPort object with default settings.
- _serialPort = gcnew SerialPort();
-
- // Allow the user to set the appropriate properties.
- _serialPort->PortName = SetPortName(_serialPort->PortName);
- _serialPort->BaudRate = SetPortBaudRate(_serialPort->BaudRate);
- _serialPort->Parity = SetPortParity(_serialPort->Parity);
- _serialPort->DataBits = SetPortDataBits(_serialPort->DataBits);
- _serialPort->StopBits = SetPortStopBits(_serialPort->StopBits);
- _serialPort->Handshake = SetPortHandshake(_serialPort->Handshake);
-
- // Set the read/write timeouts
- _serialPort->ReadTimeout = 500;
- _serialPort->WriteTimeout = 500;
-
- _serialPort->Open();
- _continue = true;
- readThread->Start();
-
- Console::Write("Name: ");
- name = Console::ReadLine();
-
- Console::WriteLine("Type QUIT to exit");
-
- while (_continue)
- {
- message = Console::ReadLine();
-
- if (stringComparer->Equals("quit", message))
- {
- _continue = false;
- }
- else
- {
- _serialPort->WriteLine(
- String::Format("<{0}>: {1}", name, message) );
- }
- }
-
- readThread->Join();
- _serialPort->Close();
- }
-
- static void Read()
- {
- while (_continue)
- {
- try
- {
- String^ message = _serialPort->ReadLine();
- Console::WriteLine(message);
- }
- catch (TimeoutException ^) { }
- }
- }
- //
-
- //
- static String^ SetPortName(String^ defaultPortName)
- {
- String^ portName;
-
- Console::WriteLine("Available Ports:");
- for each (String^ s in SerialPort::GetPortNames())
- {
- Console::WriteLine(" {0}", s);
- }
-
- Console::Write("Enter COM port value (Default: {0}): ", defaultPortName);
- portName = Console::ReadLine();
-
- if (portName == "")
- {
- portName = defaultPortName;
- }
- return portName;
- }
- //
-
- static Int32 SetPortBaudRate(Int32 defaultPortBaudRate)
- {
- String^ baudRate;
-
- Console::Write("Baud Rate(default:{0}): ", defaultPortBaudRate);
- baudRate = Console::ReadLine();
-
- if (baudRate == "")
- {
- baudRate = defaultPortBaudRate.ToString();
- }
-
- return Int32::Parse(baudRate);
- }
-
- //
- static Parity SetPortParity(Parity defaultPortParity)
- {
- String^ parity;
-
- Console::WriteLine("Available Parity options:");
- for each (String^ s in Enum::GetNames(Parity::typeid))
- {
- Console::WriteLine(" {0}", s);
- }
-
- Console::Write("Enter Parity value (Default: {0}):", defaultPortParity.ToString());
- parity = Console::ReadLine();
-
- if (parity == "")
- {
- parity = defaultPortParity.ToString();
- }
-
- return (Parity)Enum::Parse(Parity::typeid, parity);
- }
- //
-
- static Int32 SetPortDataBits(Int32 defaultPortDataBits)
- {
- String^ dataBits;
-
- Console::Write("Enter DataBits value (Default: {0}): ", defaultPortDataBits);
- dataBits = Console::ReadLine();
-
- if (dataBits == "")
- {
- dataBits = defaultPortDataBits.ToString();
- }
-
- return Int32::Parse(dataBits);
- }
-
- //
- static StopBits SetPortStopBits(StopBits defaultPortStopBits)
- {
- String^ stopBits;
-
- Console::WriteLine("Available Stop Bits options:");
- for each (String^ s in Enum::GetNames(StopBits::typeid))
- {
- Console::WriteLine(" {0}", s);
- }
-
- Console::Write("Enter StopBits value (None is not supported and \n" +
- "raises an ArgumentOutOfRangeException. \n (Default: {0}):", defaultPortStopBits.ToString());
- stopBits = Console::ReadLine();
-
- if (stopBits == "")
- {
- stopBits = defaultPortStopBits.ToString();
- }
-
- return (StopBits)Enum::Parse(StopBits::typeid, stopBits);
- }
- //
-
- //
- static Handshake SetPortHandshake(Handshake defaultPortHandshake)
- {
- String^ handshake;
-
- Console::WriteLine("Available Handshake options:");
- for each (String^ s in Enum::GetNames(Handshake::typeid))
- {
- Console::WriteLine(" {0}", s);
- }
-
- Console::Write("Enter Handshake value (Default: {0}):", defaultPortHandshake.ToString());
- handshake = Console::ReadLine();
-
- if (handshake == "")
- {
- handshake = defaultPortHandshake.ToString();
- }
-
- return (Handshake)Enum::Parse(Handshake::typeid, handshake);
- }
- //
-};
-
-int main()
-{
- PortChat::Main();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp
deleted file mode 100644
index a1f9f662b60..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-ref class StreamReaderSample: public TextReader
-{
-public:
-
- //
- StreamReaderSample()
- {
- printInfo();
- usePeek();
- usePosition();
- useNull();
- useReadLine();
- useReadToEnd();
- }
-
-
-private:
-
- //All Overloaded Constructors for StreamReader
- //
- void getNewStreamReader()
- {
-
- //Get a new StreamReader in ASCII format from a
- //file using a buffer and byte order mark detection
- StreamReader^ srAsciiFromFileFalse512 = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII,false,512 );
-
- //Get a new StreamReader in ASCII format from a
- //file with byte order mark detection = false
- StreamReader^ srAsciiFromFileFalse = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII,false );
-
- //Get a new StreamReader in ASCII format from a file
- StreamReader^ srAsciiFromFile = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII );
-
- //Get a new StreamReader from a
- //file with byte order mark detection = false
- StreamReader^ srFromFileFalse = gcnew StreamReader( "C:\\Temp\\Test.txt",false );
-
- //Get a new StreamReader from a file
- StreamReader^ srFromFile = gcnew StreamReader( "C:\\Temp\\Test.txt" );
-
- //Get a new StreamReader in ASCII format from a
- //FileStream with byte order mark detection = false and a buffer
- StreamReader^ srAsciiFromStreamFalse512 = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII,false,512 );
-
- //Get a new StreamReader in ASCII format from a
- //FileStream with byte order mark detection = false
- StreamReader^ srAsciiFromStreamFalse = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII,false );
-
- //Get a new StreamReader in ASCII format from a FileStream
- StreamReader^ srAsciiFromStream = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII );
-
- //Get a new StreamReader from a
- //FileStream with byte order mark detection = false
- StreamReader^ srFromStreamFalse = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),false );
-
- //Get a new StreamReader from a FileStream
- StreamReader^ srFromStream = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ) );
- }
-
-
- //
- //
- void printInfo()
- {
-
- //
- //
- StreamReader^ srEncoding = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII );
- Console::WriteLine( "Encoding: {0}", srEncoding->CurrentEncoding->EncodingName );
- srEncoding->Close();
-
- //
- }
-
- void usePeek()
- {
-
- //
- StreamReader^ srPeek = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII );
-
- // set the file pointer to the beginning
- srPeek->BaseStream->Seek( 0, SeekOrigin::Begin );
-
- // cycle while there is a next char
- while ( srPeek->Peek() > -1 )
- {
- Console::Write( srPeek->ReadLine() );
- }
-
- srPeek->Close();
-
- //
- }
-
- void usePosition()
- {
-
- //
- StreamReader^ srRead = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII );
-
- // set the file pointer to the beginning
- srRead->BaseStream->Seek( 0, SeekOrigin::Begin );
- srRead->BaseStream->Position = 0;
- while ( srRead->BaseStream->Position < srRead->BaseStream->Length )
- {
- array<__wchar_t>^buffer = gcnew array<__wchar_t>(1);
- srRead->Read( buffer, 0, 1 );
- Console::Write( buffer[ 0 ].ToString() );
- srRead->BaseStream->Position = srRead->BaseStream->Position + 1;
- }
-
- srRead->DiscardBufferedData();
- srRead->Close();
-
- //
- }
-
- void useNull()
- {
-
- //
- StreamReader^ srNull = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII );
- if ( !srNull->Equals( StreamReader::Null ) )
- {
- srNull->BaseStream->Seek( 0, SeekOrigin::Begin );
- Console::WriteLine( srNull->ReadToEnd() );
- }
-
- srNull->Close();
-
- //
- }
-
- void useReadLine()
- {
-
- //
- StreamReader^ srReadLine = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII );
- srReadLine->BaseStream->Seek( 0, SeekOrigin::Begin );
- while ( srReadLine->Peek() > -1 )
- {
- Console::WriteLine( srReadLine->ReadLine() );
- }
-
- srReadLine->Close();
-
- //
- }
-
- void useReadToEnd()
- {
-
- //
- StreamReader^ srReadToEnd = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII );
- srReadToEnd->BaseStream->Seek( 0, SeekOrigin::Begin );
- Console::WriteLine( srReadToEnd->ReadToEnd() );
- srReadToEnd->Close();
-
- //
- //
- }
-
- //
- //
-};
-
-
-//
-void main( int argc )
-{
- StreamReaderSample^ srs = gcnew StreamReaderSample;
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp
deleted file mode 100644
index a901e502b87..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Runtime;
-using namespace System::Reflection;
-using namespace System::Runtime::Remoting::Lifetime;
-using namespace System::Security::Permissions;
-
-namespace StreamWriterSample
-{
- public ref class Logger
- {
-//
- public:
- //Constructors
- Logger()
- {
- BeginWrite();
- }
-
- Logger( String^ logFile )
- {
- BeginWrite( logFile );
- }
-
- //Destructor
- ~Logger()
- {
- EndWrite();
- }
-
- //
- void CreateTextFile( String^ fileName, String^ textToAdd )
- {
- String^ logFile = String::Concat( DateTime::Now.ToShortDateString()
- ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" );
-
- FileStream^ fs = gcnew FileStream( fileName,
- FileMode::CreateNew, FileAccess::Write, FileShare::None );
-
- StreamWriter^ swFromFile = gcnew StreamWriter( logFile );
- swFromFile->Write( textToAdd );
- swFromFile->Flush();
- swFromFile->Close();
-
- StreamWriter^ swFromFileStream = gcnew StreamWriter( fs );
- swFromFileStream->Write( textToAdd );
- swFromFileStream->Flush();
- swFromFileStream->Close();
-
- StreamWriter^ swFromFileStreamDefaultEnc =
- gcnew System::IO::StreamWriter( fs,
- System::Text::Encoding::Default );
- swFromFileStreamDefaultEnc->Write( textToAdd );
- swFromFileStreamDefaultEnc->Flush();
- swFromFileStreamDefaultEnc->Close();
-
- StreamWriter^ swFromFileTrue =
- gcnew StreamWriter( fileName,true );
- swFromFileTrue->Write( textToAdd );
- swFromFileTrue->Flush();
- swFromFileTrue->Close();
-
- StreamWriter^ swFromFileTrueUTF8Buffer =
- gcnew StreamWriter( fileName,
- true, System::Text::Encoding::UTF8, 512 );
- swFromFileTrueUTF8Buffer->Write( textToAdd );
- swFromFileTrueUTF8Buffer->Flush();
- swFromFileTrueUTF8Buffer->Close();
-
- StreamWriter^ swFromFileTrueUTF8 =
- gcnew StreamWriter( fileName, true,
- System::Text::Encoding::UTF8 );
- swFromFileTrueUTF8->Write( textToAdd );
- swFromFileTrueUTF8->Flush();
- swFromFileTrueUTF8->Close();
-
- StreamWriter^ swFromFileStreamUTF8Buffer =
- gcnew StreamWriter( fs, System::Text::Encoding::UTF8, 512 );
- swFromFileStreamUTF8Buffer->Write( textToAdd );
- swFromFileStreamUTF8Buffer->Flush();
- swFromFileStreamUTF8Buffer->Close();
- }
- //
-
- //
- private:
- [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)]
- void BeginWrite( String^ logFile )
- {
- //
- //
- StreamWriter^ sw = gcnew StreamWriter( logFile,true );
-
- //
- //
- // Gets or sets a value indicating whether the StreamWriter
- // will flush its buffer to the underlying stream after every
- // call to StreamWriter.Write.
- sw->AutoFlush = true;
- //
- //
- if ( sw->Equals( StreamWriter::Null ) )
- {
- sw->WriteLine( "The store can be written to, but not read from." );
- }
- //
- //
- sw->Write( Char::Parse( " " ) );
- //
- //
- String^ hello = "Hellow World!";
- array^ buffer = hello->ToCharArray();
- sw->Write( buffer );
- //
- //
- String^ helloWorld = "Hellow World!";
- // writes out "low World"
- sw->Write( helloWorld );
- //
- //
- sw->WriteLine( "---Begin Log Entry---" );
- //
- //
- // Write out the current text encoding
- sw->WriteLine( "Encoding: {0}",
- sw->Encoding->ToString() );
- //
- //
- // Display the Format Provider
- sw->WriteLine( "Format Provider: {0} ",
- sw->FormatProvider->ToString() );
- //
- //
- // Set the characters you would like to designate a new line
- sw->NewLine = "\r\n";
- //
- //
- ILease^ obj = dynamic_cast(sw->InitializeLifetimeService());
- if ( obj != nullptr )
- {
- sw->WriteLine( "Object initialized lease " +
- "time remaining: {0}.",
- obj->CurrentLeaseTime.ToString() );
- }
- //
- //
- ILease^ lease = dynamic_cast(sw->GetLifetimeService());
- if ( lease != nullptr )
- {
- sw->WriteLine( "Object lease time remaining: {0}.",
- lease->CurrentLeaseTime.ToString() );
- }
- //
-
- //
- // update underlying file
- sw->Flush();
- //
- //
- // close the file by closing the writer
- sw->Close();
- //
- //
- }
- //
-
- void BeginWrite()
- {
- BeginWrite( String::Concat( DateTime::Now.ToShortDateString()
- ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ) );
- }
-
- void EndWrite( String^ logFile )
- {
- StreamWriter^ sw = gcnew StreamWriter( logFile,true );
-
- // Set the file pointer to the end of file.
- sw->BaseStream->Seek( 0, SeekOrigin::End );
- // Write text to the file.
- sw->WriteLine( "---End Log Entry---\r\n" );
- // Update the underlying file.
- sw->Flush();
- // Close the file by closing the writer.
- sw->Close();
- }
-
- void EndWrite()
- {
- EndWrite( String::Concat( DateTime::Now.ToShortDateString()
- ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ) );
- }
- //
- };
-}
-//
-
-int main()
-{
- StreamWriterSample::Logger^ l = gcnew StreamWriterSample::Logger;
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp
deleted file mode 100644
index 0e1c9ac1f5b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
- String^ textReaderText = "TextReader is the abstract base "
- "class of StreamReader and StringReader, which read "
- "characters from streams and strings, respectively.\n\n"
- "Create an instance of TextReader to open a text file "
- "for reading a specified range of characters, or to "
- "create a reader based on an existing stream.\n\n"
- "You can also use an instance of TextReader to read "
- "text from a custom backing store using the same "
- "APIs you would use for a string or a stream.\n\n";
- Console::WriteLine( "Original text:\n\n{0}", textReaderText );
-
- //
- // From textReaderText, create a continuous paragraph
- // with two spaces between each sentence.
- String^ aLine;
- String^ aParagraph;
- StringReader^ strReader = gcnew StringReader( textReaderText );
- while ( true )
- {
- aLine = strReader->ReadLine();
- if ( aLine != nullptr )
- {
- aParagraph = String::Concat( aParagraph, aLine, " " );
- }
- else
- {
- aParagraph = String::Concat( aParagraph, "\n" );
- break;
- }
- }
-
- Console::WriteLine( "Modified text:\n\n{0}", aParagraph );
-
- //
- // Re-create textReaderText from aParagraph.
- int intCharacter;
- Char convertedCharacter;
- StringWriter^ strWriter = gcnew StringWriter;
- strReader = gcnew StringReader( aParagraph );
- while ( true )
- {
- intCharacter = strReader->Read();
-
- // Check for the end of the string
- // before converting to a character.
- if ( intCharacter == -1 )
- break;
-
-
- //
- convertedCharacter = Convert::ToChar( intCharacter );
- if ( convertedCharacter == '.' )
- {
- strWriter->Write( ".\n\n" );
-
- // Bypass the spaces between sentences.
- strReader->Read();
- strReader->Read();
- }
- //
- else
- {
- strWriter->Write( convertedCharacter );
- }
- }
-
- Console::WriteLine( "\nOriginal text:\n\n{0}", strWriter->ToString() );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp
deleted file mode 100644
index 8c1ec78fa24..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-int main()
-{
- StringWriter^ strWriter = gcnew StringWriter;
-
- //
- // Use the three overloads of the Write method that are
- // overridden by the StringWriter class.
- strWriter->Write( "file path characters are: " );
- strWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length );
- strWriter->Write( Char::Parse( "." ) );
-
- //
- //
- // Use the underlying StringBuilder for more complex
- // manipulations of the string.
- strWriter->GetStringBuilder()->Insert( 0, "Invalid " );
-
- //
- //
- Console::WriteLine( "The following string is {0} encoded.\n{1}", strWriter->Encoding->EncodingName, strWriter->ToString() );
-
- //
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp
deleted file mode 100644
index 3314eaac96a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Globalization;
-using namespace System::IO;
-int main()
-{
- StringWriter^ strWriter = gcnew StringWriter( gcnew CultureInfo( "ar-DZ" ) );
- strWriter->Write( DateTime::Now );
-
- //
- Console::WriteLine( "Current date and time using the invariant culture: {0}\n"
- "Current date and time using the Algerian culture: {1}", DateTime::Now.ToString(), strWriter->ToString() );
-
- //
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp
deleted file mode 100644
index 10ced5c03d7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-int main()
-{
- StringBuilder^ strBuilder = gcnew StringBuilder( "file path characters are: " );
- StringWriter^ strWriter = gcnew StringWriter( strBuilder );
- strWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length );
-
- //
- strWriter->Close();
-
- // Since the StringWriter is closed, an exception will
- // be thrown if the Write method is called. However,
- // the StringBuilder can still manipulate the string.
- strBuilder->Insert( 0, "Invalid " );
- Console::WriteLine( strWriter->ToString() );
-
- //
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp
deleted file mode 100644
index e9352f717a0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-
-//
-void WriteText( TextWriter^ textWriter )
-{
- textWriter->Write( "Invalid file path characters are: " );
- textWriter->Write( Path::InvalidPathChars );
- textWriter->Write( Char::Parse( "." ) );
-}
-
-
-//
-//
-void ReadText( TextReader^ textReader )
-{
- Console::WriteLine( "From {0} - {1}", textReader->GetType()->Name, textReader->ReadToEnd() );
-}
-
-
-//
-int main()
-{
-
- //
- TextWriter^ stringWriter = gcnew StringWriter;
- TextWriter^ streamWriter = gcnew StreamWriter( "InvalidPathChars.txt" );
-
- //
- WriteText( stringWriter );
- WriteText( streamWriter );
- streamWriter->Close();
-
- //
- TextReader^ stringReader = gcnew StringReader( stringWriter->ToString() );
- TextReader^ streamReader = gcnew StreamReader( "InvalidPathChars.txt" );
-
- //
- ReadText( stringReader );
- ReadText( streamReader );
- streamReader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp
deleted file mode 100644
index bcc6eb8fc3a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-//
-// This sample shows the differences between dates from methods that use
-//coordinated universal time (UTC) format and those that do not.
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Set the directory.
- String^ n = "C:\\test\\newdir";
-
- //Create two variables to use to set the time.
- DateTime dtime1 = DateTime(2002,1,3);
- DateTime dtime2 = DateTime(1999,1,1);
-
- //Create the directory.
- try
- {
- Directory::CreateDirectory( n );
- }
- catch ( IOException^ e )
- {
- Console::WriteLine( e );
- }
-
-
- //Set the creation and last access times to a variable DateTime value.
- Directory::SetCreationTime( n, dtime1 );
- Directory::SetLastAccessTimeUtc( n, dtime1 );
-
- // Print to console the results.
- Console::WriteLine( "Creation Date: {0}", Directory::GetCreationTime( n ) );
- Console::WriteLine( "UTC creation Date: {0}", Directory::GetCreationTimeUtc( n ) );
- Console::WriteLine( "Last write time: {0}", Directory::GetLastWriteTime( n ) );
- Console::WriteLine( "UTC last write time: {0}", Directory::GetLastWriteTimeUtc( n ) );
- Console::WriteLine( "Last access time: {0}", Directory::GetLastAccessTime( n ) );
- Console::WriteLine( "UTC last access time: {0}", Directory::GetLastAccessTimeUtc( n ) );
-
- //Set the last write time to a different value.
- Directory::SetLastWriteTimeUtc( n, dtime2 );
- Console::WriteLine( "Changed last write time: {0}", Directory::GetLastWriteTimeUtc( n ) );
-}
-
-// Obviously, since this sample deals with dates and times, the output will vary
-// depending on when you run the executable. Here is one example of the output:
-//Creation Date: 1/3/2002 12:00:00 AM
-//UTC creation Date: 1/3/2002 8:00:00 AM
-//Last write time: 12/31/1998 4:00:00 PM
-//UTC last write time: 1/1/1999 12:00:00 AM
-//Last access time: 1/2/2002 4:00:00 PM
-//UTC last access time: 1/3/2002 12:00:00 AM
-//Changed last write time: 1/1/1999 12:00:00 AM
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp
deleted file mode 100644
index 2b795397fac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Use attributes to mark the class as serializable and obsolete.
- CodeAttributeDeclaration^ codeAttrDecl =
- gcnew CodeAttributeDeclaration("System.Serializable");
- class1->CustomAttributes->Add(codeAttrDecl);
-
- CodeAttributeArgument^ codeAttr =
- gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression("This class is obsolete."));
- codeAttrDecl = gcnew CodeAttributeDeclaration("System.Obsolete", codeAttr);
- class1->CustomAttributes->Add(codeAttrDecl);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-//[System.Serializable()]
-//[System.Obsolete("This class is obsolete.")]
-//public class Class1 {
-//}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp
deleted file mode 100644
index 5523f2c37c7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Declare a new code attribute
- CodeAttributeDeclaration^ codeAttrDecl = gcnew CodeAttributeDeclaration(
- "System.CLSCompliantAttribute",
- gcnew CodeAttributeArgument(gcnew CodePrimitiveExpression(false)));
- class1->CustomAttributes->Add(codeAttrDecl);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-//[System.CLSCompliantAttribute(false)]
-//public class Class1 {
-//}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp
deleted file mode 100644
index 4db196685db..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Declares a type constructor that calls a method.
- CodeConstructor^ constructor1 = gcnew CodeConstructor();
- constructor1->Attributes = MemberAttributes::Public;
- class1->Members->Add(constructor1);
-
- // Creates a method reference for dict.Init.
- CodeMethodReferenceExpression^ methodRef1 =
- gcnew CodeMethodReferenceExpression(
- gcnew CodeVariableReferenceExpression("dict"),
- "Init",
- gcnew array {
- gcnew CodeTypeReference("System.Decimal"),
- gcnew CodeTypeReference("System.Int32")});
-
- // Invokes the dict.Init method from the constructor.
- CodeMethodInvokeExpression^ invoke1 =
- gcnew CodeMethodInvokeExpression(methodRef1, gcnew array {});
- constructor1->Statements->Add(invoke1);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-//public class Class1 {
-//
-// public Class1() {
-// dict.Init();
-// }
-// }
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp
deleted file mode 100644
index dcd7661e4aa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Declare a new generated code attribute
- GeneratedCodeAttribute^ generatedCodeAttribute =
- gcnew GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0");
-
- // Use the generated code attribute members in the attribute declaration
- CodeAttributeDeclaration^ codeAttrDecl =
- gcnew CodeAttributeDeclaration(generatedCodeAttribute->GetType()->Name,
- gcnew CodeAttributeArgument(
- gcnew CodePrimitiveExpression(generatedCodeAttribute->Tool)),
- gcnew CodeAttributeArgument(
- gcnew CodePrimitiveExpression(generatedCodeAttribute->Version)));
- class1->CustomAttributes->Add(codeAttrDecl);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-// [GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0")]
-// public class Class1 {
-// }
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp
deleted file mode 100644
index 95fbc966ac0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-
-ref class TestCollectionsUtils
-{
-public:
- static void Main()
- {
- Hashtable^ population1 = CollectionsUtil::CreateCaseInsensitiveHashtable();
-
- population1["Trapperville"] = 15;
- population1["Doggerton"] = 230;
- population1["New Hollow"] = 1234;
- population1["McHenry"] = 185;
-
- // Select cities from the table using mixed case.
- Console::WriteLine("Case insensitive hashtable results:\n");
- Console::WriteLine("{0}'s population is: {1}", "Trapperville", population1["trapperville"]);
- Console::WriteLine("{0}'s population is: {1}", "Doggerton", population1["DOGGERTON"]);
- Console::WriteLine("{0}'s population is: {1}", "New Hollow", population1["New hoLLow"]);
- Console::WriteLine("{0}'s population is: {1}", "McHenry", population1["MchenrY"]);
-
- SortedList^ population2 = CollectionsUtil::CreateCaseInsensitiveSortedList();
-
- for each (String^ city in population1->Keys)
- {
- population2->Add(city, population1[city]);
- }
-
- // Select cities from the sorted list using mixed case.
- Console::WriteLine("\nCase insensitive sorted list results:\n");
- Console::WriteLine("{0}'s population is: {1}", "Trapperville", population2["trapPeRVille"]);
- Console::WriteLine("{0}'s population is: {1}", "Doggerton", population2["dOGGeRtON"]);
- Console::WriteLine("{0}'s population is: {1}", "New Hollow", population2["nEW hOLLOW"]);
- Console::WriteLine("{0}'s population is: {1}", "McHenry", population2["MchEnrY"]);
- }
-};
-
-int main()
-{
- TestCollectionsUtils::Main();
-}
-
-// This program displays the following output to the console
-//
-// Case insensitive hashtable results:
-//
-// Trapperville's population is: 15
-// Doggerton's population is: 230
-// New Hollow's population is: 1234
-// McHenry's population is: 185
-//
-// Case insensitive sorted list results:
-//
-// Trapperville's population is: 15
-// Doggerton's population is: 230
-// New Hollow's population is: 1234
-// McHenry's population is: 185
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp
deleted file mode 100644
index 9fef255cba7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Collections::Specialized;
-using namespace System::Threading;
-
-public ref class DerivedCollection : public NameObjectCollectionBase {
-
-private:
- DictionaryEntry^ _de;
-
- // Creates an empty collection.
-public:
- DerivedCollection() {
- _de = gcnew DictionaryEntry();
- }
-
- // Adds elements from an IDictionary into the new collection.
- DerivedCollection( IDictionary^ d, Boolean bReadOnly ) {
-
- _de = gcnew DictionaryEntry();
-
- for each ( DictionaryEntry^ de in d ) {
- this->BaseAdd( (String^) de->Key, de->Value );
- }
- this->IsReadOnly = bReadOnly;
- }
-
- // Gets a key-and-value pair (DictionaryEntry) using an index.
- property DictionaryEntry^ default[ int ] {
- DictionaryEntry^ get(int index) {
- _de->Key = this->BaseGetKey(index);
- _de->Value = this->BaseGet(index);
- return( _de );
- }
- }
-
- // Gets or sets the value associated with the specified key.
- property Object^ default[ String^ ] {
- Object^ get(String^ key) {
- return( this->BaseGet( key ) );
- }
- void set( String^ key, Object^ value ) {
- this->BaseSet( key, value );
- }
- }
-
- // Gets a String array that contains all the keys in the collection.
- property array^ AllKeys {
- array^ get() {
- return( (array^)this->BaseGetAllKeys() );
- }
- }
-
- // Gets an Object array that contains all the values in the collection.
- property Array^ AllValues {
- Array^ get() {
- return( this->BaseGetAllValues() );
- }
- }
-
- // Gets a String array that contains all the values in the collection.
- property array^ AllStringValues {
- array^ get() {
- return( (array^) this->BaseGetAllValues( String ::typeid ));
- }
- }
-
- // Gets a value indicating if the collection contains keys that are not null.
- property Boolean HasKeys {
- Boolean get() {
- return( this->BaseHasKeys() );
- }
- }
-
- // Adds an entry to the collection.
- void Add( String^ key, Object^ value ) {
- this->BaseAdd( key, value );
- }
-
- // Removes an entry with the specified key from the collection.
- void Remove( String^ key ) {
- this->BaseRemove( key );
- }
-
- // Removes an entry in the specified index from the collection.
- void Remove( int index ) {
- this->BaseRemoveAt( index );
- }
-
- // Clears all the elements in the collection.
- void Clear() {
- this->BaseClear();
- }
-};
-
-public ref class SamplesNameObjectCollectionBaseKeys
-{
-public:
- static void Main()
- {
- //
- // Create a collection derived from NameObjectCollectionBase
- NameObjectCollectionBase^ myBaseCollection = gcnew DerivedCollection();
- // Get the ICollection from NameObjectCollectionBase.KeysCollection
- ICollection^ myKeysCollection = myBaseCollection->Keys;
- bool lockTaken = false;
- try
- {
- Monitor::Enter(myKeysCollection->SyncRoot, lockTaken);
- for each (Object^ item in myKeysCollection)
- {
- // Insert your code here.
- }
- }
- finally
- {
- if (lockTaken)
- {
- Monitor::Exit(myKeysCollection->SyncRoot);
- }
- }
- //
- }
-};
-
-int main()
-{
- SamplesNameObjectCollectionBaseKeys::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp
deleted file mode 100644
index 2e0fc257300..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-#define TRACE
-
-#using
-
-using namespace System;
-using namespace System::Diagnostics;
-
-namespace TestingTracing
-{
- //
- public ref class ErrorFilter : TraceFilter
- {
- public:
- virtual bool ShouldTrace(TraceEventCache^ cache, String^ source,
- TraceEventType eventType, int id, String^ formatOrMessage,
- array^ args, Object^ data, array^ dataArray) override
- {
- return eventType == TraceEventType::Error;
- }
- };
- //
-
- ref class TraceTest
- {
- public:
- static void Main()
- {
- TraceSource^ ts = gcnew TraceSource("TraceTest");
- SourceSwitch^ sourceSwitch = gcnew SourceSwitch("SourceSwitch", "Verbose");
- ts->Switch = sourceSwitch;
- ConsoleTraceListener^ ctl = gcnew ConsoleTraceListener();
- ctl->Name = "console";
- ctl->TraceOutputOptions = TraceOptions::DateTime;
- ctl->Filter = gcnew ErrorFilter();
- ts->Listeners->Add(ctl);
-
- ts->TraceEvent(TraceEventType::Warning, 1, "*** This event will be filtered out ***");
- // this event will be get displayed
- ts->TraceEvent(TraceEventType::Error, 2, "*** This event will be be displayed ***");
-
- ts->Flush();
- ts->Close();
- }
- };
-}
-
-int main()
-{
- TestingTracing::TraceTest::Main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp
deleted file mode 100644
index 40f37b3e60b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::IO::Pipes;
-using namespace System::Diagnostics;
-
-ref class PipeStreamExample
-{
-private:
- static array^ matchSign = {9, 0, 9, 0};
-
-public:
- static void Main()
- {
- array^ args = Environment::GetCommandLineArgs();
- if (args->Length < 2)
- {
- Process^ clientProcess = gcnew Process();
-
- clientProcess->StartInfo->FileName = Environment::CommandLine;
-
- AnonymousPipeServerStream^ pipeServer =
- gcnew AnonymousPipeServerStream(PipeDirection::In,
- HandleInheritability::Inheritable);
- // Pass the client process a handle to the server.
- clientProcess->StartInfo->Arguments = pipeServer->GetClientHandleAsString();
- clientProcess->StartInfo->UseShellExecute = false;
- Console::WriteLine("[SERVER] Starting client process...");
- clientProcess->Start();
-
- pipeServer->DisposeLocalCopyOfClientHandle();
-
- try
- {
- if (WaitForClientSign(pipeServer))
- {
- Console::WriteLine("[SERVER] Valid sign code received!");
- }
- else
- {
- Console::WriteLine("[SERVER] Invalid sign code received!");
- }
- }
- catch (IOException^ e)
- {
- Console::WriteLine("[SERVER] Error: {0}", e->Message);
- }
- clientProcess->WaitForExit();
- clientProcess->Close();
- Console::WriteLine("[SERVER] Client quit. Server terminating.");
- }
- else
- {
- PipeStream^ pipeClient =
- gcnew AnonymousPipeClientStream(PipeDirection::Out, args[1]);
- try
- {
- Console::WriteLine("[CLIENT] Sending sign code...");
- SendClientSign(pipeClient);
- }
- catch (IOException^ e)
- {
- Console::WriteLine("[CLIENT] Error: {0}", e->Message);
- }
- Console::WriteLine("[CLIENT] Terminating.");
- }
- }
-
- //
-private:
- static bool WaitForClientSign(PipeStream^ inStream)
- {
- array^ inSign = gcnew array(matchSign->Length);
- int len = inStream->Read(inSign, 0, matchSign->Length);
- bool valid = len == matchSign->Length;
-
- while (valid && len-- > 0)
- {
- valid = valid && (matchSign[len] == inSign[len]);
- }
- return valid;
- }
- //
-
- static void SendClientSign(PipeStream^ outStream)
- {
- outStream->Write(matchSign, 0, matchSign->Length);
- }
-};
-
-int main()
-{
- PipeStreamExample::Main();
-}
-//
diff --git a/xml/System.Collections.Generic/Dictionary`2.xml b/xml/System.Collections.Generic/Dictionary`2.xml
index ba32ea72d21..4cb0c0d8e47 100644
--- a/xml/System.Collections.Generic/Dictionary`2.xml
+++ b/xml/System.Collections.Generic/Dictionary`2.xml
@@ -152,7 +152,6 @@
The `foreach` statement of the C# language (`For Each` in Visual Basic) returns an object of the type of the elements in the collection. Since the is a collection of keys and values, the element type is not the type of the key or the type of the value. Instead, the element type is a of the key type and the value type. For example:
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp" id="Snippet11":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source2.cs" id="Snippet11":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source2.fs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source2.vb" id="Snippet11":::
@@ -176,7 +175,6 @@
Finally, the example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet1":::
@@ -261,7 +259,6 @@
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet2":::
@@ -896,7 +893,6 @@
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet2":::
@@ -1108,15 +1104,12 @@
This code example is part of a larger example provided for the class (`openWith` is the name of the Dictionary used in this example).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet6":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet6":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet6":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet6":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet5":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet4":::
@@ -1546,19 +1539,15 @@
This code example is part of a larger example provided for the class. `openWith` is the name of the Dictionary used in this example.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet2":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet3":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet4":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet5":::
@@ -1627,11 +1616,9 @@
This code is part of a larger example that can be compiled and executed (`openWith` is the name of the Dictionary used in this example). See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet9":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet9":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet9":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet9":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet7":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet7":::
@@ -1763,7 +1750,6 @@
This code example is part of a larger example provided for the class (`openWith` is the name of the Dictionary used in this example).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet10":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet10":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet10":::
@@ -3534,11 +3520,9 @@ Unlike the method, this
This code example is part of a larger example provided for the class (`openWith` is the name of the Dictionary used in this example).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet5":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet4":::
@@ -3607,11 +3591,9 @@ Unlike the method, this
This code example is part of a larger example provided for the class (`openWith` is the name of the Dictionary used in this example).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet8":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet8":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet8":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet7":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.fs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet7":::
diff --git a/xml/System.Collections.Generic/HashSet`1.xml b/xml/System.Collections.Generic/HashSet`1.xml
index 071ce0e7d05..df120c11c30 100644
--- a/xml/System.Collections.Generic/HashSet`1.xml
+++ b/xml/System.Collections.Generic/HashSet`1.xml
@@ -438,7 +438,6 @@ The following example demonstrates how to merge two disparate sets. This example
## Examples
The following example uses a supplied to allow case-insensitive comparisons on the elements of a collection of vehicle types.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp" id="Snippet03":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/.ctor/source2.cs" interactive="try-dotnet-method" id="Snippet03":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/HashSetT/.ctor/source2.fs" id="Snippet03":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/vb/source2.vb" id="Snippet03":::
@@ -1277,7 +1276,6 @@ The following example demonstrates how to merge two disparate sets. This example
## Examples
The following example creates two collections with overlapping sets of data. The lower range of values is then removed from the larger set using the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp" id="Snippet02":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/.ctor/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/HashSetT/.ctor/Program.fs" id="Snippet02":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/vb/Program.vb" id="Snippet02":::
diff --git a/xml/System.Collections.Generic/IDictionary`2.xml b/xml/System.Collections.Generic/IDictionary`2.xml
index 2c6d89a9de6..4f6592baddc 100644
--- a/xml/System.Collections.Generic/IDictionary`2.xml
+++ b/xml/System.Collections.Generic/IDictionary`2.xml
@@ -91,7 +91,6 @@
The `foreach` statement of the C# language (`For Each` in Visual Basic) returns an object of the type of the elements in the collection. Since each element of the is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is . For example:
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp" id="Snippet11":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source2.cs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source2.vb" id="Snippet11":::
@@ -113,7 +112,6 @@
Finally, the example shows how to enumerate the keys and values in the dictionary, and how to enumerate the values alone using the property.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet1":::
@@ -189,7 +187,6 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet2":::
@@ -262,13 +259,10 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet6":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet6":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet6":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet5":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet4":::
@@ -346,13 +340,10 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet3":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet4":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet5":::
@@ -421,7 +412,6 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet9":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet9":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet9":::
@@ -489,7 +479,6 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet10":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet10":::
@@ -571,10 +560,8 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet5":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet4":::
@@ -640,7 +627,6 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp" id="Snippet8":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source.vb" id="Snippet8":::
diff --git a/xml/System.Collections.Generic/IReadOnlyDictionary`2.xml b/xml/System.Collections.Generic/IReadOnlyDictionary`2.xml
index 88399f287f9..b009a8c414a 100644
--- a/xml/System.Collections.Generic/IReadOnlyDictionary`2.xml
+++ b/xml/System.Collections.Generic/IReadOnlyDictionary`2.xml
@@ -89,7 +89,6 @@
The `foreach` statement of the C# language (`For Each` in Visual Basic) requires the type of each element in the collection. Because each element of the interface is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is , as the following example illustrates.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp" id="Snippet11":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source2.cs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.IDictionary/VB/source2.vb" id="Snippet11":::
diff --git a/xml/System.Collections.Generic/KeyValuePair`2.xml b/xml/System.Collections.Generic/KeyValuePair`2.xml
index 551be8a1551..76cff684e87 100644
--- a/xml/System.Collections.Generic/KeyValuePair`2.xml
+++ b/xml/System.Collections.Generic/KeyValuePair`2.xml
@@ -92,7 +92,6 @@
The `foreach` statement of the C# language (`For Each` in Visual Basic) returns an object of the type of the elements in the collection. Since each element of a collection based on is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is . For example:
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp" id="Snippet11":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source2.cs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source2.vb" id="Snippet11":::
@@ -105,7 +104,6 @@
This code is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet7":::
@@ -263,7 +261,6 @@
This code is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet7":::
@@ -380,7 +377,6 @@
This code is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source.vb" id="Snippet7":::
diff --git a/xml/System.Collections.Generic/LinkedListNode`1.xml b/xml/System.Collections.Generic/LinkedListNode`1.xml
index 468161d572f..3279af7d7b6 100644
--- a/xml/System.Collections.Generic/LinkedListNode`1.xml
+++ b/xml/System.Collections.Generic/LinkedListNode`1.xml
@@ -77,7 +77,6 @@
## Examples
The following code example creates a , adds it to a , and tracks the values of its properties as the changes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListNodeT/Overview/llnctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/VB/llnctor.vb" id="Snippet1":::
@@ -141,7 +140,6 @@
## Examples
The following code example creates a , adds it to a , and tracks the values of its properties as the changes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListNodeT/Overview/llnctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/VB/llnctor.vb" id="Snippet1":::
@@ -205,7 +203,6 @@
## Examples
The following code example creates a , adds it to a , and tracks the values of its properties as the changes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListNodeT/Overview/llnctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/VB/llnctor.vb" id="Snippet1":::
@@ -265,7 +262,6 @@
## Examples
The following code example creates a , adds it to a , and tracks the values of its properties as the changes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListNodeT/Overview/llnctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/VB/llnctor.vb" id="Snippet1":::
@@ -325,7 +321,6 @@
## Examples
The following code example creates a , adds it to a , and tracks the values of its properties as the changes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListNodeT/Overview/llnctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/VB/llnctor.vb" id="Snippet1":::
@@ -393,7 +388,6 @@
## Examples
The following code example creates a , adds it to a , and tracks the values of its properties as the changes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListNodeT/Overview/llnctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/VB/llnctor.vb" id="Snippet1":::
diff --git a/xml/System.Collections.Generic/LinkedList`1.xml b/xml/System.Collections.Generic/LinkedList`1.xml
index b88018f67b1..7e1a3812fad 100644
--- a/xml/System.Collections.Generic/LinkedList`1.xml
+++ b/xml/System.Collections.Generic/LinkedList`1.xml
@@ -140,7 +140,6 @@
## Examples
The following code example demonstrates many features of the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListT/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.LinkedList/vb/source.vb" id="Snippet1":::
@@ -219,7 +218,6 @@
## Examples
The following code example creates and initializes a of type , adds several nodes, and then displays its contents.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/LinkedListT/.ctor/llctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/VB/llctor.vb" id="Snippet1":::
diff --git a/xml/System.Collections.Generic/List`1.xml b/xml/System.Collections.Generic/List`1.xml
index be53559f1f0..0b6bd98f635 100644
--- a/xml/System.Collections.Generic/List`1.xml
+++ b/xml/System.Collections.Generic/List`1.xml
@@ -189,7 +189,6 @@
The example adds, inserts, and removes items, showing how the capacity changes as these methods are used.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -248,7 +247,6 @@
## Examples
The following example demonstrates the constructor and various methods of the class that act on ranges. An array of strings is created and passed to the constructor, populating the list with the elements of the array. The property is then displayed, to show that the initial capacity is exactly what is required to hold the input elements.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
@@ -320,7 +318,6 @@
## Examples
The following example demonstrates the constructor. A of strings with a capacity of 4 is created, because the ultimate size of the list is known to be exactly 4. The list is populated with four strings, and a read-only copy is created by using the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_AsReadOnly/vb/source.vb" id="Snippet1":::
@@ -398,7 +395,6 @@
Other properties and methods are used to search for, insert, and remove elements from the list, and finally to clear the list.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -466,7 +462,6 @@
## Examples
The following example demonstrates the method and various other methods of the class that act on ranges. An array of strings is created and passed to the constructor, populating the list with the elements of the array. The method is called, with the list as its argument. The result is that the current elements of the list are added to the end of the list, duplicating all the elements.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
@@ -535,7 +530,6 @@
An element of the original list is set to "Coelophysis" using the property (the indexer in C#), and the contents of the read-only list are displayed again to demonstrate that it is just a wrapper for the original list.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_AsReadOnly/vb/source.vb" id="Snippet1":::
@@ -618,7 +612,6 @@
The method overload is then used to search for two strings that are not in the list, and the method is used to insert them. The return value of the method is negative in each case, because the strings are not in the list. Taking the bitwise complement (the ~ operator in C#, `Xor` -1 in Visual Basic) of this negative number produces the index of the first element in the list that is larger than the search string, and inserting at this location preserves the sort order. The second search string is larger than any element in the list, so the insertion position is at the end of the list.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearch/vb/source.vb" id="Snippet1":::
@@ -714,7 +707,6 @@
The method overload is then used to search for several strings that are not in the list, employing the alternate comparer. The method is used to insert the strings. These two methods are located in the function named `SearchAndInsert`, along with code to take the bitwise complement (the ~ operator in C#, `Xor` -1 in Visual Basic) of the negative number returned by and use it as an index for inserting the new string.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparer/vb/source.vb" id="Snippet1":::
@@ -811,7 +803,6 @@
The method overload is then used to search only the range of herbivores for "Brachiosaurus". The string is not found, and the bitwise complement (the ~ operator in C#, `Xor` -1 in Visual Basic) of the negative number returned by the method is used as an index for inserting the new string.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source2.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparerRange/vb/source.vb" id="Snippet1":::
@@ -900,7 +891,6 @@
The property is displayed again after the method is used to reduce the capacity to match the count. Finally, the method is used to remove all items from the list, and the and properties are displayed again.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -970,7 +960,6 @@
The following example demonstrates the method and various other properties and methods of the generic class. The method is used at the end of the program, to remove all items from the list, and the and properties are then displayed.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -1120,7 +1109,6 @@
## Examples
The following example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates a of structures, creates a `Converter\` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. Both lists are displayed.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/ConverterTInput,TOutput/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_ConvertAll/vb/source.vb" id="Snippet1":::
@@ -1146,7 +1134,6 @@
## Examples
The following example demonstrates all three overloads of the method. A of strings is created and populated with 5 strings. An empty string array of 15 elements is created, and the method overload is used to copy all the elements of the list to the array beginning at the first element of the array. The method overload is used to copy all the elements of the list to the array beginning at array index 6 (leaving index 5 empty). Finally, the method overload is used to copy 3 elements from the list, beginning with index 2, to the array beginning at array index 12 (leaving index 11 empty). The contents of the array are then displayed.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/CopyTo/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_CopyTo/vb/source.vb" id="Snippet1":::
@@ -1428,7 +1415,6 @@
The following example shows the value of the property at various points in the life of a list. After the list has been created and populated and its elements displayed, the and properties are displayed. These properties are displayed again after the method has been called, and again after the contents of the list are cleared.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -1542,7 +1528,6 @@
> [!NOTE]
> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context and create it automatically.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Exists/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
@@ -2603,7 +2588,6 @@ Public Function StartsWith(e As Employee) As Boolean
## Examples
The following example demonstrates the method and other methods of the class that act on ranges. At the end of the example, the method is used to get three items from the list, beginning with index location 2. The method is called on the resulting , creating an array of three elements. The elements of the array are displayed.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
@@ -2637,7 +2621,6 @@ Public Function StartsWith(e As Employee) As Boolean
## Examples
The following example demonstrates all three overloads of the method. A of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the list from the beginning, and finds the first occurrence of the string. The method overload is used to search the list beginning with index location 3 and continuing to the end of the list, and finds the second occurrence of the string. Finally, the method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/IndexOf/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_IndexOf/vb/source.vb" id="Snippet1":::
@@ -2921,7 +2904,6 @@ Public Function StartsWith(e As Employee) As Boolean
The following example demonstrates the method, along with various other properties and methods of the generic class. After the list is created, elements are added. The method is used to insert an item into the middle of the list. The item inserted is a duplicate, which is later removed using the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -3000,7 +2982,6 @@ Public Function StartsWith(e As Employee) As Boolean
## Examples
The following example demonstrates method and various other methods of the class that act on ranges. After the list has been created and populated with the names of several peaceful plant-eating dinosaurs, the method is used to insert an array of three ferocious meat-eating dinosaurs into the list, beginning at index location 3.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
@@ -3125,7 +3106,6 @@ Public Function StartsWith(e As Employee) As Boolean
## Examples
The following example demonstrates all three overloads of the method. A of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the entire list from the end, and finds the second occurrence of the string. The method overload is used to search the list backward beginning with index location 3 and continuing to the beginning of the list, so it finds the first occurrence of the string in the list. Finally, the method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/LastIndexOf/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_LastIndexOf/vb/source.vb" id="Snippet1":::
@@ -3402,7 +3382,6 @@ Public Function StartsWith(e As Employee) As Boolean
The following example demonstrates method. Several properties and methods of the generic class are used to add, insert, and search the list. After these operations, the list contains a duplicate. The method is used to remove the first instance of the duplicate item, and the contents are displayed. The method always removes the first instance it encounters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -3481,7 +3460,6 @@ Public Function StartsWith(e As Employee) As Boolean
Finally, the method verifies that there are no strings in the list that end with "saurus".
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Exists/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
@@ -3626,7 +3604,6 @@ Public Function StartsWith(e As Employee) As Boolean
## Examples
The following example demonstrates the method and various other methods of the class that act on ranges. After the list has been created and modified, the method is used to remove two elements from the list, beginning at index location 2.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
@@ -3662,7 +3639,6 @@ Public Function StartsWith(e As Employee) As Boolean
## Examples
The following example demonstrates both overloads of the method. The example creates a of strings and adds six strings. The method overload is used to reverse the list, and then the method overload is used to reverse the middle of the list, beginning with element 1 and encompassing four elements.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Reverse/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Reverse/vb/source.vb" id="Snippet1":::
@@ -3911,7 +3887,6 @@ Public Function StartsWith(e As Employee) As Boolean
The method overload is then used to search for two strings that are not in the list, and the method is used to insert them. The return value of the method is negative in each case, because the strings are not in the list. Taking the bitwise complement (the ~ operator in C#, `Xor` -1 in Visual Basic) of this negative number produces the index of the first element in the list that is larger than the search string, and inserting at this location preserves the sort order. The second search string is larger than any element in the list, so the insertion position is at the end of the list.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearch/vb/source.vb" id="Snippet1":::
@@ -4000,7 +3975,6 @@ Public Function StartsWith(e As Employee) As Boolean
The method overload is then used to search for several strings that are not in the list, employing the alternate comparer. The method is used to insert the strings. These two methods are located in the function named `SearchAndInsert`, along with code to take the bitwise complement (the ~ operator in C#, `Xor` -1 in Visual Basic) of the negative number returned by and use it as an index for inserting the new string.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparer/vb/source.vb" id="Snippet1":::
@@ -4086,7 +4060,6 @@ Public Function StartsWith(e As Employee) As Boolean
A of strings is created and populated with four strings, in no particular order. The list also includes an empty string and a null reference. The list is displayed, sorted using a generic delegate representing the `CompareDinosByLength` method, and displayed again.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/ComparisonT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortComparison/vb/source.vb" id="Snippet1":::
@@ -4182,7 +4155,6 @@ Public Function StartsWith(e As Employee) As Boolean
The method overload is then used to search only the range of herbivores for "Brachiosaurus". The string is not found, and the bitwise complement (the ~ operator in C#, `Xor` -1 in Visual Basic) of the negative number returned by the method is used as an index for inserting the new string.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source2.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparerRange/vb/source.vb" id="Snippet1":::
@@ -5199,7 +5171,6 @@ Retrieving the value of this property is an O(1) operation.
## Examples
The following example demonstrates the method and other methods of the class that act on ranges. At the end of the example, the method is used to get three items from the list, beginning with index location 2. The method is called on the resulting , creating an array of three elements. The elements of the array are displayed.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
@@ -5270,7 +5241,6 @@ Retrieving the value of this property is an O(1) operation.
The following example demonstrates the method. Several properties and methods of the class are used to add, insert, and remove items from a list of strings. Then the method is used to reduce the capacity to match the count, and the and properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized. Finally, the contents of the list are cleared.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
@@ -5344,7 +5314,6 @@ Retrieving the value of this property is an O(1) operation.
> [!NOTE]
> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context and create it automatically.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Exists/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
diff --git a/xml/System.Collections.Generic/SortedDictionary`2.xml b/xml/System.Collections.Generic/SortedDictionary`2.xml
index a05c958be61..c1ffc58be1e 100644
--- a/xml/System.Collections.Generic/SortedDictionary`2.xml
+++ b/xml/System.Collections.Generic/SortedDictionary`2.xml
@@ -132,7 +132,6 @@
The `foreach` statement of the C# language (`For Each` in Visual Basic) returns an object of the type of the elements in the collection. Since each element of the is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is . The following code shows the syntax.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp" id="Snippet11":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source2.cs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Dictionary/VB/source2.vb" id="Snippet11":::
diff --git a/xml/System.Collections.Generic/SortedList`2.xml b/xml/System.Collections.Generic/SortedList`2.xml
index cbfd5bc244d..3d3dc3dfe67 100644
--- a/xml/System.Collections.Generic/SortedList`2.xml
+++ b/xml/System.Collections.Generic/SortedList`2.xml
@@ -127,7 +127,6 @@
Another difference between the and classes is that supports efficient indexed retrieval of keys and values through the collections returned by the and properties. It is not necessary to regenerate the lists when the properties are accessed, because the lists are just wrappers for the internal arrays of keys and values. The following code shows the use of the property for indexed retrieval of values from a sorted list of strings:
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp" id="Snippet11":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/remarks.cs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/remarks.vb" id="Snippet11":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/remarks.fs" id="Snippet11":::
@@ -144,7 +143,6 @@
The `foreach` statement of the C# language (`For Each` in Visual Basic) returns an object of the type of the elements in the collection. Since the elements of the are key/value pairs, the element type is not the type of the key or the type of the value. Instead, the element type is . For example:
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp" id="Snippet12":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/remarks.cs" id="Snippet12":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/remarks.vb" id="Snippet12":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/remarks.fs" id="Snippet12":::
@@ -164,7 +162,6 @@
Finally, the example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet1":::
@@ -244,7 +241,6 @@
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet2":::
@@ -713,7 +709,6 @@
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet2":::
@@ -960,15 +955,12 @@
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet6":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet6":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet6":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet6":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet5":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet4":::
@@ -1419,15 +1411,12 @@
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet3":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet4":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet5":::
@@ -1494,7 +1483,6 @@
The collection returned by the property provides an efficient way to retrieve keys by index. It is not necessary to regenerate the list when the property is accessed, because the list is just a wrapper for the internal array of keys. The following code shows the use of the property for indexed retrieval of keys from a sorted list of elements with string keys:
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp" id="Snippet11":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/remarks.cs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/remarks.vb" id="Snippet11":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/remarks.fs" id="Snippet11":::
@@ -1510,11 +1498,9 @@
This code is part of a larger example that can be compiled and executed. See .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet9":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet9":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet9":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet9":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet7":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet7":::
@@ -1584,7 +1570,6 @@
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet10":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet10":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet10":::
@@ -3265,11 +3250,9 @@ Retrieving the value of this property is an O(1) operation.
This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet5":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.SortedList/VB/source.vb" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.fs" id="Snippet4":::
@@ -3338,7 +3321,6 @@ Retrieving the value of this property is an O(1) operation.
The collection returned by the