diff --git a/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp b/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp
deleted file mode 100644
index b45d3fbc13a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Threading;
-using namespace System::Collections::Generic;
-using namespace System::Text;
-
-generic public ref class SafeQueue
-{
-private:
- //
- //
- // A queue that is protected by Monitor.
- Queue^ m_inputQueue;
- //
-
-public:
- SafeQueue()
- {
- m_inputQueue = gcnew Queue();
- };
-
- // Lock the queue and add an element.
- void Enqueue(T qValue)
- {
- // Request the lock, and block until it is obtained.
- Monitor::Enter(m_inputQueue);
- try
- {
- // When the lock is obtained, add an element.
- m_inputQueue->Enqueue(qValue);
- }
- finally
- {
- // Ensure that the lock is released.
- Monitor::Exit(m_inputQueue);
- }
- };
- //
-
- //
- // Try to add an element to the queue: Add the element to the queue
- // only if the lock is immediately available.
- bool TryEnqueue(T qValue)
- {
- // Request the lock.
- if (Monitor::TryEnter(m_inputQueue))
- {
- try
- {
- m_inputQueue->Enqueue(qValue);
- }
- finally
- {
- // Ensure that the lock is released.
- Monitor::Exit(m_inputQueue);
- }
- return true;
- }
- else
- {
- return false;
- }
- };
- //
-
- //
- // Try to add an element to the queue: Add the element to the queue
- // only if the lock becomes available during the specified time
- // interval.
- bool TryEnqueue(T qValue, int waitTime)
- {
- // Request the lock.
- if (Monitor::TryEnter(m_inputQueue, waitTime))
- {
- try
- {
- m_inputQueue->Enqueue(qValue);
- }
- finally
- {
- // Ensure that the lock is released.
- Monitor::Exit(m_inputQueue);
- }
- return true;
- }
- else
- {
- return false;
- }
- };
- //
-
- // Lock the queue and dequeue an element.
- T Dequeue()
- {
- T retval;
-
- // Request the lock, and block until it is obtained.
- Monitor::Enter(m_inputQueue);
- try
- {
- // When the lock is obtained, dequeue an element.
- retval = m_inputQueue->Dequeue();
- }
- finally
- {
- // Ensure that the lock is released.
- Monitor::Exit(m_inputQueue);
- }
-
- return retval;
- };
-
- // Delete all elements that equal the given object.
- int Remove(T qValue)
- {
- int removedCt = 0;
-
- // Wait until the lock is available and lock the queue.
- Monitor::Enter(m_inputQueue);
- try
- {
- int counter = m_inputQueue->Count;
- while (counter > 0)
- // Check each element.
- {
- T elem = m_inputQueue->Dequeue();
- if (!elem->Equals(qValue))
- {
- m_inputQueue->Enqueue(elem);
- }
- else
- {
- // Keep a count of items removed.
- removedCt += 1;
- }
- counter = counter - 1;
- }
- }
- finally
- {
- // Ensure that the lock is released.
- Monitor::Exit(m_inputQueue);
- }
-
- return removedCt;
- };
-
- // Print all queue elements.
- String^ PrintAllElements()
- {
- StringBuilder^ output = gcnew StringBuilder();
-
- // Lock the queue.
- Monitor::Enter(m_inputQueue);
- try
- {
- for each ( T elem in m_inputQueue )
- {
- // Print the next element.
- output->AppendLine(elem->ToString());
- }
- }
- finally
- {
- // Ensure that the lock is released.
- Monitor::Exit(m_inputQueue);
- }
-
- return output->ToString();
- };
-};
-
-public ref class Example
-{
-private:
- static SafeQueue^ q = gcnew SafeQueue();
- static int threadsRunning = 0;
- static array^>^ results = gcnew array^>(3);
-
- static void ThreadProc(Object^ state)
- {
- DateTime finish = DateTime::Now.AddSeconds(10);
- Random^ rand = gcnew Random();
- array^ result = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- int threadNum = (int) state;
-
- while (DateTime::Now < finish)
-
- {
- int what = rand->Next(250);
- int how = rand->Next(100);
-
- if (how < 16)
- {
- q->Enqueue(what);
- result[(int)ThreadResultIndex::EnqueueCt] += 1;
- }
- else if (how < 32)
- {
- if (q->TryEnqueue(what))
- {
- result[(int)ThreadResultIndex::TryEnqueueSucceedCt] += 1;
- }
- else
- {
- result[(int)ThreadResultIndex::TryEnqueueFailCt] += 1;
- }
- }
- else if (how < 48)
- {
- // Even a very small wait significantly increases the success
- // rate of the conditional enqueue operation.
- if (q->TryEnqueue(what, 10))
- {
- result[(int)ThreadResultIndex::TryEnqueueWaitSucceedCt] += 1;
- }
- else
- {
- result[(int)ThreadResultIndex::TryEnqueueWaitFailCt] += 1;
- }
- }
- else if (how < 96)
- {
- result[(int)ThreadResultIndex::DequeueCt] += 1;
- try
- {
- q->Dequeue();
- }
- catch (Exception^ ex)
- {
- result[(int)ThreadResultIndex::DequeueExCt] += 1;
- }
- }
- else
- {
- result[(int)ThreadResultIndex::RemoveCt] += 1;
- result[(int)ThreadResultIndex::RemovedCt] += q->Remove(what);
- }
- }
-
- results[threadNum] = result;
-
- if (0 == Interlocked::Decrement(threadsRunning))
- {
- StringBuilder^ sb = gcnew StringBuilder(
- " Thread 1 Thread 2 Thread 3 Total\n");
-
- for (int row = 0; row < 9; row++)
- {
- int total = 0;
- sb->Append(titles[row]);
-
- for(int col = 0; col < 3; col++)
- {
- sb->Append(String::Format("{0,9}", results[col][row]));
- total += results[col][row];
- }
-
- sb->AppendLine(String::Format("{0,9}", total));
- }
-
- Console::WriteLine(sb->ToString());
- }
- };
-
- static array^ titles = {
- "Enqueue ",
- "TryEnqueue succeeded ",
- "TryEnqueue failed ",
- "TryEnqueue(T, wait) succeeded ",
- "TryEnqueue(T, wait) failed ",
- "Dequeue attempts ",
- "Dequeue exceptions ",
- "Remove operations ",
- "Queue elements removed "};
-
- enum class ThreadResultIndex
- {
- EnqueueCt,
- TryEnqueueSucceedCt,
- TryEnqueueFailCt,
- TryEnqueueWaitSucceedCt,
- TryEnqueueWaitFailCt,
- DequeueCt,
- DequeueExCt,
- RemoveCt,
- RemovedCt
- };
-
-public:
- static void Demo()
- {
- Console::WriteLine("Working...");
-
- for(int i = 0; i < 3; i++)
- {
- Thread^ t = gcnew Thread(gcnew ParameterizedThreadStart(Example::ThreadProc));
- t->Start(i);
- Interlocked::Increment(threadsRunning);
- }
- };
-};
-
-void main()
-{
- Example::Demo();
-}
-
-
-/* This example produces output similar to the following:
-
-Working...
- Thread 1 Thread 2 Thread 3 Total
-Enqueue 274718 513514 337895 1126127
-TryEnqueue succeeded 274502 513516 337480 1125498
-TryEnqueue failed 119 235 141 495
-TryEnqueue(T, wait) succeeded 274552 513116 338532 1126200
-TryEnqueue(T, wait) failed 0 1 0 1
-Dequeue attempts 824038 1541866 1015006 3380910
-Dequeue exceptions 12828 23416 14799 51043
-Remove operations 68746 128218 84306 281270
-Queue elements removed 11464 22024 14470 47958
-Queue elements removed 2921 4690 2982 10593
- */
-//
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp b/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp
deleted file mode 100644
index 1cfed0722c1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Text::RegularExpressions;
-int main()
-{
- //
- // Define a regular expression for repeated words.
- Regex^ rx = gcnew Regex( "\\b(?\\w+)\\s+(\\k)\\b",static_cast(RegexOptions::Compiled | RegexOptions::IgnoreCase) );
- //
-
- // Define a test string.
- String^ text = "The the quick brown fox fox jumps over the lazy dog dog.";
-
- //
- // Find matches.
- MatchCollection^ matches = rx->Matches( text );
- //
-
- //
- // Report the number of matches found.
- Console::WriteLine( "{0} matches found.", matches->Count );
- //
-
- //
- // Report on each match.
- for each (Match^ match in matches)
- {
- String^ word = match->Groups["word"]->Value;
- int index = match->Index;
- Console::WriteLine("{0} repeated at position {1}", word, index);
- }
- //
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp b/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp
deleted file mode 100644
index ba044bc83d7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//Code Modification: Removed AppendLine and associated comment after the AppendFormat line.
-//The CR/LF bytes introduces by AppendLine made the sb.Length appear incorrect.
-// Before
-//sb.AppendFormat("GHI{0}{1}", 'J', 'k');
-////APpend a blank line to the end of the StringBuilder.
-// sb.AppendLine();
-// After
-//sb.AppendFormat("GHI{0}{1}", 'J', 'k');
-//Code Modification: End
-//Types:System.Text.StringBuilder
-//
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- //
- // Create a StringBuilder that expects to hold 50 characters.
- // Initialize the StringBuilder with "ABC".
- StringBuilder^ sb = gcnew StringBuilder("ABC", 50);
- //
-
- //
- // Append three characters (D, E, and F) to the end of the
- // StringBuilder.
- sb->Append(gcnew array{'D', 'E', 'F'});
- //
-
- //
- // Append a format string to the end of the StringBuilder.
- sb->AppendFormat("GHI{0}{1}", (Char)'J', (Char)'k');
- //
-
- //
- // Display the number of characters in the StringBuilder
- // and its string.
- Console::WriteLine("{0} chars: {1}", sb->Length, sb->ToString());
- //
-
- //
- // Insert a string at the beginning of the StringBuilder.
- sb->Insert(0, "Alphabet: ");
- //
-
- //
- // Replace all lowercase k's with uppercase K's.
- sb->Replace('k', 'K');
- //
-
- // Display the number of characters in the StringBuilder
- // and its string.
- Console::WriteLine("{0} chars: {1}", sb->Length, sb->ToString());
-}
-
-// This code produces the following output.
-//
-// 11 chars: ABCDEFGHIJk
-// 21 chars: Alphabet: ABCDEFGHIJK
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp
deleted file mode 100644
index 00fb6116cb7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-void ThreadProc()
-{
- Thread::Sleep(2000);
-};
-
-void main()
-{
- Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc));
- Console::WriteLine("Before setting apartment state: {0}",
- t->GetApartmentState());
-
- t->SetApartmentState(ApartmentState::STA);
- Console::WriteLine("After setting apartment state: {0}",
- t->GetApartmentState());
-
- bool result = t->TrySetApartmentState(ApartmentState::MTA);
- Console::WriteLine("Try to change state: {0}", result);
-
- t->Start();
-
- Thread::Sleep(500);
-
- try
- {
- t->TrySetApartmentState(ApartmentState::STA);
- }
- catch (ThreadStateException^)
- {
- Console::WriteLine("ThreadStateException occurs " +
- "if apartment state is set after starting thread.");
- }
-
- t->Join();
-}
-
-/* This code example produces the following output:
-
-Before setting apartment state: Unknown
-After setting apartment state: STA
-Try to change state: False
-ThreadStateException occurs if apartment state is set after starting thread.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp
deleted file mode 100644
index b1f06ee79ff..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Security::Permissions;
-ref class ThreadWork
-{
-public:
- static void DoWork()
- {
- try
- {
- for ( int i = 0; i < 100; i++ )
- {
- Console::WriteLine( "Thread - working." );
- Thread::Sleep( 100 );
-
- }
- }
- catch ( ThreadAbortException^ e )
- {
- Console::WriteLine( "Thread - caught ThreadAbortException - resetting." );
- Console::WriteLine( "Exception message: {0}", e->Message );
- Thread::ResetAbort();
- }
-
- Console::WriteLine( "Thread - still alive and working." );
- Thread::Sleep( 1000 );
- Console::WriteLine( "Thread - finished working." );
- }
-
-};
-
-int main()
-{
- ThreadStart^ myThreadDelegate = gcnew ThreadStart( ThreadWork::DoWork );
- Thread^ myThread = gcnew Thread( myThreadDelegate );
- myThread->Start();
- Thread::Sleep( 100 );
- Console::WriteLine( "Main - aborting my thread." );
- myThread->Abort();
- myThread->Join();
- Console::WriteLine( "Main ending." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp
deleted file mode 100644
index 45cf4ed9674..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class ThreadWork
-{
-public:
- static void DoWork()
- {
- Console::WriteLine( "Working thread..." );
- }
-
-};
-
-int main()
-{
- ThreadStart^ myThreadDelegate = gcnew ThreadStart( ThreadWork::DoWork );
- Thread^ myThread = gcnew Thread( myThreadDelegate );
- myThread->Start();
- Thread::Sleep( 0 );
- Console::WriteLine( "In main. Attempting to restart myThread." );
- try
- {
- myThread->Start();
- }
- catch ( ThreadStateException^ e )
- {
- Console::WriteLine( "Caught: {0}", e->Message );
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp
deleted file mode 100644
index d59246f431a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-public ref class ThreadWork
-{
-public:
- static void DoWork()
- {
- for ( int i = 0; i < 3; i++ )
- {
- Console::WriteLine( "Working thread..." );
- Thread::Sleep( 100 );
- }
- }
-};
-
-int main()
-{
- ThreadStart^ myThreadDelegate = gcnew ThreadStart(&ThreadWork::DoWork);
- Thread^ thread1 = gcnew Thread( myThreadDelegate );
- thread1->Start();
- for ( int i = 0; i < 3; i++ )
- {
- Console::WriteLine( "In main." );
- Thread::Sleep( 100 );
- }
-}
-// The example displays output like the following:
-// In main.
-// Working thread...
-// In main.
-// Working thread...
-// In main.
-// Working thread...
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp b/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp
deleted file mode 100644
index a5590808eaa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//Types:System.Threading.WaitHandle
-//
-using namespace System;
-using namespace System::Threading;
-
-public ref class WaitHandleExample
-{
- // Define a random number generator for testing.
-private:
- static Random^ random = gcnew Random();
-public:
- static void DoTask(Object^ state)
- {
- AutoResetEvent^ autoReset = (AutoResetEvent^) state;
- int time = 1000 * random->Next(2, 10);
- Console::WriteLine("Performing a task for {0} milliseconds.", time);
- Thread::Sleep(time);
- autoReset->Set();
- }
-};
-
-//
-int main()
-{
- // Define an array with two AutoResetEvent WaitHandles.
- array^ handles = gcnew array {
- gcnew AutoResetEvent(false), gcnew AutoResetEvent(false)};
-
- // Queue up two tasks on two different threads;
- // wait until all tasks are completed.
- DateTime timeInstance = DateTime::Now;
- Console::WriteLine("Main thread is waiting for BOTH tasks to " +
- "complete.");
- ThreadPool::QueueUserWorkItem(
- gcnew WaitCallback(WaitHandleExample::DoTask), handles[0]);
- ThreadPool::QueueUserWorkItem(
- gcnew WaitCallback(WaitHandleExample::DoTask), handles[1]);
- WaitHandle::WaitAll(handles);
- // The time shown below should match the longest task.
- Console::WriteLine("Both tasks are completed (time waited={0})",
- (DateTime::Now - timeInstance).TotalMilliseconds);
-
- // Queue up two tasks on two different threads;
- // wait until any tasks are completed.
- timeInstance = DateTime::Now;
- Console::WriteLine();
- Console::WriteLine("The main thread is waiting for either task to " +
- "complete.");
- ThreadPool::QueueUserWorkItem(
- gcnew WaitCallback(WaitHandleExample::DoTask), handles[0]);
- ThreadPool::QueueUserWorkItem(
- gcnew WaitCallback(WaitHandleExample::DoTask), handles[1]);
- int index = WaitHandle::WaitAny(handles);
- // The time shown below should match the shortest task.
- Console::WriteLine("Task {0} finished first (time waited={1}).",
- index + 1, (DateTime::Now - timeInstance).TotalMilliseconds);
-}
-//
-
-// This code produces the following sample output.
-//
-// Main thread is waiting for BOTH tasks to complete.
-// Performing a task for 7000 milliseconds.
-// Performing a task for 4000 milliseconds.
-// Both tasks are completed (time waited=7064.8052)
-
-// The main thread is waiting for either task to complete.
-// Performing a task for 2000 milliseconds.
-// Performing a task for 2000 milliseconds.
-// Task 1 finished first (time waited=2000.6528).
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp b/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp
deleted file mode 100644
index 8695804de6c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Text::RegularExpressions;
-void main()
-{
-
- String^ text = "One car red car blue car";
- String^ pat = "(\\w+)\\s+(car)";
-
- // Compile the regular expression.
- Regex^ r = gcnew Regex( pat,RegexOptions::IgnoreCase );
-
- // Match the regular expression pattern against a text string.
- Match^ m = r->Match(text);
- int matchCount = 0;
- while ( m->Success )
- {
- Console::WriteLine( "Match{0}", ++matchCount );
- for ( int i = 1; i <= 2; i++ )
- {
- Group^ g = m->Groups[ i ];
- Console::WriteLine( "Group{0}='{1}'", i, g );
- CaptureCollection^ cc = g->Captures;
- for ( int j = 0; j < cc->Count; j++ )
- {
- Capture^ c = cc[ j ];
- System::Console::WriteLine( "Capture{0}='{1}', Position={2}", j, c, c->Index );
- }
- }
- m = m->NextMatch();
- }
-}
-// This example displays the following output:
-// Match1
-// Group1='One'
-// Capture0='One', Position=0
-// Group2='car'
-// Capture0='car', Position=4
-// Match2
-// Group1='red'
-// Capture0='red', Position=8
-// Group2='car'
-// Capture0='car', Position=12
-// Match3
-// Group1='blue'
-// Capture0='blue', Position=16
-// Group2='car'
-// Capture0='car', Position=21
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp
deleted file mode 100644
index 3cb652fc45a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-// This example demonstrates the StringBuilder.AppendFormat method
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Globalization;
-void Show( StringBuilder^ sbs )
-{
- Console::WriteLine( sbs );
- sbs->Length = 0;
-}
-
-int main()
-{
- StringBuilder^ sb = gcnew StringBuilder;
- int var1 = 111;
- float var2 = 2.22F;
- String^ var3 = "abcd";
- array
diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp
deleted file mode 100644
index 8d70a9a85d3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// This example demonstrates the StringBuilder.AppendLine()
-// method.
-
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- StringBuilder^ sb = gcnew StringBuilder;
- String^ line = L"A line of text.";
- int number = 123;
-
- // Append two lines of text.
- sb->AppendLine( L"The first line of text." );
- sb->AppendLine( line );
-
- // Append a new line, an empty string, and a null cast as a string.
- sb->AppendLine();
- sb->AppendLine( L"" );
- sb->AppendLine( L"" );
-
- // Append the non-string value, 123, and two new lines.
- sb->Append( number )->AppendLine()->AppendLine();
-
- // Append two lines of text.
- sb->AppendLine( line );
- sb->AppendLine( L"The last line of text." );
-
- // Convert the value of the StringBuilder to a string and display the string.
- Console::WriteLine( sb );
-
- return 0;
-}
-
-/*
-This example produces the following results:
-
-The first line of text.
-A line of text.
-
-
-
-123
-
-A line of text.
-The last line of text.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp
deleted file mode 100644
index be8fea41b47..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// This example demonstrates the CopyTo(Int32, Char[], Int32, Int32) method.
-// Typically the destination array is small, preallocated, and global while
-// the StringBuilder is large with programmatically defined data.
-// However, for this example both the array and StringBuilder are small
-// and the StringBuilder has predefined data.
-
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- array^dest = gcnew array(6);
- StringBuilder^ src = gcnew StringBuilder( "abcdefghijklmnopqrstuvwxyz!" );
- dest[ 1 ] = ')';
- dest[ 2 ] = ' ';
-
- // Copy the source to the destination in 9 pieces, 3 characters per piece.
- Console::WriteLine( "\nPiece) Data:" );
- for ( int ix = 0; ix < 9; ix++ )
- {
- dest[ 0 ] = ix.ToString()[ 0 ];
- src->CopyTo( ix * 3, dest, 3, 3 );
- Console::Write( " " );
- Console::WriteLine( dest );
- }
-}
-
-/*
-This example produces the following results:
-
-Piece) Data:
- 0) abc
- 1) def
- 2) ghi
- 3) jkl
- 4) mno
- 5) pqr
- 6) stu
- 7) vwx
- 8) yz!
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp
deleted file mode 100644
index 8043d615414..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-
-// This example demonstrates StringBuilder.EnsureCapacity
-// StringBuilder.Capacity
-// StringBuilder.Length
-// StringBuilder.Equals
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- StringBuilder^ sb1 = gcnew StringBuilder( "abc" );
- StringBuilder^ sb2 = gcnew StringBuilder( "abc",16 );
- Console::WriteLine();
- Console::WriteLine( "a1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity );
- Console::WriteLine( "a2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity );
- Console::WriteLine( "a3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 );
- Console::WriteLine( "a4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) );
- Console::WriteLine();
- Console::WriteLine( "Ensure sb1 has a capacity of at least 50 characters." );
- sb1->EnsureCapacity( 50 );
- Console::WriteLine();
- Console::WriteLine( "b1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity );
- Console::WriteLine( "b2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity );
- Console::WriteLine( "b3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 );
- Console::WriteLine( "b4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) );
- Console::WriteLine();
- Console::WriteLine( "Set the length of sb1 to zero." );
- Console::WriteLine( "Set the capacity of sb2 to 51 characters." );
- sb1->Length = 0;
- sb2->Capacity = 51;
- Console::WriteLine();
- Console::WriteLine( "c1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity );
- Console::WriteLine( "c2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity );
- Console::WriteLine( "c3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 );
- Console::WriteLine( "c4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) );
-}
-
-/*
-The example displays the following output:
-
-a1) sb1->Length = 3, sb1->Capacity = 16
-a2) sb2->Length = 3, sb2->Capacity = 16
-a3) sb1 = "abc", sb2 = "abc"
-a4) sb1 equals sb2: True
-
-Ensure sb1 has a capacity of at least 50 characters.
-
-b1) sb1->Length = 3, sb1->Capacity = 50
-b2) sb2->Length = 3, sb2->Capacity = 16
-b3) sb1 = "abc", sb2 = "abc"
-b4) sb1 equals sb2: False
-
-Set the length of sb1 to zero.
-Set the capacity of sb2 to 51 characters.
-
-c1) sb1->Length = 0, sb1->Capacity = 50
-c2) sb2->Length = 3, sb2->Capacity = 51
-c3) sb1 = "", sb2 = "abc"
-c4) sb1 equals sb2: False
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp
deleted file mode 100644
index 03de6cb972e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-
-// This example demonstrates StringBuilder.Insert()
-//
-using namespace System;
-using namespace System::Text;
-ref class Sample
-{
-private:
-
- // index: 012345
- static String^ initialValue = "--[]--";
- static StringBuilder^ sb;
-
-public:
- static void Main()
- {
- String^ xyz = "xyz";
- array^abc = {'a','b','c'};
- Char star = '*';
- Object^ obj = 0;
- bool xBool = true;
- Byte xByte = 1;
- short xInt16 = 2;
- int xInt32 = 3;
- long xInt64 = 4;
- Decimal xDecimal = 5;
- float xSingle = 6.6F;
- double xDouble = 7.7;
-
- // The following types are not CLS-compliant.
- UInt16 xUInt16 = 8;
- UInt32 xUInt32 = 9;
- UInt64 xUInt64 = 10;
- SByte xSByte = -11;
-
- //
- Console::WriteLine( "StringBuilder.Insert method" );
- sb = gcnew StringBuilder( initialValue );
- sb->Insert( 3, xyz, 2 );
- Show( 1, sb );
- sb->Insert( 3, xyz );
- Show( 2, sb );
- sb->Insert( 3, star );
- Show( 3, sb );
- sb->Insert( 3, abc );
- Show( 4, sb );
- sb->Insert( 3, abc, 1, 2 );
- Show( 5, sb );
- sb->Insert( 3, xBool ); // True
- Show( 6, sb );
- sb->Insert( 3, obj ); // 0
- Show( 7, sb );
- sb->Insert( 3, xByte ); // 1
- Show( 8, sb );
- sb->Insert( 3, xInt16 ); // 2
- Show( 9, sb );
- sb->Insert( 3, xInt32 ); // 3
- Show( 10, sb );
- sb->Insert( 3, xInt64 ); // 4
- Show( 11, sb );
- sb->Insert( 3, xDecimal ); // 5
- Show( 12, sb );
- sb->Insert( 3, xSingle ); // 6.6
- Show( 13, sb );
- sb->Insert( 3, xDouble ); // 7.7
- Show( 14, sb );
-
- // The following Insert methods are not CLS-compliant.
- sb->Insert( 3, xUInt16 ); // 8
- Show( 15, sb );
- sb->Insert( 3, xUInt32 ); // 9
- Show( 16, sb );
- sb->Insert( 3, xUInt64 ); // 10
- Show( 17, sb );
- sb->Insert( 3, xSByte ); // -11
- Show( 18, sb );
-
- //
- }
-
- static void Show( int overloadNumber, StringBuilder^ sbs )
- {
- Console::WriteLine( "{0,2:G} = {1}", overloadNumber, sbs );
- sb = gcnew StringBuilder( initialValue );
- }
-
-};
-
-int main()
-{
- Sample::Main();
-}
-
-/*
-This example produces the following results:
-
-StringBuilder.Insert method
- 1 = --[xyzxyz]--
- 2 = --[xyz]--
- 3 = --[*]--
- 4 = --[abc]--
- 5 = --[bc]--
- 6 = --[True]--
- 7 = --[0]--
- 8 = --[1]--
- 9 = --[2]--
-10 = --[3]--
-11 = --[4]--
-12 = --[5]--
-13 = --[6.6]--
-14 = --[7.7]--
-15 = --[8]--
-16 = --[9]--
-17 = --[10]--
-18 = --[-11]--
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp
deleted file mode 100644
index df36afedca8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// This example demonstrates StringBuilder.Remove()
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- String^ rule1 = "0----+----1----+----2----+----3----+----4---";
- String^ rule2 = "01234567890123456789012345678901234567890123";
- String^ str = "The quick brown fox jumps over the lazy dog.";
- StringBuilder^ sb = gcnew StringBuilder( str );
- Console::WriteLine();
- Console::WriteLine( "StringBuilder.Remove method" );
- Console::WriteLine();
- Console::WriteLine( "Original value:" );
- Console::WriteLine( rule1 );
- Console::WriteLine( rule2 );
- Console::WriteLine( "{0}", sb );
- Console::WriteLine();
- sb->Remove( 10, 6 ); // Remove "brown "
- Console::WriteLine( "New value:" );
- Console::WriteLine( rule1 );
- Console::WriteLine( rule2 );
- Console::WriteLine( "{0}", sb );
-}
-
-/*
-This example produces the following results:
-
-StringBuilder.Remove method
-
-Original value:
-0----+----1----+----2----+----3----+----4---
-01234567890123456789012345678901234567890123
-The quick brown fox jumps over the lazy dog.
-
-New value:
-0----+----1----+----2----+----3----+----4---
-01234567890123456789012345678901234567890123
-The quick fox jumps over the lazy dog.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp
deleted file mode 100644
index 56420a34a24..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-// This example demonstrates StringBuilder.Replace()
-//
-using namespace System;
-using namespace System::Text;
-void Show( StringBuilder^ sbs )
-{
- String^ rule1 = "0----+----1----+----2----+----3----+----4---";
- String^ rule2 = "01234567890123456789012345678901234567890123";
- Console::WriteLine( rule1 );
- Console::WriteLine( rule2 );
- Console::WriteLine( "{0}", sbs );
- Console::WriteLine();
-}
-
-int main()
-{
-
- // 0----+----1----+----2----+----3----+----4---
- // 01234567890123456789012345678901234567890123
- String^ str = "The quick br!wn d#g jumps #ver the lazy cat.";
- StringBuilder^ sb = gcnew StringBuilder( str );
- Console::WriteLine();
- Console::WriteLine( "StringBuilder.Replace method" );
- Console::WriteLine();
- Console::WriteLine( "Original value:" );
- Show( sb );
- sb->Replace( '#', '!', 15, 29 ); // Some '#' -> '!'
- Show( sb );
- sb->Replace( '!', 'o' ); // All '!' -> 'o'
- Show( sb );
- sb->Replace( "cat", "dog" ); // All "cat" -> "dog"
- Show( sb );
- sb->Replace( "dog", "fox", 15, 20 ); // Some "dog" -> "fox"
- Console::WriteLine( "Final value:" );
- Show( sb );
-}
-
-/*
-This example produces the following results:
-
-StringBuilder.Replace method
-
-Original value:
-0----+----1----+----2----+----3----+----4---
-01234567890123456789012345678901234567890123
-The quick br!wn d#g jumps #ver the lazy cat.
-
-0----+----1----+----2----+----3----+----4---
-01234567890123456789012345678901234567890123
-The quick br!wn d!g jumps !ver the lazy cat.
-
-0----+----1----+----2----+----3----+----4---
-01234567890123456789012345678901234567890123
-The quick brown dog jumps over the lazy cat.
-
-0----+----1----+----2----+----3----+----4---
-01234567890123456789012345678901234567890123
-The quick brown dog jumps over the lazy dog.
-
-Final value:
-0----+----1----+----2----+----3----+----4---
-01234567890123456789012345678901234567890123
-The quick brown fox jumps over the lazy dog.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp
deleted file mode 100644
index 6728f14abce..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// This example demonstrates the DecoderExceptionFallback class.
-
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- // Create an encoding, which is equivalent to calling the
- // ASCIIEncoding class constructor.
- // The DecoderExceptionFallback parameter specifies that an exception
- // is thrown if a character cannot be encoded.
- // An encoder exception fallback is also specified, but in this code
- // example the encoding operation cannot fail.
-
- Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii",
- gcnew EncoderExceptionFallback(), gcnew DecoderExceptionFallback());
- String^ inputString = "XYZ";
- String^ decodedString;
- String^ twoNewLines = Environment::NewLine + Environment::NewLine ;
-
- array^ encodedBytes =
- gcnew array(asciiEncoding->GetByteCount(inputString));
- int numberOfEncodedBytes = 0;
-
- // ---------------------------------------------------------------------
- Console::Clear();
-
- // Display the name of the encoding.
- Console::WriteLine("The name of the encoding is \"{0}\".{1}",
- asciiEncoding->WebName, Environment::NewLine);
-
- // Display the input string in text.
- Console::WriteLine("Input string ({0} characters): \"{1}\"",
- inputString->Length, inputString);
-
- // Display the input string in hexadecimal.
- Console::Write("Input string in hexadecimal: ");
- for each (char c in inputString)
- {
- Console::Write("0x{0:X2} ", c);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
- // Encode the input string.
-
- Console::WriteLine("Encode the input string...");
-
- numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0,
- inputString->Length, encodedBytes, 0);
-
- // Display the encoded bytes.
- Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}",
- numberOfEncodedBytes, Environment::NewLine);
- for each (Byte b in encodedBytes)
- {
- Console::Write("0x{0:X2} ", b);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
-
- // Replace the encoded byte sequences for the characters 'X' and 'Z'
- // with the value 0xFF, which is outside the valid range of 0x00 to 0x7F
- // for ASCIIEncoding. The resulting byte sequence is actually the
- // beginning of this code example because it is the input to the decoder
- // operation, and is equivalent to a corrupted or improperly encoded
- // byte sequence.
-
- encodedBytes[0] = 0xFF;
- encodedBytes[2] = 0xFF;
-
- Console::WriteLine("Display the corrupted byte sequence...");
- Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}",
- numberOfEncodedBytes, Environment::NewLine);
- for each (Byte b in encodedBytes)
- {
- Console::Write("0x{0:X2} ", b);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
- // Attempt to decode the encoded bytes. However, an exception is thrown
- // before the byte sequence can be decoded.
-
- Console::WriteLine("Compare the decoded bytes to the input string...");
-
- try
- {
- decodedString = asciiEncoding->GetString(encodedBytes);
- // This statement is never executed.
- Console::WriteLine("This statement is never executed.");
- }
- catch (DecoderFallbackException^ ex)
- {
- Console::WriteLine(ex);
- Console::WriteLine(
- "{0}*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***",
- Environment::NewLine);
- }
-}
-
-
-/*
-This code example produces the following results:
-
-The name of the encoding is "us-ascii".
-
-Input string (3 characters): "XYZ"
-Input string in hexadecimal: 0x58 0x59 0x5A
-
-Encode the input string...
-Encoded bytes in hexadecimal (3 bytes):
-
-0x58 0x59 0x5A
-
-Display the corrupted byte sequence...
-Encoded bytes in hexadecimal (3 bytes):
-
-0xFF 0x59 0xFF
-
-Compare the decoded bytes to the input string...
-System.Text.DecoderFallbackException: Unable to translate bytes [FF] at index 0 from speci
-fied code page to Unicode.
-at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
-at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index
-)
-at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes)
-at System.Text.ASCIIEncoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS decoder)
-
-at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encod
-ing)
-at System.Text.ASCIIEncoding.GetString(Byte[] bytes, Int32 byteIndex, Int32 byteCount)
-at System.Text.Encoding.GetString(Byte[] bytes)
-at Sample.Main()
-
-*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp
deleted file mode 100644
index 332c5a91b7d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// This example demonstrates the DecoderReplacementFallback class.
-
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- // Create an encoding, which is equivalent to calling the
- // ASCIIEncoding class constructor.
- // The DecoderReplacementFallback parameter specifies that the
- // string "(error)" is to replace characters that cannot be decoded.
- // An encoder replacement fallback is also specified, but in this code
- // example the encoding operation cannot fail.
-
- Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii",
- gcnew EncoderReplacementFallback("(unknown)"),
- gcnew DecoderReplacementFallback("(error)"));
- String^ inputString = "XYZ";
- String^ decodedString;
- String^ twoNewLines = Environment::NewLine + Environment::NewLine;
- array^ encodedBytes = gcnew array(
- asciiEncoding->GetByteCount(inputString));
- int numberOfEncodedBytes = 0;
-
- // ---------------------------------------------------------------------
- Console::Clear();
-
- // Display the name of the encoding.
- Console::WriteLine("The name of the encoding is \"{0}\".{1}",
- asciiEncoding->WebName, Environment::NewLine);
-
- // Display the input string in text.
- Console::WriteLine("Input string ({0} characters): \"{1}\"",
- inputString->Length, inputString);
-
- // Display the input string in hexadecimal.
- Console::Write("Input string in hexadecimal: ");
- for each (char c in inputString)
- {
- Console::Write("0x{0:X2} ", c);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
- // Encode the input string.
-
- Console::WriteLine("Encode the input string...");
- numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0,
- inputString->Length, encodedBytes, 0);
-
- // Display the encoded bytes.
- Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}",
- numberOfEncodedBytes, Environment::NewLine);
- for each (Byte b in encodedBytes)
- {
- Console::Write("0x{0:X2} ", b);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
-
- // Replace the encoded byte sequences for the characters 'X' and 'Z'
- // with the value 0xFF, which is outside the valid range of 0x00 to 0x7F
- // for ASCIIEncoding. The resulting byte sequence is actually the
- // beginning of this code example because it is the input to the decoder
- // operation, and is equivalent to a corrupted or improperly encoded
- // byte sequence.
-
- encodedBytes[0] = 0xFF;
- encodedBytes[2] = 0xFF;
-
- Console::WriteLine("Display the corrupted byte sequence...");
- Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}",
- numberOfEncodedBytes, Environment::NewLine);
- for each (Byte b in encodedBytes)
- {
- Console::Write("0x{0:X2} ", b);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
- // Decode the encoded bytes.
-
- Console::WriteLine("Compare the decoded bytes to the input string...");
- decodedString = asciiEncoding->GetString(encodedBytes);
-
- // Display the input string and the decoded string for comparison.
- Console::WriteLine("Input string: \"{0}\"", inputString);
- Console::WriteLine("Decoded string:\"{0}\"", decodedString);
-}
-/*
-This code example produces the following results:
-
-The name of the encoding is "us-ascii".
-
-Input string (3 characters): "XYZ"
-Input string in hexadecimal: 0x58 0x59 0x5A
-
-Encode the input string...
-Encoded bytes in hexadecimal (3 bytes):
-
-0x58 0x59 0x5A
-
-Display the corrupted byte sequence...
-Encoded bytes in hexadecimal (3 bytes):
-
-0xFF 0x59 0xFF
-
-Compare the decoded bytes to the input string...
-Input string: "XYZ"
-Decoded string:"(error)Y(error)"
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp
deleted file mode 100644
index 3207d7a7fb2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// This example demonstrates the EncoderExceptionFallback class.
-
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- // Create an encoding, which is equivalent to calling the
- // ASCIIEncoding class constructor.
- // The EncoderExceptionFallback parameter causes an exception to
- // be thrown when a character cannot be encoded.
- // A decoder exception fallback is also specified, but it is not
- // used because this example terminates during the encoding operation.
-
- Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii",
- gcnew EncoderExceptionFallback(), gcnew DecoderExceptionFallback());
-
- // The input string consists of the Unicode characters LEFT POINTING
- // DOUBLE ANGLE QUOTATION MARK (U+00AB), 'X' (U+0058), and RIGHT
- // POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB).
- // The encoding can only encode characters in the US-ASCII range of
- // U+0000 through U+007F. Consequently, the characters bracketing the
- // 'X' character cause an exception.
- String^ inputString = L"\u00abX\u00bb";
-
- String^ twoNewLines = Environment::NewLine + Environment::NewLine;
- array^ encodedBytes = gcnew array(
- asciiEncoding->GetMaxByteCount(inputString->Length));
- int numberOfEncodedBytes = 0;
-
- // ---------------------------------------------------------------------
- Console::Clear();
-
- // Display the name of the encoding.
- Console::WriteLine("The name of the encoding is \"{0}\".{1}",
- asciiEncoding->WebName, Environment::NewLine);
-
- // Display the input string in text.
- Console::WriteLine("Input string ({0} characters): \"{1}\"",
- inputString->Length, inputString);
-
- // Display the input string in hexadecimal.
- Console::Write("Input string in hexadecimal: ");
- for each (char c in inputString)
- {
- Console::Write("0x{0:X2} ", c);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
- // Attempt to encode the input string. However, an exception is thrown
- // before the input string can be encoded.
-
- Console::WriteLine("Encode the input string...");
-
- // The code example terminates during the call to the GetBytes() method.
- try
- {
- numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0,
- inputString->Length, encodedBytes, 0);
- // This statement is never executed.
- Console::WriteLine("This statement is never executed.");
- }
- catch (EncoderFallbackException^ ex)
- {
- Console::WriteLine(ex);
- Console::WriteLine(
- "{0}*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***",
- Environment::NewLine);
- }
-}
-
-/*
-This code example produces the following results:
-
-The name of the encoding is "us-ascii".
-
-Input string (3 characters): "X"
-Input string in hexadecimal: 0xAB 0x58 0xBB
-
-Encode the input string...
-System.Text.EncoderFallbackException: Unable to translate Unicode character \u00AB at inde
-x 0 to specified code page.
-at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
-at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
-at System.Text.ASCIIEncoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32
-byteCount, EncoderNLS encoder)
-at System.Text.ASCIIEncoding.GetBytes(String chars, Int32 charIndex, Int32 charCount, B
-yte[] bytes, Int32 byteIndex)
-at Sample.Main()
-
-*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp
deleted file mode 100644
index ec4a3456bd1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// This example demonstrates the EncoderReplacementFallback class.
-
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- // Create an encoding, which is equivalent to calling the
- // ASCIIEncoding class constructor.
- // The EncoderReplacementFallback parameter specifies that the
- // string, "(unknown)", replace characters that cannot be encoded.
- // A decoder replacement fallback is also specified, but in this
- // code example the decoding operation cannot fail.
-
- Encoding^ ascii = Encoding::GetEncoding("us-ascii",
- gcnew EncoderReplacementFallback("(unknown)"),
- gcnew DecoderReplacementFallback("(error)"));
-
- // The input string consists of the Unicode characters LEFT POINTING
- // DOUBLE ANGLE QUOTATION MARK (U+00AB), 'X' (U+0058), and RIGHT
- // POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB).
- // The encoding can only encode characters in the US-ASCII range of
- // U+0000 through U+007F. Consequently, the characters bracketing the
- // 'X' character are replaced with the fallback replacement string,
- // "(unknown)".
-
- String^ inputString = "\u00abX\u00bb";
- String^ decodedString;
- String^ twoNewLines = Environment::NewLine + Environment::NewLine;
- array ^ encodedBytes =
- gcnew array(ascii->GetByteCount(inputString));
- int numberOfEncodedBytes = 0;
-
- // ---------------------------------------------------------------------
- // Display the name of the encoding.
- Console::WriteLine("The name of the encoding is \"{0}\".{1}",
- ascii->WebName, Environment::NewLine);
-
- // Display the input string in text.
- Console::WriteLine("Input string ({0} characters): \"{1}\"",
- inputString->Length, inputString);
-
- // Display the input string in hexadecimal.
- Console::Write("Input string in hexadecimal: ");
- for each (char c in inputString)
- {
- Console::Write("0x{0:X2} ", c);
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
- // Encode the input string.
-
- Console::WriteLine("Encode the input string...");
- numberOfEncodedBytes = ascii->GetBytes(inputString, 0, inputString->Length,
- encodedBytes, 0);
-
- // Display the encoded bytes.
- Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}",
- numberOfEncodedBytes, Environment::NewLine);
- for(int i = 0; i < encodedBytes->Length; i++)
- {
- Console::Write("0x{0:X2} ", encodedBytes[i]);
- if(((i + 1) % 6) == 0)
- {
- Console::WriteLine();
- }
- }
- Console::Write(twoNewLines);
-
- // ---------------------------------------------------------------------
- // Decode the encoded bytes, yielding a reconstituted string.
-
- Console::WriteLine("Decode the encoded bytes...");
- decodedString = ascii->GetString(encodedBytes);
-
- // Display the input string and the decoded string for comparison.
- Console::WriteLine("Input string: \"{0}\"", inputString);
- Console::WriteLine("Decoded string:\"{0}\"", decodedString);
-}
-
-
-
-/*
-This code example produces the following results:
-
-The name of the encoding is "us-ascii".
-
-Input string (3 characters): "X"
-Input string in hexadecimal: 0xAB 0x58 0xBB
-
-Encode the input string...
-Encoded bytes in hexadecimal (19 bytes):
-
-0x28 0x75 0x6E 0x6B 0x6E 0x6F
-0x77 0x6E 0x29 0x58 0x28 0x75
-0x6E 0x6B 0x6E 0x6F 0x77 0x6E
-0x29
-
-Decode the encoded bytes...
-Input string: "X"
-Decoded string:"(unknown)X(unknown)"
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp
deleted file mode 100644
index 79399d8f51e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-int main()
-{
- for (int i = 0; i < 5; i++)
- {
- Console::WriteLine("Sleep for 2 seconds.");
- Thread::Sleep(2000);
- }
-
- Console::WriteLine("Main thread exits.");
-}
-
-/* This example produces the following output:
-
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Main thread exits.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp
deleted file mode 100644
index 4f50e318256..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-int main()
-{
- TimeSpan interval = TimeSpan(0, 0, 2);
-
- for (int i = 0; i < 5; i++)
- {
- Console::WriteLine("Sleep for 2 seconds.");
- Thread::Sleep(interval);
- }
-
- Console::WriteLine("Main thread exits.");
-}
-
-/* This example produces the following output:
-
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Sleep for 2 seconds.
-Main thread exits.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp
deleted file mode 100644
index 56512d92aca..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // These bytes in UTF-8 correspond to 3 different Unicode
- // characters: space (U+0020), # (U+0023), and the biohazard
- // symbol (U+2623). Note the biohazard symbol requires 3 bytes
- // in UTF-8 (hexadecimal e2, 98, a3). Decoders store state across
- // multiple calls to GetChars, handling the case when one char
- // is in multiple byte arrays.
- array^bytes1 = {0x20,0x23,0xe2};
- array^bytes2 = {0x98,0xa3};
- array^chars = gcnew array(3);
- Decoder^ d = Encoding::UTF8->GetDecoder();
- int charLen = d->GetChars( bytes1, 0, bytes1->Length, chars, 0 );
-
- // The value of charLen should be 2 now.
- charLen += d->GetChars( bytes2, 0, bytes2->Length, chars, charLen );
- for ( UInt16 index(0); index < chars->Length; ++index )
- {
- Console::Write( "U+{0:X4} ", static_cast(chars[ index ]) );
-
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp
deleted file mode 100644
index df797ae34f0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Use this code inside a project created with the Visual C++ > CLR > CLR Console Application template.
-// Replace the code in the default .cpp file with this code.
-
-#include "stdafx.h"
-#using
-
-using namespace System;
-
-// To avoid confusion with other Timer classes, this sample always uses the fully-qualified
-// name of System::Timers::Timer instead of a using statement for System::Timer.
-
-public ref class Example
-{
-private:
- static System::Timers::Timer^ aTimer;
-
-public:
- static void Demo()
- {
- // Normally, the timer is declared at the class level, so that it stays in scope as long as it
- // is needed. If the timer is declared in a long-running method, KeepAlive must be used to prevent
- // the JIT compiler from allowing aggressive garbage collection to occur before the method ends.
- // You can experiment with this by commenting out the class-level declaration and uncommenting
- // the declaration below; then uncomment the GC.KeepAlive(aTimer) at the end of the method.
- //System::Timers::Timer^ aTimer;
-
- // Create a timer and set a two second interval.
- aTimer = gcnew System::Timers::Timer();
- aTimer->Interval = 2000;
-
- // Alternate method: create a Timer with an interval argument to the constructor.
- //aTimer = gcnew System::Timers::Timer(2000);
-
- // Hook up the Elapsed event for the timer.
- aTimer->Elapsed += gcnew System::Timers::ElapsedEventHandler(Example::OnTimedEvent);
-
- // Have the timer fire repeated events (true is the default)
- aTimer->AutoReset = true;
-
- // Start the timer
- aTimer->Enabled = true;
-
- Console::WriteLine("Press the Enter key to exit the program at any time... ");
- Console::ReadLine();
-
- // If the timer is declared in a long-running method, use KeepAlive to prevent garbage collection
- // from occurring before the method ends.
- //GC::KeepAlive(aTimer);
- }
-
-private:
- static void OnTimedEvent(Object^ source, System::Timers::ElapsedEventArgs^ e)
- {
- Console::WriteLine("The Elapsed event was raised at {0}", e->SignalTime);
- }
-
-};
-
-int main()
-{
- Example::Demo();
-}
-
-// This example displays output like the following:
-// Press the Enter key to exit the program at any time...
-// The Elapsed event was raised at 5/20/2015 8:48:58 PM
-// The Elapsed event was raised at 5/20/2015 8:49:00 PM
-// The Elapsed event was raised at 5/20/2015 8:49:02 PM
-// The Elapsed event was raised at 5/20/2015 8:49:04 PM
-// The Elapsed event was raised at 5/20/2015 8:49:06 PM
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp
deleted file mode 100644
index 6f843e8ba21..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Timers;
-
-public ref class Timer2
-{
-private:
- static System::Timers::Timer^ aTimer;
-
-public:
- static void Main()
- {
- // Create a new Timer with Interval set to 1.5 seconds.
- double interval = 1500.0;
- aTimer = gcnew System::Timers::Timer(interval);
-
- // Hook up the event handler for the Elapsed event.
- aTimer->Elapsed += gcnew ElapsedEventHandler( OnTimedEvent );
-
- // Only raise the event the first time Interval elapses.
- aTimer->AutoReset = false;
- aTimer->Enabled = true;
-
- // Ensure the event fires before the exit message appears.
- System::Threading::Thread::Sleep((int) interval * 2);
- Console::WriteLine("Press the Enter key to exit the program.");
- Console::ReadLine();
-
- // If the timer is declared in a long-running method, use
- // KeepAlive to prevent garbage collection from occurring
- // before the method ends.
- //GC::KeepAlive(aTimer);
- }
-
-private:
- // Handle the Elapsed event.
- static void OnTimedEvent( Object^ /*source*/, ElapsedEventArgs^ /*e*/ )
- {
- Console::WriteLine( "Hello World!" );
- }
-
-};
-
-int main()
-{
- Timer2::Main();
-}
-// The example displays the following output:
-// Hello World!
-// Press the Enter key to exit the program.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp
deleted file mode 100644
index b1cbd4a7c59..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Text;
-int main()
-{
-
- // The encoding.
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
-
- // A Unicode string with two characters outside the ASCII code range.
- String^ unicodeString = L"This Unicode String* contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3).";
- Console::WriteLine( "Original String*:" );
- Console::WriteLine( unicodeString );
-
- // Save positions of the special characters for later reference.
- int indexOfPi = unicodeString->IndexOf( L'\u03a0' );
- int indexOfSigma = unicodeString->IndexOf( L'\u03a3' );
-
- // Encode string.
- array^encodedBytes = ascii->GetBytes( unicodeString );
- Console::WriteLine();
- Console::WriteLine( "Encoded bytes:" );
- IEnumerator^ myEnum = encodedBytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "->Item[ {0}]", b );
- }
-
- Console::WriteLine();
-
- // Notice that the special characters have been replaced with
- // the value 63, which is the ASCII character code for '?'.
- Console::WriteLine();
- Console::WriteLine( "Value at position of Pi character: {0}", encodedBytes[ indexOfPi ] );
- Console::WriteLine( "Value at position of Sigma character: {0}", encodedBytes[ indexOfSigma ] );
-
- // Decode bytes back to string.
- // Notice missing Pi and Sigma characters.
- String^ decodedString = ascii->GetString( encodedBytes );
- Console::WriteLine();
- Console::WriteLine( "Decoded bytes:" );
- Console::WriteLine( decodedString );
-}
-// The example displays the following output:
-// Original string:
-// This Unicode string contains two characters with codes outside the ASCII code ra
-// nge, Pi (Π) and Sigma (Σ).
-//
-// Encoded bytes:
-// [84][104][105][115][32][85][110][105][99][111][100][101][32][115][116][114][105]
-// [110][103][32][99][111][110][116][97][105][110][115][32][116][119][111][32][99][
-// 104][97][114][97][99][116][101][114][115][32][119][105][116][104][32][99][111][1
-// 00][101][115][32][111][117][116][115][105][100][101][32][116][104][101][32][65][
-// 83][67][73][73][32][99][111][100][101][32][114][97][110][103][101][44][32][80][1
-// 05][32][40][63][41][32][97][110][100][32][83][105][103][109][97][32][40][63][41]
-// [46]
-//
-// Value at position of Pi character: 63
-// Value at position of Sigma character: 63
-//
-// Decoded bytes:
-// This Unicode string contains two characters with codes outside the ASCII code ra
-// nge, Pi (?) and Sigma (?).
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp
deleted file mode 100644
index 6c219637683..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int byteCount = ascii->GetByteCount( chars, 1, 2 );
- Console::WriteLine( " {0} bytes needed to encode characters.", byteCount.ToString() );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp
deleted file mode 100644
index 9cca1f732fb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- String^ chars = "ASCII Encoding Example";
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int byteCount = ascii->GetByteCount( chars );
- Console::WriteLine( " {0} bytes needed to encode string.", byteCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index 8c299b71779..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
- String^ chars = "ASCII Encoding Example";
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int byteCount = ascii->GetByteCount( chars->ToCharArray(), 6, 8 );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = ascii->GetBytes( chars, 6, 8, bytes, 0 );
- Console::WriteLine( " {0} bytes used to encode string.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index 50c3b1c6605..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int byteCount = ascii->GetByteCount( chars, 1, 2 );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = ascii->GetBytes( chars, 1, 2, bytes, 0 );
- Console::WriteLine( " {0} bytes used to encode characters.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
deleted file mode 100644
index 9a924b51b64..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- array^bytes = {65,83,67,73,73,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101};
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int charCount = ascii->GetCharCount( bytes, 6, 8 );
- Console::WriteLine( "{0} characters needed to decode bytes.", charCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
deleted file mode 100644
index 7185ebd1815..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars;
- array^bytes = {65,83,67,73,73,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101};
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int charCount = ascii->GetCharCount( bytes, 6, 8 );
- chars = gcnew array(charCount);
- int charsDecodedCount = ascii->GetChars( bytes, 6, 8, chars, 0 );
- Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount );
- Console::Write( "Decoded chars: " );
- IEnumerator^ myEnum = chars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", c.ToString() );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
deleted file mode 100644
index 2f2f78f27ff..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int charCount = 2;
- int maxByteCount = ascii->GetMaxByteCount( charCount );
- Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
deleted file mode 100644
index b6d834c02f9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- int byteCount = 8;
- int maxCharCount = ascii->GetMaxCharCount( byteCount );
- Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp
deleted file mode 100644
index b8f188b7df6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- // Define a string.
- String^ original = "ASCII Encoding Example";
- // Instantiate an ASCII encoding object.
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
-
- // Create an ASCII byte array.
- array^ bytes = ascii->GetBytes(original);
-
- // Display encoded bytes.
- Console::Write("Encoded bytes (in hex): ");
- for each (Byte value in bytes)
- Console::Write("{0:X2} ", value);
- Console::WriteLine();
-
- // Decode the bytes and display the resulting Unicode string.
- String^ decoded = ascii->GetString(bytes);
- Console::WriteLine("Decoded string: '{0}'", decoded);
-}
-// The example displays the following output:
-// Encoded bytes (in hex): 41 53 43 49 49 20 45 6E 63 6F 64 69 6E 67 20 45 78 61 6D 70 6C 65
-// Decoded string: 'ASCII Encoding Example'
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp
deleted file mode 100644
index 962a0f07f41..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
- String^ encodingName = ascii->EncodingName;
- Console::WriteLine( "Encoding name: {0}", encodingName );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
deleted file mode 100644
index 370f5662328..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0};
- Decoder^ uniDecoder = Encoding::Unicode->GetDecoder();
- int charCount = uniDecoder->GetCharCount( bytes, 0, bytes->Length );
- Console::WriteLine( "{0} characters needed to decode bytes.", charCount );
-}
-
-/* This code example produces the following output.
-
-7 characters needed to decode bytes.
-
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
deleted file mode 100644
index 7183cd449b3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars;
- array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0};
- Decoder^ uniDecoder = Encoding::Unicode->GetDecoder();
- int charCount = uniDecoder->GetCharCount( bytes, 0, bytes->Length );
- chars = gcnew array(charCount);
- int charsDecodedCount = uniDecoder->GetChars( bytes, 0, bytes->Length, chars, 0 );
- Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount );
- Console::Write( "Decoded chars: " );
- IEnumerator^ myEnum = chars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", c.ToString() );
- }
-
- Console::WriteLine();
-}
-
-/* This code example produces the following output.
-
-7 characters used to decode bytes.
-Decoded chars: [U][n][i][c][o][d][e]
-
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp
deleted file mode 100644
index 70bd454cc25..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // A Decoder is obtained from an Encoding.
- UnicodeEncoding^ uni = gcnew UnicodeEncoding;
- Decoder^ dec1 = uni->GetDecoder();
-
- // A more direct technique.
- Decoder^ dec2 = Encoding::Unicode->GetDecoder();
-
- // dec1 and dec2 seem to be the same.
- Console::WriteLine( dec1 );
- Console::WriteLine( dec2 );
-
- // Note that their hash codes differ.
- Console::WriteLine( dec1->GetHashCode() );
- Console::WriteLine( dec2->GetHashCode() );
-}
-
-/* This code example produces the following output.
-
-System.Text.UnicodeEncoding+Decoder
-System.Text.UnicodeEncoding+Decoder
-54267293
-18643596
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp
deleted file mode 100644
index 74bd7968408..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-void ShowArray( Array^ theArray )
-{
- IEnumerator^ myEnum = theArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ o = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", o );
- }
-
- Console::WriteLine( "\n" );
-}
-
-int main()
-{
-
- // The characters to encode.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
-
- // Encode characters using an Encoding Object*.
- Encoding^ encoding = Encoding::UTF7;
- Console::WriteLine( "Using Encoding\n--------------" );
-
- // Encode complete array for comparison.
- array^allCharactersFromEncoding = encoding->GetBytes( chars );
- Console::WriteLine( "All characters encoded:" );
- ShowArray( allCharactersFromEncoding );
-
- // Encode characters, one-by-one.
- // The Encoding Object* will NOT maintain state between calls.
- array^firstchar = encoding->GetBytes( chars, 0, 1 );
- Console::WriteLine( "First character:" );
- ShowArray( firstchar );
- array^secondchar = encoding->GetBytes( chars, 1, 1 );
- Console::WriteLine( "Second character:" );
- ShowArray( secondchar );
- array^thirdchar = encoding->GetBytes( chars, 2, 1 );
- Console::WriteLine( "Third character:" );
- ShowArray( thirdchar );
- array^fourthchar = encoding->GetBytes( chars, 3, 1 );
- Console::WriteLine( "Fourth character:" );
- ShowArray( fourthchar );
-
- // Now, encode characters using an Encoder Object*.
- Encoder^ encoder = encoding->GetEncoder();
- Console::WriteLine( "Using Encoder\n-------------" );
-
- // Encode complete array for comparison.
- array^allCharactersFromEncoder = gcnew array(encoder->GetByteCount( chars, 0, chars->Length, true ));
- encoder->GetBytes( chars, 0, chars->Length, allCharactersFromEncoder, 0, true );
- Console::WriteLine( "All characters encoded:" );
- ShowArray( allCharactersFromEncoder );
-
- // Do not flush state; i.e. maintain state between calls.
- bool bFlushState = false;
-
- // Encode characters one-by-one.
- // By maintaining state, the Encoder will not store extra bytes in the output.
- array^firstcharNoFlush = gcnew array(encoder->GetByteCount( chars, 0, 1, bFlushState ));
- encoder->GetBytes( chars, 0, 1, firstcharNoFlush, 0, bFlushState );
- Console::WriteLine( "First character:" );
- ShowArray( firstcharNoFlush );
- array^secondcharNoFlush = gcnew array(encoder->GetByteCount( chars, 1, 1, bFlushState ));
- encoder->GetBytes( chars, 1, 1, secondcharNoFlush, 0, bFlushState );
- Console::WriteLine( "Second character:" );
- ShowArray( secondcharNoFlush );
- array^thirdcharNoFlush = gcnew array(encoder->GetByteCount( chars, 2, 1, bFlushState ));
- encoder->GetBytes( chars, 2, 1, thirdcharNoFlush, 0, bFlushState );
- Console::WriteLine( "Third character:" );
- ShowArray( thirdcharNoFlush );
-
- // Must flush state on last call to GetBytes().
- bFlushState = true;
- array^fourthcharNoFlush = gcnew array(encoder->GetByteCount( chars, 3, 1, bFlushState ));
- encoder->GetBytes( chars, 3, 1, fourthcharNoFlush, 0, bFlushState );
- Console::WriteLine( "Fourth character:" );
- ShowArray( fourthcharNoFlush );
-}
-
-/* This code example produces the following output.
-
-Using Encoding
---------------
-All characters encoded:
-[43][65][54][65][68][111][119][79][109][65][54][107][45]
-
-First character:
-[43][65][54][65][45]
-
-Second character:
-[43][65][54][77][45]
-
-Third character:
-[43][65][54][89][45]
-
-Fourth character:
-[43][65][54][107][45]
-
-Using Encoder
--------------
-All characters encoded:
-[43][65][54][65][68][111][119][79][109][65][54][107][45]
-
-First character:
-[43][65][54]
-
-Second character:
-[65][68][111]
-
-Third character:
-[119][79][109]
-
-Fourth character:
-[65][54][107][45]
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp
deleted file mode 100644
index d8af6efc812..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- Encoder^ uniEncoder = Encoding::Unicode->GetEncoder();
- int byteCount = uniEncoder->GetByteCount( chars, 0, chars->Length, true );
- Console::WriteLine( "{0} bytes needed to encode characters.", byteCount );
-}
-
-/* This code example produces the following output.
-
-8 bytes needed to encode characters.
-
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index 1430f4918f5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- Encoder^ uniEncoder = Encoding::Unicode->GetEncoder();
- int byteCount = uniEncoder->GetByteCount( chars, 0, chars->Length, true );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = uniEncoder->GetBytes( chars, 0, chars->Length, bytes, 0, true );
- Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-/* This code example produces the following output.
-
-8 bytes used to encode characters.
-Encoded bytes: [160][3][163][3][166][3][169][3]
-
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp
deleted file mode 100644
index 0f8e033017f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // An Encoder is obtained from an Encoding.
- UnicodeEncoding^ uni = gcnew UnicodeEncoding;
- Encoder^ enc1 = uni->GetEncoder();
-
- // A more direct technique.
- Encoder^ enc2 = Encoding::Unicode->GetEncoder();
-
- // enc1 and enc2 seem to be the same.
- Console::WriteLine( enc1 );
- Console::WriteLine( enc2 );
-
- // Note that their hash codes differ.
- Console::WriteLine( enc1->GetHashCode() );
- Console::WriteLine( enc2->GetHashCode() );
-}
-
-/* This code example produces the following output.
-
-System.Text.EncoderNLS
-System.Text.EncoderNLS
-54267293
-18643596
-
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp
deleted file mode 100644
index 3ea34429d23..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
-
- // Create an ASCII encoding.
- Encoding^ ascii = Encoding::ASCII;
-
- // A Unicode String* with two characters outside the ASCII code range.
- String^ unicodeString = L"This unicode string contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3).";
- Console::WriteLine( "Original string:" );
- Console::WriteLine( unicodeString );
-
- // Save the positions of the special characters for later reference.
- int indexOfPi = unicodeString->IndexOf( L'\u03a0' );
- int indexOfSigma = unicodeString->IndexOf( L'\u03a3' );
-
- // Encode the String*.
- array^encodedBytes = ascii->GetBytes( unicodeString );
- Console::WriteLine();
- Console::WriteLine( "Encoded bytes:" );
- IEnumerator^ myEnum = encodedBytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-
- // Notice that the special characters have been replaced with
- // the value 63, which is the ASCII character code for '?'.
- Console::WriteLine();
- Console::WriteLine( "Value at position of Pi character: {0}", encodedBytes[ indexOfPi ] );
- Console::WriteLine( "Value at position of Sigma character: {0}", encodedBytes[ indexOfSigma ] );
-
- // Decode bytes back to String*.
- // Notice the missing Pi and Sigma characters.
- String^ decodedString = ascii->GetString( encodedBytes );
- Console::WriteLine();
- Console::WriteLine( "Decoded bytes:" );
- Console::WriteLine( decodedString );
-}
-
-/*
-This code produces the following output.
-
-Original string:
-This unicode string contains two characters with codes outside the ASCII code range, Pi (Π) and Sigma (Σ).
-
-Encoded bytes:
-[84][104][105][115][32][117][110][105][99][111][100][101][32][115][116][114][105][110][103][32][99][111][110][116][97][105][110][115][32][116][119][111][32][99][104][97][114][97][99][116][101][114][115][32][119][105][116][104][32][99][111][100][101][115][32][111][117][116][115][105][100][101][32][116][104][101][32][65][83][67][73][73][32][99][111][100][101][32][114][97][110][103][101][44][32][80][105][32][40][63][41][32][97][110][100][32][83][105][103][109][97][32][40][63][41][46]
-
-Value at position of Pi character: 63
-Value at position of Sigma character: 63
-
-Decoded bytes:
-This unicode string contains two characters with codes outside the ASCII code range, Pi (?) and Sigma (?).
-
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp
deleted file mode 100644
index 8e692e11ce8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-int main()
-{
-
- // Read a text file saved with Big Endian Unicode encoding.
- System::Text::Encoding^ encoding = System::Text::Encoding::BigEndianUnicode;
- StreamReader^ reader = gcnew StreamReader( "TextFile.txt",encoding );
- String^ line = reader->ReadLine();
- while ( line != nullptr )
- {
- Console::WriteLine( line );
- line = reader->ReadLine();
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp
deleted file mode 100644
index 1c3ea4a7481..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-
-// The following code example determines the Windows code page that most closely corresponds to each encoding.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Print the header.
- Console::Write( "CodePage identifier and name " );
- Console::WriteLine( "WindowsCodePage" );
-
- // For every encoding, get the Windows code page for it.
- System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- EncodingInfo ^ ei = safe_cast(myEnum->Current);
- Encoding^ e = ei->GetEncoding();
- Console::Write( "{0,-6} {1,-25} ", ei->CodePage, ei->Name );
- Console::Write( "{0,-6} ", e->WindowsCodePage );
-
- // Mark the ones that are different.
- if ( ei->CodePage != e->WindowsCodePage )
- Console::Write( "*" );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-CodePage identifier and name WindowsCodePage
-37 IBM037 1252 *
-437 IBM437 1252 *
-500 IBM500 1252 *
-708 ASMO-708 1256 *
-720 DOS-720 1256 *
-737 ibm737 1253 *
-775 ibm775 1257 *
-850 ibm850 1252 *
-852 ibm852 1250 *
-855 IBM855 1252 *
-857 ibm857 1254 *
-858 IBM00858 1252 *
-860 IBM860 1252 *
-861 ibm861 1252 *
-862 DOS-862 1255 *
-863 IBM863 1252 *
-864 IBM864 1256 *
-865 IBM865 1252 *
-866 cp866 1251 *
-869 ibm869 1253 *
-870 IBM870 1250 *
-874 windows-874 874
-875 cp875 1253 *
-932 shift_jis 932
-936 gb2312 936
-949 ks_c_5601-1987 949
-950 big5 950
-1026 IBM1026 1254 *
-1047 IBM01047 1252 *
-1140 IBM01140 1252 *
-1141 IBM01141 1252 *
-1142 IBM01142 1252 *
-1143 IBM01143 1252 *
-1144 IBM01144 1252 *
-1145 IBM01145 1252 *
-1146 IBM01146 1252 *
-1147 IBM01147 1252 *
-1148 IBM01148 1252 *
-1149 IBM01149 1252 *
-1200 utf-16 1200
-1201 unicodeFFFE 1200 *
-1250 windows-1250 1250
-1251 windows-1251 1251
-1252 Windows-1252 1252
-1253 windows-1253 1253
-1254 windows-1254 1254
-1255 windows-1255 1255
-1256 windows-1256 1256
-1257 windows-1257 1257
-1258 windows-1258 1258
-1361 Johab 949 *
-10000 macintosh 1252 *
-10001 x-mac-japanese 932 *
-10002 x-mac-chinesetrad 950 *
-10003 x-mac-korean 949 *
-10004 x-mac-arabic 1256 *
-10005 x-mac-hebrew 1255 *
-10006 x-mac-greek 1253 *
-10007 x-mac-cyrillic 1251 *
-10008 x-mac-chinesesimp 936 *
-10010 x-mac-romanian 1250 *
-10017 x-mac-ukrainian 1251 *
-10021 x-mac-thai 874 *
-10029 x-mac-ce 1250 *
-10079 x-mac-icelandic 1252 *
-10081 x-mac-turkish 1254 *
-10082 x-mac-croatian 1250 *
-12000 utf-32 1200 *
-12001 utf-32BE 1200 *
-20000 x-Chinese-CNS 950 *
-20001 x-cp20001 950 *
-20002 x-Chinese-Eten 950 *
-20003 x-cp20003 950 *
-20004 x-cp20004 950 *
-20005 x-cp20005 950 *
-20105 x-IA5 1252 *
-20106 x-IA5-German 1252 *
-20107 x-IA5-Swedish 1252 *
-20108 x-IA5-Norwegian 1252 *
-20127 us-ascii 1252 *
-20261 x-cp20261 1252 *
-20269 x-cp20269 1252 *
-20273 IBM273 1252 *
-20277 IBM277 1252 *
-20278 IBM278 1252 *
-20280 IBM280 1252 *
-20284 IBM284 1252 *
-20285 IBM285 1252 *
-20290 IBM290 932 *
-20297 IBM297 1252 *
-20420 IBM420 1256 *
-20423 IBM423 1253 *
-20424 IBM424 1255 *
-20833 x-EBCDIC-KoreanExtended 949 *
-20838 IBM-Thai 874 *
-20866 koi8-r 1251 *
-20871 IBM871 1252 *
-20880 IBM880 1251 *
-20905 IBM905 1254 *
-20924 IBM00924 1252 *
-20932 EUC-JP 932 *
-20936 x-cp20936 936 *
-20949 x-cp20949 949 *
-21025 cp1025 1251 *
-21866 koi8-u 1251 *
-28591 iso-8859-1 1252 *
-28592 iso-8859-2 1250 *
-28593 iso-8859-3 1254 *
-28594 iso-8859-4 1257 *
-28595 iso-8859-5 1251 *
-28596 iso-8859-6 1256 *
-28597 iso-8859-7 1253 *
-28598 iso-8859-8 1255 *
-28599 iso-8859-9 1254 *
-28603 iso-8859-13 1257 *
-28605 iso-8859-15 1252 *
-29001 x-Europa 1252 *
-38598 iso-8859-8-i 1255 *
-50220 iso-2022-jp 932 *
-50221 csISO2022JP 932 *
-50222 iso-2022-jp 932 *
-50225 iso-2022-kr 949 *
-50227 x-cp50227 936 *
-51932 euc-jp 932 *
-51936 EUC-CN 936 *
-51949 euc-kr 949 *
-52936 hz-gb-2312 936 *
-54936 GB18030 936 *
-57002 x-iscii-de 57002
-57003 x-iscii-be 57003
-57004 x-iscii-ta 57004
-57005 x-iscii-te 57005
-57006 x-iscii-as 57006
-57007 x-iscii-or 57007
-57008 x-iscii-ka 57008
-57009 x-iscii-ma 57009
-57010 x-iscii-gu 57010
-57011 x-iscii-pa 57011
-65000 utf-7 1200 *
-65001 utf-8 1200 *
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp
deleted file mode 100644
index 90b8851bb09..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-
-int main()
-{
- String^ unicodeString = "This string contains the unicode character Pi (\u03a0)";
-
- // Create two different encodings.
- Encoding^ ascii = Encoding::ASCII;
- Encoding^ unicode = Encoding::Unicode;
-
- // Convert the string into a byte array.
- array^unicodeBytes = unicode->GetBytes( unicodeString );
-
- // Perform the conversion from one encoding to the other.
- array^asciiBytes = Encoding::Convert( unicode, ascii, unicodeBytes );
-
- // Convert the new Byte into[] a char and[] then into a string.
- array^asciiChars = gcnew array(ascii->GetCharCount( asciiBytes, 0, asciiBytes->Length ));
- ascii->GetChars( asciiBytes, 0, asciiBytes->Length, asciiChars, 0 );
- String^ asciiString = gcnew String( asciiChars );
-
- // Display the strings created before and after the conversion.
- Console::WriteLine( "Original String*: {0}", unicodeString );
- Console::WriteLine( "Ascii converted String*: {0}", asciiString );
-}
-// The example displays the following output:
-// Original string: This string contains the unicode character Pi (Î )
-// Ascii converted string: This string contains the unicode character Pi (?)
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp
deleted file mode 100644
index cfdede118a3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-// The following code example gets two instances of the same encoding (one by codepage and another by name), and checks their equality.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Get a UTF-32 encoding by codepage.
- Encoding^ e1 = Encoding::GetEncoding( 12000 );
-
- // Get a UTF-32 encoding by name.
- Encoding^ e2 = Encoding::GetEncoding( "utf-32" );
-
- // Check their equality.
- Console::WriteLine( "e1 equals e2? {0}", e1->Equals( e2 ) );
-}
-
-/*
-This code produces the following output.
-
-e1 equals e2? True
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp
deleted file mode 100644
index b6762b0e360..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-// The following code example determines the number of bytes required to encode a character array,
-// encodes the characters, and displays the resulting bytes.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndBytes( array^chars, Encoding^ enc );
-void PrintHexBytes( array^bytes );
-int main()
-{
-
- // The characters to encode:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- // a high-surrogate value (U+D8FF)
- // a low-surrogate value (U+DCFF)
- array^myChars = gcnew array{
- L'z','a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF'
- };
-
- // Get different encodings.
- Encoding^ u7 = Encoding::UTF7;
- Encoding^ u8 = Encoding::UTF8;
- Encoding^ u16LE = Encoding::Unicode;
- Encoding^ u16BE = Encoding::BigEndianUnicode;
- Encoding^ u32 = Encoding::UTF32;
-
- // Encode the entire array, and print out the counts and the resulting bytes.
- PrintCountsAndBytes( myChars, u7 );
- PrintCountsAndBytes( myChars, u8 );
- PrintCountsAndBytes( myChars, u16LE );
- PrintCountsAndBytes( myChars, u16BE );
- PrintCountsAndBytes( myChars, u32 );
-}
-
-void PrintCountsAndBytes( array^chars, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-30} :", enc );
-
- // Display the exact byte count.
- int iBC = enc->GetByteCount( chars );
- Console::Write( " {0,-3}", iBC );
-
- // Display the maximum byte count.
- int iMBC = enc->GetMaxByteCount( chars->Length );
- Console::Write( " {0,-3} :", iMBC );
-
- // Encode the array of chars.
- array^bytes = enc->GetBytes( chars );
-
- // Display all the encoded bytes.
- PrintHexBytes( bytes );
-}
-
-void PrintHexBytes( array^bytes )
-{
- if ( (bytes == nullptr) || (bytes->Length == 0) )
- Console::WriteLine( "" );
- else
- {
- for ( int i = 0; i < bytes->Length; i++ )
- Console::Write( "{0:X2} ", bytes[ i ] );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
-System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
-System.Text.UnicodeEncoding : 14 16 :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
-System.Text.UnicodeEncoding : 14 16 :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
-System.Text.UTF32Encoding : 24 32 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp
deleted file mode 100644
index 2fd11ecfbd4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-
-// The following code example determines the number of bytes required to encode three characters from a character array,
-// encodes the characters, and displays the resulting bytes.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc );
-void PrintHexBytes( array^bytes );
-int main()
-{
-
- // The characters to encode:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- // a high-surrogate value (U+D8FF)
- // a low-surrogate value (U+DCFF)
- array^myChars = gcnew array{
- L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF'
- };
-
- // Get different encodings.
- Encoding^ u7 = Encoding::UTF7;
- Encoding^ u8 = Encoding::UTF8;
- Encoding^ u16LE = Encoding::Unicode;
- Encoding^ u16BE = Encoding::BigEndianUnicode;
- Encoding^ u32 = Encoding::UTF32;
-
- // Encode three characters starting at index 4, and print out the counts and the resulting bytes.
- PrintCountsAndBytes( myChars, 4, 3, u7 );
- PrintCountsAndBytes( myChars, 4, 3, u8 );
- PrintCountsAndBytes( myChars, 4, 3, u16LE );
- PrintCountsAndBytes( myChars, 4, 3, u16BE );
- PrintCountsAndBytes( myChars, 4, 3, u32 );
-}
-
-void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-30} :", enc );
-
- // Display the exact byte count.
- int iBC = enc->GetByteCount( chars, index, count );
- Console::Write( " {0,-3}", iBC );
-
- // Display the maximum byte count.
- int iMBC = enc->GetMaxByteCount( count );
- Console::Write( " {0,-3} :", iMBC );
-
- // Encode the array of chars.
- array^bytes = enc->GetBytes( chars, index, count );
-
- // The following is an alternative way to encode the array of chars:
- // byte[] bytes = new byte[iBC];
- // enc.GetBytes( chars, index, count, bytes, bytes.GetLowerBound(0) );
- // Display all the encoded bytes.
- PrintHexBytes( bytes );
-}
-
-void PrintHexBytes( array^bytes )
-{
- if ( (bytes == nullptr) || (bytes->Length == 0) )
- Console::WriteLine( "" );
- else
- {
- for ( int i = 0; i < bytes->Length; i++ )
- Console::Write( "{0:X2} ", bytes[ i ] );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D
-System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF
-System.Text.UnicodeEncoding : 6 8 :B2 03 FF D8 FF DC
-System.Text.UnicodeEncoding : 6 8 :03 B2 D8 FF DC FF
-System.Text.UTF32Encoding : 8 16 :B2 03 00 00 FF FC 04 00
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp
deleted file mode 100644
index bf43b1262a2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-
-// The following code example determines the number of bytes required to encode a string or a range in the string,
-// encodes the characters, and displays the resulting bytes.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndBytes( String^ s, Encoding^ enc );
-void PrintCountsAndBytes( String^ s, int index, int count, Encoding^ enc );
-void PrintHexBytes( array^bytes );
-int main()
-{
-
- // The characters to encode:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- // a high-surrogate value (U+D8FF)
- // a low-surrogate value (U+DCFF)
- String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF";
-
- // Get different encodings.
- Encoding^ u7 = Encoding::UTF7;
- Encoding^ u8 = Encoding::UTF8;
- Encoding^ u16LE = Encoding::Unicode;
- Encoding^ u16BE = Encoding::BigEndianUnicode;
- Encoding^ u32 = Encoding::UTF32;
-
- // Encode the entire string, and print out the counts and the resulting bytes.
- Console::WriteLine( "Encoding the entire string:" );
- PrintCountsAndBytes( myStr, u7 );
- PrintCountsAndBytes( myStr, u8 );
- PrintCountsAndBytes( myStr, u16LE );
- PrintCountsAndBytes( myStr, u16BE );
- PrintCountsAndBytes( myStr, u32 );
- Console::WriteLine();
-
- // Encode three characters starting at index 4, and print out the counts and the resulting bytes.
- Console::WriteLine( "Encoding the characters from index 4 through 6:" );
- PrintCountsAndBytes( myStr, 4, 3, u7 );
- PrintCountsAndBytes( myStr, 4, 3, u8 );
- PrintCountsAndBytes( myStr, 4, 3, u16LE );
- PrintCountsAndBytes( myStr, 4, 3, u16BE );
- PrintCountsAndBytes( myStr, 4, 3, u32 );
-}
-
-void PrintCountsAndBytes( String^ s, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-30} :", enc );
-
- // Display the exact byte count.
- int iBC = enc->GetByteCount( s );
- Console::Write( " {0,-3}", iBC );
-
- // Display the maximum byte count.
- int iMBC = enc->GetMaxByteCount( s->Length );
- Console::Write( " {0,-3} :", iMBC );
-
- // Encode the entire string.
- array^bytes = enc->GetBytes( s );
-
- // Display all the encoded bytes.
- PrintHexBytes( bytes );
-}
-
-void PrintCountsAndBytes( String^ s, int index, int count, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-30} :", enc );
-
- // Display the exact byte count.
- int iBC = enc->GetByteCount( s->ToCharArray(), index, count );
- Console::Write( " {0,-3}", iBC );
-
- // Display the maximum byte count.
- int iMBC = enc->GetMaxByteCount( count );
- Console::Write( " {0,-3} :", iMBC );
-
- // Encode a range of characters in the string.
- array^bytes = gcnew array(iBC);
- enc->GetBytes( s, index, count, bytes, bytes->GetLowerBound( 0 ) );
-
- // Display all the encoded bytes.
- PrintHexBytes( bytes );
-}
-
-void PrintHexBytes( array^bytes )
-{
- if ( (bytes == nullptr) || (bytes->Length == 0) )
- Console::WriteLine( "" );
- else
- {
- for ( int i = 0; i < bytes->Length; i++ )
- Console::Write( "{0:X2} ", bytes[ i ] );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-Encoding the entire string:
-System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
-System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
-System.Text.UnicodeEncoding : 14 16 :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC
-System.Text.UnicodeEncoding : 14 16 :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF
-System.Text.UTF32Encoding : 24 32 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
-
-Encoding the characters from index 4 through 6:
-System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D
-System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF
-System.Text.UnicodeEncoding : 6 8 :B2 03 FF D8 FF DC
-System.Text.UnicodeEncoding : 6 8 :03 B2 D8 FF DC FF
-System.Text.UTF32Encoding : 8 16 :B2 03 00 00 FF FC 04 00
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp
deleted file mode 100644
index 14988aae74c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-// The following code example encodes a string into an array of bytes,
-// and then decodes the bytes into an array of characters.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndChars( array^bytes, Encoding^ enc );
-int main()
-{
-
- // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order.
- Encoding^ u32LE = Encoding::GetEncoding( "utf-32" );
- Encoding^ u32BE = Encoding::GetEncoding( "utf-32BE" );
-
- // Use a string containing the following characters:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- String^ myStr = "za\u0306\u01FD\u03B2";
-
- // Encode the string using the big-endian byte order.
- array^barrBE = gcnew array(u32BE->GetByteCount( myStr ));
- u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 );
-
- // Encode the string using the little-endian byte order.
- array^barrLE = gcnew array(u32LE->GetByteCount( myStr ));
- u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 );
-
- // Get the char counts, and decode the byte arrays.
- Console::Write( "BE array with BE encoding : " );
- PrintCountsAndChars( barrBE, u32BE );
- Console::Write( "LE array with LE encoding : " );
- PrintCountsAndChars( barrLE, u32LE );
-}
-
-void PrintCountsAndChars( array^bytes, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-25} :", enc );
-
- // Display the exact character count.
- int iCC = enc->GetCharCount( bytes );
- Console::Write( " {0,-3}", iCC );
-
- // Display the maximum character count.
- int iMCC = enc->GetMaxCharCount( bytes->Length );
- Console::Write( " {0,-3} :", iMCC );
-
- // Decode the bytes and display the characters.
- array^chars = enc->GetChars( bytes );
- Console::WriteLine( chars );
-}
-
-/*
-This code produces the following output. The question marks take the place of characters that cannot be displayed at the console.
-
-BE array with BE encoding : System.Text.UTF32Encoding : 5 12 :zăǽβ
-LE array with LE encoding : System.Text.UTF32Encoding : 5 12 :zăǽβ
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp
deleted file mode 100644
index 5d42df4246f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-
-// The following code example encodes a string into an array of bytes,
-// and then decodes a range of the bytes into an array of characters.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndChars( array^bytes, int index, int count, Encoding^ enc );
-int main()
-{
-
- // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order.
- Encoding^ u32LE = Encoding::GetEncoding( "utf-32" );
- Encoding^ u32BE = Encoding::GetEncoding( "utf-32BE" );
-
- // Use a string containing the following characters:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- String^ myStr = "za\u0306\u01FD\u03B2";
-
- // Encode the string using the big-endian byte order.
- array^barrBE = gcnew array(u32BE->GetByteCount( myStr ));
- u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 );
-
- // Encode the string using the little-endian byte order.
- array^barrLE = gcnew array(u32LE->GetByteCount( myStr ));
- u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 );
-
- // Get the char counts, decode eight bytes starting at index 0,
- // and print out the counts and the resulting bytes.
- Console::Write( "BE array with BE encoding : " );
- PrintCountsAndChars( barrBE, 0, 8, u32BE );
- Console::Write( "LE array with LE encoding : " );
- PrintCountsAndChars( barrLE, 0, 8, u32LE );
-}
-
-void PrintCountsAndChars( array^bytes, int index, int count, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-25} :", enc );
-
- // Display the exact character count.
- int iCC = enc->GetCharCount( bytes, index, count );
- Console::Write( " {0,-3}", iCC );
-
- // Display the maximum character count.
- int iMCC = enc->GetMaxCharCount( count );
- Console::Write( " {0,-3} :", iMCC );
-
- // Decode the bytes and display the characters.
- array^chars = enc->GetChars( bytes, index, count );
-
- // The following is an alternative way to decode the bytes:
- // Char[] chars = new Char[iCC];
- // enc->GetChars( bytes, index, count, chars, 0 );
- Console::WriteLine( chars );
-}
-
-/*
-This code produces the following output. The question marks take the place of characters that cannot be displayed at the console.
-
-BE array with BE encoding : System.Text.UTF32Encoding : 2 6 :za
-LE array with LE encoding : System.Text.UTF32Encoding : 2 6 :za
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp
deleted file mode 100644
index 8b3e3c0da25..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- Encoding^ unicode = Encoding::Unicode;
-
- // Get the preamble for the Unicode encoder.
- // In this case the preamblecontains the Byte order mark (BOM).
- array^preamble = unicode->GetPreamble();
-
- // Make sure a preamble was returned
- // and is large enough to contain a BOM.
- if ( preamble->Length >= 2 )
- {
-
- // if (preamble->Item[0] == 0xFE && preamble->Item[1] == 0xFF)
- if ( preamble[ 0 ] == 0xFE && preamble[ 1 ] == 0xFF )
- {
- Console::WriteLine( "The Unicode encoder is encoding in big-endian order." );
- }
- // else if (preamble->Item[0] == 0xFF && preamble->Item[1] == 0xFE)
- else
-
- // else if (preamble->Item[0] == 0xFF && preamble->Item[1] == 0xFE)
- if ( preamble[ 0 ] == 0xFF && preamble[ 1 ] == 0xFE )
- {
- Console::WriteLine( "The Unicode encoder is encoding in little-endian order." );
- }
- }
-}
-
-/*
-This code produces the following output.
-
-The Unicode encoder is encoding in little-endian order.
-
-*/
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp
deleted file mode 100644
index 79ba4ed7a77..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-
-// The following code example checks the values of the Boolean properties of each encoding.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Print the header.
- Console::Write( "CodePage identifier and name " );
- Console::Write( "BrDisp BrSave " );
- Console::Write( "MNDisp MNSave " );
- Console::WriteLine( "1-Byte ReadOnly " );
-
- // For every encoding, get the property values.
- System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- EncodingInfo ^ ei = safe_cast(myEnum->Current);
- Encoding^ e = ei->GetEncoding();
- Console::Write( "{0,-6} {1,-25} ", ei->CodePage, ei->Name );
- Console::Write( "{0,-8} {1,-8} ", e->IsBrowserDisplay, e->IsBrowserSave );
- Console::Write( "{0,-8} {1,-8} ", e->IsMailNewsDisplay, e->IsMailNewsSave );
- Console::WriteLine( "{0,-8} {1,-8} ", e->IsSingleByte, e->IsReadOnly );
- }
-}
-
-/*
-This code produces the following output.
-
-CodePage identifier and name BrDisp BrSave MNDisp MNSave 1-Byte ReadOnly
-37 IBM037 False False False False True True
-437 IBM437 False False False False True True
-500 IBM500 False False False False True True
-708 ASMO-708 True True False False True True
-720 DOS-720 True True False False True True
-737 ibm737 False False False False True True
-775 ibm775 False False False False True True
-850 ibm850 False False False False True True
-852 ibm852 True True False False True True
-855 IBM855 False False False False True True
-857 ibm857 False False False False True True
-858 IBM00858 False False False False True True
-860 IBM860 False False False False True True
-861 ibm861 False False False False True True
-862 DOS-862 True True False False True True
-863 IBM863 False False False False True True
-864 IBM864 False False False False True True
-865 IBM865 False False False False True True
-866 cp866 True True False False True True
-869 ibm869 False False False False True True
-870 IBM870 False False False False True True
-874 windows-874 True True True True True True
-875 cp875 False False False False True True
-932 shift_jis True True True True False True
-936 gb2312 True True True True False True
-949 ks_c_5601-1987 True True True True False True
-950 big5 True True True True False True
-1026 IBM1026 False False False False True True
-1047 IBM01047 False False False False True True
-1140 IBM01140 False False False False True True
-1141 IBM01141 False False False False True True
-1142 IBM01142 False False False False True True
-1143 IBM01143 False False False False True True
-1144 IBM01144 False False False False True True
-1145 IBM01145 False False False False True True
-1146 IBM01146 False False False False True True
-1147 IBM01147 False False False False True True
-1148 IBM01148 False False False False True True
-1149 IBM01149 False False False False True True
-1200 utf-16 False True False False False True
-1201 unicodeFFFE False False False False False True
-1250 windows-1250 True True True True True True
-1251 windows-1251 True True True True True True
-1252 Windows-1252 True True True True True True
-1253 windows-1253 True True True True True True
-1254 windows-1254 True True True True True True
-1255 windows-1255 True True True True True True
-1256 windows-1256 True True True True True True
-1257 windows-1257 True True True True True True
-1258 windows-1258 True True True True True True
-1361 Johab False False False False False True
-10000 macintosh False False False False True True
-10001 x-mac-japanese False False False False False True
-10002 x-mac-chinesetrad False False False False False True
-10003 x-mac-korean False False False False False True
-10004 x-mac-arabic False False False False True True
-10005 x-mac-hebrew False False False False True True
-10006 x-mac-greek False False False False True True
-10007 x-mac-cyrillic False False False False True True
-10008 x-mac-chinesesimp False False False False False True
-10010 x-mac-romanian False False False False True True
-10017 x-mac-ukrainian False False False False True True
-10021 x-mac-thai False False False False True True
-10029 x-mac-ce False False False False True True
-10079 x-mac-icelandic False False False False True True
-10081 x-mac-turkish False False False False True True
-10082 x-mac-croatian False False False False True True
-12000 utf-32 False False False False False True
-12001 utf-32BE False False False False False True
-20000 x-Chinese-CNS False False False False False True
-20001 x-cp20001 False False False False False True
-20002 x-Chinese-Eten False False False False False True
-20003 x-cp20003 False False False False False True
-20004 x-cp20004 False False False False False True
-20005 x-cp20005 False False False False False True
-20105 x-IA5 False False False False True True
-20106 x-IA5-German False False False False True True
-20107 x-IA5-Swedish False False False False True True
-20108 x-IA5-Norwegian False False False False True True
-20127 us-ascii False False True True True True
-20261 x-cp20261 False False False False False True
-20269 x-cp20269 False False False False True True
-20273 IBM273 False False False False True True
-20277 IBM277 False False False False True True
-20278 IBM278 False False False False True True
-20280 IBM280 False False False False True True
-20284 IBM284 False False False False True True
-20285 IBM285 False False False False True True
-20290 IBM290 False False False False True True
-20297 IBM297 False False False False True True
-20420 IBM420 False False False False True True
-20423 IBM423 False False False False True True
-20424 IBM424 False False False False True True
-20833 x-EBCDIC-KoreanExtended False False False False True True
-20838 IBM-Thai False False False False True True
-20866 koi8-r True True True True True True
-20871 IBM871 False False False False True True
-20880 IBM880 False False False False True True
-20905 IBM905 False False False False True True
-20924 IBM00924 False False False False True True
-20932 EUC-JP False False False False False True
-20936 x-cp20936 False False False False False True
-20949 x-cp20949 False False False False False True
-21025 cp1025 False False False False True True
-21866 koi8-u True True True True True True
-28591 iso-8859-1 True True True True True True
-28592 iso-8859-2 True True True True True True
-28593 iso-8859-3 False False True True True True
-28594 iso-8859-4 True True True True True True
-28595 iso-8859-5 True True True True True True
-28596 iso-8859-6 True True True True True True
-28597 iso-8859-7 True True True True True True
-28598 iso-8859-8 True True False False True True
-28599 iso-8859-9 True True True True True True
-28603 iso-8859-13 False False True True True True
-28605 iso-8859-15 False True True True True True
-29001 x-Europa False False False False True True
-38598 iso-8859-8-i True True True True True True
-50220 iso-2022-jp False False True True False True
-50221 csISO2022JP False True True True False True
-50222 iso-2022-jp False False False False False True
-50225 iso-2022-kr False False True False False True
-50227 x-cp50227 False False False False False True
-51932 euc-jp True True True True False True
-51936 EUC-CN False False False False False True
-51949 euc-kr False False True True False True
-52936 hz-gb-2312 True True True True False True
-54936 GB18030 True True True True False True
-57002 x-iscii-de False False False False False True
-57003 x-iscii-be False False False False False True
-57004 x-iscii-ta False False False False False True
-57005 x-iscii-te False False False False False True
-57006 x-iscii-as False False False False False True
-57007 x-iscii-or False False False False False True
-57008 x-iscii-ka False False False False False True
-57009 x-iscii-ma False False False False False True
-57010 x-iscii-gu False False False False False True
-57011 x-iscii-pa False False False False False True
-65001 utf-8 True True True True False True
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp
deleted file mode 100644
index 53f98f67454..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-// The following code example retrieves the different names for each encoding
-// and displays the encodings with one or more names that are different from EncodingInfo.Name.
-// It displays EncodingName but does not compare against it.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Print the header.
- Console::Write( "Name " );
- Console::Write( "CodePage " );
- Console::Write( "BodyName " );
- Console::Write( "HeaderName " );
- Console::Write( "WebName " );
- Console::WriteLine( "Encoding.EncodingName" );
-
- // For every encoding, compare the name properties with EncodingInfo.Name.
- // Display only the encodings that have one or more different names.
- System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- EncodingInfo ^ ei = safe_cast(myEnum->Current);
- Encoding^ e = ei->GetEncoding();
- if ( !ei->Name->Equals( e->BodyName ) || !ei->Name->Equals( e->HeaderName ) || !ei->Name->Equals( e->WebName ) )
- {
- Console::Write( "{0,-18} ", ei->Name );
- Console::Write( "{0,-9} ", e->CodePage );
- Console::Write( "{0,-18} ", e->BodyName );
- Console::Write( "{0,-18} ", e->HeaderName );
- Console::Write( "{0,-18} ", e->WebName );
- Console::WriteLine( "{0} ", e->EncodingName );
- }
- }
-}
-
-/*
-This code produces the following output.
-
-Name CodePage BodyName HeaderName WebName Encoding.EncodingName
-shift_jis 932 iso-2022-jp iso-2022-jp shift_jis Japanese (Shift-JIS)
-windows-1250 1250 iso-8859-2 windows-1250 windows-1250 Central European (Windows)
-windows-1251 1251 koi8-r windows-1251 windows-1251 Cyrillic (Windows)
-Windows-1252 1252 iso-8859-1 Windows-1252 Windows-1252 Western European (Windows)
-windows-1253 1253 iso-8859-7 windows-1253 windows-1253 Greek (Windows)
-windows-1254 1254 iso-8859-9 windows-1254 windows-1254 Turkish (Windows)
-csISO2022JP 50221 iso-2022-jp iso-2022-jp csISO2022JP Japanese (JIS-Allow 1 byte Kana)
-iso-2022-kr 50225 iso-2022-kr euc-kr iso-2022-kr Korean (ISO)
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp
deleted file mode 100644
index 7b3357371c8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Web;
-int main()
-{
-
- // Use UTF8 encoding.
- Encoding^ encoding = Encoding::UTF8;
- StreamWriter^ writer = gcnew StreamWriter( "Encoding.html",false,encoding );
- writer->WriteLine( "" );
-
- // Write charset attribute to the html file.
- // writer -> WriteLine(S"");
- writer->WriteLine( String::Concat( "" ) );
- writer->WriteLine( "" );
- writer->WriteLine( "{0}
", HttpUtility::HtmlEncode( encoding->EncodingName ) );
- writer->WriteLine( "" );
- writer->Flush();
- writer->Close();
-}
-
-/*
-This code produces the following output in an HTML file.
-
-
-
-
-Unicode (UTF-8)
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp
deleted file mode 100644
index 60ac3dd0f2b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-
-// The following code example retrieves the different names for each encoding
-// and compares them with the equivalent Encoding names.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Print the header.
- Console::Write( "Info.CodePage " );
- Console::Write( "Info.Name " );
- Console::Write( "Info.DisplayName" );
- Console::WriteLine();
-
- // Display the EncodingInfo names for every encoding, and compare with the equivalent Encoding names.
- System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- EncodingInfo ^ ei = safe_cast(myEnum->Current);
- Encoding^ e = ei->GetEncoding();
- Console::Write( "{0,-15}", ei->CodePage );
- if ( ei->CodePage == e->CodePage )
- Console::Write( " " );
- else
- Console::Write( "*** " );
- Console::Write( "{0,-25}", ei->Name );
- if ( ei->CodePage == e->CodePage )
- Console::Write( " " );
- else
- Console::Write( "*** " );
- Console::Write( "{0,-25}", ei->DisplayName );
- if ( ei->CodePage == e->CodePage )
- Console::Write( " " );
- else
- Console::Write( "*** " );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-Info.CodePage Info.Name Info.DisplayName
-37 IBM037 IBM EBCDIC (US-Canada)
-437 IBM437 OEM United States
-500 IBM500 IBM EBCDIC (International)
-708 ASMO-708 Arabic (ASMO 708)
-720 DOS-720 Arabic (DOS)
-737 ibm737 Greek (DOS)
-775 ibm775 Baltic (DOS)
-850 ibm850 Western European (DOS)
-852 ibm852 Central European (DOS)
-855 IBM855 OEM Cyrillic
-857 ibm857 Turkish (DOS)
-858 IBM00858 OEM Multilingual Latin I
-860 IBM860 Portuguese (DOS)
-861 ibm861 Icelandic (DOS)
-862 DOS-862 Hebrew (DOS)
-863 IBM863 French Canadian (DOS)
-864 IBM864 Arabic (864)
-865 IBM865 Nordic (DOS)
-866 cp866 Cyrillic (DOS)
-869 ibm869 Greek, Modern (DOS)
-870 IBM870 IBM EBCDIC (Multilingual Latin-2)
-874 windows-874 Thai (Windows)
-875 cp875 IBM EBCDIC (Greek Modern)
-932 shift_jis Japanese (Shift-JIS)
-936 gb2312 Chinese Simplified (GB2312)
-949 ks_c_5601-1987 Korean
-950 big5 Chinese Traditional (Big5)
-1026 IBM1026 IBM EBCDIC (Turkish Latin-5)
-1047 IBM01047 IBM Latin-1
-1140 IBM01140 IBM EBCDIC (US-Canada-Euro)
-1141 IBM01141 IBM EBCDIC (Germany-Euro)
-1142 IBM01142 IBM EBCDIC (Denmark-Norway-Euro)
-1143 IBM01143 IBM EBCDIC (Finland-Sweden-Euro)
-1144 IBM01144 IBM EBCDIC (Italy-Euro)
-1145 IBM01145 IBM EBCDIC (Spain-Euro)
-1146 IBM01146 IBM EBCDIC (UK-Euro)
-1147 IBM01147 IBM EBCDIC (France-Euro)
-1148 IBM01148 IBM EBCDIC (International-Euro)
-1149 IBM01149 IBM EBCDIC (Icelandic-Euro)
-1200 utf-16 Unicode
-1201 unicodeFFFE Unicode (Big-Endian)
-1250 windows-1250 Central European (Windows)
-1251 windows-1251 Cyrillic (Windows)
-1252 Windows-1252 Western European (Windows)
-1253 windows-1253 Greek (Windows)
-1254 windows-1254 Turkish (Windows)
-1255 windows-1255 Hebrew (Windows)
-1256 windows-1256 Arabic (Windows)
-1257 windows-1257 Baltic (Windows)
-1258 windows-1258 Vietnamese (Windows)
-1361 Johab Korean (Johab)
-10000 macintosh Western European (Mac)
-10001 x-mac-japanese Japanese (Mac)
-10002 x-mac-chinesetrad Chinese Traditional (Mac)
-10003 x-mac-korean Korean (Mac)
-10004 x-mac-arabic Arabic (Mac)
-10005 x-mac-hebrew Hebrew (Mac)
-10006 x-mac-greek Greek (Mac)
-10007 x-mac-cyrillic Cyrillic (Mac)
-10008 x-mac-chinesesimp Chinese Simplified (Mac)
-10010 x-mac-romanian Romanian (Mac)
-10017 x-mac-ukrainian Ukrainian (Mac)
-10021 x-mac-thai Thai (Mac)
-10029 x-mac-ce Central European (Mac)
-10079 x-mac-icelandic Icelandic (Mac)
-10081 x-mac-turkish Turkish (Mac)
-10082 x-mac-croatian Croatian (Mac)
-12000 utf-32 Unicode (UTF-32)
-12001 utf-32BE Unicode (UTF-32 Big-Endian)
-20000 x-Chinese-CNS Chinese Traditional (CNS)
-20001 x-cp20001 TCA Taiwan
-20002 x-Chinese-Eten Chinese Traditional (Eten)
-20003 x-cp20003 IBM5550 Taiwan
-20004 x-cp20004 TeleText Taiwan
-20005 x-cp20005 Wang Taiwan
-20105 x-IA5 Western European (IA5)
-20106 x-IA5-German German (IA5)
-20107 x-IA5-Swedish Swedish (IA5)
-20108 x-IA5-Norwegian Norwegian (IA5)
-20127 us-ascii US-ASCII
-20261 x-cp20261 T.61
-20269 x-cp20269 ISO-6937
-20273 IBM273 IBM EBCDIC (Germany)
-20277 IBM277 IBM EBCDIC (Denmark-Norway)
-20278 IBM278 IBM EBCDIC (Finland-Sweden)
-20280 IBM280 IBM EBCDIC (Italy)
-20284 IBM284 IBM EBCDIC (Spain)
-20285 IBM285 IBM EBCDIC (UK)
-20290 IBM290 IBM EBCDIC (Japanese katakana)
-20297 IBM297 IBM EBCDIC (France)
-20420 IBM420 IBM EBCDIC (Arabic)
-20423 IBM423 IBM EBCDIC (Greek)
-20424 IBM424 IBM EBCDIC (Hebrew)
-20833 x-EBCDIC-KoreanExtended IBM EBCDIC (Korean Extended)
-20838 IBM-Thai IBM EBCDIC (Thai)
-20866 koi8-r Cyrillic (KOI8-R)
-20871 IBM871 IBM EBCDIC (Icelandic)
-20880 IBM880 IBM EBCDIC (Cyrillic Russian)
-20905 IBM905 IBM EBCDIC (Turkish)
-20924 IBM00924 IBM Latin-1
-20932 EUC-JP Japanese (JIS 0208-1990 and 0212-1990)
-20936 x-cp20936 Chinese Simplified (GB2312-80)
-20949 x-cp20949 Korean Wansung
-21025 cp1025 IBM EBCDIC (Cyrillic Serbian-Bulgarian)
-21866 koi8-u Cyrillic (KOI8-U)
-28591 iso-8859-1 Western European (ISO)
-28592 iso-8859-2 Central European (ISO)
-28593 iso-8859-3 Latin 3 (ISO)
-28594 iso-8859-4 Baltic (ISO)
-28595 iso-8859-5 Cyrillic (ISO)
-28596 iso-8859-6 Arabic (ISO)
-28597 iso-8859-7 Greek (ISO)
-28598 iso-8859-8 Hebrew (ISO-Visual)
-28599 iso-8859-9 Turkish (ISO)
-28603 iso-8859-13 Estonian (ISO)
-28605 iso-8859-15 Latin 9 (ISO)
-29001 x-Europa Europa
-38598 iso-8859-8-i Hebrew (ISO-Logical)
-50220 iso-2022-jp Japanese (JIS)
-50221 csISO2022JP Japanese (JIS-Allow 1 byte Kana)
-50222 iso-2022-jp Japanese (JIS-Allow 1 byte Kana - SO/SI)
-50225 iso-2022-kr Korean (ISO)
-50227 x-cp50227 Chinese Simplified (ISO-2022)
-51932 euc-jp Japanese (EUC)
-51936 EUC-CN Chinese Simplified (EUC)
-51949 euc-kr Korean (EUC)
-52936 hz-gb-2312 Chinese Simplified (HZ)
-54936 GB18030 Chinese Simplified (GB18030)
-57002 x-iscii-de ISCII Devanagari
-57003 x-iscii-be ISCII Bengali
-57004 x-iscii-ta ISCII Tamil
-57005 x-iscii-te ISCII Telugu
-57006 x-iscii-as ISCII Assamese
-57007 x-iscii-or ISCII Oriya
-57008 x-iscii-ka ISCII Kannada
-57009 x-iscii-ma ISCII Malayalam
-57010 x-iscii-gu ISCII Gujarati
-57011 x-iscii-pa ISCII Punjabi
-65000 utf-7 Unicode (UTF-7)
-65001 utf-8 Unicode (UTF-8)
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp
deleted file mode 100644
index b70e9f7092d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// This sample demonstrates how to use each member of the StringBuilder class.
-//
-using namespace System;
-using namespace System::Text;
-
-ref class Constructors
-{
-public:
- static void Main()
- {
- ConstructorWithNothing();
- ConstructorWithCapacity();
- ConstructorWithString();
- ConstructorWithCapacityAndMax();
- ConstructorWithSubstring();
- ConstructorWithStringAndMax();
-
- Console::Write( L"This sample completed successfully; " );
- Console::WriteLine( L"press Enter to exit." );
- Console::ReadLine();
- }
-
-private:
- static void ConstructorWithNothing()
- {
- // Initialize a new StringBuilder object.
- //
- StringBuilder^ stringBuilder = gcnew StringBuilder;
- //
- }
-
- static void ConstructorWithCapacity()
- {
- // Initialize a new StringBuilder object with the specified capacity.
- //
- int capacity = 255;
- StringBuilder^ stringBuilder = gcnew StringBuilder( capacity );
- //
- }
-
- static void ConstructorWithString()
- {
- // Initialize a new StringBuilder object with the specified string.
- //
- String^ initialString = L"Initial string.";
- StringBuilder^ stringBuilder = gcnew StringBuilder( initialString );
- //
- }
-
- static void ConstructorWithCapacityAndMax()
- {
- // Initialize a new StringBuilder object with the specified capacity
- // and maximum capacity.
- //
- int capacity = 255;
- int maxCapacity = 1024;
- StringBuilder^ stringBuilder = gcnew StringBuilder( capacity,maxCapacity );
- //
- }
-
- static void ConstructorWithSubstring()
- {
- // Initialize a new StringBuilder object with the specified substring.
- //
- String^ initialString = L"Initial string for stringbuilder.";
- int startIndex = 0;
- int substringLength = 14;
- int capacity = 255;
- StringBuilder^ stringBuilder = gcnew StringBuilder(
- initialString,startIndex,substringLength,capacity );
- //
- }
-
- static void ConstructorWithStringAndMax()
- {
- // Initialize a new StringBuilder object with the specified string
- // and maximum capacity.
- //
- String^ initialString = L"Initial string. ";
- int capacity = 255;
- StringBuilder^ stringBuilder = gcnew StringBuilder(
- initialString,capacity );
- //
-
- // Ensure that appending the specified string will not exceed the
- // maximum capacity of the object.
- //
- String^ phraseToAdd = L"Sentence to be appended.";
- if ( (stringBuilder->Length + phraseToAdd->Length) <=
- stringBuilder->MaxCapacity )
- {
- stringBuilder->Append( phraseToAdd );
- }
- //
-
- // Retrieve the string value of the StringBuilder object.
- //
- String^ builderResults = stringBuilder->ToString();
- //
-
- // Retrieve the last 10 characters of the StringBuilder object.
- //
- int sentenceLength = 10;
- int startPosition = stringBuilder->Length - sentenceLength;
- String^ endPhrase = stringBuilder->ToString( startPosition,
- sentenceLength );
- //
-
- // Retrieve the last character of the StringBuilder object.
- //
- int lastCharacterPosition = stringBuilder->Length - 1;
- char lastCharacter = static_cast(
- stringBuilder->default[ lastCharacterPosition ] );
- //
- }
-};
-
-int main()
-{
- Constructors::Main();
-}
-
-//
-// This sample produces the following output:
-//
-// This sample completed successfully; press Enter to exit.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp
deleted file mode 100644
index 86fc73cb09c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// The following code example uses an encoder and a decoder to encode a string into an array of bytes,
-// and then decode the bytes into an array of characters.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Get an encoder and a decoder from UTF32Encoding.
- UTF32Encoding ^ u32 = gcnew UTF32Encoding( false,true,true );
- Encoder^ myEnc = u32->GetEncoder();
- Decoder^ myDec = u32->GetDecoder();
-
- // The characters to encode:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- array^myChars = gcnew array(5){
- L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2'
- };
- Console::Write( "The original characters : " );
- Console::WriteLine( myChars );
-
- // Encode the character array.
- int iBC = myEnc->GetByteCount( myChars, 0, myChars.Length, true );
- array^myBytes = gcnew array(iBC);
- myEnc->GetBytes( myChars, 0, myChars.Length, myBytes, 0, true );
-
- // Print the resulting bytes.
- Console::Write( "Using the encoder : " );
- for ( int i = 0; i < myBytes.Length; i++ )
- Console::Write( "{0:X2} ", myBytes[ i ] );
- Console::WriteLine();
-
- // Decode the byte array back into an array of characters.
- int iCC = myDec->GetCharCount( myBytes, 0, myBytes.Length, true );
- array^myDecodedChars = gcnew array(iCC);
- myDec->GetChars( myBytes, 0, myBytes.Length, myDecodedChars, 0, true );
-
- // Print the resulting characters.
- Console::Write( "Using the decoder : " );
- Console::WriteLine( myDecodedChars );
-}
-
-/*
-This code produces the following output. The question marks take the place of characters that cannot be displayed at the console.
-
-The original characters : za??
-Using the encoder : 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00
-Using the decoder : za??
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp
deleted file mode 100644
index a627b7388d4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-
-// The following code example creates instances of the UTF32Encoding class using different parameter values and then checks them for equality.
-//
-using namespace System;
-using namespace System::Text;
-void CompareEncodings( UTF32Encoding ^ a, String^ name );
-int main()
-{
-
- // Create different instances of UTF32Encoding.
- UTF32Encoding ^ u32 = gcnew UTF32Encoding;
- UTF32Encoding ^ u32tt = gcnew UTF32Encoding( true,true );
- UTF32Encoding ^ u32tf = gcnew UTF32Encoding( true,false );
- UTF32Encoding ^ u32ft = gcnew UTF32Encoding( false,true );
- UTF32Encoding ^ u32ff = gcnew UTF32Encoding( false,false );
-
- // Compare these instances with instances created using the ctor with three parameters.
- CompareEncodings( u32, "u32 " );
- CompareEncodings( u32tt, "u32tt" );
- CompareEncodings( u32tf, "u32tf" );
- CompareEncodings( u32ft, "u32ft" );
- CompareEncodings( u32ff, "u32ff" );
-}
-
-void CompareEncodings( UTF32Encoding ^ a, String^ name )
-{
-
- // Create different instances of UTF32Encoding using the ctor with three parameters.
- UTF32Encoding ^ u32ttt = gcnew UTF32Encoding( true,true,true );
- UTF32Encoding ^ u32ttf = gcnew UTF32Encoding( true,true,false );
- UTF32Encoding ^ u32tft = gcnew UTF32Encoding( true,false,true );
- UTF32Encoding ^ u32tff = gcnew UTF32Encoding( true,false,false );
- UTF32Encoding ^ u32ftt = gcnew UTF32Encoding( false,true,true );
- UTF32Encoding ^ u32ftf = gcnew UTF32Encoding( false,true,false );
- UTF32Encoding ^ u32fft = gcnew UTF32Encoding( false,false,true );
- UTF32Encoding ^ u32fff = gcnew UTF32Encoding( false,false,false );
-
- // Compare the specified instance with each of the instances that were just created.
- Console::WriteLine( "{0} and u32ttt : {1}", name, a->Equals( u32ttt ) );
- Console::WriteLine( "{0} and u32ttf : {1}", name, a->Equals( u32ttf ) );
- Console::WriteLine( "{0} and u32tft : {1}", name, a->Equals( u32tft ) );
- Console::WriteLine( "{0} and u32tff : {1}", name, a->Equals( u32tff ) );
- Console::WriteLine( "{0} and u32ftt : {1}", name, a->Equals( u32ftt ) );
- Console::WriteLine( "{0} and u32ftf : {1}", name, a->Equals( u32ftf ) );
- Console::WriteLine( "{0} and u32fft : {1}", name, a->Equals( u32fft ) );
- Console::WriteLine( "{0} and u32fff : {1}", name, a->Equals( u32fff ) );
-}
-
-/*
-This code produces the following output.
-
-u32 vs u32ttt : False
-u32 vs u32ttf : False
-u32 vs u32tft : False
-u32 vs u32tff : False
-u32 vs u32ftt : False
-u32 vs u32ftf : False
-u32 vs u32fft : False
-u32 vs u32fff : True
-u32tt vs u32ttt : False
-u32tt vs u32ttf : True
-u32tt vs u32tft : False
-u32tt vs u32tff : False
-u32tt vs u32ftt : False
-u32tt vs u32ftf : False
-u32tt vs u32fft : False
-u32tt vs u32fff : False
-u32tf vs u32ttt : False
-u32tf vs u32ttf : False
-u32tf vs u32tft : False
-u32tf vs u32tff : True
-u32tf vs u32ftt : False
-u32tf vs u32ftf : False
-u32tf vs u32fft : False
-u32tf vs u32fff : False
-u32ft vs u32ttt : False
-u32ft vs u32ttf : False
-u32ft vs u32tft : False
-u32ft vs u32tff : False
-u32ft vs u32ftt : False
-u32ft vs u32ftf : True
-u32ft vs u32fft : False
-u32ft vs u32fff : False
-u32ff vs u32ttt : False
-u32ff vs u32ttf : False
-u32ff vs u32tft : False
-u32ff vs u32tff : False
-u32ff vs u32ftt : False
-u32ff vs u32ftf : False
-u32ff vs u32fft : False
-u32ff vs u32fff : True
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp
deleted file mode 100644
index c1436193d7b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-
-// The following code example demonstrates the behavior of UTF32Encoding with error detection enabled and without.
-//
-using namespace System;
-using namespace System::Text;
-void PrintDecodedString( array^bytes, Encoding^ enc );
-int main()
-{
-
- // Create an instance of UTF32Encoding using little-endian byte order.
- // This will be used for encoding.
- UTF32Encoding^ u32LE = gcnew UTF32Encoding( false,true );
-
- // Create two instances of UTF32Encoding using big-endian byte order: one with error detection and one without.
- // These will be used for decoding.
- UTF32Encoding^ u32withED = gcnew UTF32Encoding( true,true,true );
- UTF32Encoding^ u32noED = gcnew UTF32Encoding( true,true,false );
-
- // Create byte arrays from the same string containing the following characters:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF";
-
- // Encode the string using little-endian byte order.
- array^myBytes = gcnew array(u32LE->GetByteCount( myStr ));
- u32LE->GetBytes( myStr, 0, myStr->Length, myBytes, 0 );
-
- // Decode the byte array with error detection.
- Console::WriteLine( "Decoding with error detection:" );
- PrintDecodedString( myBytes, u32withED );
-
- // Decode the byte array without error detection.
- Console::WriteLine( "Decoding without error detection:" );
- PrintDecodedString( myBytes, u32noED );
-}
-
-
-// Decode the bytes and display the string.
-void PrintDecodedString( array^bytes, Encoding^ enc )
-{
- try
- {
- Console::WriteLine( " Decoded string: {0}", enc->GetString( bytes, 0, bytes->Length ) );
- }
- catch ( System::ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- Console::WriteLine();
-}
-
-//
-/*
-This code produces the following output.
-
-Decoding with error detection:
-System.ArgumentException: Invalid byte was found at byte index 3.
- at System.Text.UTF32Encoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder)
- at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding)
- at System.Text.UTF32Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)
- at SamplesUTF32Encoding.PrintDecodedString(Byte[] bytes, Encoding enc)
-
-Decoding without error detection:
- Decoded string:
-
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp
deleted file mode 100644
index 019b60c8871..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-
-// The following code example determines the number of bytes required to encode three characters from a character array,
-// then encodes the characters and displays the resulting bytes.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc );
-void PrintHexBytes( array^bytes );
-int main()
-{
-
- // The characters to encode:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- // a high-surrogate value (U+D8FF)
- // a low-surrogate value (U+DCFF)
- array^myChars = gcnew array(7){
- L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF'
- };
-
- // Create instances of different encodings.
- UTF7Encoding^ u7 = gcnew UTF7Encoding;
- UTF8Encoding^ u8Nobom = gcnew UTF8Encoding( false,true );
- UTF8Encoding^ u8Bom = gcnew UTF8Encoding( true,true );
- UTF32Encoding ^ u32Nobom = gcnew UTF32Encoding( false,false,true );
- UTF32Encoding ^ u32Bom = gcnew UTF32Encoding( false,true,true );
-
- // Encode three characters starting at index 4 and print out the counts and the resulting bytes.
- PrintCountsAndBytes( myChars, 4, 3, u7 );
- PrintCountsAndBytes( myChars, 4, 3, u8Nobom );
- PrintCountsAndBytes( myChars, 4, 3, u8Bom );
- PrintCountsAndBytes( myChars, 4, 3, u32Nobom );
- PrintCountsAndBytes( myChars, 4, 3, u32Bom );
-}
-
-void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-25} :", enc );
-
- // Display the exact byte count.
- int iBC = enc->GetByteCount( chars, index, count );
- Console::Write( " {0,-3}", iBC );
-
- // Display the maximum byte count.
- int iMBC = enc->GetMaxByteCount( count );
- Console::Write( " {0,-3} :", iMBC );
-
- // Get the byte order mark, if any.
- array^preamble = enc->GetPreamble();
-
- // Combine the preamble and the encoded bytes.
- array^bytes = gcnew array(preamble->Length + iBC);
- Array::Copy( preamble, bytes, preamble->Length );
- enc->GetBytes( chars, index, count, bytes, preamble->Length );
-
- // Display all the encoded bytes.
- PrintHexBytes( bytes );
-}
-
-void PrintHexBytes( array^bytes )
-{
- if ( (bytes == nullptr) || (bytes->Length == 0) )
- Console::WriteLine( "" );
- else
- {
- for ( int i = 0; i < bytes->Length; i++ )
- Console::Write( "{0:X2} ", bytes[ i ] );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D
-System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF
-System.Text.UTF8Encoding : 6 12 :EF BB BF CE B2 F1 8F B3 BF
-System.Text.UTF32Encoding : 8 12 :B2 03 00 00 FF FC 04 00
-System.Text.UTF32Encoding : 8 12 :FF FE 00 00 B2 03 00 00 FF FC 04 00
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp
deleted file mode 100644
index d554ef4eb8b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-
-// The following code example determines the number of bytes required to encode a string,
-// then encodes the string and displays the resulting bytes.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndBytes( String^ s, Encoding^ enc );
-void PrintHexBytes( array^bytes );
-int main()
-{
-
- // The characters to encode:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- // a high-surrogate value (U+D8FF)
- // a low-surrogate value (U+DCFF)
- String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF";
-
- // Create instances of different encodings.
- UTF7Encoding^ u7 = gcnew UTF7Encoding;
- UTF8Encoding^ u8Nobom = gcnew UTF8Encoding( false,true );
- UTF8Encoding^ u8Bom = gcnew UTF8Encoding( true,true );
- UTF32Encoding ^ u32Nobom = gcnew UTF32Encoding( false,false,true );
- UTF32Encoding ^ u32Bom = gcnew UTF32Encoding( false,true,true );
-
- // Get the byte counts and the bytes.
- PrintCountsAndBytes( myStr, u7 );
- PrintCountsAndBytes( myStr, u8Nobom );
- PrintCountsAndBytes( myStr, u8Bom );
- PrintCountsAndBytes( myStr, u32Nobom );
- PrintCountsAndBytes( myStr, u32Bom );
-}
-
-void PrintCountsAndBytes( String^ s, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-25} :", enc );
-
- // Display the exact byte count.
- int iBC = enc->GetByteCount( s );
- Console::Write( " {0,-3}", iBC );
-
- // Display the maximum byte count.
- int iMBC = enc->GetMaxByteCount( s->Length );
- Console::Write( " {0,-3} :", iMBC );
-
- // Get the byte order mark, if any.
- array^preamble = enc->GetPreamble();
-
- // Combine the preamble and the encoded bytes.
- array^bytes = gcnew array(preamble->Length + iBC);
- Array::Copy( preamble, bytes, preamble->Length );
- enc->GetBytes( s, 0, s->Length, bytes, preamble->Length );
-
- // Display all the encoded bytes.
- PrintHexBytes( bytes );
-}
-
-void PrintHexBytes( array^bytes )
-{
- if ( (bytes == nullptr) || (bytes->Length == 0) )
- Console::WriteLine( "" );
- else
- {
- for ( int i = 0; i < bytes->Length; i++ )
- Console::Write( "{0:X2} ", bytes[ i ] );
- Console::WriteLine();
- }
-}
-
-/*
-This code produces the following output.
-
-System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D
-System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
-System.Text.UTF8Encoding : 12 24 :EF BB BF 7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF
-System.Text.UTF32Encoding : 24 28 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
-System.Text.UTF32Encoding : 24 28 :FF FE 00 00 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp
deleted file mode 100644
index beeadd8f48b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-
-// The following code example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.
-//
-using namespace System;
-using namespace System::Text;
-void PrintCountsAndChars( array^bytes, Encoding^ enc );
-int main()
-{
-
- // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order.
- UTF32Encoding^ u32LE = gcnew UTF32Encoding( false,true,true );
- UTF32Encoding^ u32BE = gcnew UTF32Encoding( true,true,true );
-
- // Create byte arrays from the same string containing the following characters:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF";
-
- // barrBE uses the big-endian byte order.
- array^barrBE = gcnew array(u32BE->GetByteCount( myStr ));
- u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 );
-
- // barrLE uses the little-endian byte order.
- array^barrLE = gcnew array(u32LE->GetByteCount( myStr ));
- u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 );
-
- // Get the char counts and decode the byte arrays.
- Console::Write( "BE array with BE encoding : " );
- PrintCountsAndChars( barrBE, u32BE );
- Console::Write( "LE array with LE encoding : " );
- PrintCountsAndChars( barrLE, u32LE );
-
- // Decode the byte arrays using an encoding with a different byte order.
- Console::Write( "BE array with LE encoding : " );
- try
- {
- PrintCountsAndChars( barrBE, u32LE );
- }
- catch ( System::ArgumentException^ e )
- {
- Console::WriteLine( e->Message );
- }
-
- Console::Write( "LE array with BE encoding : " );
- try
- {
- PrintCountsAndChars( barrLE, u32BE );
- }
- catch ( System::ArgumentException^ e )
- {
- Console::WriteLine( e->Message );
- }
-
-}
-
-void PrintCountsAndChars( array^bytes, Encoding^ enc )
-{
-
- // Display the name of the encoding used.
- Console::Write( "{0,-25} :", enc );
-
- // Display the exact character count.
- int iCC = enc->GetCharCount( bytes );
- Console::Write( " {0,-3}", iCC );
-
- // Display the maximum character count.
- int iMCC = enc->GetMaxCharCount( bytes->Length );
- Console::Write( " {0,-3} :", iMCC );
-
- // Decode the bytes and display the characters.
- array^chars = gcnew array(iCC);
- enc->GetChars( bytes, 0, bytes->Length, chars, 0 );
- Console::WriteLine( chars );
-}
-
-/*
-This code produces the following output. The question marks take the place of characters that cannot be displayed at the console.
-
-BE array with BE encoding : System.Text.UTF32Encoding : 7 14 :za??ß?
-LE array with LE encoding : System.Text.UTF32Encoding : 7 14 :za??ß?
-BE array with LE encoding : System.Text.UTF32Encoding :Invalid byte was found at byte index 3.
-LE array with BE encoding : System.Text.UTF32Encoding :Invalid byte was found at byte index 3.
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp
deleted file mode 100644
index 9d05673135c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-// The following code example retrieves and displays the byte order mark for different UTF32Encoding instances.
-//
-using namespace System;
-using namespace System::Text;
-
-void PrintHexBytes( array^bytes );
-
-int main()
-{
-
- // Create instances of UTF32Encoding, with the byte order mark and without.
- UTF32Encoding ^ u32LeNone = gcnew UTF32Encoding;
- UTF32Encoding ^ u32BeNone = gcnew UTF32Encoding( true,false );
- UTF32Encoding ^ u32LeBom = gcnew UTF32Encoding( false,true );
- UTF32Encoding ^ u32BeBom = gcnew UTF32Encoding( true,true );
-
- // Display the preamble for each instance.
- PrintHexBytes( u32LeNone->GetPreamble() );
- PrintHexBytes( u32BeNone->GetPreamble() );
- PrintHexBytes( u32LeBom->GetPreamble() );
- PrintHexBytes( u32BeBom->GetPreamble() );
-}
-
-void PrintHexBytes( array^bytes )
-{
- if ( (bytes == nullptr) || (bytes->Length == 0) )
- Console::WriteLine( "" );
- else
- {
- for ( int i = 0; i < bytes->Length; i++ )
- Console::Write( "{0:X2} ", bytes[ i ] );
- Console::WriteLine();
- }
-}
-
-/*
-This example displays the following output:
- FF FE 00 00
-
- FF FE 00 00
- 00 00 FE FF
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp
deleted file mode 100644
index c84f8ce2a84..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
-
- // Create a UTF-7 encoding.
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
-
- // A Unicode string with two characters outside a 7-bit code range.
- String^ unicodeString = L"This Unicode string contains two characters with codes outside a 7-bit code range, Pi (\u03a0) and Sigma (\u03a3).";
- Console::WriteLine( "Original string:" );
- Console::WriteLine( unicodeString );
-
- // Encode the string.
- array^encodedBytes = utf7->GetBytes( unicodeString );
- Console::WriteLine();
- Console::WriteLine( "Encoded bytes:" );
- IEnumerator^ myEnum = encodedBytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-
- // Decode bytes back to string.
- // Notice Pi and Sigma characters are still present.
- String^ decodedString = utf7->GetString( encodedBytes );
- Console::WriteLine();
- Console::WriteLine( "Decoded bytes:" );
- Console::WriteLine( decodedString );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp
deleted file mode 100644
index ddc015fa0f3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
- int byteCount = utf7->GetByteCount( chars, 1, 2 );
- Console::WriteLine( "{0} bytes needed to encode characters.", byteCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index 97b50574c01..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
- int byteCount = utf7->GetByteCount( chars, 1, 2 );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = utf7->GetBytes( chars, 1, 2, bytes, 0 );
- Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
deleted file mode 100644
index b5e8fc2023a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars;
- array^bytes = {85,84,70,55,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101};
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
- int charCount = utf7->GetCharCount( bytes, 2, 8 );
- chars = gcnew array(charCount);
- int charsDecodedCount = utf7->GetChars( bytes, 2, 8, chars, 0 );
- Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount );
- Console::Write( "Decoded chars: " );
- IEnumerator^ myEnum = chars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", c.ToString() );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp
deleted file mode 100644
index 7fb0ea443fe..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars;
- array^bytes = {99,43,65,119,67,103,111,65,45};
- Decoder^ utf7Decoder = Encoding::UTF7->GetDecoder();
- int charCount = utf7Decoder->GetCharCount( bytes, 0, bytes->Length );
- chars = gcnew array(charCount);
- int charsDecodedCount = utf7Decoder->GetChars( bytes, 0, bytes->Length, chars, 0 );
- Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount );
- Console::Write( "Decoded chars: " );
- IEnumerator^ myEnum = chars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", c.ToString() );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp
deleted file mode 100644
index 60c28256953..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars = {'a','b','c',L'\u0300',L'\ua0a0'};
- array^bytes;
- Encoder^ utf7Encoder = Encoding::UTF7->GetEncoder();
- int byteCount = utf7Encoder->GetByteCount( chars, 2, 3, true );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = utf7Encoder->GetBytes( chars, 2, 3, bytes, 0, true );
- Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
deleted file mode 100644
index e368c581615..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
- int charCount = 2;
- int maxByteCount = utf7->GetMaxByteCount( charCount );
- Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
deleted file mode 100644
index e11609a9b4f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
- int byteCount = 8;
- int maxCharCount = utf7->GetMaxCharCount( byteCount );
- Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp
deleted file mode 100644
index 3474715e028..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
- String^ encodingName = utf7->EncodingName;
- Console::WriteLine( "Encoding name: {0}", encodingName );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp
deleted file mode 100644
index 0af6372132d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-void ShowArray( Array^ theArray )
-{
- IEnumerator^ myEnum = theArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ o = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", o );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
-
- // A few optional characters.
- String^ chars = "!@#$";
-
- // The default Encoding does not allow optional characters.
- // Alternate Byte values are used.
- UTF7Encoding^ utf7 = gcnew UTF7Encoding;
- array^bytes1 = utf7->GetBytes( chars );
- Console::WriteLine( "Default UTF7 Encoding:" );
- ShowArray( bytes1 );
-
- // Convert back to characters.
- Console::WriteLine( "Characters:" );
- ShowArray( utf7->GetChars( bytes1 ) );
-
- // Now, allow optional characters.
- // Optional characters are encoded with their normal code points.
- UTF7Encoding^ utf7AllowOptionals = gcnew UTF7Encoding( true );
- array^bytes2 = utf7AllowOptionals->GetBytes( chars );
- Console::WriteLine( "UTF7 Encoding with optional characters allowed:" );
- ShowArray( bytes2 );
-
- // Convert back to characters.
- Console::WriteLine( "Characters:" );
- ShowArray( utf7AllowOptionals->GetChars( bytes2 ) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp
deleted file mode 100644
index 0f2e71a46f4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-// The following code example encodes a string into an array of bytes, and then decodes the bytes back into a string.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Create an instance of UTF7Encoding.
- UTF7Encoding^ u7 = gcnew UTF7Encoding( true );
-
- // Create byte arrays from the same string containing the following characters:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- String^ myStr = "za\u0306\u01FD\u03B2";
-
- // Encode the string.
- array^myBArr = gcnew array(u7->GetByteCount( myStr ));
- u7->GetBytes( myStr, 0, myStr->Length, myBArr, 0 );
-
- // Decode the byte array.
- Console::WriteLine( "The new string is: {0}", u7->GetString( myBArr, 0, myBArr->Length ) );
-}
-
-/*
-This code produces the following output. The question marks take the place of characters that cannot be displayed at the console.
-
-The new string is: za??
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp
deleted file mode 100644
index 207ede33c02..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-//using namespace System::Collections;
-
-int main()
-{
- // Create a UTF-8 encoding.
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
-
- // A Unicode string with two characters outside an 8-bit code range.
- String^ unicodeString = L"This Unicode string has 2 characters " +
- L"outside the ASCII range:\n" +
- L"Pi (\u03a0), and Sigma (\u03a3).";
- Console::WriteLine("Original string:");
- Console::WriteLine(unicodeString);
-
- // Encode the string.
- array^ encodedBytes = utf8->GetBytes(unicodeString );
- Console::WriteLine();
- Console::WriteLine("Encoded bytes:");
- for (int ctr = 0; ctr < encodedBytes->Length; ctr++) {
- Console::Write( "{0:X2} ", encodedBytes[ctr]);
- if ((ctr + 1) % 25 == 0)
- Console::WriteLine();
- }
-
- Console::WriteLine();
-
- // Decode bytes back to string.
- String^ decodedString = utf8->GetString(encodedBytes);
- Console::WriteLine();
- Console::WriteLine("Decoded bytes:");
- Console::WriteLine(decodedString);
-}
-// The example displays the following output:
-// Original string:
-// This Unicode string has 2 characters outside the ASCII range:
-// Pi (π), and Sigma (Σ).
-//
-// Encoded bytes:
-// 54 68 69 73 20 55 6E 69 63 6F 64 65 20 73 74 72 69 6E 67 20 68 61 73 20 32
-// 20 63 68 61 72 61 63 74 65 72 73 20 6F 75 74 73 69 64 65 20 74 68 65 20 41
-// 53 43 49 49 20 72 61 6E 67 65 3A 20 0D 0A 50 69 20 28 CE A0 29 2C 20 61 6E
-// 64 20 53 69 67 6D 61 20 28 CE A3 29 2E
-//
-// Decoded bytes:
-// This Unicode string has 2 characters outside the ASCII range:
-// Pi (π), and Sigma (Σ).
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp
deleted file mode 100644
index 5e6ae2e299e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-void DescribeEquivalence( Boolean isEquivalent )
-{
- Console::WriteLine( "{0} equivalent encoding.", (isEquivalent ? (String^)"An" : "Not an") );
-}
-
-int main()
-{
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- UTF8Encoding^ utf8true = gcnew UTF8Encoding( true );
- UTF8Encoding^ utf8truetrue = gcnew UTF8Encoding( true,true );
- UTF8Encoding^ utf8falsetrue = gcnew UTF8Encoding( false,true );
- DescribeEquivalence( utf8->Equals( utf8 ) );
- DescribeEquivalence( utf8->Equals( utf8true ) );
- DescribeEquivalence( utf8->Equals( utf8truetrue ) );
- DescribeEquivalence( utf8->Equals( utf8falsetrue ) );
- DescribeEquivalence( utf8true->Equals( utf8 ) );
- DescribeEquivalence( utf8true->Equals( utf8true ) );
- DescribeEquivalence( utf8true->Equals( utf8truetrue ) );
- DescribeEquivalence( utf8true->Equals( utf8falsetrue ) );
- DescribeEquivalence( utf8truetrue->Equals( utf8 ) );
- DescribeEquivalence( utf8truetrue->Equals( utf8true ) );
- DescribeEquivalence( utf8truetrue->Equals( utf8truetrue ) );
- DescribeEquivalence( utf8truetrue->Equals( utf8falsetrue ) );
- DescribeEquivalence( utf8falsetrue->Equals( utf8 ) );
- DescribeEquivalence( utf8falsetrue->Equals( utf8true ) );
- DescribeEquivalence( utf8falsetrue->Equals( utf8truetrue ) );
- DescribeEquivalence( utf8falsetrue->Equals( utf8falsetrue ) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index 5adc3b4928a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- int byteCount = utf8->GetByteCount( chars, 1, 2 );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = utf8->GetBytes( chars, 1, 2, bytes, 0 );
- Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index e89bbb84c9e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
- String^ chars = "UTF8 Encoding Example";
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- int byteCount = utf8->GetByteCount( chars->ToCharArray(), 0, 13 );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = utf8->GetBytes( chars, 0, 13, bytes, 0 );
- Console::WriteLine( "{0} bytes used to encode string.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
deleted file mode 100644
index 7456dd1e21a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- array^bytes = {85,84,70,56,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101};
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- int charCount = utf8->GetCharCount( bytes, 2, 8 );
- Console::WriteLine( "{0} characters needed to decode bytes.", charCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
deleted file mode 100644
index 6d629f2db9b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars;
- array^bytes = {85,84,70,56,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101};
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- int charCount = utf8->GetCharCount( bytes, 2, 13 );
- chars = gcnew array(charCount);
- int charsDecodedCount = utf8->GetChars( bytes, 2, 13, chars, 0 );
- Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount );
- Console::Write( "Decoded chars: " );
- IEnumerator^ myEnum = chars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", c.ToString() );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp
deleted file mode 100644
index 3e5900dd0e4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars;
- array^bytes = {99,204,128,234,130,160};
- Decoder^ utf8Decoder = Encoding::UTF8->GetDecoder();
- int charCount = utf8Decoder->GetCharCount( bytes, 0, bytes->Length );
- chars = gcnew array(charCount);
- int charsDecodedCount = utf8Decoder->GetChars( bytes, 0, bytes->Length, chars, 0 );
- Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount );
- Console::Write( "Decoded chars: " );
- IEnumerator^ myEnum = chars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", c.ToString() );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp
deleted file mode 100644
index 2969f330f96..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars = {'a','b','c',L'\u0300',L'\ua0a0'};
- array^bytes;
- Encoder^ utf8Encoder = Encoding::UTF8->GetEncoder();
- int byteCount = utf8Encoder->GetByteCount( chars, 2, 3, true );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = utf8Encoder->GetBytes( chars, 2, 3, bytes, 0, true );
- Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp
deleted file mode 100644
index 00934592f35..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Many ways to instantiate a UTF8 encoding.
- UTF8Encoding^ UTF8a = gcnew UTF8Encoding;
- Encoding^ UTF8b = Encoding::UTF8;
- Encoding^ UTF8c = gcnew UTF8Encoding( true,true );
- Encoding^ UTF8d = gcnew UTF8Encoding( false,false );
-
- // But not all are the same.
- Console::WriteLine( UTF8a->GetHashCode() );
- Console::WriteLine( UTF8b->GetHashCode() );
- Console::WriteLine( UTF8c->GetHashCode() );
- Console::WriteLine( UTF8d->GetHashCode() );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
deleted file mode 100644
index eaf84b21006..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- int charCount = 2;
- int maxByteCount = utf8->GetMaxByteCount( charCount );
- Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
deleted file mode 100644
index 624c31a8ccf..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- int byteCount = 8;
- int maxCharCount = utf8->GetMaxCharCount( byteCount );
- Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp
deleted file mode 100644
index 8bc22343a5c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-
-void ShowArray(array^ bytes)
-{
- for each (Byte b in bytes)
- Console::Write( "{0:X2} ", b);
-
- Console::WriteLine();
-}
-
-int main()
-{
- // The default constructor does not provide a preamble.
- UTF8Encoding^ UTF8NoPreamble = gcnew UTF8Encoding;
- UTF8Encoding^ UTF8WithPreamble = gcnew UTF8Encoding( true );
- array^preamble;
- preamble = UTF8NoPreamble->GetPreamble();
- Console::WriteLine( "UTF8NoPreamble" );
- Console::WriteLine( " preamble length: {0}", preamble->Length );
- Console::Write( " preamble: " );
- ShowArray( preamble );
- Console::WriteLine();
-
- preamble = UTF8WithPreamble->GetPreamble();
- Console::WriteLine( "UTF8WithPreamble" );
- Console::WriteLine( " preamble length: {0}", preamble->Length );
- Console::Write( " preamble: " );
- ShowArray( preamble );
-}
-// The example displays the following output:
-// UTF8NoPreamble
-// preamble length: 0
-// preamble:
-//
-// UTF8WithPreamble
-// preamble length: 3
-// preamble: EF BB BF
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp
deleted file mode 100644
index 862c4ca0aec..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- String^ encodingName = utf8->EncodingName;
- Console::WriteLine( "Encoding name: {0}", encodingName );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp
deleted file mode 100644
index 0dafbdef102..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-void ShowArray( Array^ theArray )
-{
- IEnumerator^ myEnum = theArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ o = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", o );
- }
-
- Console::WriteLine();
-}
-
-int main()
-{
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- UTF8Encoding^ utf8EmitBOM = gcnew UTF8Encoding( true );
- Console::WriteLine( "utf8 preamble:" );
- ShowArray( utf8->GetPreamble() );
- Console::WriteLine( "utf8EmitBOM:" );
- ShowArray( utf8EmitBOM->GetPreamble() );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp
deleted file mode 100644
index 9f6b9081759..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-
-void ShowArray(Array^ theArray)
-{
- for each (Byte b in theArray) {
- Console::Write( "{0:X2} ", b);
- }
- Console::WriteLine();
-}
-
-int main()
-{
- UTF8Encoding^ utf8 = gcnew UTF8Encoding;
- UTF8Encoding^ utf8ThrowException = gcnew UTF8Encoding(false,true);
-
- // This array contains two high surrogates in a row (\uD801, \uD802).
- array^chars = {'a','b','c',L'\xD801',L'\xD802','d'};
-
- // The following method call will not throw an exception.
- array^bytes = utf8->GetBytes( chars );
- ShowArray( bytes );
- Console::WriteLine();
-
- try {
-
- // The following method call will throw an exception.
- bytes = utf8ThrowException->GetBytes( chars );
- }
- catch (EncoderFallbackException^ e ) {
- Console::WriteLine("{0} exception\nMessage:\n{1}",
- e->GetType()->Name, e->Message);
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp
deleted file mode 100644
index c498942c8f5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
-
- // The encoding.
- UnicodeEncoding^ unicode = gcnew UnicodeEncoding;
-
- // Create a String* that contains Unicode characters.
- String^ unicodeString = L"This Unicode string contains two characters with codes outside the traditional ASCII code range, Pi (\u03a0) and Sigma (\u03a3).";
- Console::WriteLine( "Original string:" );
- Console::WriteLine( unicodeString );
-
- // Encode the String*.
- array^encodedBytes = unicode->GetBytes( unicodeString );
- Console::WriteLine();
- Console::WriteLine( "Encoded bytes:" );
- IEnumerator^ myEnum = encodedBytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-
- // Decode bytes back to String*.
- // Notice Pi and Sigma characters are still present.
- String^ decodedString = unicode->GetString( encodedBytes );
- Console::WriteLine();
- Console::WriteLine( "Decoded bytes:" );
- Console::WriteLine( decodedString );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp
deleted file mode 100644
index 39d50f0b408..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- Console::WriteLine( "Unicode character size: {0} bytes", UnicodeEncoding::CharSize );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp
deleted file mode 100644
index 7f46e6d47b0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// The following code example uses an encoder and a decoder to encode a string into an array of bytes,
-// and then decode the bytes into an array of characters.
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
-
- // Get an encoder and a decoder from UnicodeEncoding.
- UnicodeEncoding^ u16 = gcnew UnicodeEncoding( false,true,true );
- Encoder^ myEnc = u16->GetEncoder();
- Decoder^ myDec = u16->GetDecoder();
-
- // The characters to encode:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- array^myChars = gcnew array(5){
- L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2'
- };
- Console::Write( "The original characters : " );
- Console::WriteLine( myChars );
-
- // Encode the character array.
- int iBC = myEnc->GetByteCount( myChars, 0, myChars->Length, true );
- array^myBytes = gcnew array(iBC);
- myEnc->GetBytes( myChars, 0, myChars->Length, myBytes, 0, true );
-
- // Print the resulting bytes.
- Console::Write( "Using the encoder : " );
- for ( int i = 0; i < myBytes->Length; i++ )
- Console::Write( "{0:X2} ", myBytes[ i ] );
- Console::WriteLine();
-
- // Decode the byte array back into an array of characters.
- int iCC = myDec->GetCharCount( myBytes, 0, myBytes->Length, true );
- array^myDecodedChars = gcnew array(iCC);
- myDec->GetChars( myBytes, 0, myBytes->Length, myDecodedChars, 0, true );
-
- // Print the resulting characters.
- Console::Write( "Using the decoder : " );
- Console::WriteLine( myDecodedChars );
-}
-
-/*
-This code produces the following output. The question marks take the place of characters that cannot be displayed at the console.
-
-The original characters : za??ß
-Using the encoder : 7A 00 61 00 06 03 FD 01 B2 03
-Using the decoder : za??ß
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp
deleted file mode 100644
index de042ae169e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-
-// The following code example demonstrates the behavior of UnicodeEncoding with error detection enabled and without.
-//
-using namespace System;
-using namespace System::Text;
-void PrintDecodedString( array^bytes, Encoding^ enc );
-int main()
-{
-
- // Create an instance of UnicodeEncoding using little-endian byte order.
- // This will be used for encoding.
- UnicodeEncoding^ u16LE = gcnew UnicodeEncoding( false,true );
-
- // Create two instances of UnicodeEncoding using big-endian byte order: one with error detection and one without.
- // These will be used for decoding.
- UnicodeEncoding^ u16withED = gcnew UnicodeEncoding( true,true,true );
- UnicodeEncoding^ u16noED = gcnew UnicodeEncoding( true,true,false );
-
- // Create byte arrays from the same string containing the following characters:
- // Latin Small Letter Z (U+007A)
- // Latin Small Letter A (U+0061)
- // Combining Breve (U+0306)
- // Latin Small Letter AE With Acute (U+01FD)
- // Greek Small Letter Beta (U+03B2)
- // Latin Capital Letter U with Diaeresis (U+00DC)
- String^ myStr = "za\u0306\u01FD\u03B2\u00DC";
-
- // Encode the string using little-endian byte order.
- array^myBytes = gcnew array(u16LE->GetByteCount( myStr ));
- u16LE->GetBytes( myStr, 0, myStr->Length, myBytes, 0 );
-
- // Decode the byte array with error detection.
- Console::WriteLine( "Decoding with error detection:" );
- PrintDecodedString( myBytes, u16withED );
-
- // Decode the byte array without error detection.
- Console::WriteLine( "Decoding without error detection:" );
- PrintDecodedString( myBytes, u16noED );
-}
-
-
-// Decode the bytes and display the string.
-void PrintDecodedString( array^bytes, Encoding^ enc )
-{
- try
- {
- Console::WriteLine( " Decoded string: {0}", enc->GetString( bytes, 0, bytes->Length ) );
- }
- catch ( System::ArgumentException^ e )
- {
- Console::WriteLine( e );
- }
-
- Console::WriteLine();
-}
-
-//
-/* BUGBUG: Reproduce this output in retail build, then add to the snippet.
-This code produces the following output.
-
-Decoding with error detection:
-System.ArgumentException: Invalid byte was found at byte index 3.
- at System.Text.UnicodeEncoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder)
- at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding)
- at System.Text.UnicodeEncoding.GetString(Byte[] bytes, Int32 index, Int32 count)
- at SamplesUnicodeEncoding.PrintDecodedString(Byte[] bytes, Encoding enc)
-
-Decoding without error detection:
- Decoded string:
-
-*/
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index bbefc038187..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
-
- // Unicode characters.
-
- // Pi
- // Sigma
- array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'};
- UnicodeEncoding^ Unicode = gcnew UnicodeEncoding;
- int byteCount = Unicode->GetByteCount( chars, 1, 2 );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = Unicode->GetBytes( chars, 1, 2, bytes, 0 );
- Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp
deleted file mode 100644
index 25dee60bee6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^bytes;
- String^ chars = "Unicode Encoding Example";
- UnicodeEncoding^ Unicode = gcnew UnicodeEncoding;
- int byteCount = Unicode->GetByteCount( chars->ToCharArray(), 8, 8 );
- bytes = gcnew array(byteCount);
- int bytesEncodedCount = Unicode->GetBytes( chars, 8, 8, bytes, 0 );
- Console::WriteLine( "{0} bytes used to encode string.", bytesEncodedCount );
- Console::Write( "Encoded bytes: " );
- IEnumerator^ myEnum = bytes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
deleted file mode 100644
index 0925c759295..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0};
- UnicodeEncoding^ Unicode = gcnew UnicodeEncoding;
- int charCount = Unicode->GetCharCount( bytes, 2, 8 );
- Console::WriteLine( "{0} characters needed to decode bytes.", charCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
deleted file mode 100644
index e68162a021c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^chars;
- array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0};
- UnicodeEncoding^ Unicode = gcnew UnicodeEncoding;
- int charCount = Unicode->GetCharCount( bytes, 2, 8 );
- chars = gcnew array(charCount);
- int charsDecodedCount = Unicode->GetChars( bytes, 2, 8, chars, 0 );
- Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount );
- Console::Write( "Decoded chars: " );
- IEnumerator^ myEnum = chars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Char c = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", c.ToString() );
- }
-
- Console::WriteLine();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
deleted file mode 100644
index 08545fa0a5e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UnicodeEncoding^ Unicode = gcnew UnicodeEncoding;
- int charCount = 2;
- int maxByteCount = Unicode->GetMaxByteCount( charCount );
- Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
deleted file mode 100644
index c956533d9a8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UnicodeEncoding^ Unicode = gcnew UnicodeEncoding;
- int byteCount = 8;
- int maxCharCount = Unicode->GetMaxCharCount( byteCount );
- Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp
deleted file mode 100644
index b2e176ae267..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Collections;
-int main()
-{
- array^byteOrderMark;
- byteOrderMark = Encoding::Unicode->GetPreamble();
- Console::WriteLine( "Default (little-endian) Unicode Preamble:" );
- IEnumerator^ myEnum = byteOrderMark->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-
- Console::WriteLine( "\n" );
- UnicodeEncoding^ bigEndianUnicode = gcnew UnicodeEncoding( true,true );
- byteOrderMark = bigEndianUnicode->GetPreamble();
- Console::WriteLine( "Big-endian Unicode Preamble:" );
- myEnum = byteOrderMark->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte b = safe_cast(myEnum->Current);
- Console::Write( "[{0}]", b );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp
deleted file mode 100644
index 13dd01a98bb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-int main()
-{
- UnicodeEncoding^ unicode = gcnew UnicodeEncoding;
- String^ encodingName = unicode->EncodingName;
- Console::WriteLine( "Encoding name: {0}", encodingName );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp
deleted file mode 100644
index e295b687fdd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-void DescribeEquivalence( Boolean isEquivalent )
-{
- Console::WriteLine( " {0} equivalent encoding.", (isEquivalent ? (String^)"An" : "Not an") );
-}
-
-int main()
-{
-
- // Create a UnicodeEncoding without parameters.
- UnicodeEncoding^ unicode = gcnew UnicodeEncoding;
-
- // Create a UnicodeEncoding to support little-endian Byte ordering
- // and include the Unicode Byte order mark.
- UnicodeEncoding^ unicodeLittleEndianBOM = gcnew UnicodeEncoding( false,true );
-
- // Compare this UnicodeEncoding to the UnicodeEncoding without parameters.
- DescribeEquivalence( unicode->Equals( unicodeLittleEndianBOM ) );
-
- // Create a UnicodeEncoding to support little-endian Byte ordering
- // and not include the Unicode Byte order mark.
- UnicodeEncoding^ unicodeLittleEndianNoBOM = gcnew UnicodeEncoding( false,false );
-
- // Compare this UnicodeEncoding to the UnicodeEncoding without parameters.
- DescribeEquivalence( unicode->Equals( unicodeLittleEndianNoBOM ) );
-
- // Create a UnicodeEncoding to support big-endian Byte ordering
- // and include the Unicode Byte order mark.
- UnicodeEncoding^ unicodeBigEndianBOM = gcnew UnicodeEncoding( true,true );
-
- // Compare this UnicodeEncoding to the UnicodeEncoding without parameters.
- DescribeEquivalence( unicode->Equals( unicodeBigEndianBOM ) );
-
- // Create a UnicodeEncoding to support big-endian Byte ordering
- // and not include the Unicode Byte order mark.
- UnicodeEncoding^ unicodeBigEndianNoBOM = gcnew UnicodeEncoding( true,false );
-
- // Compare this UnicodeEncoding to the UnicodeEncoding without parameters.
- DescribeEquivalence( unicode->Equals( unicodeBigEndianNoBOM ) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp
deleted file mode 100644
index ea0fa55c83a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-namespace SystemThreadingExample
-{
- public ref class Example
- {
- private:
- static ManualResetEvent^ dummyEvent =
- gcnew ManualResetEvent(false);
-
- static Mutex^ orphanMutex1 = gcnew Mutex;
- static Mutex^ orphanMutex2 = gcnew Mutex;
- static Mutex^ orphanMutex3 = gcnew Mutex;
- static Mutex^ orphanMutex4 = gcnew Mutex;
- static Mutex^ orphanMutex5 = gcnew Mutex;
-
- public:
- static void ProduceAbandonMutexException(void)
- {
-
- // Start a thread that grabs all five mutexes, and then
- // abandons them.
- Thread^ abandonThread =
- gcnew Thread(gcnew ThreadStart(AbandonMutex));
-
- abandonThread->Start();
-
- // Make sure the thread is finished.
- abandonThread->Join();
-
- // Wait on one of the abandoned mutexes. The WaitOne
- // throws an AbandonedMutexException.
- try
- {
- orphanMutex1->WaitOne();
- Console::WriteLine("WaitOne succeeded.");
- }
- catch (AbandonedMutexException^ ex)
- {
- Console::WriteLine("Exception in WaitOne: {0}",
- ex->Message);
- }
- finally
- {
-
- // Whether or not the exception was thrown,
- // the current thread owns the mutex, and
- // must release it.
- orphanMutex1->ReleaseMutex();
- }
-
-
- // Create an array of wait handles, consisting of one
- // ManualResetEvent and two mutexes, using two more of
- // the abandoned mutexes.
- array ^ waitFor = {dummyEvent,
- orphanMutex2, orphanMutex3};
-
- // WaitAny returns when any of the wait handles in the
- // array is signaled. Either of the two abandoned mutexes
- // satisfy the wait, but lower of the two index values is
- // returned by MutexIndex. Note that the Try block and
- // the Catch block obtain the index in different ways.
- try
- {
- int index = WaitHandle::WaitAny(waitFor);
- Console::WriteLine("WaitAny succeeded.");
- (safe_cast(waitFor[index]))->ReleaseMutex();
- }
- catch (AbandonedMutexException^ ex)
- {
- Console::WriteLine("Exception in WaitAny at index {0}"
- "\r\n\tMessage: {1}", ex->MutexIndex,
- ex->Message);
- (safe_cast(waitFor[ex->MutexIndex]))->
- ReleaseMutex();
- }
-
- orphanMutex3->ReleaseMutex();
-
- // Use two more of the abandoned mutexes for the WaitAll
- // call. WaitAll doesn't return until all wait handles
- // are signaled, so the ManualResetEvent must be signaled
- // by calling Set().
- dummyEvent->Set();
- waitFor[1] = orphanMutex4;
- waitFor[2] = orphanMutex5;
-
- // Because WaitAll requires all the wait handles to be
- // signaled, both mutexes must be released even if the
- // exception is thrown. Thus, the ReleaseMutex calls are
- // placed in the Finally block. Again, MutexIndex returns
- // the lower of the two index values for the abandoned
- // mutexes.
- //
- try
- {
- WaitHandle::WaitAll(waitFor);
- Console::WriteLine("WaitAll succeeded.");
- }
- catch (AbandonedMutexException^ ex)
- {
- Console::WriteLine("Exception in WaitAny at index {0}"
- "\r\n\tMessage: {1}", ex->MutexIndex,
- ex->Message);
- }
- finally
- {
- orphanMutex4->ReleaseMutex();
- orphanMutex5->ReleaseMutex();
- }
-
- }
-
-
- private:
- [MTAThread]
- static void AbandonMutex()
- {
- orphanMutex1->WaitOne();
- orphanMutex2->WaitOne();
- orphanMutex3->WaitOne();
- orphanMutex4->WaitOne();
- orphanMutex5->WaitOne();
- Console::WriteLine(
- "Thread exits without releasing the mutexes.");
- }
- };
-}
-
-//Entry point of example application
-[MTAThread]
-int main(void)
-{
- SystemThreadingExample::Example::ProduceAbandonMutexException();
-}
-
-// This code example produces the following output:
-// Thread exits without releasing the mutexes.
-// Exception in WaitOne: The wait completed due to an abandoned mutex.
-// Exception in WaitAny at index 1
-// Message: The wait completed due to an abandoned mutex.
-// Exception in WaitAll at index -1
-// Message: The wait completed due to an abandoned mutex.
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp
deleted file mode 100644
index 286d1b48439..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class MyMainClass
-{
-public:
- static void MyReadThreadProc()
- {
- while ( true )
- {
-
- //The value will not be read until the writer has written
- // at least once since the last read.
- myResetEvent->WaitOne();
- Console::WriteLine( " {0} reading value: {1}", Thread::CurrentThread->Name, number );
- }
- }
-
-
- //Initially not signaled.
- static AutoResetEvent^ myResetEvent = gcnew AutoResetEvent( false );
- static int number;
- literal int numIterations = 100;
-};
-
-int main()
-{
-
- //Create and start the reader thread.
- Thread^ myReaderThread = gcnew Thread( gcnew ThreadStart( MyMainClass::MyReadThreadProc ) );
- myReaderThread->Name = "ReaderThread";
- myReaderThread->Start();
- for ( int i = 1; i <= MyMainClass::numIterations; i++ )
- {
- Console::WriteLine( "Writer thread writing value: {0}", i );
- MyMainClass::number = i;
-
- //Signal that a value has been written.
- MyMainClass::myResetEvent->Set();
-
- //Give the Reader thread an opportunity to act.
- Thread::Sleep( 1 );
-
- }
-
- //Terminate the reader thread.
- myReaderThread->Abort();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp
deleted file mode 100644
index 96444ba3776..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-ref class Example
-{
-private:
- static AutoResetEvent^ event_1 = gcnew AutoResetEvent(true);
- static AutoResetEvent^ event_2 = gcnew AutoResetEvent(false);
-
- static void ThreadProc()
- {
- String^ name = Thread::CurrentThread->Name;
-
- Console::WriteLine("{0} waits on AutoResetEvent #1.", name);
- event_1->WaitOne();
- Console::WriteLine("{0} is released from AutoResetEvent #1.", name);
-
- Console::WriteLine("{0} waits on AutoResetEvent #2.", name);
- event_2->WaitOne();
- Console::WriteLine("{0} is released from AutoResetEvent #2.", name);
-
- Console::WriteLine("{0} ends.", name);
- }
-
-public:
- static void Demo()
- {
- Console::WriteLine("Press Enter to create three threads and start them.\r\n" +
- "The threads wait on AutoResetEvent #1, which was created\r\n" +
- "in the signaled state, so the first thread is released.\r\n" +
- "This puts AutoResetEvent #1 into the unsignaled state.");
- Console::ReadLine();
-
- for (int i = 1; i < 4; i++)
- {
- Thread^ t = gcnew Thread(gcnew ThreadStart(&ThreadProc));
- t->Name = "Thread_" + i;
- t->Start();
- }
- Thread::Sleep(250);
-
- for (int i = 0; i < 2; i++)
- {
- Console::WriteLine("Press Enter to release another thread.");
- Console::ReadLine();
- event_1->Set();
- Thread::Sleep(250);
- }
-
- Console::WriteLine("\r\nAll threads are now waiting on AutoResetEvent #2.");
- for (int i = 0; i < 3; i++)
- {
- Console::WriteLine("Press Enter to release a thread.");
- Console::ReadLine();
- event_2->Set();
- Thread::Sleep(250);
- }
-
- // Visual Studio: Uncomment the following line.
- //Console::Readline();
- }
-};
-
-void main()
-{
- Example::Demo();
-}
-
-/* This example produces output similar to the following:
-
-Press Enter to create three threads and start them.
-The threads wait on AutoResetEvent #1, which was created
-in the signaled state, so the first thread is released.
-This puts AutoResetEvent #1 into the unsignaled state.
-
-Thread_1 waits on AutoResetEvent #1.
-Thread_1 is released from AutoResetEvent #1.
-Thread_1 waits on AutoResetEvent #2.
-Thread_3 waits on AutoResetEvent #1.
-Thread_2 waits on AutoResetEvent #1.
-Press Enter to release another thread.
-
-Thread_3 is released from AutoResetEvent #1.
-Thread_3 waits on AutoResetEvent #2.
-Press Enter to release another thread.
-
-Thread_2 is released from AutoResetEvent #1.
-Thread_2 waits on AutoResetEvent #2.
-
-All threads are now waiting on AutoResetEvent #2.
-Press Enter to release a thread.
-
-Thread_2 is released from AutoResetEvent #2.
-Thread_2 ends.
-Press Enter to release a thread.
-
-Thread_1 is released from AutoResetEvent #2.
-Thread_1 ends.
-Press Enter to release a thread.
-
-Thread_3 is released from AutoResetEvent #2.
-Thread_3 ends.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp
deleted file mode 100644
index 9545b8e2fae..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Security::AccessControl;
-using namespace System::Security::Permissions;
-
-public ref class Example
-{
-public:
- [SecurityPermissionAttribute(SecurityAction::Demand,Flags=SecurityPermissionFlag::UnmanagedCode)]
- static void Main()
- {
- //
- String^ ewhName = L"EventWaitHandleExample5";
-
- EventWaitHandle^ ewh = nullptr;
- bool doesNotExist = false;
- bool unauthorized = false;
-
- // The value of this variable is set by the event
- // constructor. It is true if the named system event was
- // created, and false if the named event already existed.
- //
- bool wasCreated;
-
- // Attempt to open the named event.
- try
- {
- // Open the event with (EventWaitHandleRights.Synchronize
- // | EventWaitHandleRights.Modify), to wait on and
- // signal the named event.
- //
- ewh = EventWaitHandle::OpenExisting( ewhName );
- }
- catch ( WaitHandleCannotBeOpenedException^ )
- {
- Console::WriteLine( L"Named event does not exist." );
- doesNotExist = true;
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unauthorized access: {0}", ex->Message );
- unauthorized = true;
- }
- //
-
- // There are three cases: (1) The event does not exist.
- // (2) The event exists, but the current user doesn't
- // have access. (3) The event exists and the user has
- // access.
- //
- if ( doesNotExist )
- {
- //
- // The event does not exist, so create it.
-
- // Create an access control list (ACL) that denies the
- // current user the right to wait on or signal the
- // event, but allows the right to read and change
- // security information for the event.
- //
- String^ user = String::Concat( Environment::UserDomainName, L"\\",
- Environment::UserName );
- EventWaitHandleSecurity^ ewhSec = gcnew EventWaitHandleSecurity;
- //following constructor fails
- EventWaitHandleAccessRule^ rule = gcnew EventWaitHandleAccessRule(
- user,
- static_cast(
- EventWaitHandleRights::Synchronize |
- EventWaitHandleRights::Modify),
- AccessControlType::Deny );
- ewhSec->AddAccessRule( rule );
-
- rule = gcnew EventWaitHandleAccessRule( user,
- static_cast(
- EventWaitHandleRights::ReadPermissions |
- EventWaitHandleRights::ChangePermissions),
- AccessControlType::Allow );
- ewhSec->AddAccessRule( rule );
-
- // Create an EventWaitHandle object that represents
- // the system event named by the constant 'ewhName',
- // initially signaled, with automatic reset, and with
- // the specified security access. The Boolean value that
- // indicates creation of the underlying system object
- // is placed in wasCreated.
- //
- ewh = gcnew EventWaitHandle( true,
- EventResetMode::AutoReset,
- ewhName,
- wasCreated,
- ewhSec );
-
- // If the named system event was created, it can be
- // used by the current instance of this program, even
- // though the current user is denied access. The current
- // program owns the event. Otherwise, exit the program.
- //
- if ( wasCreated )
- {
- Console::WriteLine( L"Created the named event." );
- }
- else
- {
- Console::WriteLine( L"Unable to create the event." );
- return;
- }
- //
- }
- else if ( unauthorized )
- {
- //
- // Open the event to read and change the access control
- // security. The access control security defined above
- // allows the current user to do this.
- //
- try
- {
- ewh = EventWaitHandle::OpenExisting( ewhName,
- static_cast(
- EventWaitHandleRights::ReadPermissions |
- EventWaitHandleRights::ChangePermissions) );
-
- // Get the current ACL. This requires
- // EventWaitHandleRights.ReadPermissions.
- EventWaitHandleSecurity^ ewhSec = ewh->GetAccessControl();
- String^ user = String::Concat( Environment::UserDomainName, L"\\",
- Environment::UserName );
-
- // First, the rule that denied the current user
- // the right to enter and release the event must
- // be removed.
- EventWaitHandleAccessRule^ rule = gcnew EventWaitHandleAccessRule(
- user,
- static_cast(
- EventWaitHandleRights::Synchronize |
- EventWaitHandleRights::Modify),
- AccessControlType::Deny );
- ewhSec->RemoveAccessRule( rule );
-
- // Now grant the user the correct rights.
- //
- rule = gcnew EventWaitHandleAccessRule( user,
- static_cast(
- EventWaitHandleRights::Synchronize |
- EventWaitHandleRights::Modify),
- AccessControlType::Allow );
- ewhSec->AddAccessRule( rule );
-
- // Update the ACL. This requires
- // EventWaitHandleRights.ChangePermissions.
- ewh->SetAccessControl( ewhSec );
- Console::WriteLine( L"Updated event security." );
-
- // Open the event with (EventWaitHandleRights.Synchronize
- // | EventWaitHandleRights.Modify), the rights required
- // to wait on and signal the event.
- //
- ewh = EventWaitHandle::OpenExisting( ewhName );
- //
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unable to change permissions: {0}",
- ex->Message );
- return;
- }
-
- }
-
- // Wait on the event, and hold it until the program
- // exits.
- //
- try
- {
- Console::WriteLine( L"Wait on the event." );
- ewh->WaitOne();
- Console::WriteLine( L"Event was signaled." );
- Console::WriteLine( L"Press the Enter key to signal the event and exit." );
- Console::ReadLine();
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unauthorized access: {0}", ex->Message );
- }
- finally
- {
- ewh->Set();
- }
- }
-};
-
-int main()
-{
- Example::Main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp
deleted file mode 100644
index 37370e944c5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-//
-// This example demonstrates a thread-safe method that adds to a
-// running total. It cannot be run directly. You can compile it
-// as a library, or add the class to a project.
-#using
-
-using namespace System::Threading;
-public ref class ThreadSafe
-{
-private:
-
- // totalValue contains a running total that can be updated
- // by multiple threads. It must be protected from unsynchronized
- // access.
- int totalValue;
-
-public:
-
- property int Total
- {
-
- // The Total property returns the running total.
- int get()
- {
- return totalValue;
- }
-
- }
-
- // AddToTotal safely adds a value to the running total.
- int AddToTotal( int addend )
- {
- int initialValue;
- int computedValue;
- do
- {
-
- // Save the current running total in a local variable.
- initialValue = totalValue;
-
- // Add the new value to the running total.
- computedValue = initialValue + addend;
-
- // CompareExchange compares totalValue to initialValue. If
- // they are not equal, then another thread has updated the
- // running total since this loop started. CompareExchange
- // does not update totalValue. CompareExchange returns the
- // contents of totalValue, which do not equal initialValue,
- // so the loop executes again.
- }
- while ( initialValue != Interlocked::CompareExchange( totalValue, computedValue, initialValue ) );
-
-
- // If no other thread updated the running total, then
- // totalValue and initialValue are equal when CompareExchange
- // compares them, and computedValue is stored in totalValue.
- // CompareExchange returns the value that was in totalValue
- // before the update, which is equal to initialValue, so the
- // loop ends.
- // The function returns computedValue, not totalValue, because
- // totalValue could be changed by another thread between
- // the time the loop ends and the function returns.
- return computedValue;
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp
deleted file mode 100644
index a04b9df75bd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-const int numThreads = 10;
-const int numThreadIterations = 5;
-ref class MyInterlockedExchangeExampleClass
-{
-public:
- static void MyThreadProc()
- {
- for ( int i = 0; i < numThreadIterations; i++ )
- {
- UseResource();
-
- //Wait 1 second before next attempt.
- Thread::Sleep( 1000 );
-
- }
- }
-
-
-private:
- //A simple method that denies reentrancy.
- static bool UseResource()
- {
-
- //0 indicates that the method is not in use.
- if ( 0 == Interlocked::Exchange( usingResource, 1 ) )
- {
- Console::WriteLine( " {0} acquired the lock", Thread::CurrentThread->Name );
-
- //Code to access a resource that is not thread safe would go here.
- //Simulate some work
- Thread::Sleep( 500 );
- Console::WriteLine( " {0} exiting lock", Thread::CurrentThread->Name );
-
- //Release the lock
- Interlocked::Exchange( usingResource, 0 );
- return true;
- }
- else
- {
- Console::WriteLine( " {0} was denied the lock", Thread::CurrentThread->Name );
- return false;
- }
- }
-
-
- //0 for false, 1 for true.
- static int usingResource;
-};
-
-int main()
-{
- Thread^ myThread;
- Random^ rnd = gcnew Random;
- for ( int i = 0; i < numThreads; i++ )
- {
- myThread = gcnew Thread( gcnew ThreadStart( MyInterlockedExchangeExampleClass::MyThreadProc ) );
- myThread->Name = String::Format( "Thread {0}", i + 1 );
-
- //Wait a random amount of time before starting next thread.
- Thread::Sleep( rnd->Next( 0, 1000 ) );
- myThread->Start();
-
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp
deleted file mode 100644
index f89e7184409..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-ref class Example
-{
-private:
- // mre is used to block and release threads manually. It is
- // created in the unsignaled state.
- static ManualResetEvent^ mre = gcnew ManualResetEvent(false);
-
- static void ThreadProc()
- {
- String^ name = Thread::CurrentThread->Name;
-
- Console::WriteLine(name + " starts and calls mre->WaitOne()");
-
- mre->WaitOne();
-
- Console::WriteLine(name + " ends.");
- }
-
-public:
- static void Demo()
- {
- Console::WriteLine("\nStart 3 named threads that block on a ManualResetEvent:\n");
-
- for(int i = 0; i <=2 ; i++)
- {
- Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc));
- t->Name = "Thread_" + i;
- t->Start();
- }
-
- Thread::Sleep(500);
- Console::WriteLine("\nWhen all three threads have started, press Enter to call Set()" +
- "\nto release all the threads.\n");
- Console::ReadLine();
-
- mre->Set();
-
- Thread::Sleep(500);
- Console::WriteLine("\nWhen a ManualResetEvent is signaled, threads that call WaitOne()" +
- "\ndo not block. Press Enter to show this.\n");
- Console::ReadLine();
-
- for(int i = 3; i <= 4; i++)
- {
- Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc));
- t->Name = "Thread_" + i;
- t->Start();
- }
-
- Thread::Sleep(500);
- Console::WriteLine("\nPress Enter to call Reset(), so that threads once again block" +
- "\nwhen they call WaitOne().\n");
- Console::ReadLine();
-
- mre->Reset();
-
- // Start a thread that waits on the ManualResetEvent.
- Thread^ t5 = gcnew Thread(gcnew ThreadStart(ThreadProc));
- t5->Name = "Thread_5";
- t5->Start();
-
- Thread::Sleep(500);
- Console::WriteLine("\nPress Enter to call Set() and conclude the demo.");
- Console::ReadLine();
-
- mre->Set();
-
- // If you run this example in Visual Studio, uncomment the following line:
- //Console::ReadLine();
- }
-};
-
-int main()
-{
- Example::Demo();
-}
-
-/* This example produces output similar to the following:
-
-Start 3 named threads that block on a ManualResetEvent:
-
-Thread_0 starts and calls mre->WaitOne()
-Thread_1 starts and calls mre->WaitOne()
-Thread_2 starts and calls mre->WaitOne()
-
-When all three threads have started, press Enter to call Set()
-to release all the threads.
-
-
-Thread_2 ends.
-Thread_1 ends.
-Thread_0 ends.
-
-When a ManualResetEvent is signaled, threads that call WaitOne()
-do not block. Press Enter to show this.
-
-
-Thread_3 starts and calls mre->WaitOne()
-Thread_3 ends.
-Thread_4 starts and calls mre->WaitOne()
-Thread_4 ends.
-
-Press Enter to call Reset(), so that threads once again block
-when they call WaitOne().
-
-
-Thread_5 starts and calls mre->WaitOne()
-
-Press Enter to call Set() and conclude the demo.
-
-Thread_5 ends.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp
deleted file mode 100644
index b46723cfa04..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-const int numIterations = 1;
-const int numThreads = 3;
-
-ref class Test
-{
-public:
-
- // Create a new Mutex. The creating thread owns the
- // Mutex.
- static Mutex^ mut = gcnew Mutex( true );
- static void MyThreadProc()
- {
- for ( int i = 0; i < numIterations; i++ )
- {
- UseResource();
-
- }
- }
-
-
-private:
-
- // This method represents a resource that must be synchronized
- // so that only one thread at a time can enter.
- static void UseResource()
- {
-
- //Wait until it is OK to enter.
- mut->WaitOne();
- Console::WriteLine( "{0} has entered protected the area", Thread::CurrentThread->Name );
-
- // Place code to access non-reentrant resources here.
- // Simulate some work.
- Thread::Sleep( 500 );
- Console::WriteLine( "{0} is leaving protected the area\r\n", Thread::CurrentThread->Name );
-
- // Release the Mutex.
- mut->ReleaseMutex();
- }
-
-};
-
-int main()
-{
-
- // Initialize the Mutex.
- Mutex^ mut = Test::mut;
-
- // Create the threads that will use the protected resource.
- for ( int i = 0; i < numThreads; i++ )
- {
- Thread^ myThread = gcnew Thread( gcnew ThreadStart( Test::MyThreadProc ) );
- myThread->Name = String::Format( "Thread {0}", i + 1 );
- myThread->Start();
-
- }
-
- // Wait one second before allowing other threads to
- // acquire the Mutex.
- Console::WriteLine( "Creating thread owns the Mutex." );
- Thread::Sleep( 1000 );
- Console::WriteLine( "Creating thread releases the Mutex.\r\n" );
- mut->ReleaseMutex();
-}
-// The example displays output like the following:
-// Creating thread owns the Mutex.
-// Creating thread releases the Mutex.
-//
-// Thread1 has entered the protected area
-// Thread1 is leaving the protected area
-//
-// Thread2 has entered the protected area
-// Thread2 is leaving the protected area
-//
-// Thread3 has entered the protected area
-// Thread3 is leaving the protected area
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp
deleted file mode 100644
index 4079eedaa6e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-int main()
-{
- // Create the named mutex. Only one system object named
- // "MyMutex" can exist; the local Mutex object represents
- // this system object, regardless of which process or thread
- // caused "MyMutex" to be created.
- Mutex^ m = gcnew Mutex( false,"MyMutex" );
-
- // Try to gain control of the named mutex. If the mutex is
- // controlled by another thread, wait for it to be released.
- Console::WriteLine( "Waiting for the Mutex." );
- m->WaitOne();
-
- // Keep control of the mutex until the user presses
- // ENTER.
- Console::WriteLine( "This application owns the mutex. "
- "Press ENTER to release the mutex and exit." );
- Console::ReadLine();
- m->ReleaseMutex();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp
deleted file mode 100644
index a8d967c7296..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-//
-// This example shows how a named mutex is used to signal between
-// processes or threads.
-// Run this program from two (or more) command windows. Each process
-// creates a Mutex object that represents the named mutex "MyMutex".
-// The named mutex is a system object whose lifetime is bounded by the
-// lifetimes of the Mutex objects that represent it. The named mutex
-// is created when the first process creates its local Mutex; in this
-// example, the named mutex is owned by the first process. The named
-// mutex is destroyed when all the Mutex objects that represent it
-// have been released.
-// The second process (and any subsequent process) waits for earlier
-// processes to release the named mutex.
-using namespace System;
-using namespace System::Threading;
-int main()
-{
-
- // Set this variable to false if you do not want to request
- // initial ownership of the named mutex.
- bool requestInitialOwnership = true;
- bool mutexWasCreated;
-
- // Request initial ownership of the named mutex by passing
- // true for the first parameter. Only one system object named
- // "MyMutex" can exist; the local Mutex object represents
- // this system object. If "MyMutex" is created by this call,
- // then mutexWasCreated contains true; otherwise, it contains
- // false.
- Mutex^ m = gcnew Mutex( requestInitialOwnership, "MyMutex", mutexWasCreated );
-
- // This thread owns the mutex only if it both requested
- // initial ownership and created the named mutex. Otherwise,
- // it can request the named mutex by calling WaitOne.
- if ( !(requestInitialOwnership && mutexWasCreated) )
- {
- Console::WriteLine( "Waiting for the named mutex." );
- m->WaitOne();
- }
-
-
- // Once the process has gained control of the named mutex,
- // hold onto it until the user presses ENTER.
- Console::WriteLine( "This process owns the named mutex. "
- "Press ENTER to release the mutex and exit." );
- Console::ReadLine();
-
- // Call ReleaseMutex to allow other threads to gain control
- // of the named mutex. If you keep a reference to the local
- // Mutex, you can call WaitOne to request control of the
- // named mutex.
- m->ReleaseMutex();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp
deleted file mode 100644
index 958035c2e03..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-//
-// This example shows how a Mutex is used to synchronize access
-// to a protected resource. Unlike Monitor, Mutex can be used with
-// WaitHandle.WaitAll and WaitAny, and can be passed across
-// AppDomain boundaries.
-using namespace System;
-using namespace System::Threading;
-const int numIterations = 1;
-const int numThreads = 3;
-ref class Test
-{
-public:
-
- // Create a new Mutex. The creating thread does not own the
- // Mutex.
- static Mutex^ mut = gcnew Mutex;
- static void MyThreadProc()
- {
- for ( int i = 0; i < numIterations; i++ )
- {
- UseResource();
-
- }
- }
-
-
-private:
-
- // This method represents a resource that must be synchronized
- // so that only one thread at a time can enter.
- static void UseResource()
- {
-
- //Wait until it is OK to enter.
- mut->WaitOne();
- Console::WriteLine( "{0} has entered protected the area", Thread::CurrentThread->Name );
-
- // Place code to access non-reentrant resources here.
- // Simulate some work.
- Thread::Sleep( 500 );
- Console::WriteLine( "{0} is leaving protected the area\r\n", Thread::CurrentThread->Name );
-
- // Release the Mutex.
- mut->ReleaseMutex();
- }
-
-};
-
-int main()
-{
-
- // Create the threads that will use the protected resource.
- for ( int i = 0; i < numThreads; i++ )
- {
- Thread^ myThread = gcnew Thread( gcnew ThreadStart( Test::MyThreadProc ) );
- myThread->Name = String::Format( "Thread {0}", i + 1 );
- myThread->Start();
-
- }
-
- // The main thread exits, but the application continues to
- // run until all foreground threads have exited.
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp
deleted file mode 100644
index 26673315e5e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Security::AccessControl;
-using namespace System::Security::Permissions;
-
-public ref class Example
-{
-public:
- [SecurityPermissionAttribute(SecurityAction::Demand,Flags=SecurityPermissionFlag::UnmanagedCode)]
- static void Main()
- {
- //
- String^ mutexName = L"MutexExample4";
-
- Mutex^ m = nullptr;
- bool doesNotExist = false;
- bool unauthorized = false;
-
- // The value of this variable is set by the mutex
- // constructor. It is true if the named system mutex was
- // created, and false if the named mutex already existed.
- //
- bool mutexWasCreated = false;
-
- // Attempt to open the named mutex.
- try
- {
- // Open the mutex with (MutexRights.Synchronize |
- // MutexRights.Modify), to enter and release the
- // named mutex.
- //
- m = Mutex::OpenExisting( mutexName );
- }
- catch ( WaitHandleCannotBeOpenedException^ )
- {
- Console::WriteLine( L"Mutex does not exist." );
- doesNotExist = true;
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unauthorized access: {0}", ex->Message );
- unauthorized = true;
- }
- //
-
- // There are three cases: (1) The mutex does not exist.
- // (2) The mutex exists, but the current user doesn't
- // have access. (3) The mutex exists and the user has
- // access.
- //
- if ( doesNotExist )
- {
- //
- // The mutex does not exist, so create it.
- // Create an access control list (ACL) that denies the
- // current user the right to enter or release the
- // mutex, but allows the right to read and change
- // security information for the mutex.
- //
- String^ user = String::Concat( Environment::UserDomainName, L"\\",
- Environment::UserName );
- MutexSecurity^ mSec = gcnew MutexSecurity;
-
- MutexAccessRule^ rule = gcnew MutexAccessRule( user,
- static_cast(
- MutexRights::Synchronize |
- MutexRights::Modify),
- AccessControlType::Deny );
- mSec->AddAccessRule( rule );
-
- rule = gcnew MutexAccessRule( user,
- static_cast(
- MutexRights::ReadPermissions |
- MutexRights::ChangePermissions),
- AccessControlType::Allow );
- mSec->AddAccessRule( rule );
-
- // Create a Mutex object that represents the system
- // mutex named by the constant 'mutexName', with
- // initial ownership for this thread, and with the
- // specified security access. The Boolean value that
- // indicates creation of the underlying system object
- // is placed in mutexWasCreated.
- //
- m = gcnew Mutex( true,mutexName, mutexWasCreated,mSec );
-
- // If the named system mutex was created, it can be
- // used by the current instance of this program, even
- // though the current user is denied access. The current
- // program owns the mutex. Otherwise, exit the program.
- //
- if ( mutexWasCreated )
- {
- Console::WriteLine( L"Created the mutex." );
- }
- else
- {
- Console::WriteLine( L"Unable to create the mutex." );
- return;
- }
- //
- }
- else if ( unauthorized )
- {
- //
- // Open the mutex to read and change the access control
- // security. The access control security defined above
- // allows the current user to do this.
- //
- try
- {
- m = Mutex::OpenExisting( mutexName,
- static_cast(
- MutexRights::ReadPermissions |
- MutexRights::ChangePermissions) );
-
- // Get the current ACL. This requires
- // MutexRights.ReadPermissions.
- MutexSecurity^ mSec = m->GetAccessControl();
-
- String^ user = String::Concat( Environment::UserDomainName,
- L"\\", Environment::UserName );
-
- // First, the rule that denied the current user
- // the right to enter and release the mutex must
- // be removed.
- MutexAccessRule^ rule = gcnew MutexAccessRule( user,
- static_cast(
- MutexRights::Synchronize |
- MutexRights::Modify),
- AccessControlType::Deny );
- mSec->RemoveAccessRule( rule );
-
- // Now grant the user the correct rights.
- //
- rule = gcnew MutexAccessRule( user,
- static_cast(
- MutexRights::Synchronize |
- MutexRights::Modify),
- AccessControlType::Allow );
- mSec->AddAccessRule( rule );
-
- // Update the ACL. This requires
- // MutexRights.ChangePermissions.
- m->SetAccessControl( mSec );
-
- Console::WriteLine( L"Updated mutex security." );
-
- // Open the mutex with (MutexRights.Synchronize
- // | MutexRights.Modify), the rights required to
- // enter and release the mutex.
- //
- m = Mutex::OpenExisting( mutexName );
- //
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine(
- L"Unable to change permissions: {0}", ex->Message );
- return;
- }
- }
-
- // If this program created the mutex, it already owns
- // the mutex.
- //
- if ( !mutexWasCreated )
- {
- // Enter the mutex, and hold it until the program
- // exits.
- //
- try
- {
- Console::WriteLine( L"Wait for the mutex." );
- m->WaitOne();
- Console::WriteLine( L"Entered the mutex." );
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unauthorized access: {0}",
- ex->Message );
- }
- }
-
- Console::WriteLine( L"Press the Enter key to exit." );
- Console::ReadLine();
- m->ReleaseMutex();
- m->Dispose();
- }
-};
-
-int main()
-{
- Example::Main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp
deleted file mode 100644
index 6395c7d937d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-namespace SystemThreadingExample
-{
- public ref class Work
- {
- public:
- void StartThreads()
- {
- // Start a thread that calls a parameterized static method.
- Thread^ newThread = gcnew
- Thread(gcnew ParameterizedThreadStart(Work::DoWork));
- newThread->Start(42);
-
- // Start a thread that calls a parameterized instance method.
- Work^ someWork = gcnew Work;
- newThread = gcnew Thread(
- gcnew ParameterizedThreadStart(someWork,
- &Work::DoMoreWork));
- newThread->Start("The answer.");
- }
-
- static void DoWork(Object^ data)
- {
- Console::WriteLine("Static thread procedure. Data='{0}'",
- data);
- }
-
- void DoMoreWork(Object^ data)
- {
- Console::WriteLine("Instance thread procedure. Data='{0}'",
- data);
- }
- };
-}
-
-//Entry point of example application
-int main()
-{
- SystemThreadingExample::Work^ samplework =
- gcnew SystemThreadingExample::Work();
- samplework->StartThreads();
-}
-// This example displays output like the following:
-// Static thread procedure. Data='42'
-// Instance thread procedure. Data='The answer.'
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp
deleted file mode 100644
index 36560d92fa5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-int main()
-{
- ReaderWriterLock^ rwLock = gcnew ReaderWriterLock;
- rwLock->AcquireWriterLock( Timeout::Infinite );
- rwLock->AcquireReaderLock( Timeout::Infinite );
- if ( rwLock->IsReaderLockHeld )
- {
- Console::WriteLine( "Reader lock held." );
- rwLock->ReleaseReaderLock();
- }
- else
- if ( rwLock->IsWriterLockHeld )
- {
- Console::WriteLine( "Writer lock held." );
- rwLock->ReleaseWriterLock();
- }
- else
- {
- Console::WriteLine( "No locks held." );
- }
-
-
- if ( rwLock->IsReaderLockHeld )
- {
- Console::WriteLine( "Reader lock held." );
- rwLock->ReleaseReaderLock();
- }
- else
- if ( rwLock->IsWriterLockHeld )
- {
- Console::WriteLine( "Writer lock held." );
- rwLock->ReleaseWriterLock();
- }
- else
- {
- Console::WriteLine( "No locks held." );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp
deleted file mode 100644
index 1aca8464071..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-//
-// This example shows a ReaderWriterLock protecting a shared
-// resource that is read concurrently and written exclusively
-// by multiple threads.
-//
-// The complete code is located in the ReaderWriterLock
-// class topic.
-using namespace System;
-using namespace System::Threading;
-public ref class Test
-{
-public:
-
- // Declaring the ReaderWriterLock at the class level
- // makes it visible to all threads.
- static ReaderWriterLock^ rwl = gcnew ReaderWriterLock;
-
- // For this example, the shared resource protected by the
- // ReaderWriterLock is just an integer.
- static int resource = 0;
-
- //
- literal int numThreads = 26;
- static bool running = true;
-
- // Statistics.
- static int readerTimeouts = 0;
- static int writerTimeouts = 0;
- static int reads = 0;
- static int writes = 0;
- static void ThreadProc()
- {
- Random^ rnd = gcnew Random;
-
- // As long as a thread runs, it randomly selects
- // various ways to read and write from the shared
- // resource. Each of the methods demonstrates one
- // or more features of ReaderWriterLock.
- while ( running )
- {
- double action = rnd->NextDouble();
- if ( action < .8 )
- ReadFromResource( 10 );
- else
- if ( action < .81 )
- ReleaseRestore( rnd, 50 );
- else
- if ( action < .90 )
- UpgradeDowngrade( rnd, 100 );
- else
- WriteToResource( rnd, 100 );
- }
- }
-
-
- //
- // Shows how to request and release a reader lock, and
- // how to handle time-outs.
- static void ReadFromResource( int timeOut )
- {
- try
- {
- rwl->AcquireReaderLock( timeOut );
- try
- {
-
- // It is safe for this thread to read from
- // the shared resource.
- Display( String::Format( "reads resource value {0}", resource ) );
- Interlocked::Increment( reads );
- }
- finally
- {
-
- // Ensure that the lock is released.
- rwl->ReleaseReaderLock();
- }
-
- }
- catch ( ApplicationException^ )
- {
-
- // The reader lock request timed out.
- Interlocked::Increment( readerTimeouts );
- }
-
- }
-
-
- //
- //
- // Shows how to request and release the writer lock, and
- // how to handle time-outs.
- static void WriteToResource( Random^ rnd, int timeOut )
- {
- try
- {
- rwl->AcquireWriterLock( timeOut );
- try
- {
-
- // It is safe for this thread to read or write
- // from the shared resource.
- resource = rnd->Next( 500 );
- Display( String::Format( "writes resource value {0}", resource ) );
- Interlocked::Increment( writes );
- }
- finally
- {
-
- // Ensure that the lock is released.
- rwl->ReleaseWriterLock();
- }
-
- }
- catch ( ApplicationException^ )
- {
-
- // The writer lock request timed out.
- Interlocked::Increment( writerTimeouts );
- }
-
- }
-
-
- //
- //
- // Shows how to request a reader lock, upgrade the
- // reader lock to the writer lock, and downgrade to a
- // reader lock again.
- static void UpgradeDowngrade( Random^ rnd, int timeOut )
- {
- try
- {
- rwl->AcquireReaderLock( timeOut );
- try
- {
-
- // It is safe for this thread to read from
- // the shared resource.
- Display( String::Format( "reads resource value {0}", resource ) );
- Interlocked::Increment( reads );
-
- // If it is necessary to write to the resource,
- // you must either release the reader lock and
- // then request the writer lock, or upgrade the
- // reader lock. Note that upgrading the reader lock
- // puts the thread in the write queue, behind any
- // other threads that might be waiting for the
- // writer lock.
- try
- {
- LockCookie lc = rwl->UpgradeToWriterLock( timeOut );
- try
- {
-
- // It is safe for this thread to read or write
- // from the shared resource.
- resource = rnd->Next( 500 );
- Display( String::Format( "writes resource value {0}", resource ) );
- Interlocked::Increment( writes );
- }
- finally
- {
-
- // Ensure that the lock is released.
- rwl->DowngradeFromWriterLock( lc );
- }
-
- }
- catch ( ApplicationException^ )
- {
-
- // The upgrade request timed out.
- Interlocked::Increment( writerTimeouts );
- }
-
-
- // When the lock has been downgraded, it is
- // still safe to read from the resource.
- Display( String::Format( "reads resource value {0}", resource ) );
- Interlocked::Increment( reads );
- }
- finally
- {
-
- // Ensure that the lock is released.
- rwl->ReleaseReaderLock();
- }
-
- }
- catch ( ApplicationException^ )
- {
-
- // The reader lock request timed out.
- Interlocked::Increment( readerTimeouts );
- }
-
- }
-
-
- //
- //
- // Shows how to release all locks and later restore
- // the lock state. Shows how to use sequence numbers
- // to determine whether another thread has obtained
- // a writer lock since this thread last accessed the
- // resource.
- static void ReleaseRestore( Random^ rnd, int timeOut )
- {
- int lastWriter;
- try
- {
- rwl->AcquireReaderLock( timeOut );
- try
- {
-
- // It is safe for this thread to read from
- // the shared resource. Cache the value. (You
- // might do this if reading the resource is
- // an expensive operation.)
- int resourceValue = resource;
- Display( String::Format( "reads resource value {0}", resourceValue ) );
- Interlocked::Increment( reads );
-
- // Save the current writer sequence number.
- lastWriter = rwl->WriterSeqNum;
-
- // Release the lock, and save a cookie so the
- // lock can be restored later.
- LockCookie lc = rwl->ReleaseLock();
-
- // Wait for a random interval (up to a
- // quarter of a second), and then restore
- // the previous state of the lock. Note that
- // there is no timeout on the Restore method.
- Thread::Sleep( rnd->Next( 250 ) );
- rwl->RestoreLock( lc );
-
- // Check whether other threads obtained the
- // writer lock in the interval. If not, then
- // the cached value of the resource is still
- // valid.
- if ( rwl->AnyWritersSince( lastWriter ) )
- {
- resourceValue = resource;
- Interlocked::Increment( reads );
- Display( String::Format( "resource has changed {0}", resourceValue ) );
- }
- else
- {
- Display( String::Format( "resource has not changed {0}", resourceValue ) );
- }
- }
- finally
- {
-
- // Ensure that the lock is released.
- rwl->ReleaseReaderLock();
- }
-
- }
- catch ( ApplicationException^ )
- {
-
- // The reader lock request timed out.
- Interlocked::Increment( readerTimeouts );
- }
-
- }
-
-
- //
- // Helper method briefly displays the most recent
- // thread action. Comment out calls to Display to
- // get a better idea of throughput.
- static void Display( String^ msg )
- {
- Console::Write( "Thread {0} {1}. \r", Thread::CurrentThread->Name, msg );
- }
-
- //
-};
-
-
-//
-int main()
-{
- array^args = Environment::GetCommandLineArgs();
-
- // Start a series of threads. Each thread randomly
- // performs reads and writes on the shared resource.
- array^t = gcnew array(Test::numThreads);
- for ( int i = 0; i < Test::numThreads; i++ )
- {
- t[ i ] = gcnew Thread( gcnew ThreadStart( Test::ThreadProc ) );
- t[ i ]->Name = gcnew String( Convert::ToChar( i + 65 ),1 );
- t[ i ]->Start();
- if ( i > 10 )
- Thread::Sleep( 300 );
-
- }
-
- // Tell the threads to shut down, then wait until they all
- // finish.
- Test::running = false;
- for ( int i = 0; i < Test::numThreads; i++ )
- {
- t[ i ]->Join();
-
- }
-
- // Display statistics.
- Console::WriteLine( "\r\n {0} reads, {1} writes, {2} reader time-outs, {3} writer time-outs.", Test::reads, Test::writes, Test::readerTimeouts, Test::writerTimeouts );
- Console::WriteLine( "Press ENTER to exit." );
- Console::ReadLine();
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp
deleted file mode 100644
index c9829906328..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-#using
-using namespace System;
-using namespace System::Threading;
-
-public ref class Example
-{
-public:
- static void main()
- {
- // Create a Semaphore object that represents the named
- // system semaphore "SemaphoreExample3". The semaphore has a
- // maximum count of five. The initial count is also five.
- // There is no point in using a smaller initial count,
- // because the initial count is not used if this program
- // doesn't create the named system semaphore, and with
- // this method overload there is no way to tell. Thus, this
- // program assumes that it is competing with other
- // programs for the semaphore.
- //
- Semaphore^ sem = gcnew Semaphore( 5,5,L"SemaphoreExample3" );
-
- // Attempt to enter the semaphore three times. If another
- // copy of this program is already running, only the first
- // two requests can be satisfied. The third blocks. Note
- // that in a real application, timeouts should be used
- // on the WaitOne calls, to avoid deadlocks.
- //
- sem->WaitOne();
- Console::WriteLine( L"Entered the semaphore once." );
- sem->WaitOne();
- Console::WriteLine( L"Entered the semaphore twice." );
- sem->WaitOne();
- Console::WriteLine( L"Entered the semaphore three times." );
-
- // The thread executing this program has entered the
- // semaphore three times. If a second copy of the program
- // is run, it will block until this program releases the
- // semaphore at least once.
- //
- Console::WriteLine( L"Enter the number of times to call Release." );
- int n;
- if ( Int32::TryParse( Console::ReadLine(),n ) )
- {
- sem->Release( n );
- }
-
- int remaining = 3 - n;
- if ( remaining > 0 )
- {
- Console::WriteLine( L"Press Enter to release the remaining "
- L"count ({0}) and exit the program.", remaining );
- Console::ReadLine();
- sem->Release( remaining );
- }
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp
deleted file mode 100644
index a51b308ac9e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-#using
-using namespace System;
-using namespace System::Threading;
-
-public ref class Example
-{
-public:
- static void main()
- {
- // The value of this variable is set by the semaphore
- // constructor. It is true if the named system semaphore was
- // created, and false if the named semaphore already existed.
- //
- bool semaphoreWasCreated;
-
- // Create a Semaphore object that represents the named
- // system semaphore "SemaphoreExample". The semaphore has a
- // maximum count of five, and an initial count of two. The
- // Boolean value that indicates creation of the underlying
- // system object is placed in semaphoreWasCreated.
- //
- Semaphore^ sem = gcnew Semaphore( 2,5,L"SemaphoreExample",
- semaphoreWasCreated );
- if ( semaphoreWasCreated )
- {
- // If the named system semaphore was created, its count is
- // set to the initial count requested in the constructor.
- // In effect, the current thread has entered the semaphore
- // three times.
- //
- Console::WriteLine( L"Entered the semaphore three times." );
- }
- else
- {
- // If the named system semaphore was not created,
- // attempt to enter it three times. If another copy of
- // this program is already running, only the first two
- // requests can be satisfied. The third blocks.
- //
- sem->WaitOne();
- Console::WriteLine( L"Entered the semaphore once." );
- sem->WaitOne();
- Console::WriteLine( L"Entered the semaphore twice." );
- sem->WaitOne();
- Console::WriteLine( L"Entered the semaphore three times." );
- }
-
- // The thread executing this program has entered the
- // semaphore three times. If a second copy of the program
- // is run, it will block until this program releases the
- // semaphore at least once.
- //
- Console::WriteLine( L"Enter the number of times to call Release." );
- int n;
- if ( Int32::TryParse( Console::ReadLine(), n ) )
- {
- sem->Release( n );
- }
-
- int remaining = 3 - n;
- if ( remaining > 0 )
- {
- Console::WriteLine( L"Press Enter to release the remaining "
- L"count ({0}) and exit the program.", remaining );
- Console::ReadLine();
- sem->Release( remaining );
- }
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp
deleted file mode 100644
index 471a8d1e8b1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-#using
-using namespace System;
-using namespace System::Threading;
-using namespace System::Security::AccessControl;
-using namespace System::Security::Permissions;
-
-public ref class Example
-{
-public:
- [SecurityPermissionAttribute(SecurityAction::Demand, Flags = SecurityPermissionFlag::UnmanagedCode)]
- static void main()
- {
- //
- String^ semaphoreName = L"SemaphoreExample5";
-
- Semaphore^ sem = nullptr;
- bool doesNotExist = false;
- bool unauthorized = false;
-
- // Attempt to open the named semaphore.
- try
- {
- // Open the semaphore with (SemaphoreRights.Synchronize
- // | SemaphoreRights.Modify), to enter and release the
- // named semaphore.
- //
- sem = Semaphore::OpenExisting( semaphoreName );
- }
- catch ( WaitHandleCannotBeOpenedException^ ex )
- {
- Console::WriteLine( L"Semaphore does not exist." );
- doesNotExist = true;
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unauthorized access: {0}", ex->Message );
- unauthorized = true;
- }
- //
-
- // There are three cases: (1) The semaphore does not exist.
- // (2) The semaphore exists, but the current user doesn't
- // have access. (3) The semaphore exists and the user has
- // access.
- //
- if ( doesNotExist )
- {
- //
- // The semaphore does not exist, so create it.
- //
- // The value of this variable is set by the semaphore
- // constructor. It is true if the named system semaphore was
- // created, and false if the named semaphore already existed.
- //
- bool semaphoreWasCreated;
-
- // Create an access control list (ACL) that denies the
- // current user the right to enter or release the
- // semaphore, but allows the right to read and change
- // security information for the semaphore.
- //
- String^ user = String::Concat( Environment::UserDomainName,
- L"\\", Environment::UserName );
- SemaphoreSecurity^ semSec = gcnew SemaphoreSecurity;
-
- SemaphoreAccessRule^ rule = gcnew SemaphoreAccessRule( user,
- static_cast(
- SemaphoreRights::Synchronize |
- SemaphoreRights::Modify ),
- AccessControlType::Deny );
- semSec->AddAccessRule( rule );
-
- rule = gcnew SemaphoreAccessRule( user,
- static_cast(
- SemaphoreRights::ReadPermissions |
- SemaphoreRights::ChangePermissions ),
- AccessControlType::Allow );
- semSec->AddAccessRule( rule );
-
- // Create a Semaphore object that represents the system
- // semaphore named by the constant 'semaphoreName', with
- // maximum count three, initial count three, and the
- // specified security access. The Boolean value that
- // indicates creation of the underlying system object is
- // placed in semaphoreWasCreated.
- //
- sem = gcnew Semaphore( 3,3,semaphoreName,semaphoreWasCreated,semSec );
-
- // If the named system semaphore was created, it can be
- // used by the current instance of this program, even
- // though the current user is denied access. The current
- // program enters the semaphore. Otherwise, exit the
- // program.
- //
- if ( semaphoreWasCreated )
- {
- Console::WriteLine( L"Created the semaphore." );
- }
- else
- {
- Console::WriteLine( L"Unable to create the semaphore." );
- return;
- }
- //
-
- }
- else if ( unauthorized )
- {
- //
- // Open the semaphore to read and change the access
- // control security. The access control security defined
- // above allows the current user to do this.
- //
- try
- {
- sem = Semaphore::OpenExisting( semaphoreName,
- static_cast(
- SemaphoreRights::ReadPermissions |
- SemaphoreRights::ChangePermissions ));
-
- // Get the current ACL. This requires
- // SemaphoreRights.ReadPermissions.
- SemaphoreSecurity^ semSec = sem->GetAccessControl();
-
- String^ user = String::Concat( Environment::UserDomainName,
- L"\\", Environment::UserName );
-
- // First, the rule that denied the current user
- // the right to enter and release the semaphore must
- // be removed.
- SemaphoreAccessRule^ rule = gcnew SemaphoreAccessRule( user,
- static_cast(
- SemaphoreRights::Synchronize |
- SemaphoreRights::Modify ),
- AccessControlType::Deny );
- semSec->RemoveAccessRule( rule );
-
- // Now grant the user the correct rights.
- //
- rule = gcnew SemaphoreAccessRule( user,
- static_cast(
- SemaphoreRights::Synchronize |
- SemaphoreRights::Modify ),
- AccessControlType::Allow );
- semSec->AddAccessRule( rule );
-
- // Update the ACL. This requires
- // SemaphoreRights.ChangePermissions.
- sem->SetAccessControl( semSec );
-
- Console::WriteLine( L"Updated semaphore security." );
-
- // Open the semaphore with (SemaphoreRights.Synchronize
- // | SemaphoreRights.Modify), the rights required to
- // enter and release the semaphore.
- //
- sem = Semaphore::OpenExisting( semaphoreName );
- //
-
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unable to change permissions: {0}", ex->Message );
- return;
- }
- }
-
- // Enter the semaphore, and hold it until the program
- // exits.
- //
- try
- {
- sem->WaitOne();
- Console::WriteLine( L"Entered the semaphore." );
- Console::WriteLine( L"Press the Enter key to exit." );
- Console::ReadLine();
- sem->Release();
- }
- catch ( UnauthorizedAccessException^ ex )
- {
- Console::WriteLine( L"Unauthorized access: {0}", ex->Message );
- }
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp
deleted file mode 100644
index 13cb5b616e3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-#using
-using namespace System;
-using namespace System::Threading;
-
-public ref class Example
-{
-private:
- // A semaphore that simulates a limited resource pool.
- //
- static Semaphore^ _pool;
-
- // A padding interval to make the output more orderly.
- static int _padding;
-
-public:
- static void Main()
- {
- // Create a semaphore that can satisfy up to three
- // concurrent requests. Use an initial count of zero,
- // so that the entire semaphore count is initially
- // owned by the main program thread.
- //
- _pool = gcnew Semaphore( 0,3 );
-
- // Create and start five numbered threads.
- //
- for ( int i = 1; i <= 5; i++ )
- {
- Thread^ t = gcnew Thread(
- gcnew ParameterizedThreadStart( Worker ) );
-
- // Start the thread, passing the number.
- //
- t->Start( i );
- }
-
- // Wait for half a second, to allow all the
- // threads to start and to block on the semaphore.
- //
- Thread::Sleep( 500 );
-
- // The main thread starts out holding the entire
- // semaphore count. Calling Release(3) brings the
- // semaphore count back to its maximum value, and
- // allows the waiting threads to enter the semaphore,
- // up to three at a time.
- //
- Console::WriteLine( L"Main thread calls Release(3)." );
- _pool->Release( 3 );
-
- Console::WriteLine( L"Main thread exits." );
- }
-
-private:
- static void Worker( Object^ num )
- {
- // Each worker thread begins by requesting the
- // semaphore.
- Console::WriteLine( L"Thread {0} begins and waits for the semaphore.", num );
- _pool->WaitOne();
-
- // A padding interval to make the output more orderly.
- int padding = Interlocked::Add( _padding, 100 );
-
- Console::WriteLine( L"Thread {0} enters the semaphore.", num );
-
- // The thread's "work" consists of sleeping for
- // about a second. Each thread "works" a little
- // longer, just to make the output more orderly.
- //
- Thread::Sleep( 1000 + padding );
-
- Console::WriteLine( L"Thread {0} releases the semaphore.", num );
- Console::WriteLine( L"Thread {0} previous semaphore count: {1}",
- num, _pool->Release() );
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp
deleted file mode 100644
index 91f6e6c03f5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-#using
-using namespace System;
-using namespace System::Threading;
-
-public ref class Example
-{
-private:
- // A semaphore that can satisfy at most two concurrent
- // requests.
- //
- static Semaphore^ _pool = gcnew Semaphore( 2,2 );
-
-public:
- static void main()
- {
- // Create and start two threads, A and B.
- //
- Thread^ tA = gcnew Thread( gcnew ThreadStart( ThreadA ) );
- tA->Start();
-
- Thread^ tB = gcnew Thread( gcnew ThreadStart( ThreadB ) );
- tB->Start();
- }
-
-private:
- static void ThreadA()
- {
- // Thread A enters the semaphore and simulates a task
- // that lasts a second.
- //
- _pool->WaitOne();
- Console::WriteLine( L"Thread A entered the semaphore." );
-
- Thread::Sleep( 1000 );
-
- try
- {
- _pool->Release();
- Console::WriteLine( L"Thread A released the semaphore." );
- }
- catch ( Exception^ ex )
- {
- Console::WriteLine( L"Thread A: {0}", ex->Message );
- }
- }
-
- static void ThreadB()
- {
- // Thread B simulates a task that lasts half a second,
- // then enters the semaphore.
- //
- Thread::Sleep( 500 );
-
- _pool->WaitOne();
- Console::WriteLine( L"Thread B entered the semaphore." );
-
- // Due to a programming error, Thread B releases the
- // semaphore twice. To fix the program, delete one line.
- _pool->Release();
- _pool->Release();
- Console::WriteLine( L"Thread B exits successfully." );
- }
-};
-/* This code example produces the following output:
-
-Thread A entered the semaphore.
-Thread B entered the semaphore.
-Thread B exits successfully.
-Thread A: Adding the given count to the semaphore would cause it to exceed its maximum count.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp
deleted file mode 100644
index 4ae633572bc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class Test
-{
-private:
- Test(){}
-
-
-public:
- static void TestMethod()
- {
- try
- {
- while ( true )
- {
- Console::WriteLine( "New thread running." );
- Thread::Sleep( 1000 );
- }
- }
- catch ( ThreadAbortException^ abortException )
- {
- Console::WriteLine( dynamic_cast(abortException->ExceptionState) );
- }
-
- }
-
-};
-
-int main()
-{
- Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::TestMethod ) );
- newThread->Start();
- Thread::Sleep( 1000 );
-
- // Abort newThread.
- Console::WriteLine( "Main aborting new thread." );
- newThread->Abort( "Information from main." );
-
- // Wait for the thread to terminate.
- newThread->Join();
- Console::WriteLine( "New thread terminated - main exiting." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp
deleted file mode 100644
index 99ee37687eb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-using namespace System::Threading;
-
-public ref class MyUtility
-{
-public:
- void PerformTask()
- {
- // Code in this region can be aborted without affecting
- // other tasks.
- //
- Thread::BeginCriticalRegion();
- //
- // The host might decide to unload the application domain
- // if a failure occurs in this code region.
- //
- Thread::EndCriticalRegion();
- //
- // Code in this region can be aborted without affecting
- // other tasks.
- }
-};
-//
-
-int main() {}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp
deleted file mode 100644
index 2fd262cc0fa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-using namespace System::Threading;
-using namespace System::Security::Permissions;
-
-public ref class MyUtility
-{
-public:
- [SecurityPermissionAttribute(SecurityAction::Demand, ControlThread=true)]
- void PerformTask()
- {
- // Code that does not have thread affinity goes here.
- //
- Thread::BeginThreadAffinity();
- //
- // Code that has thread affinity goes here.
- //
- Thread::EndThreadAffinity();
- //
- // More code that does not have thread affinity.
- }
-};
-//
-
-int main() {}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp
deleted file mode 100644
index e91e5179e09..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Threading;
-using namespace System::Windows::Forms;
-ref class UICulture: public Form
-{
-public:
- UICulture()
- {
-
- // Set the user interface to display in the
- // same culture as that set in Control Panel.
- Thread::CurrentThread->CurrentUICulture = Thread::CurrentThread->CurrentCulture;
-
- // Add additional code.
- }
-};
-
-
-int main()
-{
- Application::Run( gcnew UICulture );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp
deleted file mode 100644
index 1ae83042eb2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Security::Principal;
-using namespace System::Threading;
-
-int main()
-{
- array^rolesArray = {"managers","executives"};
- try
- {
-
- // Set the principal to a new generic principal.
- Thread::CurrentPrincipal = gcnew GenericPrincipal( gcnew GenericIdentity( "Bob","Passport" ),rolesArray );
- }
- catch ( SecurityException^ secureException )
- {
- Console::WriteLine( "{0}: Permission to set Principal "
- "is denied.", secureException->GetType()->Name );
- }
-
- IPrincipal^ threadPrincipal = Thread::CurrentPrincipal;
- Console::WriteLine( "Name: {0}\nIsAuthenticated: {1}"
- "\nAuthenticationType: {2}", threadPrincipal->Identity->Name, threadPrincipal->Identity->IsAuthenticated.ToString(), threadPrincipal->Identity->AuthenticationType );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp
deleted file mode 100644
index 88a93c82f9d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class Slot
-{
-private:
- static Random^ randomGenerator;
- static LocalDataStoreSlot^ localSlot;
- static Slot()
- {
- randomGenerator = gcnew Random;
- localSlot = Thread::AllocateDataSlot();
- }
-
-
-public:
- static void SlotTest()
- {
-
- // Set different data in each thread's data slot.
- Thread::SetData( localSlot, randomGenerator->Next( 1, 200 ) );
-
- // Write the data from each thread's data slot.
- Console::WriteLine( "Data in thread_{0}'s data slot: {1,3}", AppDomain::GetCurrentThreadId().ToString(), Thread::GetData( localSlot )->ToString() );
-
- // Allow other threads time to execute SetData to show
- // that a thread's data slot is unique to the thread.
- Thread::Sleep( 1000 );
- Console::WriteLine( "Data in thread_{0}'s data slot: {1,3}", AppDomain::GetCurrentThreadId().ToString(), Thread::GetData( localSlot )->ToString() );
- }
-
-};
-
-int main()
-{
- array^newThreads = gcnew array(4);
- for ( int i = 0; i < newThreads->Length; i++ )
- {
- newThreads[ i ] = gcnew Thread( gcnew ThreadStart( &Slot::SlotTest ) );
- newThreads[ i ]->Start();
-
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp
deleted file mode 100644
index 7e368cd0a1c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-ref class ThreadData
-{
-private:
- [ThreadStatic]
- static int threadSpecificData;
-
-public:
- static void ThreadStaticDemo()
- {
- // Store the managed thread id for each thread in the static
- // variable.
- threadSpecificData = Thread::CurrentThread->ManagedThreadId;
-
- // Allow other threads time to execute the same code, to show
- // that the static data is unique to each thread.
- Thread::Sleep( 1000 );
-
- // Display the static data.
- Console::WriteLine( "Data for managed thread {0}: {1}",
- Thread::CurrentThread->ManagedThreadId, threadSpecificData );
- }
-};
-
-int main()
-{
- for ( int i = 0; i < 3; i++ )
- {
- Thread^ newThread =
- gcnew Thread( gcnew ThreadStart( ThreadData::ThreadStaticDemo ));
- newThread->Start();
- }
-}
-
-/* This code example produces output similar to the following:
-
-Data for managed thread 4: 4
-Data for managed thread 5: 5
-Data for managed thread 3: 3
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp
deleted file mode 100644
index 497071f1d0f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class Test
-{
-private:
- Test(){}
-
-
-public:
- static void ThreadMethod()
- {
- Console::WriteLine( "Thread {0} started in {1} with AppDomainID = {2}.", AppDomain::GetCurrentThreadId().ToString(), Thread::GetDomain()->FriendlyName, Thread::GetDomainID().ToString() );
- }
-
-};
-
-int main()
-{
- Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::ThreadMethod ) );
- newThread->Start();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp
deleted file mode 100644
index 533813e424f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security::Permissions;
-using namespace System::Threading;
-
-ref class StayAwake
-{
-private:
- bool sleepSwitch;
-
-public:
-
- property bool SleepSwitch
- {
- void set( bool value )
- {
- sleepSwitch = value;
- }
-
- }
- StayAwake()
- {
- sleepSwitch = false;
- }
-
- void ThreadMethod()
- {
- Console::WriteLine( "newThread is executing ThreadMethod." );
- while ( !sleepSwitch )
- {
-
- // Use SpinWait instead of Sleep to demonstrate the
- // effect of calling Interrupt on a running thread.
- Thread::SpinWait( 10000000 );
- }
-
- try
- {
- Console::WriteLine( "newThread going to sleep." );
-
- // When newThread goes to sleep, it is immediately
- // woken up by a ThreadInterruptedException.
- Thread::Sleep( Timeout::Infinite );
- }
- catch ( ThreadInterruptedException^ /*e*/ )
- {
- Console::WriteLine( "newThread cannot go to sleep - "
- "interrupted by main thread." );
- }
-
- }
-
-};
-
-int main()
-{
- StayAwake^ stayAwake = gcnew StayAwake;
- Thread^ newThread = gcnew Thread( gcnew ThreadStart( stayAwake, &StayAwake::ThreadMethod ) );
- newThread->Start();
-
- // The following line causes an exception to be thrown
- // in ThreadMethod if newThread is currently blocked
- // or becomes blocked in the future.
- newThread->Interrupt();
- Console::WriteLine( "Main thread calls Interrupt on newThread." );
-
- // Then tell newThread to go to sleep.
- stayAwake->SleepSwitch = true;
-
- // Wait for newThread to end.
- newThread->Join();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp
deleted file mode 100644
index 7743178ff7e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-ref class BackgroundTest
-{
-private:
- int maxIterations;
-
-public:
- BackgroundTest(int maxIterations)
- {
- this->maxIterations = maxIterations;
- }
-
- void RunLoop()
- {
- for (int i = 0; i < maxIterations; i++ )
- {
- Console::WriteLine("{0} count: {1}",
- Thread::CurrentThread->IsBackground ?
- "Background Thread" : "Foreground Thread", i);
- Thread::Sleep(250);
-
- }
- Console::WriteLine("{0} finished counting.",
- Thread::CurrentThread->IsBackground ?
- "Background Thread" : "Foreground Thread");
- }
-};
-
-int main()
-{
- BackgroundTest^ shortTest = gcnew BackgroundTest( 10 );
- Thread^ foregroundThread = gcnew Thread( gcnew ThreadStart( shortTest, &BackgroundTest::RunLoop ) );
- foregroundThread->Name = "ForegroundThread";
- BackgroundTest^ longTest = gcnew BackgroundTest( 50 );
- Thread^ backgroundThread = gcnew Thread( gcnew ThreadStart( longTest, &BackgroundTest::RunLoop ) );
- backgroundThread->Name = "BackgroundThread";
- backgroundThread->IsBackground = true;
- foregroundThread->Start();
- backgroundThread->Start();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp
deleted file mode 100644
index 9ae320e27d8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class IsThreadPool
-{
-public:
-
- //
- static void ThreadMethod()
- {
- Console::WriteLine( "ThreadOne, executing ThreadMethod, "
- "is {0}from the thread pool.", Thread::CurrentThread->IsThreadPoolThread ? (String^)"" : "not " );
- }
-
-
- //
- static void WorkMethod( Object^ stateInfo )
- {
- Console::WriteLine( "ThreadTwo, executing WorkMethod, "
- "is {0}from the thread pool.", Thread::CurrentThread->IsThreadPoolThread ? (String^)"" : "not " );
-
- // Signal that this thread is finished.
- dynamic_cast(stateInfo)->Set();
- }
-
-};
-
-int main()
-{
- AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false );
- Thread^ regularThread = gcnew Thread( gcnew ThreadStart( &IsThreadPool::ThreadMethod ) );
- regularThread->Start();
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &IsThreadPool::WorkMethod ), autoEvent );
-
- // Wait for foreground thread to end.
- regularThread->Join();
-
- // Wait for background thread to end.
- autoEvent->WaitOne();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp
deleted file mode 100644
index 7ef570a3bad..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-ref class Slot
-{
-private:
- static Random^ randomGenerator = gcnew Random();
-
-public:
- static void SlotTest()
- {
- // Set random data in each thread's data slot.
- int slotData = randomGenerator->Next(1, 200);
- int threadId = Thread::CurrentThread->ManagedThreadId;
-
- Thread::SetData(
- Thread::GetNamedDataSlot("Random"),
- slotData);
-
- // Show what was saved in the thread's data slot.
- Console::WriteLine("Data stored in thread_{0}'s data slot: {1,3}",
- threadId, slotData);
-
- // Allow other threads time to execute SetData to show
- // that a thread's data slot is unique to itself.
- Thread::Sleep(1000);
-
- int newSlotData =
- (int)Thread::GetData(Thread::GetNamedDataSlot("Random"));
-
- if (newSlotData == slotData)
- {
- Console::WriteLine("Data in thread_{0}'s data slot is still: {1,3}",
- threadId, newSlotData);
- }
- else
- {
- Console::WriteLine("Data in thread_{0}'s data slot changed to: {1,3}",
- threadId, newSlotData);
- }
- }
-};
-
-ref class Test
-{
-public:
- static void Main()
- {
- array^ newThreads = gcnew array(4);
- int i;
- for (i = 0; i < newThreads->Length; i++)
- {
- newThreads[i] =
- gcnew Thread(gcnew ThreadStart(&Slot::SlotTest));
- newThreads[i]->Start();
- }
- Thread::Sleep(2000);
- for (i = 0; i < newThreads->Length; i++)
- {
- newThreads[i]->Join();
- Console::WriteLine("Thread_{0} finished.",
- newThreads[i]->ManagedThreadId);
- }
- }
-};
-
-int main()
-{
- Test::Main();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp
deleted file mode 100644
index 3f8ee654cfc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-static TimeSpan waitTime = TimeSpan(0,0,1);
-
-ref class Test
-{
-public:
- static void Work()
- {
- Thread::Sleep( waitTime );
- }
-
-};
-
-int main()
-{
- Thread^ newThread = gcnew Thread( gcnew ThreadStart( Test::Work ) );
- newThread->Start();
- if ( newThread->Join( waitTime + waitTime ) )
- {
- Console::WriteLine( "New thread terminated." );
- }
- else
- {
- Console::WriteLine( "Join timed out." );
- }
-}
-// The example displays the following output:
-// New thread terminated.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp
deleted file mode 100644
index d4ca56d299c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class Work
-{
-private:
- Work(){}
-
-
-public:
- static void DoWork(){}
-
-};
-
-int main()
-{
- Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Work::DoWork ) );
- newThread->Start();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp
deleted file mode 100644
index 0ac57be1362..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class Work
-{
-public:
- Work(){}
-
- void DoWork(){}
-
-};
-
-int main()
-{
- Work^ threadWork = gcnew Work;
- Thread^ newThread = gcnew Thread( gcnew ThreadStart( threadWork, &Work::DoWork ) );
- newThread->Start();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp
deleted file mode 100644
index 2f2ccf1a8d9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-ref class Example
-{
-public:
-
- // This thread procedure performs the task.
- static void ThreadProc(Object^ stateInfo)
- {
-
- // No state object was passed to QueueUserWorkItem, so stateInfo is 0.
- Console::WriteLine( "Hello from the thread pool." );
- }
-};
-
-int main()
-{
- // Queue the task.
- ThreadPool::QueueUserWorkItem(gcnew WaitCallback(Example::ThreadProc));
-
- Console::WriteLine("Main thread does some work, then sleeps.");
-
- Thread::Sleep(1000);
- Console::WriteLine("Main thread exits.");
- return 0;
-}
-// The example displays output like the following:
-// Main thread does some work, then sleeps.
-// Hello from the thread pool.
-// Main thread exits.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp
deleted file mode 100644
index 94c24506593..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-public ref class Fibonacci
-{
-private:
- ManualResetEvent^ _doneEvent;
-
- int Calculate(int n)
- {
- if (n <= 1)
- {
- return n;
- }
- return Calculate(n - 1) + Calculate(n - 2);
- }
-
-public:
-
- int ID;
- int N;
- int FibOfN;
-
- Fibonacci(int id, int n, ManualResetEvent^ doneEvent)
- {
- ID = id;
- N = n;
- _doneEvent = doneEvent;
- }
-
- void Calculate()
- {
- FibOfN = Calculate(N);
- }
-
- void SetDone()
- {
- _doneEvent->Set();
- }
-};
-
-public ref struct Example
-{
-public:
-
- static void ThreadProc(Object^ stateInfo)
- {
- Fibonacci^ f = dynamic_cast(stateInfo);
- Console::WriteLine("Thread {0} started...", f->ID);
- f->Calculate();
- Console::WriteLine("Thread {0} result calculated...", f->ID);
- f->SetDone();
- }
-};
-
-
-void main()
-{
- const int FibonacciCalculations = 5;
-
- array^ doneEvents = gcnew array(FibonacciCalculations);
- array^ fibArray = gcnew array(FibonacciCalculations);
- Random^ rand = gcnew Random();
-
- Console::WriteLine("Launching {0} tasks...", FibonacciCalculations);
-
- for (int i = 0; i < FibonacciCalculations; i++)
- {
- doneEvents[i] = gcnew ManualResetEvent(false);
- Fibonacci^ f = gcnew Fibonacci(i, rand->Next(20, 40), doneEvents[i]);
- fibArray[i] = f;
- ThreadPool::QueueUserWorkItem(gcnew WaitCallback(Example::ThreadProc), f);
- }
-
- WaitHandle::WaitAll(doneEvents);
- Console::WriteLine("All calculations are complete.");
-
- for (int i = 0; i < FibonacciCalculations; i++)
- {
- Fibonacci^ f = fibArray[i];
- Console::WriteLine("Fibonacci({0}) = {1}", f->N, f->FibOfN);
- }
-}
-// Output is similar to:
-// Launching 5 tasks...
-// Thread 3 started...
-// Thread 2 started...
-// Thread 1 started...
-// Thread 0 started...
-// Thread 4 started...
-// Thread 4 result calculated...
-// Thread 1 result calculated...
-// Thread 2 result calculated...
-// Thread 0 result calculated...
-// Thread 3 result calculated...
-// All calculations are complete.
-// Fibonacci(30) = 832040
-// Fibonacci(24) = 46368
-// Fibonacci(26) = 121393
-// Fibonacci(36) = 14930352
-// Fibonacci(20) = 6765
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp
deleted file mode 100644
index 290d35f3698..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-// TaskInfo contains data that will be passed to the callback
-// method.
-public ref class TaskInfo
-{
-public:
- TaskInfo()
- {
- Handle = nullptr;
- OtherInfo = "default";
- }
-
- RegisteredWaitHandle^ Handle;
- String^ OtherInfo;
-};
-
-ref class Example
-{
-public:
-
- // The callback method executes when the registered wait times out,
- // or when the WaitHandle (in this case AutoResetEvent) is signaled.
- // WaitProc unregisters the WaitHandle the first time the event is
- // signaled.
- static void WaitProc( Object^ state, bool timedOut )
- {
-
- // The state Object must be cast to the correct type, because the
- // signature of the WaitOrTimerCallback delegate specifies type
- // Object.
- TaskInfo^ ti = static_cast(state);
- String^ cause = "TIMED OUT";
- if ( !timedOut )
- {
- cause = "SIGNALED";
-
- // If the callback method executes because the WaitHandle is
- // signaled, stop future execution of the callback method
- // by unregistering the WaitHandle.
- if ( ti->Handle != nullptr )
- ti->Handle->Unregister( nullptr );
- }
-
- Console::WriteLine( "WaitProc( {0}) executes on thread {1}; cause = {2}.", ti->OtherInfo, Thread::CurrentThread->GetHashCode(), cause );
- }
-
-};
-
-int main()
-{
-
- // The main thread uses AutoResetEvent to signal the
- // registered wait handle, which executes the callback
- // method.
- AutoResetEvent^ ev = gcnew AutoResetEvent( false );
- TaskInfo^ ti = gcnew TaskInfo;
- ti->OtherInfo = "First task";
-
- // The TaskInfo for the task includes the registered wait
- // handle returned by RegisterWaitForSingleObject. This
- // allows the wait to be terminated when the object has
- // been signaled once (see WaitProc).
- ti->Handle = ThreadPool::RegisterWaitForSingleObject( ev, gcnew WaitOrTimerCallback( Example::WaitProc ), ti, 1000, false );
-
- // The main thread waits three seconds, to demonstrate the
- // time-outs on the queued thread, and then signals.
- Thread::Sleep( 3100 );
- Console::WriteLine( "Main thread signals." );
- ev->Set();
-
- // The main thread sleeps, which should give the callback
- // method time to execute. If you comment out this line, the
- // program usually ends before the ThreadPool thread can execute.
- Thread::Sleep( 1000 );
-
- // If you start a thread yourself, you can wait for it to end
- // by calling Thread::Join. This option is not available with
- // thread pool threads.
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp
deleted file mode 100644
index 4d728332eac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Security::Permissions;
-using namespace System::Threading;
-
-ref class ThreadPoolTest
-{
-private:
-
- // Maintains state information to be passed to EndWriteCallback.
- // This information allows the callback to end the asynchronous
- // write operation and signal when it is finished.
- ref class State
- {
- public:
- FileStream^ fStream;
- AutoResetEvent^ autoEvent;
- State( FileStream^ fStream, AutoResetEvent^ autoEvent )
- {
- this->fStream = fStream;
- this->autoEvent = autoEvent;
- }
-
- };
-
-
-public:
- ThreadPoolTest(){}
-
- static void EndWriteCallback( IAsyncResult^ asyncResult )
- {
- Console::WriteLine( "Starting EndWriteCallback." );
- State^ stateInfo = dynamic_cast(asyncResult->AsyncState);
- int workerThreads;
- int portThreads;
- try
- {
- ThreadPool::GetAvailableThreads( workerThreads, portThreads );
- Console::WriteLine( "\nAvailable worker threads: \t{0}"
- "\nAvailable completion port threads: {1}\n", workerThreads.ToString(), portThreads.ToString() );
- stateInfo->fStream->EndWrite( asyncResult );
-
- // Sleep so the other thread has a chance to run
- // before the current thread ends.
- Thread::Sleep( 1500 );
- }
- catch ( Exception^ e )
- {
- }
- finally
- {
-
- // Signal that the current thread is finished.
- stateInfo->autoEvent->Set();
- Console::WriteLine( "Ending EndWriteCallback." );
- }
-
- }
-
- static void WorkItemMethod( Object^ mainEvent )
- {
- Console::WriteLine( "\nStarting WorkItem.\n" );
- AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false );
-
- // Create some data.
- const int ArraySize = 10000;
- const int BufferSize = 1000;
- array^byteArray = gcnew array(ArraySize);
- (gcnew Random)->NextBytes( byteArray );
-
- // Create two files and two State objects.
- FileStream^ fileWriter1 = gcnew FileStream( "C:\\Test1@##.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite,BufferSize,true );
- FileStream^ fileWriter2 = gcnew FileStream( "C:\\Test2@##.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite,BufferSize,true );
- State^ stateInfo1 = gcnew State( fileWriter1,autoEvent );
- State^ stateInfo2 = gcnew State( fileWriter2,autoEvent );
-
- // Asynchronously write to the files.
- fileWriter1->BeginWrite( byteArray, 0, byteArray->Length, gcnew AsyncCallback( &ThreadPoolTest::EndWriteCallback ), stateInfo1 );
- fileWriter2->BeginWrite( byteArray, 0, byteArray->Length, gcnew AsyncCallback( &ThreadPoolTest::EndWriteCallback ), stateInfo2 );
-
- // Wait for each callback to finish.
- autoEvent->WaitOne();
- autoEvent->WaitOne();
- fileWriter1->Close();
- fileWriter2->Close();
- Console::WriteLine( "\nEnding WorkItem.\n" );
-
- // Signal Main that the work item is finished.
- dynamic_cast(mainEvent)->Set();
- }
-
-};
-
-int main()
-{
- AutoResetEvent^ mainEvent = gcnew AutoResetEvent( false );
- int workerThreads;
- int portThreads;
- ThreadPool::GetMaxThreads( workerThreads, portThreads );
- Console::WriteLine( "\nMaximum worker threads: \t{0}"
- "\nMaximum completion port threads: {1}", workerThreads.ToString(), portThreads.ToString() );
- ThreadPool::GetAvailableThreads( workerThreads, portThreads );
- Console::WriteLine( "\nAvailable worker threads: \t{0}"
- "\nAvailable completion port threads: {1}\n", workerThreads.ToString(), portThreads.ToString() );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &ThreadPoolTest::WorkItemMethod ), mainEvent );
-
- // Since ThreadPool threads are background threads,
- // wait for the work item to signal before ending main().
- mainEvent->WaitOne( 5000, false );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp
deleted file mode 100644
index 654530d80b8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-int main()
-{
- int minWorker;
- int minIOC;
-
- // Get the current settings.
- ThreadPool::GetMinThreads( minWorker, minIOC );
-
- // Change the minimum number of worker threads to four, but
- // keep the old setting for minimum asynchronous I/O
- // completion threads.
- if ( ThreadPool::SetMinThreads( 4, minIOC ) )
- {
-
- // The minimum number of threads was set successfully.
- }
- else
- {
-
- // The minimum number of threads was not changed.
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp
deleted file mode 100644
index 3295346dbdc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class Work
-{
-public:
- static void DoWork()
- {
- Console::WriteLine( "Static thread procedure." );
- }
-
- int Data;
- void DoMoreWork()
- {
- Console::WriteLine( "Instance thread procedure. Data={0}", Data );
- }
-
-};
-
-int main()
-{
-
- // To start a thread using an instance method for the thread
- // procedure, specify the object as the first argument of the
- // ThreadStart constructor.
- //
- Work^ w = gcnew Work;
- w->Data = 42;
- ThreadStart^ threadDelegate = gcnew ThreadStart( w, &Work::DoMoreWork );
- Thread^ newThread = gcnew Thread( threadDelegate );
- newThread->Start();
-
- // To start a thread using a static thread procedure, specify
- // only the address of the procedure. This is a change from
- // earlier versions of the .NET Framework, which required
- // two arguments, the first of which was null (0).
- //
- threadDelegate = gcnew ThreadStart( &Work::DoWork );
- newThread = gcnew Thread( threadDelegate );
- newThread->Start();
-}
-
-/* This code example produces the following output (the order
- of the lines might vary):
-Static thread procedure.
-Instance thread procedure. Data=42
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp
deleted file mode 100644
index 4dd79b85f2c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-ref class StatusChecker
-{
-private:
- int invokeCount, maxCount;
-
-public:
- StatusChecker(int count)
- {
- invokeCount = 0;
- maxCount = count;
- }
-
- // This method is called by the timer delegate.
- void CheckStatus(Object^ stateInfo)
- {
- AutoResetEvent^ autoEvent = dynamic_cast(stateInfo);
- Console::WriteLine("{0:h:mm:ss.fff} Checking status {1,2}.",
- DateTime::Now, ++invokeCount);
-
- if (invokeCount == maxCount) {
- // Reset the counter and signal the waiting thread.
- invokeCount = 0;
- autoEvent->Set();
- }
- }
-};
-
-ref class TimerExample
-{
-public:
- static void Main()
- {
- // Create an AutoResetEvent to signal the timeout threshold in the
- // timer callback has been reached.
- AutoResetEvent^ autoEvent = gcnew AutoResetEvent(false);
-
- StatusChecker^ statusChecker = gcnew StatusChecker(10);
-
- // Create a delegate that invokes methods for the timer.
- TimerCallback^ tcb =
- gcnew TimerCallback(statusChecker, &StatusChecker::CheckStatus);
-
- // Create a timer that invokes CheckStatus after one second,
- // and every 1/4 second thereafter.
- Console::WriteLine("{0:h:mm:ss.fff} Creating timer.\n",
- DateTime::Now);
- Timer^ stateTimer = gcnew Timer(tcb, autoEvent, 1000, 250);
-
- // When autoEvent signals, change the period to every half second.
- autoEvent->WaitOne(5000, false);
- stateTimer->Change(0, 500);
- Console::WriteLine("\nChanging period to .5 seconds.\n");
-
- // When autoEvent signals the second time, dispose of the timer.
- autoEvent->WaitOne(5000, false);
- stateTimer->~Timer();
- Console::WriteLine("\nDestroying timer.");
- }
-};
-
-int main()
-{
- TimerExample::Main();
-}
-// The example displays output like the following:
-// 11:59:54.202 Creating timer.
-//
-// 11:59:55.217 Checking status 1.
-// 11:59:55.466 Checking status 2.
-// 11:59:55.716 Checking status 3.
-// 11:59:55.968 Checking status 4.
-// 11:59:56.218 Checking status 5.
-// 11:59:56.470 Checking status 6.
-// 11:59:56.722 Checking status 7.
-// 11:59:56.972 Checking status 8.
-// 11:59:57.223 Checking status 9.
-// 11:59:57.473 Checking status 10.
-//
-// Changing period to .5 seconds.
-//
-// 11:59:57.474 Checking status 1.
-// 11:59:57.976 Checking status 2.
-// 11:59:58.476 Checking status 3.
-// 11:59:58.977 Checking status 4.
-// 11:59:59.477 Checking status 5.
-// 11:59:59.977 Checking status 6.
-// 12:00:00.478 Checking status 7.
-// 12:00:00.980 Checking status 8.
-// 12:00:01.481 Checking status 9.
-// 12:00:01.981 Checking status 10.
-//
-// Destroying timer.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp
deleted file mode 100644
index ec633fe45b1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class StatusChecker
-{
-private:
- int invokeCount;
- int maxCount;
-
-public:
- StatusChecker( int count )
- : invokeCount( 0 ), maxCount( count )
- {}
-
-
- // This method is called by the timer delegate.
- void CheckStatus( Object^ stateInfo )
- {
- AutoResetEvent^ autoEvent = dynamic_cast(stateInfo);
- Console::WriteLine( "{0} Checking status {1,2}.", DateTime::Now.ToString( "h:mm:ss.fff" ), (++invokeCount).ToString() );
- if ( invokeCount == maxCount )
- {
-
- // Reset the counter and signal main.
- invokeCount = 0;
- autoEvent->Set();
- }
- }
-
-};
-
-int main()
-{
- AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false );
- StatusChecker^ statusChecker = gcnew StatusChecker( 10 );
-
- // Create the delegate that invokes methods for the timer.
- TimerCallback^ timerDelegate = gcnew TimerCallback( statusChecker, &StatusChecker::CheckStatus );
- TimeSpan delayTime = TimeSpan(0,0,1);
- TimeSpan intervalTime = TimeSpan(0,0,0,0,250);
-
- // Create a timer that signals the delegate to invoke CheckStatus
- // after one second, and every 1/4 second thereafter.
- Console::WriteLine( "{0} Creating timer.\n", DateTime::Now.ToString( "h:mm:ss.fff" ) );
- Timer^ stateTimer = gcnew Timer( timerDelegate,autoEvent,delayTime,intervalTime );
-
- // When autoEvent signals, change the period to every 1/2 second.
- autoEvent->WaitOne( 5000, false );
- stateTimer->Change( TimeSpan(0), intervalTime + intervalTime );
- Console::WriteLine( "\nChanging period.\n" );
-
- // When autoEvent signals the second time, dispose of the timer.
- autoEvent->WaitOne( 5000, false );
- stateTimer->~Timer();
- Console::WriteLine( "\nDestroying timer." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp
deleted file mode 100644
index 2de583f098d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-
-public ref class Example
-{
-private:
- // The EventWaitHandle used to demonstrate the difference
- // between AutoReset and ManualReset synchronization events.
- //
- static EventWaitHandle^ ewh;
-
- // A counter to make sure all threads are started and
- // blocked before any are released. A Long is used to show
- // the use of the 64-bit Interlocked methods.
- //
- static __int64 threadCount = 0;
-
- // An AutoReset event that allows the main thread to block
- // until an exiting thread has decremented the count.
- //
- static EventWaitHandle^ clearCount =
- gcnew EventWaitHandle( false,EventResetMode::AutoReset );
-
-public:
- [MTAThread]
- static void main()
- {
- // Create an AutoReset EventWaitHandle.
- //
- ewh = gcnew EventWaitHandle( false,EventResetMode::AutoReset );
-
- // Create and start five numbered threads. Use the
- // ParameterizedThreadStart delegate, so the thread
- // number can be passed as an argument to the Start
- // method.
- for ( int i = 0; i <= 4; i++ )
- {
- Thread^ t = gcnew Thread(
- gcnew ParameterizedThreadStart( ThreadProc ) );
- t->Start( i );
- }
-
- // Wait until all the threads have started and blocked.
- // When multiple threads use a 64-bit value on a 32-bit
- // system, you must access the value through the
- // Interlocked class to guarantee thread safety.
- //
- while ( Interlocked::Read( threadCount ) < 5 )
- {
- Thread::Sleep( 500 );
- }
-
- // Release one thread each time the user presses ENTER,
- // until all threads have been released.
- //
- while ( Interlocked::Read( threadCount ) > 0 )
- {
- Console::WriteLine( L"Press ENTER to release a waiting thread." );
- Console::ReadLine();
-
- // SignalAndWait signals the EventWaitHandle, which
- // releases exactly one thread before resetting,
- // because it was created with AutoReset mode.
- // SignalAndWait then blocks on clearCount, to
- // allow the signaled thread to decrement the count
- // before looping again.
- //
- WaitHandle::SignalAndWait( ewh, clearCount );
- }
- Console::WriteLine();
-
- // Create a ManualReset EventWaitHandle.
- //
- ewh = gcnew EventWaitHandle( false,EventResetMode::ManualReset );
-
- // Create and start five more numbered threads.
- //
- for ( int i = 0; i <= 4; i++ )
- {
- Thread^ t = gcnew Thread(
- gcnew ParameterizedThreadStart( ThreadProc ) );
- t->Start( i );
- }
-
- // Wait until all the threads have started and blocked.
- //
- while ( Interlocked::Read( threadCount ) < 5 )
- {
- Thread::Sleep( 500 );
- }
-
- // Because the EventWaitHandle was created with
- // ManualReset mode, signaling it releases all the
- // waiting threads.
- //
- Console::WriteLine( L"Press ENTER to release the waiting threads." );
- Console::ReadLine();
- ewh->Set();
-
- }
-
- static void ThreadProc( Object^ data )
- {
- int index = static_cast(data);
-
- Console::WriteLine( L"Thread {0} blocks.", data );
- // Increment the count of blocked threads.
- Interlocked::Increment( threadCount );
-
- // Wait on the EventWaitHandle.
- ewh->WaitOne();
-
- Console::WriteLine( L"Thread {0} exits.", data );
- // Decrement the count of blocked threads.
- Interlocked::Decrement( threadCount );
-
- // After signaling ewh, the main thread blocks on
- // clearCount until the signaled thread has
- // decremented the count. Signal it now.
- //
- clearCount->Set();
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp
deleted file mode 100644
index 77becf280e4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Security::Permissions;
-using namespace System::Threading;
-
-ref class State
-{
-public:
- String^ fileName;
- array^byteArray;
- ManualResetEvent^ manualEvent;
- State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent )
- : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent )
- {}
-
-};
-
-ref class Writer
-{
-private:
- static int workItemCount = 0;
- Writer(){}
-
-
-public:
- static void WriteToFile( Object^ state )
- {
- int workItemNumber = workItemCount;
- Interlocked::Increment( workItemCount );
- Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() );
- State^ stateInfo = dynamic_cast(state);
- FileStream^ fileWriter;
-
- // Create and write to the file.
- try
- {
- fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create );
- fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length );
- }
- finally
- {
- if ( fileWriter != nullptr )
- {
- fileWriter->Close();
- }
-
- // Signal main() that the work item has finished.
- Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() );
- stateInfo->manualEvent->Set();
- }
-
- }
-
-};
-
-void main()
-{
- const int numberOfFiles = 5;
- String^ dirName = "C:\\TestTest";
- String^ fileName;
- array^byteArray;
- Random^ randomGenerator = gcnew Random;
- array^manualEvents = gcnew array(numberOfFiles);
- State^ stateInfo;
- if ( !Directory::Exists( dirName ) )
- {
- Directory::CreateDirectory( dirName );
- }
-
-
- // Queue the work items that create and write to the files.
- for ( int i = 0; i < numberOfFiles; i++ )
- {
- fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" );
-
- // Create random data to write to the file.
- byteArray = gcnew array(1000000);
- randomGenerator->NextBytes( byteArray );
- manualEvents[ i ] = gcnew ManualResetEvent( false );
- stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo );
-
- }
-
- // Since ThreadPool threads are background threads,
- // wait for the work items to signal before exiting.
- WaitHandle::WaitAll( manualEvents );
- Console::WriteLine( "Files written - main exiting." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp
deleted file mode 100644
index 8cad6cf4acd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Security::Permissions;
-using namespace System::Threading;
-
-// Maintain state to pass to WriteToFile.
-ref class State
-{
-public:
- String^ fileName;
- array^byteArray;
- ManualResetEvent^ manualEvent;
- State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent )
- : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent )
- {}
-
-};
-
-ref class Writer
-{
-private:
- static int workItemCount = 0;
- Writer(){}
-
-
-public:
- static void WriteToFile( Object^ state )
- {
- int workItemNumber = workItemCount;
- Interlocked::Increment( workItemCount );
- Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() );
- State^ stateInfo = dynamic_cast(state);
- FileStream^ fileWriter;
-
- // Create and write to the file.
- try
- {
- fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create );
- fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length );
- }
- finally
- {
- if ( fileWriter != nullptr )
- {
- fileWriter->Close();
- }
-
- // Signal main() that the work item has finished.
- Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() );
- stateInfo->manualEvent->Set();
- }
-
- }
-
-};
-
-int main()
-{
- const int numberOfFiles = 5;
- String^ dirName = "C:\\TestTest";
- String^ fileName;
- array^byteArray;
- Random^ randomGenerator = gcnew Random;
- array^manualEvents = gcnew array(numberOfFiles);
- State^ stateInfo;
- if ( !Directory::Exists( dirName ) )
- {
- Directory::CreateDirectory( dirName );
- }
-
-
- // Queue the work items that create and write to the files.
- for ( int i = 0; i < numberOfFiles; i++ )
- {
- fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" );
-
- // Create random data to write to the file.
- byteArray = gcnew array(1000000);
- randomGenerator->NextBytes( byteArray );
- manualEvents[ i ] = gcnew ManualResetEvent( false );
- stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo );
-
- }
-
- // Since ThreadPool threads are background threads,
- // wait for the work items to signal before exiting.
- if ( WaitHandle::WaitAll( manualEvents, 5000, false ) )
- {
- Console::WriteLine( "Files written - main exiting." );
- }
- else
- {
-
- // The wait operation times out.
- Console::WriteLine( "Error writing files - main exiting." );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp
deleted file mode 100644
index 6044e88bdcc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Security::Permissions;
-using namespace System::Threading;
-
-// Maintain state to pass to WriteToFile.
-ref class State
-{
-public:
- String^ fileName;
- array^byteArray;
- ManualResetEvent^ manualEvent;
- State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent )
- : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent )
- {}
-
-};
-
-ref class Writer
-{
-private:
- static int workItemCount = 0;
- Writer(){}
-
-
-public:
- static void WriteToFile( Object^ state )
- {
- int workItemNumber = workItemCount;
- Interlocked::Increment( workItemCount );
- Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() );
- State^ stateInfo = dynamic_cast(state);
- FileStream^ fileWriter;
-
- // Create and write to the file.
- try
- {
- fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create );
- fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length );
- }
- finally
- {
- if ( fileWriter != nullptr )
- {
- fileWriter->Close();
- }
-
- // Signal main() that the work item has finished.
- Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() );
- stateInfo->manualEvent->Set();
- }
-
- }
-
-};
-
-int main()
-{
- const int numberOfFiles = 5;
- String^ dirName = "C:\\TestTest";
- String^ fileName;
- array^byteArray;
- Random^ randomGenerator = gcnew Random;
- array^manualEvents = gcnew array(numberOfFiles);
- State^ stateInfo;
- if ( !Directory::Exists( dirName ) )
- {
- Directory::CreateDirectory( dirName );
- }
-
-
- // Queue the work items that create and write to the files.
- for ( int i = 0; i < numberOfFiles; i++ )
- {
- fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" );
-
- // Create random data to write to the file.
- byteArray = gcnew array(1000000);
- randomGenerator->NextBytes( byteArray );
- manualEvents[ i ] = gcnew ManualResetEvent( false );
- stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo );
-
- }
-
- // Since ThreadPool threads are background threads,
- // wait for the work items to signal before exiting.
- if ( WaitHandle::WaitAll( manualEvents, TimeSpan(0,0,5), false ) )
- {
- Console::WriteLine( "Files written - main exiting." );
- }
- else
- {
-
- // The wait operation times out.
- Console::WriteLine( "Error writing files - main exiting." );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp
deleted file mode 100644
index 5873df3b3ad..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Threading;
-ref class Search
-{
-private:
-
- // Maintain state information to pass to FindCallback.
- ref class State
- {
- public:
- AutoResetEvent^ autoEvent;
- String^ fileName;
- State( AutoResetEvent^ autoEvent, String^ fileName )
- : autoEvent( autoEvent ), fileName( fileName )
- {}
-
- };
-
-
-public:
- array^autoEvents;
- array^diskLetters;
-
- // Search for stateInfo->fileName.
- void FindCallback( Object^ state )
- {
- State^ stateInfo = dynamic_cast(state);
-
- // Signal if the file is found.
- if ( File::Exists( stateInfo->fileName ) )
- {
- stateInfo->autoEvent->Set();
- }
- }
-
- Search()
- {
-
- // Retrieve an array of disk letters.
- diskLetters = Environment::GetLogicalDrives();
- autoEvents = gcnew array(diskLetters->Length);
- for ( int i = 0; i < diskLetters->Length; i++ )
- {
- autoEvents[ i ] = gcnew AutoResetEvent( false );
-
- }
- }
-
-
- // Search for fileName in the root directory of all disks.
- void FindFile( String^ fileName )
- {
- for ( int i = 0; i < diskLetters->Length; i++ )
- {
- Console::WriteLine( "Searching for {0} on {1}.", fileName, diskLetters[ i ] );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( this, &Search::FindCallback ), gcnew State( autoEvents[ i ],String::Concat( diskLetters[ i ], fileName ) ) );
-
- }
-
- // Wait for the first instance of the file to be found.
- int index = WaitHandle::WaitAny( autoEvents, 3000, false );
- if ( index == WaitHandle::WaitTimeout )
- {
- Console::WriteLine( "\n{0} not found.", fileName );
- }
- else
- {
- Console::WriteLine( "\n{0} found on {1}.", fileName, diskLetters[ index ] );
- }
- }
-
-};
-
-int main()
-{
- Search^ search = gcnew Search;
- search->FindFile( "SomeFile.dat" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp
deleted file mode 100644
index c8fbef542b7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Threading;
-ref class Search
-{
-private:
-
- // Maintain state information to pass to FindCallback.
- ref class State
- {
- public:
- AutoResetEvent^ autoEvent;
- String^ fileName;
- State( AutoResetEvent^ autoEvent, String^ fileName )
- : autoEvent( autoEvent ), fileName( fileName )
- {}
-
- };
-
-
-public:
- array^autoEvents;
- array^diskLetters;
-
- // Search for stateInfo->fileName.
- void FindCallback( Object^ state )
- {
- State^ stateInfo = dynamic_cast(state);
-
- // Signal if the file is found.
- if ( File::Exists( stateInfo->fileName ) )
- {
- stateInfo->autoEvent->Set();
- }
- }
-
- Search()
- {
-
- // Retrieve an array of disk letters.
- diskLetters = Environment::GetLogicalDrives();
- autoEvents = gcnew array(diskLetters->Length);
- for ( int i = 0; i < diskLetters->Length; i++ )
- {
- autoEvents[ i ] = gcnew AutoResetEvent( false );
-
- }
- }
-
-
- // Search for fileName in the root directory of all disks.
- void FindFile( String^ fileName )
- {
- for ( int i = 0; i < diskLetters->Length; i++ )
- {
- Console::WriteLine( "Searching for {0} on {1}.", fileName, diskLetters[ i ] );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( this, &Search::FindCallback ), gcnew State( autoEvents[ i ],String::Concat( diskLetters[ i ], fileName ) ) );
-
- }
-
- // Wait for the first instance of the file to be found.
- int index = WaitHandle::WaitAny( autoEvents, TimeSpan(0,0,3), false );
- if ( index == WaitHandle::WaitTimeout )
- {
- Console::WriteLine( "\n{0} not found.", fileName );
- }
- else
- {
- Console::WriteLine( "\n{0} found on {1}.", fileName, diskLetters[ index ] );
- }
- }
-
-};
-
-int main()
-{
- Search^ search = gcnew Search;
- search->FindFile( "SomeFile.dat" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp
deleted file mode 100644
index 1e895c2aace..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class WaitOne
-{
-private:
- WaitOne(){}
-
-
-public:
- static void WorkMethod( Object^ stateInfo )
- {
- Console::WriteLine( "Work starting." );
-
- // Simulate time spent working.
- Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) );
-
- // Signal that work is finished.
- Console::WriteLine( "Work ending." );
- dynamic_cast(stateInfo)->Set();
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "Main starting." );
- AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent );
-
- // Wait for work method to signal.
- autoEvent->WaitOne( );
- Console::WriteLine( "Work method signaled.\nMain ending." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp
deleted file mode 100644
index 2d2d9d3a98f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class WaitOne
-{
-private:
- WaitOne(){}
-
-
-public:
- static void WorkMethod( Object^ stateInfo )
- {
- Console::WriteLine( "Work starting." );
-
- // Simulate time spent working.
- Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) );
-
- // Signal that work is finished.
- Console::WriteLine( "Work ending." );
- dynamic_cast(stateInfo)->Set();
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "Main starting." );
- AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent );
-
- // Wait for work method to signal.
- if ( autoEvent->WaitOne( 1000 ) )
- {
- Console::WriteLine( "Work method signaled." );
- }
- else
- {
- Console::WriteLine( "Timed out waiting for work "
- "method to signal." );
- }
-
- Console::WriteLine( "Main ending." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp
deleted file mode 100644
index d43bd113677..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-ref class WaitOne
-{
-private:
- WaitOne(){}
-
-
-public:
- static void WorkMethod( Object^ stateInfo )
- {
- Console::WriteLine( "Work starting." );
-
- // Simulate time spent working.
- Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) );
-
- // Signal that work is finished.
- Console::WriteLine( "Work ending." );
- dynamic_cast(stateInfo)->Set();
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "Main starting." );
- AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false );
- ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent );
-
- // Wait for work method to signal.
- if ( autoEvent->WaitOne( TimeSpan(0,0,1), false ) )
- {
- Console::WriteLine( "Work method signaled." );
- }
- else
- {
- Console::WriteLine( "Timed out waiting for work "
- "method to signal." );
- }
-
- Console::WriteLine( "Main ending." );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp
deleted file mode 100644
index e378abfd947..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Text::RegularExpressions;
-ref class MyClass
-{
-public:
- static int i = 0;
- static String^ ReplaceCC( Match^ m )
- {
-
- // Replace each Regex cc match with the number of the occurrence.
- i++;
- return i.ToString();
- }
-
-};
-
-int main()
-{
- String^ sInput;
- String^ sRegex;
-
- // The string to search.
- sInput = "aabbccddeeffcccgghhcccciijjcccckkcc";
-
- // A very simple regular expression.
- sRegex = "cc";
- Regex^ r = gcnew Regex( sRegex );
-
- // Assign the replace method to the MatchEvaluator delegate.
- MatchEvaluator^ myEvaluator = gcnew MatchEvaluator( &MyClass::ReplaceCC );
-
- // Write out the original string.
- Console::WriteLine( sInput );
-
- // Replace matched characters using the delegate method.
- sInput = r->Replace( sInput, myEvaluator );
-
- // Write out the modified string.
- Console::WriteLine( sInput );
-}
-// The example displays the following output:
-// aabbccddeeffcccgghhcccciijjcccckkcc
-// aabb11ddeeff22cgghh3344iijj5566kk77
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp
deleted file mode 100644
index 8cee8672a42..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-
-// ref class ApartmentTest
-// {
-// public:
- static void ThreadMethod()
- {
- Thread::Sleep( 1000 );
-// }
-
-};
-
-int main()
-{
-// Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ApartmentTest::ThreadMethod ) );
- Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ThreadMethod ) );
-
- Console::WriteLine("ThreadState: {0}", newThread->ThreadState);
- newThread->Start();
-
- // Wait for newThread to start and go to sleep.
- Thread::Sleep(300);
- Console::WriteLine("ThreadState: {0}", newThread->ThreadState);
-
- // Wait for newThread to restart.
- Thread::Sleep(1000);
- Console::WriteLine("ThreadState: {0}", newThread->ThreadState);
-}
-// The example displays the following output:
-// ThreadState: Unstarted
-// ThreadState: WaitSleepJoin
-// ThreadState: Stopped
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp
deleted file mode 100644
index 857931694b0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Runtime::Remoting::Contexts;
-
-[Synchronization(true)]
-public ref class SyncingClass : ContextBoundObject
-{
-private:
- EventWaitHandle^ waitHandle;
-
-public:
- SyncingClass()
- {
- waitHandle =
- gcnew EventWaitHandle(false, EventResetMode::ManualReset);
- }
-
- void Signal()
- {
- Console::WriteLine("Thread[{0:d4}]: Signalling...", Thread::CurrentThread->GetHashCode());
- waitHandle->Set();
- }
-
- void DoWait(bool leaveContext)
- {
- bool signalled;
-
- waitHandle->Reset();
- Console::WriteLine("Thread[{0:d4}]: Waiting...", Thread::CurrentThread->GetHashCode());
- signalled = waitHandle->WaitOne(3000, leaveContext);
- if (signalled)
- {
- Console::WriteLine("Thread[{0:d4}]: Wait released!!!", Thread::CurrentThread->GetHashCode());
- }
- else
- {
- Console::WriteLine("Thread[{0:d4}]: Wait timeout!!!", Thread::CurrentThread->GetHashCode());
- }
- }
-};
-
-public ref class TestSyncDomainWait
-{
-public:
- static void Main()
- {
- SyncingClass^ syncClass = gcnew SyncingClass();
-
- Thread^ runWaiter;
-
- Console::WriteLine("\nWait and signal INSIDE synchronization domain:\n");
- runWaiter = gcnew Thread(gcnew ParameterizedThreadStart(&TestSyncDomainWait::RunWaitKeepContext));
- runWaiter->Start(syncClass);
- Thread::Sleep(1000);
- Console::WriteLine("Thread[{0:d4}]: Signal...", Thread::CurrentThread->GetHashCode());
- // This call to Signal will block until the timeout in DoWait expires.
- syncClass->Signal();
- runWaiter->Join();
-
- Console::WriteLine("\nWait and signal OUTSIDE synchronization domain:\n");
- runWaiter = gcnew Thread(gcnew ParameterizedThreadStart(&TestSyncDomainWait::RunWaitLeaveContext));
- runWaiter->Start(syncClass);
- Thread::Sleep(1000);
- Console::WriteLine("Thread[{0:d4}]: Signal...", Thread::CurrentThread->GetHashCode());
- // This call to Signal is unblocked and will set the wait handle to
- // release the waiting thread.
- syncClass->Signal();
- runWaiter->Join();
- }
-
- static void RunWaitKeepContext(Object^ parm)
- {
- ((SyncingClass^)parm)->DoWait(false);
- }
-
- static void RunWaitLeaveContext(Object^ parm)
- {
- ((SyncingClass^)parm)->DoWait(true);
- }
-};
-
-int main()
-{
- TestSyncDomainWait::Main();
-}
-// The output for the example program will be similar to the following:
-//
-// Wait and signal INSIDE synchronization domain:
-//
-// Thread[0004]: Waiting...
-// Thread[0001]: Signal...
-// Thread[0004]: Wait timeout!!!
-// Thread[0001]: Signalling...
-//
-// Wait and signal OUTSIDE synchronization domain:
-//
-// Thread[0006]: Waiting...
-// Thread[0001]: Signal...
-// Thread[0001]: Signalling...
-// Thread[0006]: Wait released!!!
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp
deleted file mode 100644
index 84663c2d1bc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-using namespace System;
-using namespace System::Timers;
-
-public ref class Example
-{
-private:
- static System::Timers::Timer^ aTimer;
-
-public:
- static void Demo()
- {
- // Create a timer and set a two second interval.
- aTimer = gcnew System::Timers::Timer();
- aTimer->Interval = 2000;
-
- // Hook up the Elapsed event for the timer.
- aTimer->Elapsed += gcnew System::Timers::ElapsedEventHandler(Example::OnTimedEvent);
-
- // Have the timer fire repeated events (true is the default)
- aTimer->AutoReset = true;
-
- // Start the timer
- aTimer->Enabled = true;
-
- Console::WriteLine("Press the Enter key to exit the program at any time... ");
- Console::ReadLine();
- }
-
-private:
- static void OnTimedEvent(Object^ source, System::Timers::ElapsedEventArgs^ e)
- {
- Console::WriteLine("The Elapsed event was raised at {0}", e->SignalTime);
- }
-};
-
-int main()
-{
- Example::Demo();
-}
-// The example displays output like the following:
-// Press the Enter key to exit the program at any time...
-// The Elapsed event was raised at 5/20/2015 8:48:58 PM
-// The Elapsed event was raised at 5/20/2015 8:49:00 PM
-// The Elapsed event was raised at 5/20/2015 8:49:02 PM
-// The Elapsed event was raised at 5/20/2015 8:49:04 PM
-// The Elapsed event was raised at 5/20/2015 8:49:06 PM
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp
deleted file mode 100644
index 248a1274b23..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- //Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "http://localhost/baseuri.xml" );
-
- //Display information on the attribute node. The value
- //returned for BaseURI is 'http://localhost/baseuri.xml'.
- XmlAttribute^ attr = doc->DocumentElement->Attributes[ 0 ];
- Console::WriteLine( "Name of the attribute: {0}", attr->Name );
- Console::WriteLine( "Base URI of the attribute: {0}", attr->BaseURI );
- Console::WriteLine( "The value of the attribute: {0}", attr->InnerText );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp
deleted file mode 100644
index 7da06cb2507..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- //Create an XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "2elems.xml" );
-
- //Create an attribute.
- XmlAttribute^ attr;
- attr = doc->CreateAttribute( "bk", "genre", "urn:samples" );
- attr->Value = "novel";
-
- //Add the attribute to the first book.
- XmlElement^ currNode = dynamic_cast(doc->DocumentElement->FirstChild);
- currNode->SetAttributeNode( attr );
-
- //An attribute cannot be added to two different elements.
- //You must clone the attribute and add it to the second book.
- XmlAttribute^ attr2;
- attr2 = dynamic_cast(attr->CloneNode( true ));
- currNode = dynamic_cast(doc->DocumentElement->LastChild);
- currNode->SetAttributeNode( attr2 );
- Console::WriteLine( "Display the modified XML...\r\n" );
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
- doc->WriteContentTo( writer );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp
deleted file mode 100644
index e610435a6f1..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- Console::WriteLine( "Display information on each of the attributes... \r\n" );
- System::Collections::IEnumerator^ myEnum = attrColl->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- XmlAttribute^ attr = safe_cast(myEnum->Current);
- Console::Write( "{0} = {1}", attr->Name, attr->Value );
- Console::WriteLine( "\t namespaceURI={0}", attr->NamespaceURI );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp
deleted file mode 100644
index d5ae5b95da8..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- Console::WriteLine( "Display information on each of the attributes... \r\n" );
- System::Collections::IEnumerator^ myEnum = attrColl->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- XmlAttribute^ attr = safe_cast(myEnum->Current);
- Console::Write( "{0}:{1} = {2}", attr->Prefix, attr->LocalName, attr->Value );
- Console::WriteLine( "\t namespaceURI={0}", attr->NamespaceURI );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp
deleted file mode 100644
index ab859d7c703..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute.
- XmlAttribute^ attr;
- attr = doc->CreateAttribute( "bk", "genre", "urn:samples" );
- attr->Value = "novel";
-
- //Display the attribute's owner document. Note
- //that although the attribute has not been inserted
- //into the document, it still has an owner document.
- Console::WriteLine( attr->OwnerDocument->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp
deleted file mode 100644
index dcbf0298041..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute.
- XmlAttribute^ attr;
- attr = doc->CreateAttribute( "bk", "genre", "urn:samples" );
- attr->Value = "novel";
-
- //Try to display the attribute's owner element.
- if ( attr->OwnerElement == nullptr )
- Console::WriteLine( "The attribute has not been added to an element\r\n" );
- else
- Console::WriteLine( attr->OwnerElement->OuterXml );
-
-
- //Add the attribute to an element.
- doc->DocumentElement->SetAttributeNode( attr );
-
- //Display the attribute's owner element.
- Console::WriteLine( "Display the owner element..." );
- Console::WriteLine( attr->OwnerElement->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp
deleted file mode 100644
index 3adf20c7f03..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create a new attribute.
- XmlAttribute^ newAttr = doc->CreateAttribute( "genre" );
- newAttr->Value = "novel";
-
- //Create an attribute collection and add the new attribute
- //to the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->Append( newAttr );
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp
deleted file mode 100644
index ac6d9660ec5..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
-
- //Declare the array.
- array^arr = gcnew array(2);
- int index = 0;
-
- //Copy all the attributes into the array.
- attrColl->CopyTo( arr, index );
- Console::WriteLine( "Display all the attributes in the array.." );
- System::Collections::IEnumerator^ myEnum = arr->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- XmlAttribute^ attr = safe_cast(myEnum->Current);
- Console::WriteLine( "{0} = {1}", attr->Name, attr->Value );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp
deleted file mode 100644
index cef8075ba6b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create a new attribute.
- XmlAttribute^ newAttr = doc->CreateAttribute( "genre" );
- newAttr->Value = "novel";
-
- //Create an attribute collection and add the new attribute
- //to the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->InsertAfter( newAttr, attrColl[ 0 ] );
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp
deleted file mode 100644
index e83046a63b2..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create a new attribute.
- XmlAttribute^ newAttr = doc->CreateAttribute( "genre" );
- newAttr->Value = "novel";
-
- //Create an attribute collection and add the new attribute
- //to the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->InsertBefore( newAttr, attrColl[ 0 ] );
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp
deleted file mode 100644
index 58098e9636e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create a new attribute.
- XmlAttribute^ newAttr = doc->CreateAttribute( "genre" );
- newAttr->Value = "novel";
-
- //Create an attribute collection and add the new attribute
- //to the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->Prepend( newAttr );
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp
deleted file mode 100644
index 462904f2588..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute collection and remove an attribute
- //from the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->Remove( attrColl[ "genre" ] );
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp
deleted file mode 100644
index 6b44e2cdb0b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute collection and remove all attributes
- //from the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->RemoveAll();
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp
deleted file mode 100644
index 852996d7f61..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute collection and remove an attribute
- //from the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->RemoveAt( 0 );
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp
deleted file mode 100644
index 1eeb8a09d55..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create a new attribute.
- XmlAttribute^ newAttr = doc->CreateAttribute( "genre" );
- newAttr->Value = "novel";
-
- //Create an attribute collection and add the new attribute
- //to the collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- attrColl->SetNamedItem( newAttr );
- Console::WriteLine( "Display the modified XML...\r\n" );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp
deleted file mode 100644
index d05785cb9df..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- //Create an attribute collection.
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- Console::WriteLine( "Display all the attributes in the collection...\r\n" );
- for ( int i = 0; i < attrColl->Count; i++ )
- {
- Console::Write( "{0} = ", attrColl[ i ]->Name );
- Console::Write( "{0}", attrColl[ i ]->Value );
- Console::WriteLine();
-
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp
deleted file mode 100644
index 65290b3374d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- //Define the order data. They will be converted to string
- //before being written out.
- Int16 custID = 32632;
- String^ orderID = "367A54";
- DateTime orderDate = DateTime::Now;
- Double price = 19.95;
-
- //Create a writer that outputs to the console.
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
-
- //Write an element (this one is the root)
- writer->WriteStartElement( "order" );
-
- //Write the order date.
- writer->WriteAttributeString( "date", XmlConvert::ToString( orderDate, "yyyy-MM-dd" ) );
-
- //Write the order time.
- writer->WriteAttributeString( "time", XmlConvert::ToString( orderDate, "HH:mm:ss" ) );
-
- //Write the order data.
- writer->WriteElementString( "orderID", orderID );
- writer->WriteElementString( "custID", XmlConvert::ToString( custID ) );
- writer->WriteElementString( "price", XmlConvert::ToString( price ) );
-
- //Write the close tag for the root element
- writer->WriteEndElement();
-
- //Write the XML and close the writer
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp
deleted file mode 100644
index e37f5167c22..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-//
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Xml;
-using namespace System::Data::SqlClient;
-int main()
-{
- DataSet^ dsNorthwind = gcnew DataSet;
-
- //Create the connection string.
- String^ sConnect;
- sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind";
-
- //Create a connection object to connect to the northwind db.
- SqlConnection^ nwconnect = gcnew SqlConnection( sConnect );
-
- //Create a command string to select all the customers in the WA region.
- String^ sCommand = "Select * from Customers where Region='WA'";
-
- //Create an adapter to load the DataSet.
- SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect );
-
- //Fill the DataSet with the selected records.
- myDataAdapter->Fill( dsNorthwind, "Customers" );
-
- //Load the document with the DataSet.
- XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind );
-
- //Create a shallow clone of the XmlDataDocument. Note that although
- //none of the child nodes were copied over, the cloned node does
- //have the schema information.
- XmlDataDocument^ clone = dynamic_cast(doc->CloneNode( false ));
- Console::WriteLine( "Child count: {0}", clone->ChildNodes->Count );
- Console::WriteLine( clone->DataSet->GetXmlSchema() );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp
deleted file mode 100644
index 8ef5454e02d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Xml;
-
-int main()
-{
-
- //Create an XmlDataDocument.
- XmlDataDocument^ doc = gcnew XmlDataDocument;
-
- //Load the schema file.
- doc->DataSet->ReadXmlSchema( "store.xsd" );
-
- //Load the XML data.
- doc->Load( "2books.xml" );
-
- //Update the price on the first book using the DataSet methods.
- DataTable^ books = doc->DataSet->Tables[ "book" ];
- books->Rows[ 0 ][ "price" ] = "12.95";
- Console::WriteLine( "Display the modified XML data..." );
- doc->Save( Console::Out );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp
deleted file mode 100644
index 9ee8eb597d8..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Xml;
-using namespace System::Data::SqlClient;
-
-int main()
-{
- DataSet^ dsNorthwind = gcnew DataSet;
-
- //Create the connection string
- String^ sConnect;
- sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind";
-
- //Create a connection object to connect to the northwind db.
- SqlConnection^ nwconnect = gcnew SqlConnection( sConnect );
-
- //Create a command string to select all the customers in the WA region.
- String^ sCommand = "Select * from Customers where Region='WA'";
-
- //Create an adapter to load the DataSet.
- SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect );
-
- //Fill the DataSet with the selected records.
- myDataAdapter->Fill( dsNorthwind, "Customers" );
-
- //Load the document with the DataSet.
- XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind );
-
- //Create an element representing the first customer record.
- DataRow^ row = doc->DataSet->Tables[ 0 ]->Rows[ 0 ];
- XmlElement^ elem = doc->GetElementFromRow( row );
- Console::WriteLine( elem->OuterXml );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp
deleted file mode 100644
index efc4bd880c6..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-//
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Xml;
-using namespace System::Data::SqlClient;
-int main()
-{
- DataSet^ dsNorthwind = gcnew DataSet;
-
- //Create the connection string.
- String^ sConnect;
- sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind";
-
- //Create a connection object to connect to the northwind db.
- SqlConnection^ nwconnect = gcnew SqlConnection( sConnect );
-
- //Create a command string to select all the customers in the WA region.
- String^ sCommand = "Select * from Customers where Region='WA'";
-
- //Create an adapter to load the DataSet.
- SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect );
-
- //Fill the DataSet with the selected records.
- myDataAdapter->Fill( dsNorthwind, "Customers" );
-
- //Load the document with the DataSet.
- XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind );
-
- //Display the XmlDataDocument.
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp
deleted file mode 100644
index cf3fc8cd852..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- String^ xmlString = "Oberon's Legacy";
- doc->Load( gcnew StringReader( xmlString ) );
-
- // Create an XML declaration.
- XmlDeclaration^ xmldecl;
- xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr );
- xmldecl->Encoding = "UTF-8";
- xmldecl->Standalone = "yes";
-
- // Add the new node to the document.
- XmlElement^ root = doc->DocumentElement;
- doc->InsertBefore( xmldecl, root );
-
- // Display the modified XML document
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp
deleted file mode 100644
index cf3fc8cd852..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- String^ xmlString = "Oberon's Legacy";
- doc->Load( gcnew StringReader( xmlString ) );
-
- // Create an XML declaration.
- XmlDeclaration^ xmldecl;
- xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr );
- xmldecl->Encoding = "UTF-8";
- xmldecl->Standalone = "yes";
-
- // Add the new node to the document.
- XmlElement^ root = doc->DocumentElement;
- doc->InsertBefore( xmldecl, root );
-
- // Display the modified XML document
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp
deleted file mode 100644
index f4464977f99..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "" );
-
- // Create a document fragment.
- XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment();
-
- // Set the contents of the document fragment.
- docFrag->InnerXml = "- widget
";
-
- // Create a deep clone. The cloned node
- // includes child nodes.
- XmlNode^ deep = docFrag->CloneNode( true );
- Console::WriteLine( "Name: {0}", deep->Name );
- Console::WriteLine( "OuterXml: {0}", deep->OuterXml );
-
- // Create a shallow clone. The cloned node does
- // not include any child nodes.
- XmlNode^ shallow = docFrag->CloneNode( false );
- Console::WriteLine( "Name: {0}", shallow->Name );
- Console::WriteLine( "OuterXml: {0}", shallow->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp
deleted file mode 100644
index 28e3cfe2a6e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
-
- // Create a document fragment.
- XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment();
-
- // Set the contents of the document fragment.
- docFrag->InnerXml = "- widget
";
-
- // Display the document fragment.
- Console::WriteLine( docFrag->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp
deleted file mode 100644
index 8c15797d0b5..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "" );
-
- // Create a document fragment.
- XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment();
-
- // Display the owner document of the document fragment.
- Console::WriteLine( docFrag->OwnerDocument->OuterXml );
-
- // Add nodes to the document fragment. Notice that the
- // new element is created using the owner document of
- // the document fragment.
- XmlElement^ elem = doc->CreateElement( "item" );
- elem->InnerText = "widget";
- docFrag->AppendChild( elem );
- Console::WriteLine( "Display the document fragment..." );
- Console::WriteLine( docFrag->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp
deleted file mode 100644
index 6c4328103ed..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "]>"
- ""
- "Pride And Prejudice"
- ""
- "" );
-
- // Check if the node is read-only.
- if ( doc->DocumentType->IsReadOnly )
- Console::WriteLine( "Document type nodes are always read-only" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp
deleted file mode 100644
index 7c1b61160cd..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "]>"
- ""
- "Pride And Prejudice"
- ""
- "" );
-
- // Display information on the DocumentType node.
- XmlDocumentType^ doctype = doc->DocumentType;
- Console::WriteLine( "Name of the document type: {0}", doctype->Name );
- Console::WriteLine( "The internal subset of the document type: {0}", doctype->InternalSubset );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp
deleted file mode 100644
index 0b8dd71f455..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Change the value of the first attribute.
- root->Attributes[ 0 ]->Value = "fiction";
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp
deleted file mode 100644
index b75667b60fc..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "2books.xml" );
-
- // Create a new element.
- XmlElement^ elem = doc->CreateElement( "misc" );
- elem->InnerText = "hardcover";
- elem->SetAttribute( "publisher", "WorldWide Publishing" );
-
- // Clone the element so we can add one to each of the book nodes.
- XmlNode^ elem2 = elem->CloneNode( true );
-
- // Add the new elements.
- doc->DocumentElement->FirstChild->AppendChild( elem );
- doc->DocumentElement->LastChild->AppendChild( elem2 );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp
deleted file mode 100644
index fc626a6df19..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Check to see if the element has a genre attribute.
- if ( root->HasAttribute( "genre" ) )
- {
- XmlAttribute^ attr = root->GetAttributeNode( "genre" );
- Console::WriteLine( attr->Value );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp
deleted file mode 100644
index 43426ae0dd2..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "2books.xml" );
-
- // Get and display all the book titles.
- XmlElement^ root = doc->DocumentElement;
- XmlNodeList^ elemList = root->GetElementsByTagName( "title" );
- for ( int i = 0; i < elemList->Count; i++ )
- {
- Console::WriteLine( elemList[ i ]->InnerXml );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp
deleted file mode 100644
index ab87fd72095..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Check to see if the element has a genre attribute.
- if ( root->HasAttribute( "genre" ) )
- {
- String^ genre = root->GetAttribute( "genre" );
- Console::WriteLine( genre );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp
deleted file mode 100644
index b0288ee6c7e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Remove all attributes from the root element.
- if ( root->HasAttributes )
- root->RemoveAllAttributes();
-
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp
deleted file mode 100644
index 1c76c3bca01..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "some textmore text" );
- XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild);
-
- // Note that InnerText does not include the markup.
- Console::WriteLine( "Display the InnerText of the element..." );
- Console::WriteLine( elem->InnerText );
-
- // InnerXml includes the markup of the element.
- Console::WriteLine( "Display the InnerXml of the element..." );
- Console::WriteLine( elem->InnerXml );
-
- // Set InnerText to a string that includes markup.
- // The markup is escaped.
- elem->InnerText = "Text containing will have char(<) and char(>) escaped.";
- Console::WriteLine( elem->OuterXml );
-
- // Set InnerXml to a string that includes markup.
- // The markup is not escaped.
- elem->InnerXml = "Text containing .";
- Console::WriteLine( elem->OuterXml );
-}
-// This example produces the following results:
-//
-// Display the InnerText of the element...
-// some textmore text
-// Display the InnerXml of the element...
-// some textmore text
-// Text containing <markup/> will have char(<) and char(>) escaped.
-// Text containing .
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp
deleted file mode 100644
index 32d168f69fc..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " Pride And Prejudice " );
- XmlElement^ currNode = dynamic_cast(doc->DocumentElement->LastChild);
- if ( currNode->IsEmpty )
- currNode->InnerXml = "19.95";
-
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp
deleted file mode 100644
index 79d6693b5c4..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "1-861001-57-5"
- "Pride And Prejudice"
- "" );
-
- // Display information on the ISBN element.
- XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild);
- Console::Write( "{0}:{1} = {2}", elem->Prefix, elem->LocalName, elem->InnerText );
- Console::WriteLine( "\t namespaceURI={0}", elem->NamespaceURI );
-}
-
-// This code produces the following output.
-// bk:ISBN = 1-861001-57-5 namespaceURI=urn:samples
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp
deleted file mode 100644
index 0523cdebda0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "1-861001-57-5"
- "Pride And Prejudice"
- "" );
-
- // Display information on the ISBN element.
- XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild);
- Console::Write( "{0} = {1}", elem->Name, elem->InnerText );
- Console::WriteLine( "\t namespaceURI={0}", elem->NamespaceURI );
-}
-
-// This code produces the following output.
-// bk:ISBN = 1-861001-57-5 namespaceURI=urn:samples
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp
deleted file mode 100644
index 61bff069bb3..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Create a new element.
- XmlElement^ elem = doc->CreateElement( "price" );
- elem->InnerText = "19.95";
-
- // Display the new element's owner document. Note
- // that although the element has not been inserted
- // into the document, it still has an owner document.
- Console::WriteLine( elem->OwnerDocument->OuterXml );
-
- // Add the new element into the document.
- root->AppendChild( elem );
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp
deleted file mode 100644
index 55d58e8f4df..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
-
- // Remove all attributes and child nodes from the book element.
- XmlElement^ root = doc->DocumentElement;
- root->RemoveAll();
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp
deleted file mode 100644
index b35acf816b6..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Remove all attributes from the root element.
- root->RemoveAllAttributes();
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp
deleted file mode 100644
index b0464c9da27..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Remove the genre attribute.
- root->RemoveAttribute( "genre" );
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp
deleted file mode 100644
index f16ed9f8182..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Remove the ISBN attribute.
- root->RemoveAttribute( "ISBN", "urn:samples" );
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp
deleted file mode 100644
index d65bd739012..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Remove the genre attribute.
- root->RemoveAttributeAt( 0 );
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp
deleted file mode 100644
index 85f87dd21d6..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Remove the ISBN attribute.
- root->RemoveAttributeNode( "ISBN", "urn:samples" );
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp
deleted file mode 100644
index 495d6d0bedd..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Add a new attribute.
- XmlAttribute^ attr = root->SetAttributeNode( "genre", "urn:samples" );
- attr->Value = "novel";
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp
deleted file mode 100644
index 577c59e10dc..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Note that because WriteContentTo saves only the children of the element
- // to the writer none of the attributes are displayed.
- Console::WriteLine( "Display the contents of the element..." );
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
- root->WriteContentTo( writer );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp
deleted file mode 100644
index dc693bbe781..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "Pride And Prejudice" );
- XmlElement^ root = doc->DocumentElement;
-
- // Add a new attribute.
- root->SetAttribute( "genre", "urn:samples", "novel" );
- Console::WriteLine( "Display the modified XML..." );
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
- root->WriteTo( writer );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp
deleted file mode 100644
index 557e86ed61a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- //Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "http://localhost/uri.xml" );
-
- //Display information on the entity reference node.
- XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild);
- Console::WriteLine( "Name of the entity reference: {0}", entref->Name );
- Console::WriteLine( "Base URI of the entity reference: {0}", entref->BaseURI );
- Console::WriteLine( "The entity replacement text: {0}", entref->InnerText );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp
deleted file mode 100644
index 5df1512470f..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- //Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "]>"
- ""
- "Pride And Prejudice"
- ""
- "" );
-
- // Check if the node is read-only.
- XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild);
- if ( entref->IsReadOnly )
- Console::WriteLine( "Entity reference nodes are always read-only" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp
deleted file mode 100644
index 0635eed93bf..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "]>"
- ""
- "Pride And Prejudice"
- ""
- "" );
-
- // Display information on the entity reference node.
- XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild);
- Console::WriteLine( "Name of the entity reference: {0}", entref->Name );
- Console::WriteLine( "The entity replacement text: {0}", entref->InnerText );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp
deleted file mode 100644
index 80c8c8c001b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Data;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- DataSet^ dataset;
-
-public:
- void Method()
- {
-//
- XmlImplementation^ imp = gcnew XmlImplementation;
- XmlDocument^ doc1 = imp->CreateDocument();
- XmlDocument^ doc2 = imp->CreateDocument();
-//
- }
-};
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp
deleted file mode 100644
index da00cfebf0a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "books.xml" );
-
- // Display the first two book nodes.
- XmlNode^ book = doc->DocumentElement->FirstChild;
- Console::WriteLine( book->OuterXml );
- Console::WriteLine();
- Console::WriteLine( book->NextSibling->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp
deleted file mode 100644
index 6b73208b236..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "books.xml" );
- XmlNode^ lastNode = doc->DocumentElement->LastChild;
- Console::WriteLine( "Last book..." );
- Console::WriteLine( lastNode->OuterXml );
- XmlNode^ prevNode = lastNode->PreviousSibling;
- Console::WriteLine( "\r\nPrevious book..." );
- Console::WriteLine( prevNode->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp
deleted file mode 100644
index 284b8359eb1..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " Pride And Prejudice" );
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- Console::WriteLine( "Display all the attributes for this book..." );
- for ( int i = 0; i < attrColl->Count; i++ )
- {
- Console::WriteLine( "{0} = {1}", attrColl->Item( i )->Name, attrColl->Item( i )->Value );
-
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp
deleted file mode 100644
index 4d3bd90411a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Collections;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- " Pride And Prejudice"
- "" );
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
- Console::WriteLine( "Display all the attributes for this book..." );
- IEnumerator^ ienum = attrColl->GetEnumerator();
- while ( ienum->MoveNext() )
- {
- XmlAttribute^ attr = dynamic_cast(ienum->Current);
- Console::WriteLine( "{0} = {1}", attr->Name, attr->Value );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp
deleted file mode 100644
index 0f47e848c12..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " Pride And Prejudice" );
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
-
- // Change the value for the genre attribute.
- XmlAttribute^ attr = dynamic_cast(attrColl->GetNamedItem( "genre" ));
- attr->Value = "fiction";
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp
deleted file mode 100644
index 8850c3b5bc0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " Pride And Prejudice" );
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
-
- // Remove the publicationdate attribute.
- attrColl->RemoveNamedItem( "publicationdate" );
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp
deleted file mode 100644
index 6dda24559d4..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " Pride And Prejudice" );
- XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
-
- // Add a new attribute to the collection.
- XmlAttribute^ attr = doc->CreateAttribute( "style" );
- attr->Value = "hardcover";
- attrColl->SetNamedItem( attr );
- Console::WriteLine( "Display the modified XML..." );
- Console::WriteLine( doc->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp
deleted file mode 100644
index e1cf039093e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Data;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- DataSet^ dataset;
-
-public:
- void Method( XmlNamespaceManager^ nsmgr )
- {
-//
- if ( nsmgr->HasNamespace( String::Empty ) )
- {
- Console::WriteLine( nsmgr->DefaultNamespace );
- }
-//
- }
-};
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp
deleted file mode 100644
index 38bee9fe649..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-public ref class Sample
-{
-public:
- Sample()
- {
-
- // Create the XmlNamespaceManager.
- NameTable^ nt = gcnew NameTable;
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt );
-
- // Add prefix/namespace pairs to the XmlNamespaceManager.
- nsmgr->AddNamespace( "", "www.wideworldimporters.com" ); //Adds a default namespace.
- nsmgr->AddNamespace( "europe", "www.wideworldimporters.com/europe" );
- nsmgr->PushScope(); //Pushes a namespace scope on the stack.
- nsmgr->AddNamespace( "", "www.lucernepublishing.com" ); //Adds another default namespace.
- nsmgr->AddNamespace( "partners", "www.lucernepublishing.com/partners" );
- Console::WriteLine( "Show all the prefix/namespace pairs in the XmlNamespaceManager..." );
- ShowAllNamespaces( nsmgr );
- }
-
-
-private:
- void ShowAllNamespaces( XmlNamespaceManager^ nsmgr )
- {
- do
- {
- System::Collections::IEnumerator^ myEnum = nsmgr->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- String^ prefix = safe_cast(myEnum->Current);
- Console::WriteLine( "Prefix={0}, Namespace={1}", prefix, nsmgr->LookupNamespace( prefix ) );
- }
- }
- while ( nsmgr->PopScope() );
- }
-
-};
-
-int main()
-{
- gcnew Sample;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp
deleted file mode 100644
index 7e0abed5a53..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-using namespace System::Xml::Schema;
-public ref class Class1
-{
-public:
- void Method1()
- {
-
- //
- XmlTextReader^ reader = gcnew XmlTextReader( "myfile.xml" );
- XmlNamespaceManager^ nsmanager = gcnew XmlNamespaceManager( reader->NameTable );
- nsmanager->AddNamespace( "msbooks", "www.microsoft.com/books" );
- nsmanager->PushScope();
- nsmanager->AddNamespace( "msstore", "www.microsoft.com/store" );
- while ( reader->Read() )
- {
- Console::WriteLine( "Reader Prefix:{0}", reader->Prefix );
- Console::WriteLine( "XmlNamespaceManager Prefix:{0}", nsmanager->LookupPrefix( nsmanager->NameTable->Get( reader->NamespaceURI ) ) );
- }
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp
deleted file mode 100644
index cc33f1ca5ec..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- //Create a new node.
- XmlElement^ elem = doc->CreateElement( "price" );
- elem->InnerText = "19.95";
-
- //Add the node to the document.
- root->AppendChild( elem );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp
deleted file mode 100644
index 0e20454fc0c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "19.95"
- "" );
- XmlNode^ root = doc->FirstChild;
-
- //Clone the root node. The cloned node includes
- //child nodes. This is similar to calling CloneNode(true).
- XmlNode^ clone = root->Clone();
- Console::WriteLine( clone->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp
deleted file mode 100644
index 5d3608a3e74..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "19.95"
- "" );
- XmlNode^ root = doc->FirstChild;
-
- //Create a deep clone. The cloned node
- //includes the child nodes.
- XmlNode^ deep = root->CloneNode( true );
- Console::WriteLine( deep->OuterXml );
-
- //Create a shallow clone. The cloned node does not
- //include the child nodes, but does include its attribute.
- XmlNode^ shallow = root->CloneNode( false );
- Console::WriteLine( shallow->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp
deleted file mode 100644
index 8c9bb154ef8..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "19.95"
- "" );
- XmlNode^ root = doc->FirstChild;
- Console::WriteLine( "Display the title element..." );
- Console::WriteLine( root->FirstChild->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp
deleted file mode 100644
index b7fb2e4d051..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "books.xml" );
- Console::WriteLine( "Display all the books..." );
- XmlNode^ root = doc->DocumentElement;
- IEnumerator^ ienum = root->GetEnumerator();
- XmlNode^ book;
- while ( ienum->MoveNext() )
- {
- book = dynamic_cast(ienum->Current);
- Console::WriteLine( book->OuterXml );
- Console::WriteLine();
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp
deleted file mode 100644
index 7f8efa23a79..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->FirstChild;
-
- //Create a new attribute.
- String^ ns = root->GetNamespaceOfPrefix( "bk" );
- XmlNode^ attr = doc->CreateNode( XmlNodeType::Attribute, "genre", ns );
- attr->Value = "novel";
-
- //Add the attribute to the document.
- root->Attributes->SetNamedItem( attr );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp
deleted file mode 100644
index 24c5ad1996b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->FirstChild;
-
- //Create a new node.
- String^ prefix = root->GetPrefixOfNamespace( "urn:samples" );
- XmlElement^ elem = doc->CreateElement( prefix, "style", "urn:samples" );
- elem->InnerText = "hardcover";
-
- //Add the node to the document.
- root->AppendChild( elem );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp
deleted file mode 100644
index ff8ddddef56..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "19.95"
- "" );
- XmlNode^ root = doc->FirstChild;
-
- //Display the contents of the child nodes.
- if ( root->HasChildNodes )
- {
- for ( int i = 0; i < root->ChildNodes->Count; i++ )
- {
- Console::WriteLine( root->ChildNodes[ i ]->InnerText );
- }
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp
deleted file mode 100644
index afa0e8a8997..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "some textmore text"
- "" );
- XmlNode^ elem = doc->DocumentElement->FirstChild;
-
- // Note that InnerText does not include the markup.
- Console::WriteLine( "Display the InnerText of the element..." );
- Console::WriteLine( elem->InnerText );
-
- // InnerXml includes the markup of the element.
- Console::WriteLine( "Display the InnerXml of the element..." );
- Console::WriteLine( elem->InnerXml );
-
- // Set InnerText to a string that includes markup.
- // The markup is escaped.
- elem->InnerText = "Text containing will have char(<) and char(>) escaped.";
- Console::WriteLine( elem->OuterXml );
-
- // Set InnerXml to a string that includes markup.
- // The markup is not escaped.
- elem->InnerXml = "Text containing .";
- Console::WriteLine( elem->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp
deleted file mode 100644
index bbc72ef7e69..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- //Create a new node.
- XmlElement^ elem = doc->CreateElement( "price" );
- elem->InnerText = "19.95";
-
- //Add the node to the document.
- root->InsertAfter( elem, root->FirstChild );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp
deleted file mode 100644
index 3ebee800a51..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- //Create a new node.
- XmlElement^ elem = doc->CreateElement( "price" );
- elem->InnerText = "19.95";
-
- //Add the node to the document.
- root->InsertBefore( elem, root->FirstChild );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp
deleted file mode 100644
index 9514236fc62..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "19.95"
- "" );
- XmlNode^ root = doc->FirstChild;
- Console::WriteLine( "Display the price element..." );
- Console::WriteLine( root->LastChild->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp
deleted file mode 100644
index c78113a0dab..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "books.xml" );
- XmlNode^ currNode = doc->DocumentElement->FirstChild;
- Console::WriteLine( "First book..." );
- Console::WriteLine( currNode->OuterXml );
- XmlNode^ nextNode = currNode->NextSibling;
- Console::WriteLine( "\r\nSecond book..." );
- Console::WriteLine( nextNode->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp
deleted file mode 100644
index 9465dbc7815..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- // OuterXml includes the markup of current node.
- Console::WriteLine( "Display the OuterXml property..." );
- Console::WriteLine( root->OuterXml );
-
- // InnerXml does not include the markup of the current node.
- // As a result, the attributes are not displayed.
- Console::WriteLine();
- Console::WriteLine( "Display the InnerXml property..." );
- Console::WriteLine( root->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp
deleted file mode 100644
index 63c23bf93d4..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- //Create a new node.
- XmlElement^ elem = doc->CreateElement( "price" );
- elem->InnerText = "19.95";
-
- //Add the node to the document.
- root->PrependChild( elem );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp
deleted file mode 100644
index 6b73208b236..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "books.xml" );
- XmlNode^ lastNode = doc->DocumentElement->LastChild;
- Console::WriteLine( "Last book..." );
- Console::WriteLine( lastNode->OuterXml );
- XmlNode^ prevNode = lastNode->PreviousSibling;
- Console::WriteLine( "\r\nPrevious book..." );
- Console::WriteLine( prevNode->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp
deleted file mode 100644
index 5d7402c67e9..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- //Remove all attribute and child nodes.
- root->RemoveAll();
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp
deleted file mode 100644
index 3eeeb8ee336..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- //Remove the title element.
- root->RemoveChild( root->FirstChild );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp
deleted file mode 100644
index 8b2b88dc130..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->DocumentElement;
-
- //Create a new title element.
- XmlElement^ elem = doc->CreateElement( "title" );
- elem->InnerText = "The Handmaid's Tale";
-
- //Replace the title element.
- root->ReplaceChild( elem, root->FirstChild );
- Console::WriteLine( "Display the modified XML..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp
deleted file mode 100644
index fa145876295..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "booksort.xml" );
- XmlNodeList^ nodeList;
- XmlNode^ root = doc->DocumentElement;
- nodeList = root->SelectNodes( "descendant::book[author/last-name='Austen']" );
-
- //Change the price on the books.
- System::Collections::IEnumerator^ myEnum = nodeList->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- XmlNode^ book = safe_cast(myEnum->Current);
- book->LastChild->InnerText = "15.95";
- }
-
- Console::WriteLine( "Display the modified XML document...." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp
deleted file mode 100644
index 7ef2af1b754..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "booksort.xml" );
- XmlNode^ book;
- XmlNode^ root = doc->DocumentElement;
- book = root->SelectSingleNode( "descendant::book[author/last-name='Austen']" );
-
- //Change the price on the book.
- book->LastChild->InnerText = "15.95";
- Console::WriteLine( "Display the modified XML document...." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp
deleted file mode 100644
index 109df9f1d9a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->FirstChild;
-
- // Because WriteContentTo saves only the child nodes of the node
- // to the writer none of the attributes are displayed.
- Console::WriteLine( "Display the contents of the node..." );
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
- root->WriteContentTo( writer );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp
deleted file mode 100644
index 7a871794b8e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "" );
- XmlNode^ root = doc->FirstChild;
- Console::WriteLine( "Display the root node..." );
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
- root->WriteTo( writer );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp
deleted file mode 100644
index d308ff6a9b0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "19.95"
- "" );
- XmlNode^ root = doc->FirstChild;
- Console::WriteLine( "Display the title element..." );
- Console::WriteLine( root[ "title" ]->OuterXml );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp
deleted file mode 100644
index 931cd16856c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Collections;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "2books.xml" );
-
- //Get and display all the book titles.
- XmlElement^ root = doc->DocumentElement;
- XmlNodeList^ elemList = root->GetElementsByTagName( "title" );
- IEnumerator^ ienum = elemList->GetEnumerator();
- while ( ienum->MoveNext() )
- {
- XmlNode^ title = dynamic_cast(ienum->Current);
- Console::WriteLine( title->InnerText );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp
deleted file mode 100644
index 8fcc0d2c019..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- " - First item
"
- " - Second item
"
- "" );
-
- //Get and display the last item node.
- XmlElement^ root = doc->DocumentElement;
- XmlNodeList^ nodeList = root->GetElementsByTagName( "item" );
- Console::WriteLine( nodeList->Item( 1 )->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp
deleted file mode 100644
index 91353be15eb..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " "
- "" );
-
- //Load the XmlNodeReader
- reader = gcnew XmlNodeReader( doc );
-
- //Read the attributes on the root element.
- reader->MoveToContent();
- if ( reader->HasAttributes )
- {
- for ( int i = 0; i < reader->AttributeCount; i++ )
- {
- reader->MoveToAttribute( i );
- Console::WriteLine( "{0} = {1}", reader->Name, reader->Value );
-
- }
- reader->MoveToElement();
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp
deleted file mode 100644
index d3287716081..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load an XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "http://localhost/uri.xml" );
- reader = gcnew XmlNodeReader( doc );
-
- //Parse the file and display the base URI for each node.
- while ( reader->Read() )
- {
- Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp
deleted file mode 100644
index 5b0e8725b23..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " "
- "" );
-
- // Load the XmlNodeReader
- reader = gcnew XmlNodeReader( doc );
-
- //Read the ISBN attribute.
- reader->MoveToContent();
- String^ isbn = reader->GetAttribute( "ISBN" );
- Console::WriteLine( "The ISBN value: {0}", isbn );
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp
deleted file mode 100644
index 009705ea4c1..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- // Create and load an XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "]>"
- ""
- "Pride And Prejudice"
- "&h;"
- "" );
- reader = gcnew XmlNodeReader( doc );
-
- // Parse the file and display each node.
- while ( reader->Read() )
- {
- if ( reader->HasValue )
- Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value );
- else
- Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp
deleted file mode 100644
index a63f00d1f68..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Pride And Prejudice"
- "19.95"
- ""
- "" );
-
- //Load the XmlNodeReader
- reader = gcnew XmlNodeReader( doc );
-
- //Parse the XML and display the text content of each of the elements.
- while ( reader->Read() )
- {
- if ( reader->IsStartElement() )
- {
- if ( reader->IsEmptyElement )
- Console::WriteLine( "<{0}/>", reader->Name );
- else
- {
- Console::Write( "<{0}> ", reader->Name );
- reader->Read(); //Read the start tag.
- if ( reader->IsStartElement() )
-
- //Handle nested elements.
- Console::Write( "\r\n<{0}>", reader->Name );
- Console::WriteLine( reader->ReadString() ); //Read the text content of the element.
- }
- }
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp
deleted file mode 100644
index 255f2c6a1da..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "" );
-
- //Load the XmlNodeReader
- reader = gcnew XmlNodeReader( doc );
-
- //Read the genre attribute.
- reader->MoveToContent();
- reader->MoveToFirstAttribute();
- String^ genre = reader->Value;
- Console::WriteLine( "The genre value: {0}", genre );
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp
deleted file mode 100644
index 2d6857ce16e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " "
- "Pride And Prejudice"
- "19.95"
- "" );
-
- //Load the XmlNodeReader
- reader = gcnew XmlNodeReader( doc );
-
- //Read the attributes on the book element.
- reader->MoveToContent();
- while ( reader->MoveToNextAttribute() )
- {
- Console::WriteLine( "{0} = {1}", reader->Name, reader->Value );
- }
-
- //Move the reader to the title element.
- reader->Read();
-
- //Read the title and price elements.
- Console::WriteLine( reader->ReadElementString() );
- Console::WriteLine( reader->ReadElementString() );
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp
deleted file mode 100644
index b596f0cbf8c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- String^ filename = "items.xml";
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create an XmlNodeReader to read the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( filename );
- reader = gcnew XmlNodeReader( doc );
-
- //Parse the file and display each of the nodes.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::Write( "<{0}>", reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::Write( reader->Value );
- break;
-
- case XmlNodeType::CDATA:
- Console::Write( reader->Value );
- break;
-
- case XmlNodeType::ProcessingInstruction:
- Console::Write( "{0} {1}?>", reader->Name, reader->Value );
- break;
-
- case XmlNodeType::Comment:
- Console::Write( "", reader->Value );
- break;
-
- case XmlNodeType::XmlDeclaration:
- Console::Write( "" );
- break;
-
- case XmlNodeType::Document:
- break;
-
- case XmlNodeType::EndElement:
- Console::Write( "{0}>", reader->Name );
- break;
- }
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp
deleted file mode 100644
index 209660c6243..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( " "
- "Pride And Prejudice"
- "novel"
- "" );
-
- //Load the XmlNodeReader
- reader = gcnew XmlNodeReader( doc );
-
- //Parse the XML. If they exist, display the prefix and
- //namespace URI of each node.
- while ( reader->Read() )
- {
- if ( reader->IsStartElement() )
- {
- if ( reader->Prefix == String::Empty )
- Console::WriteLine( "<{0}>", reader->LocalName );
- else
- {
- Console::Write( "<{0}:{1}>", reader->Prefix, reader->LocalName );
- Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI );
- }
- }
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp
deleted file mode 100644
index fa8f90ee268..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load an XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "]>"
- ""
- "" );
-
- //Create the reader.
- reader = gcnew XmlNodeReader( doc );
-
- //Read the misc attribute. The attribute is parsed into multiple
- //text and entity reference nodes.
- reader->MoveToContent();
- reader->MoveToAttribute( "misc" );
- while ( reader->ReadAttributeValue() )
- {
- if ( reader->NodeType == XmlNodeType::EntityReference )
-
- //To expand the entity, call ResolveEntity.
- Console::WriteLine( "{0} {1}", reader->NodeType, reader->Name );
- else
- Console::WriteLine( "{0} {1}", reader->NodeType, reader->Value );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp
deleted file mode 100644
index a980ac2665e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load an XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( "]>"
- ""
- "Pride And Prejudice"
- "&h;"
- "" );
-
- //Create the reader.
- reader = gcnew XmlNodeReader( doc );
- reader->MoveToContent(); //Move to the root element.
- reader->Read(); //Move to title start tag.
- reader->Skip(); //Skip the title element.
-
- //Read the misc start tag. The reader is now positioned on
- //the entity reference node.
- reader->ReadStartElement();
-
- //You must call ResolveEntity to expand the entity reference.
- //The entity replacement text is then parsed and returned as a child node.
- Console::WriteLine( "Expand the entity..." );
- reader->ResolveEntity();
- Console::WriteLine( "The entity replacement text is returned as a text node." );
- reader->Read();
- Console::WriteLine( "NodeType: {0} Value: {1}", reader->NodeType, reader->Value );
- Console::WriteLine( "An EndEntity node closes the entity reference scope." );
- reader->Read();
- Console::WriteLine( "NodeType: {0} Name: {1}", reader->NodeType, reader->Name );
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp
deleted file mode 100644
index cb90b873442..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlNodeReader^ reader = nullptr;
- try
- {
-
- //Create and load the XML document.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- ""
- "Pride And Prejudice"
- "19.95"
- "" );
-
- //Load the XmlNodeReader
- reader = gcnew XmlNodeReader( doc );
- reader->MoveToContent(); //Move to the book node.
- reader->Read(); //Read the book start tag.
- reader->Skip(); //Skip the title element.
- Console::WriteLine( reader->ReadOuterXml() ); //Read the price element.
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp
deleted file mode 100644
index 7658108b64d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-using namespace System::Xml::Schema;
-
-public ref class Class1
-{
-//
-public:
- void DisplayAttributes( XmlReader^ reader )
- {
- if ( reader->HasAttributes )
- {
- Console::WriteLine( "Attributes of <{0}>", reader->Name );
- while ( reader->MoveToNextAttribute() )
- {
- Console::WriteLine( " {0}={1}", reader->Name, reader->Value );
- }
- }
- }
-//
-};
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp
deleted file mode 100644
index 4d1aa635c0e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- try
- {
-
- //Load the reader with the XML file.
- reader = gcnew XmlTextReader( "elems.xml" );
-
- //Parse the XML and display the text content of each of the elements.
- while ( reader->Read() )
- {
- if ( reader->IsStartElement() )
- {
- if ( reader->IsEmptyElement )
- Console::WriteLine( "<{0}/>", reader->Name );
- else
- {
- Console::Write( "<{0}> ", reader->Name );
- reader->Read(); //Read the start tag.
- if ( reader->IsStartElement() )
-
- //Handle nested elements.
- Console::Write( "\r\n<{0}>", reader->Name );
- Console::WriteLine( reader->ReadString() ); //Read the text content of the element.
- }
- }
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp
deleted file mode 100644
index 05bb06db971..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Data;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- String^ _price;
-
-public:
- void Method( XmlReader^ reader )
- {
-//
- if ( reader->MoveToContent() == XmlNodeType::Element &&
- reader->Name->Equals( "price" ) )
- {
- _price = reader->ReadString();
- }
-//
- }
-};
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp
deleted file mode 100644
index 2ecb603c997..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
- static void Main()
- {
-
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ elementCat = gcnew XmlSchemaElement();
- schema->Items->Add(elementCat);
- elementCat->Name = "cat";
- elementCat->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementDog = gcnew XmlSchemaElement();
- schema->Items->Add(elementDog);
- elementDog->Name = "dog";
- elementDog->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementRedDog = gcnew XmlSchemaElement();
- schema->Items->Add(elementRedDog);
- elementRedDog->Name = "redDog";
- elementRedDog->SubstitutionGroup = gcnew XmlQualifiedName("dog");
-
- //
- XmlSchemaElement^ elementBrownDog = gcnew XmlSchemaElement();
- schema->Items->Add(elementBrownDog);
- elementBrownDog->Name = "brownDog";
- elementBrownDog->SubstitutionGroup = gcnew XmlQualifiedName("dog");
-
-
- //
- XmlSchemaElement^ elementPets = gcnew XmlSchemaElement();
- schema->Items->Add(elementPets);
- elementPets->Name = "pets";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
- elementPets->SchemaType = complexType;
-
- //
- XmlSchemaChoice^ choice = gcnew XmlSchemaChoice();
- complexType->Particle = choice;
- choice->MinOccurs = 0;
- choice->MaxOccursString = "unbounded";
-
- //
- XmlSchemaElement^ catRef = gcnew XmlSchemaElement();
- choice->Items->Add(catRef);
- catRef->RefName = gcnew XmlQualifiedName("cat");
-
- //
- XmlSchemaElement^ dogRef = gcnew XmlSchemaElement();
- choice->Items->Add(dogRef);
- dogRef->RefName = gcnew XmlQualifiedName("dog");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp
deleted file mode 100644
index d410a9785b7..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- XmlSchemaElement^ thing1 = gcnew XmlSchemaElement();
- thing1->Name = "thing1";
- thing1->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
- schema->Items->Add(thing1);
-
- XmlSchemaElement^ thing2 = gcnew XmlSchemaElement();
- thing2->Name = "thing2";
- thing2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
- schema->Items->Add(thing2);
-
- XmlSchemaElement^ thing3 = gcnew XmlSchemaElement();
- thing3->Name = "thing3";
- thing3->SchemaTypeName =
- gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
- schema->Items->Add(thing3);
-
- XmlSchemaElement^ thing4 = gcnew XmlSchemaElement();
- thing4->Name = "thing4";
- thing4->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
- schema->Items->Add(thing4);
-
- XmlSchemaAttribute^ myAttribute = gcnew XmlSchemaAttribute();
- myAttribute->Name = "myAttribute";
- myAttribute->SchemaTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema");
- schema->Items->Add(myAttribute);
-
- XmlSchemaComplexType^ myComplexType = gcnew XmlSchemaComplexType();
- myComplexType->Name = "myComplexType";
-
- XmlSchemaAll^ complexType_all = gcnew XmlSchemaAll();
-
- XmlSchemaElement^ complexType_all_thing1 = gcnew XmlSchemaElement();
- complexType_all_thing1->RefName = gcnew XmlQualifiedName("thing1", "");
- complexType_all->Items->Add(complexType_all_thing1);
-
- XmlSchemaElement^ complexType_all_thing2 = gcnew XmlSchemaElement();
- complexType_all_thing2->RefName = gcnew XmlQualifiedName("thing2", "");
- complexType_all->Items->Add(complexType_all_thing2);
-
- XmlSchemaElement^ complexType_all_thing3 = gcnew XmlSchemaElement();
- complexType_all_thing3->RefName = gcnew XmlQualifiedName("thing3", "");
- complexType_all->Items->Add(complexType_all_thing3);
-
- XmlSchemaElement^ complexType_all_thing4 = gcnew XmlSchemaElement();
- complexType_all_thing4->RefName = gcnew XmlQualifiedName("thing4", "");
- complexType_all->Items->Add(complexType_all_thing4);
-
- myComplexType->Particle = complexType_all;
-
- XmlSchemaAttribute^ complexType_myAttribute = gcnew XmlSchemaAttribute();
- complexType_myAttribute->RefName = gcnew XmlQualifiedName("myAttribute", "");
- myComplexType->Attributes->Add(complexType_myAttribute);
-
- schema->Items->Add(myComplexType);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp
deleted file mode 100644
index 0da1a34fd86..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
- static void Main()
- {
-
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType();
- simpleType->Name = "northwestStates";
- schema->Items->Add(simpleType);
-
- //
- XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation();
- simpleType->Annotation = annNorthwestStates;
-
- // States in the Pacific Northwest of US
- XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation();
- annNorthwestStates->Items->Add(docNorthwestStates);
- docNorthwestStates->Markup = TextToNodeArray("States in the Pacific Northwest of US");
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- simpleType->Content = restriction;
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaEnumerationFacet^ enumerationWA = gcnew XmlSchemaEnumerationFacet();
- restriction->Facets->Add(enumerationWA);
- enumerationWA->Value = "WA";
-
- //
- XmlSchemaAnnotation^ annWA = gcnew XmlSchemaAnnotation();
- enumerationWA->Annotation = annWA;
-
- // Washington
- XmlSchemaDocumentation^ docWA = gcnew XmlSchemaDocumentation();
- annWA->Items->Add(docWA);
- docWA->Markup = TextToNodeArray("Washington");
-
- //
- XmlSchemaEnumerationFacet^ enumerationOR = gcnew XmlSchemaEnumerationFacet();
- restriction->Facets->Add(enumerationOR);
- enumerationOR->Value = "OR";
-
- //
- XmlSchemaAnnotation^ annOR = gcnew XmlSchemaAnnotation();
- enumerationOR->Annotation = annOR;
-
- // Oregon
- XmlSchemaDocumentation^ docOR = gcnew XmlSchemaDocumentation();
- annOR->Items->Add(docOR);
- docOR->Markup = TextToNodeArray("Oregon");
-
- //
- XmlSchemaEnumerationFacet^ enumerationID = gcnew XmlSchemaEnumerationFacet();
-
- restriction->Facets->Add(enumerationID);
- enumerationID->Value = "ID";
-
- //
- XmlSchemaAnnotation^ annID = gcnew XmlSchemaAnnotation();
- enumerationID->Annotation = annID;
-
- // Idaho
- XmlSchemaDocumentation^ docID = gcnew XmlSchemaDocumentation();
- annID->Items->Add(docID);
- docID->Markup = TextToNodeArray("Idaho");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
- static array^ TextToNodeArray(String^ text)
- {
- XmlDocument^ doc = gcnew XmlDocument();
- array^ temp = {doc->CreateTextNode(text)};
- return temp;
- }
-
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp
deleted file mode 100644
index de4222ca95d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ xeHtmlText = gcnew XmlSchemaElement();
- xeHtmlText->Name = "htmlText";
-
- //
- XmlSchemaComplexType^ ct = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence();
-
- //
- XmlSchemaAny^ any = gcnew XmlSchemaAny();
- any->MinOccurs = 1;
- any->MaxOccursString = "unbounded";
- any->Namespace = "http://www.w3.org/1999/xhtml";
- any->ProcessContents = XmlSchemaContentProcessing::Lax;
- sequence->Items->Add(any);
-
- ct->Particle = sequence;
- xeHtmlText->SchemaType = ct;
-
- schema->Items->Add(xeHtmlText);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- schema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp
deleted file mode 100644
index 17a9abb810d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- schema->Items->Add(element);
- element->Name = "stringElementWithAnyAttribute";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
- element->SchemaType = complexType;
-
- //
- XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent();
- complexType->ContentModel = simpleContent;
-
- //
- XmlSchemaSimpleContentExtension^ extension = gcnew XmlSchemaSimpleContentExtension();
- simpleContent->Content = extension;
- extension->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaAnyAttribute^ anyAttribute = gcnew XmlSchemaAnyAttribute();
- extension->AnyAttribute = anyAttribute;
- anyAttribute->Namespace = "##targetNamespace";
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp
deleted file mode 100644
index cb4bdbb1014..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- schema->Items->Add(element);
- element->Name = "State";
-
- //
- XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation();
- element->Annotation = annNorthwestStates;
-
- // State Name
- XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation();
- annNorthwestStates->Items->Add(docNorthwestStates);
- docNorthwestStates->Markup = TextToNodeArray("State Name");
-
- // Application Information
- XmlSchemaAppInfo^ appInfo = gcnew XmlSchemaAppInfo();
- annNorthwestStates->Items->Add(appInfo);
- appInfo->Markup = TextToNodeArray("Application Information");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
-
- Console::WriteLine(args->Message);
- }
-
- static array^ TextToNodeArray(String^ text)
- {
- XmlDocument^ doc = gcnew XmlDocument();
- array^ nodes = {doc->CreateTextNode(text)};
- return nodes;
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp
deleted file mode 100644
index 083c98e686d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaAttribute^ attributeBase = gcnew XmlSchemaAttribute();
- schema->Items->Add(attributeBase);
- attributeBase->Name = "mybaseattribute";
-
- //
- XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType();
- attributeBase->SchemaType = simpleType;
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- simpleType->Content = restriction;
- restriction->BaseTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet();
- restriction->Facets->Add(maxInclusive);
- maxInclusive->Value = "1000";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
- schema->Items->Add(complexType);
- complexType->Name = "myComplexType";
-
- //
- XmlSchemaAttribute^ attributeBaseRef = gcnew XmlSchemaAttribute();
- complexType->Attributes->Add(attributeBaseRef);
- attributeBaseRef->RefName = gcnew XmlQualifiedName("mybaseattribute");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp
deleted file mode 100644
index 465d8de18d4..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaAttributeGroup^ myAttributeGroup = gcnew XmlSchemaAttributeGroup();
- schema->Items->Add(myAttributeGroup);
- myAttributeGroup->Name = "myAttributeGroup";
-
- //
- XmlSchemaAttribute^ someattribute1 = gcnew XmlSchemaAttribute();
- myAttributeGroup->Attributes->Add(someattribute1);
- someattribute1->Name = "someattribute1";
- someattribute1->SchemaTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");
-
-
- //
- XmlSchemaAttribute^ someattribute2 = gcnew XmlSchemaAttribute();
- myAttributeGroup->Attributes->Add(someattribute2);
- someattribute2->Name = "someattribute2";
- someattribute2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaComplexType^ myElementType = gcnew XmlSchemaComplexType();
- schema->Items->Add(myElementType);
- myElementType->Name = "myElementType";
-
- //
- XmlSchemaAttributeGroupRef^ myAttributeGroupRef = gcnew XmlSchemaAttributeGroupRef();
- myElementType->Attributes->Add(myAttributeGroupRef);
- myAttributeGroupRef->RefName = gcnew XmlQualifiedName("myAttributeGroup");
-
- //
- XmlSchemaAttributeGroup^ myAttributeGroupA = gcnew XmlSchemaAttributeGroup();
- schema->Items->Add(myAttributeGroupA);
- myAttributeGroupA->Name = "myAttributeGroupA";
-
- //
- XmlSchemaAttribute^ someattribute10 = gcnew XmlSchemaAttribute();
- myAttributeGroupA->Attributes->Add(someattribute10);
- someattribute10->Name = "someattribute10";
- someattribute10->SchemaTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaAttribute^ someattribute11 = gcnew XmlSchemaAttribute();
- myAttributeGroupA->Attributes->Add(someattribute11);
- someattribute11->Name = "someattribute11";
- someattribute11->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaAttributeGroup^ myAttributeGroupB = gcnew XmlSchemaAttributeGroup();
- schema->Items->Add(myAttributeGroupB);
- myAttributeGroupB->Name = "myAttributeGroupB";
-
- //
- XmlSchemaAttribute^ someattribute20 = gcnew XmlSchemaAttribute();
- myAttributeGroupB->Attributes->Add(someattribute20);
- someattribute20->Name = "someattribute20";
- someattribute20->SchemaTypeName = gcnew XmlQualifiedName("date", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaAttributeGroupRef^ myAttributeGroupRefA = gcnew XmlSchemaAttributeGroupRef();
- myAttributeGroupB->Attributes->Add(myAttributeGroupRefA);
- myAttributeGroupRefA->RefName = gcnew XmlQualifiedName("myAttributeGroupA");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp
deleted file mode 100644
index d73de8b2cf6..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ xeSelected = gcnew XmlSchemaElement();
- xeSelected->Name = "selected";
- schema->Items->Add(xeSelected);
-
- //
- XmlSchemaElement^ xeUnselected = gcnew XmlSchemaElement();
- xeUnselected->Name = "unselected";
- schema->Items->Add(xeUnselected);
-
- //
- XmlSchemaElement^ xeDimpled = gcnew XmlSchemaElement();
- xeDimpled->Name = "dimpled";
- schema->Items->Add(xeDimpled);
-
- //
- XmlSchemaElement^ xePerforated = gcnew XmlSchemaElement();
- xePerforated->Name = "perforated";
- schema->Items->Add(xePerforated);
-
- //
- XmlSchemaComplexType^ chadState = gcnew XmlSchemaComplexType();
- schema->Items->Add(chadState);
- chadState->Name = "chadState";
-
- //
- XmlSchemaChoice^ choice = gcnew XmlSchemaChoice();
- chadState->Particle = choice;
- choice->MinOccurs = 1;
- choice->MaxOccurs = 1;
-
- //
- XmlSchemaElement^ elementSelected = gcnew XmlSchemaElement();
- choice->Items->Add(elementSelected);
- elementSelected->RefName = gcnew XmlQualifiedName("selected");
-
- //
- XmlSchemaElement^ elementUnselected = gcnew XmlSchemaElement();
- choice->Items->Add(elementUnselected);
- elementUnselected->RefName = gcnew XmlQualifiedName("unselected");
-
- //
- XmlSchemaElement^ elementDimpled = gcnew XmlSchemaElement();
- choice->Items->Add(elementDimpled);
- elementDimpled->RefName = gcnew XmlQualifiedName("dimpled");
-
- //
- XmlSchemaElement^ elementPerforated = gcnew XmlSchemaElement();
- choice->Items->Add(elementPerforated);
- elementPerforated->RefName = gcnew XmlQualifiedName("perforated");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp
deleted file mode 100644
index b9bf69edc70..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-using namespace System::Xml::Schema;
-
-public ref class Class1
-{
- //
-public:
- void DisplaySchemas( XmlSchemaCollection^ xsc )
- {
- XmlSchemaCollectionEnumerator^ ienum = xsc->GetEnumerator();
- while ( ienum->MoveNext() )
- {
- XmlSchema^ schema = ienum->Current;
- StringWriter^ sw = gcnew StringWriter;
- XmlTextWriter^ writer = gcnew XmlTextWriter( sw );
- writer->Formatting = Formatting::Indented;
- writer->Indentation = 2;
- schema->Write( writer );
- Console::WriteLine( sw );
- }
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp
deleted file mode 100644
index 9dfc421ef93..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::IO;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-public:
- void Method( XmlSchemaCollection^ xsc )
- {
- //
- if ( xsc->Contains( "urn:bookstore-schema" ) )
- {
- XmlSchema^ schema = xsc[ "urn:bookstore-schema" ];
- StringWriter^ sw = gcnew StringWriter;
- XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( sw );
- xmlWriter->Formatting = Formatting::Indented;
- xmlWriter->Indentation = 2;
- schema->Write( xmlWriter );
- Console::WriteLine( sw );
- }
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp
deleted file mode 100644
index 65680c23fba..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaComplexType^ address = gcnew XmlSchemaComplexType();
- schema->Items->Add(address);
- address->Name = "address";
-
- //
- XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence();
- address->Particle = sequence;
-
- //
- XmlSchemaElement^ elementName = gcnew XmlSchemaElement();
- sequence->Items->Add(elementName);
- elementName->Name = "name";
- elementName->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementStreet = gcnew XmlSchemaElement();
- sequence->Items->Add(elementStreet);
- elementStreet->Name = "street";
- elementStreet->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementCity = gcnew XmlSchemaElement();
- sequence->Items->Add(elementCity);
- elementCity->Name = "city";
- elementCity->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaComplexType^ USAddress = gcnew XmlSchemaComplexType();
- schema->Items->Add(USAddress);
- USAddress->Name = "USAddress";
-
- //
- XmlSchemaComplexContent^ complexContent = gcnew XmlSchemaComplexContent();
- USAddress->ContentModel = complexContent;
-
- //
- XmlSchemaComplexContentExtension^ extensionAddress = gcnew XmlSchemaComplexContentExtension();
- complexContent->Content = extensionAddress;
- extensionAddress->BaseTypeName = gcnew XmlQualifiedName("address");
-
- //
- XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence();
- extensionAddress->Particle = sequence2;
-
- //
- XmlSchemaElement^ elementUSState = gcnew XmlSchemaElement();
- sequence2->Items->Add(elementUSState);
- elementUSState->Name = "state";
- elementUSState->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
-
- //
- XmlSchemaElement^ elementZipcode = gcnew XmlSchemaElement();
- sequence2->Items->Add(elementZipcode);
- elementZipcode->Name = "zipcode";
- elementZipcode->SchemaTypeName = gcnew XmlQualifiedName("positiveInteger", "http://www.w3.org/2001/XMLSchema");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp
deleted file mode 100644
index 8c05936319d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaComplexType^ phoneNumber = gcnew XmlSchemaComplexType();
- phoneNumber->Name = "phoneNumber";
-
- //
- XmlSchemaSequence^ phoneNumberSequence = gcnew XmlSchemaSequence();
-
- //
- XmlSchemaElement^ areaCode1 = gcnew XmlSchemaElement();
- areaCode1->MinOccurs = 0;
- areaCode1->MaxOccursString = "1";
- areaCode1->Name = "areaCode";
- phoneNumberSequence->Items->Add(areaCode1);
-
- //
- XmlSchemaElement^ prefix1 = gcnew XmlSchemaElement();
- prefix1->MinOccurs = 1;
- prefix1->MaxOccursString = "1";
- prefix1->Name = "prefix";
- phoneNumberSequence->Items->Add(prefix1);
-
- //
- XmlSchemaElement^ number1 = gcnew XmlSchemaElement();
- number1->MinOccurs = 1;
- number1->MaxOccursString = "1";
- number1->Name = "number";
- phoneNumberSequence->Items->Add(number1);
-
- phoneNumber->Particle = phoneNumberSequence;
-
- schema->Items->Add(phoneNumber);
-
- //
- XmlSchemaComplexType^ localPhoneNumber = gcnew XmlSchemaComplexType();
- localPhoneNumber->Name = "localPhoneNumber";
-
- //
- XmlSchemaComplexContent^ complexContent = gcnew XmlSchemaComplexContent();
-
- //
- XmlSchemaComplexContentRestriction^ restriction = gcnew XmlSchemaComplexContentRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("phoneNumber", "");
-
- //
- XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence();
-
- //
- XmlSchemaElement^ areaCode2 = gcnew XmlSchemaElement();
- areaCode2->MinOccurs = 0;
- areaCode2->MaxOccursString = "1";
- areaCode2->Name = "areaCode";
- sequence2->Items->Add(areaCode2);
-
- //
- XmlSchemaElement^ prefix2 = gcnew XmlSchemaElement();
- prefix2->MinOccurs = 1;
- prefix2->MaxOccursString = "1";
- prefix2->Name = "prefix";
- sequence2->Items->Add(prefix2);
-
- //
- XmlSchemaElement^ number2 = gcnew XmlSchemaElement();
- number2->MinOccurs = 1;
- number2->MaxOccursString = "1";
- number2->Name = "number";
- sequence2->Items->Add(number2);
-
- restriction->Particle = sequence2;
- complexContent->Content = restriction;
- localPhoneNumber->ContentModel = complexContent;
-
- schema->Items->Add(localPhoneNumber);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp
deleted file mode 100644
index 6381b6b7526..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ SizeType = gcnew XmlSchemaSimpleType();
- SizeType->Name = "SizeType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaEnumerationFacet^ enumerationSmall = gcnew XmlSchemaEnumerationFacet();
- enumerationSmall->Value = "Small";
- restriction->Facets->Add(enumerationSmall);
-
- //
- XmlSchemaEnumerationFacet^ enumerationMedium = gcnew XmlSchemaEnumerationFacet();
- enumerationMedium->Value = "Medium";
- restriction->Facets->Add(enumerationMedium);
-
- //
- XmlSchemaEnumerationFacet^ enumerationLarge = gcnew XmlSchemaEnumerationFacet();
- enumerationLarge->Value = "Large";
- restriction->Facets->Add(enumerationLarge);
-
- SizeType->Content = restriction;
-
- schema->Items->Add(SizeType);
-
- //
- XmlSchemaElement^ elementItem = gcnew XmlSchemaElement();
- elementItem->Name = "Item";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ attributeSize = gcnew XmlSchemaAttribute();
- attributeSize->Name = "Size";
- attributeSize->SchemaTypeName = gcnew XmlQualifiedName("SizeType", "");
- complexType->Attributes->Add(attributeSize);
-
- elementItem->SchemaType = complexType;
-
- schema->Items->Add(elementItem);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp
deleted file mode 100644
index b7af3eb044a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class ValidXsd
-{
-public:
-
- static void Main()
- {
- FileStream^ fs;
- XmlSchema^ schema;
-
- try
- {
- fs = gcnew FileStream("example.xsd", FileMode::Open);
- schema = XmlSchema::Read(fs, gcnew ValidationEventHandler(ShowCompileError));
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ShowCompileError);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- schema = compiledSchema;
-
- if (schema->IsCompiled)
- {
- // Schema is successfully compiled.
- // Do something with it here.
-
- }
- }
- catch (XmlSchemaException^ e)
- {
- Console::WriteLine("LineNumber = {0}", e->LineNumber);
- Console::WriteLine("LinePosition = {0}", e->LinePosition);
- Console::WriteLine("Message = {0}", e->Message);
- }
-
- }
-
- static void ShowCompileError(Object^ sender, ValidationEventArgs^ e)
- {
- Console::WriteLine("Validation Error: {0}", e->Message);
- }
-};
-
-int main()
-{
- ValidXsd::Main();
- Console::ReadLine();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp
deleted file mode 100644
index 308c590aadf..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ elementThing1 = gcnew XmlSchemaElement();
- schema->Items->Add(elementThing1);
- elementThing1->Name = "thing1";
- elementThing1->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementThing2 = gcnew XmlSchemaElement();
- schema->Items->Add(elementThing2);
- elementThing2->Name = "thing2";
- elementThing2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementThing3 = gcnew XmlSchemaElement();
- schema->Items->Add(elementThing3);
- elementThing3->Name = "thing3";
- elementThing3->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaAttribute^ myAttribute = gcnew XmlSchemaAttribute();
- schema->Items->Add(myAttribute);
- myAttribute->Name = "myAttribute";
- myAttribute->SchemaTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaGroup^ myGroupOfThings = gcnew XmlSchemaGroup();
- schema->Items->Add(myGroupOfThings);
- myGroupOfThings->Name = "myGroupOfThings";
-
- //
- XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence();
- myGroupOfThings->Particle = sequence;
-
- //
- XmlSchemaElement^ elementThing1Ref = gcnew XmlSchemaElement();
- sequence->Items->Add(elementThing1Ref);
- elementThing1Ref->RefName = gcnew XmlQualifiedName("thing1");
-
- //
- XmlSchemaElement^ elementThing2Ref = gcnew XmlSchemaElement();
- sequence->Items->Add(elementThing2Ref);
- elementThing2Ref->RefName = gcnew XmlQualifiedName("thing2");
-
- //
- XmlSchemaElement^ elementThing3Ref = gcnew XmlSchemaElement();
- sequence->Items->Add(elementThing3Ref);
- elementThing3Ref->RefName = gcnew XmlQualifiedName("thing3");
-
- //
- XmlSchemaComplexType^ myComplexType = gcnew XmlSchemaComplexType();
- schema->Items->Add(myComplexType);
- myComplexType->Name = "myComplexType";
-
- //
- XmlSchemaGroupRef^ myGroupOfThingsRef = gcnew XmlSchemaGroupRef();
- myComplexType->Particle = myGroupOfThingsRef;
- myGroupOfThingsRef->RefName = gcnew XmlQualifiedName("myGroupOfThings");
-
- //
- XmlSchemaAttribute^ myAttributeRef = gcnew XmlSchemaAttribute();
- myComplexType->Attributes->Add(myAttributeRef);
- myAttributeRef->RefName = gcnew XmlQualifiedName("myAttribute");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp
deleted file mode 100644
index 4f5ccb60525..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaNotation^ notation = gcnew XmlSchemaNotation();
- notation->Name = "jpeg";
- notation->Public = "image/jpeg";
- notation->System = "viewer.exe";
-
- schema->Items->Add(notation);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp
deleted file mode 100644
index 320ba3c48fc..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Reflection;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class ValidXSD
-{
-private:
- static void DisplayObjects(Object^ o)
- {
- DisplayObjects(o, "");
- }
-
- static void DisplayObjects(Object^ o, String^ indent)
- {
- Console::WriteLine("{0}{1}", indent, o);
-
- for each (PropertyInfo^ property1 in o->GetType()->GetProperties())
- {
- if (property1->PropertyType->FullName == "System.Xml.Schema.XmlSchemaObjectCollection")
- {
- XmlSchemaObjectCollection^ childObjectCollection = dynamic_cast(property1->GetValue(o, nullptr));
-
- for each (XmlSchemaObject^ schemaObject in childObjectCollection)
- {
- DisplayObjects(schemaObject, indent + "\t");
- }
- }
- }
- }
-
- static void ShowCompileError(Object^ sender, ValidationEventArgs^ e)
- {
- Console::WriteLine("Validation Error: {0}", e->Message);
- }
-
-public:
- static int Main()
- {
- String^ xsd = "example.xsd";
-
- FileStream^ fs;
- XmlSchema^ schema;
- try
- {
- fs = gcnew FileStream(xsd, FileMode::Open);
- schema = XmlSchema::Read(fs, gcnew ValidationEventHandler(ShowCompileError));
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ShowCompileError);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- schema = compiledSchema;
-
- if (schema->IsCompiled)
- {
- DisplayObjects(schema);
- }
- return 0;
- }
- catch (XmlSchemaException^ e)
- {
- Console::WriteLine("LineNumber = {0}", e->LineNumber);
- Console::WriteLine("LinePosition = {0}", e->LinePosition);
- Console::WriteLine("Message = {0}", e->Message);
- Console::WriteLine("Source = {0}", e->Source);
- return -1;
- }
- }
-};
-
-int main()
-{
- ValidXSD::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp
deleted file mode 100644
index f4e63a564af..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-int main()
-{
- XmlSchema^ s = gcnew XmlSchema;
- s->TargetNamespace = "myNamespace";
- s->Namespaces->Add( "myImpPrefix", "myImportNamespace" );
-
- // Create the element.
- XmlSchemaImport^ import = gcnew XmlSchemaImport;
- import->Namespace = "myImportNamespace";
- import->SchemaLocation = "http://www.example.com/myImportNamespace";
- s->Includes->Add( import );
-
- // Create an element and assign a type from imported schema.
- XmlSchemaElement^ elem = gcnew XmlSchemaElement;
- elem->SchemaTypeName = gcnew XmlQualifiedName( "importType","myImportNamespace" );
- elem->Name = "element1";
- s->Items->Add( elem );
- s->Write( Console::Out );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp
deleted file mode 100644
index 4c7edb2f322..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XMLSchemaExamples
-{
-
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ generalPrice = gcnew XmlSchemaElement();
- generalPrice->Name = "generalPrice";
-
- //
- XmlSchemaComplexType^ ct = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent();
-
- //
- XmlSchemaSimpleContentExtension^ simpleContent_extension = gcnew XmlSchemaSimpleContentExtension();
- simpleContent_extension->BaseTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaAttribute^ currency = gcnew XmlSchemaAttribute();
- currency->Name = "currency";
- currency->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
- simpleContent_extension->Attributes->Add(currency);
-
- simpleContent->Content = simpleContent_extension;
- ct->ContentModel = simpleContent;
- generalPrice->SchemaType = ct;
-
- schema->Items->Add(generalPrice);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp
deleted file mode 100644
index 35a881cdd78..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ LotteryNumberType = gcnew XmlSchemaSimpleType();
- LotteryNumberType->Name = "LotteryNumber";
-
- //
- XmlSchemaSimpleTypeRestriction^ LotteryNumberRestriction = gcnew XmlSchemaSimpleTypeRestriction();
- LotteryNumberRestriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMinInclusiveFacet^ minInclusive = gcnew XmlSchemaMinInclusiveFacet();
- minInclusive->Value = "1";
- LotteryNumberRestriction->Facets->Add(minInclusive);
-
- //
- XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet();
- maxInclusive->Value = "99";
- LotteryNumberRestriction->Facets->Add(maxInclusive);
-
- LotteryNumberType->Content = LotteryNumberRestriction;
- schema->Items->Add(LotteryNumberType);
-
- //
- XmlSchemaSimpleType^ LotteryNumberListType = gcnew XmlSchemaSimpleType();
- LotteryNumberListType->Name = "LotteryNumberList";
-
- //
- XmlSchemaSimpleTypeList^ list = gcnew XmlSchemaSimpleTypeList();
- list->ItemTypeName = gcnew XmlQualifiedName("LotteryNumber", "");
- LotteryNumberListType->Content = list;
-
- schema->Items->Add(LotteryNumberListType);
-
- //
- XmlSchemaSimpleType^ LotteryNumbersType = gcnew XmlSchemaSimpleType();
- LotteryNumbersType->Name = "LotteryNumbers";
-
- //
- XmlSchemaSimpleTypeRestriction^ LotteryNumbersRestriction = gcnew XmlSchemaSimpleTypeRestriction();
- LotteryNumbersRestriction->BaseTypeName = gcnew XmlQualifiedName("LotteryNumberList", "");
-
- //
- XmlSchemaLengthFacet^ length = gcnew XmlSchemaLengthFacet();
- length->Value = "5";
- LotteryNumbersRestriction->Facets->Add(length);
-
- LotteryNumbersType->Content = LotteryNumbersRestriction;
-
- schema->Items->Add(LotteryNumbersType);
-
- //
- XmlSchemaElement^ TodaysLottery = gcnew XmlSchemaElement();
- TodaysLottery->Name = "TodaysLottery";
- TodaysLottery->SchemaTypeName = gcnew XmlQualifiedName("LotteryNumbers", "");
-
- schema->Items->Add(TodaysLottery);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp
deleted file mode 100644
index 78ec91dd354..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-public ref class Sample
-{
-private:
- XmlNode^ currNode;
- XmlTextReader^ reader;
-
-public:
- Sample()
- {
- reader = nullptr;
- String^ filename = "space.xml";
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- ""
- "Eva"
- "Corets"
- "" );
- Console::WriteLine( "InnerText before..." );
- Console::WriteLine( doc->DocumentElement->InnerText );
-
- // Add white space.
- currNode = doc->DocumentElement;
- XmlSignificantWhitespace^ sigws = doc->CreateSignificantWhitespace( "\t" );
- currNode->InsertAfter( sigws, currNode->FirstChild );
- Console::WriteLine();
- Console::WriteLine( "InnerText after..." );
- Console::WriteLine( doc->DocumentElement->InnerText );
-
- // Save and then display the file.
- doc->Save( filename );
- Console::WriteLine();
- Console::WriteLine( "Reading file..." );
- ReadFile( filename );
- }
-
-
- // Parse the file and print out each node.
- void ReadFile( String^ filename )
- {
- try
- {
- reader = gcnew XmlTextReader( filename );
- String^ sNodeType = nullptr;
- while ( reader->Read() )
- {
- sNodeType = NodeTypeToString( reader->NodeType );
-
- // Print the node type, name, and value.
- Console::WriteLine( "{0}<{1}> {2}", sNodeType, reader->Name, reader->Value );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
- }
-
- static String^ NodeTypeToString( XmlNodeType nodetype )
- {
- String^ sNodeType = nullptr;
- switch ( nodetype )
- {
- case XmlNodeType::None:
- sNodeType = "None";
- break;
-
- case XmlNodeType::Element:
- sNodeType = "Element";
- break;
-
- case XmlNodeType::Attribute:
- sNodeType = "Attribute";
- break;
-
- case XmlNodeType::Text:
- sNodeType = "Text";
- break;
-
- case XmlNodeType::Comment:
- sNodeType = "Comment";
- break;
-
- case XmlNodeType::Document:
- sNodeType = "Document";
- break;
-
- case XmlNodeType::Whitespace:
- sNodeType = "Whitespace";
- break;
-
- case XmlNodeType::SignificantWhitespace:
- sNodeType = "SignificantWhitespace";
- break;
-
- case XmlNodeType::EndElement:
- sNodeType = "EndElement";
- break;
- }
- return sNodeType;
- }
-
-};
-
-int main()
-{
- gcnew Sample;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp
deleted file mode 100644
index 47a0236b987..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- try
- {
-
- //Load the reader with the XML file.
- reader = gcnew XmlTextReader( "http://localhost/baseuri.xml" );
-
- //Parse the file and display the base URI for each node.
- while ( reader->Read() )
- {
- Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp
deleted file mode 100644
index e63d63dc208..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- try
- {
-
- //Load the reader with the XML file.
- reader = gcnew XmlTextReader( "attrs.xml" );
-
- //Read the ISBN attribute.
- reader->MoveToContent();
- String^ isbn = reader->GetAttribute( "ISBN" );
- Console::WriteLine( "The ISBN value: {0}", isbn );
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp
deleted file mode 100644
index f61a0885d7c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- String^ filename = "tworeads.xml";
- XmlTextReader^ reader = gcnew XmlTextReader( filename );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Read the first part of the XML document
- while ( reader->Read() )
- {
-
- // Display the elements and stop reading on the book endelement tag
- // then go to ReadPart2 to start another reader to read the rest of the file.
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::WriteLine( "Name: {0}", reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::WriteLine( " Element Text: {0}", reader->Value );
- break;
-
- case XmlNodeType::EndElement:
-
- // Stop reading when the reader gets to the end element of the book node.
- if ( "book" == reader->LocalName )
- {
- Console::WriteLine( "End reading first book..." );
- Console::WriteLine();
- goto ReadPart2;
- }
- break;
- }
- }
-
-
- // Read the rest of the XML document
-
-ReadPart2:
- Console::WriteLine( "Begin reading second book..." );
-
- // Create a new reader to read the rest of the document.
- XmlTextReader^ reader2 = gcnew XmlTextReader( reader->GetRemainder() );
- while ( reader2->Read() )
- {
- switch ( reader2->NodeType )
- {
- case XmlNodeType::Element:
- Console::WriteLine( "Name: {0}", reader2->Name );
- break;
-
- case XmlNodeType::Text:
- Console::WriteLine( " Element Text: {0}", reader2->Value );
- break;
-
- case XmlNodeType::EndElement:
-
- // Stop reading when the reader gets to the end element of the book node.
- if ( "book" == reader2->LocalName )
- {
- Console::WriteLine( "End reading second book..." );
- goto Done;
- }
- break;
- }
- }
-
-
-Done:
- Console::WriteLine( "Done." );
- reader->Close();
- reader2->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp
deleted file mode 100644
index 96ecc78d7af..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- try
- {
-
- //Load the reader with the XML file.
- reader = gcnew XmlTextReader( "book1.xml" );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- //Parse the file and display each node.
- while ( reader->Read() )
- {
- if ( reader->HasValue )
- Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value );
- else
- Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp
deleted file mode 100644
index a5d564f75ff..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- try
- {
-
- // Load the reader with the XML file.
- reader = gcnew XmlTextReader( "book2.xml" );
-
- // Parse the file. If they exist, display the prefix and
- // namespace URI of each node.
- while ( reader->Read() )
- {
- if ( reader->IsStartElement() )
- {
- if ( reader->Prefix == String::Empty )
- Console::WriteLine( "<{0}>", reader->LocalName );
- else
- {
- Console::Write( "<{0}:{1}>", reader->Prefix, reader->LocalName );
- Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI );
- }
- }
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp
deleted file mode 100644
index 21a005822c1..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-
-public ref class Class1
-{
- //
-public:
- void DisplayAttributes( XmlReader^ reader )
- {
- if ( reader->HasAttributes )
- {
- Console::WriteLine( "Attributes of <{0}>", reader->Name );
- for ( int i = 0; i < reader->AttributeCount; i++ )
- {
- reader->MoveToAttribute( i );
- Console::Write( " {0}={1}", reader->Name, reader->Value );
-
- }
- reader->MoveToElement(); //Moves the reader back to the element node.
- }
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp
deleted file mode 100644
index b5a9bd22ca6..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- try
- {
-
- //Load the reader with the XML file.
- reader = gcnew XmlTextReader( "attrs.xml" );
-
- //Read the genre attribute.
- reader->MoveToContent();
- reader->MoveToFirstAttribute();
- String^ genre = reader->Value;
- Console::WriteLine( "The genre value: {0}", genre );
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp
deleted file mode 100644
index e6fe1c8a26a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- String^ filename = "items.xml";
- try
- {
-
- // Load the reader with the data file and ignore all white space nodes.
- reader = gcnew XmlTextReader( filename );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Parse the file and display each of the nodes.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::Write( "<{0}>", reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::Write( reader->Value );
- break;
-
- case XmlNodeType::CDATA:
- Console::Write( "", reader->Value );
- break;
-
- case XmlNodeType::ProcessingInstruction:
- Console::Write( "{0} {1}?>", reader->Name, reader->Value );
- break;
-
- case XmlNodeType::Comment:
- Console::Write( "", reader->Value );
- break;
-
- case XmlNodeType::XmlDeclaration:
- Console::Write( "" );
- break;
-
- case XmlNodeType::Document:
- break;
-
- case XmlNodeType::DocumentType:
- Console::Write( "Name, reader->Value );
- break;
-
- case XmlNodeType::EntityReference:
- Console::Write( reader->Name );
- break;
-
- case XmlNodeType::EndElement:
- Console::Write( "{0}>", reader->Name );
- break;
- }
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp
deleted file mode 100644
index e47fe405c6d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- String^ filename = "binary.xml";
- try
- {
- reader = gcnew XmlTextReader( filename );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Read the file. Stop at the Base64 element.
- while ( reader->Read() )
- {
- if ( "Base64" == reader->Name )
- break;
- }
-
- // Read the Base64 data. Write the decoded
- // bytes to the console.
- Console::WriteLine( "Reading Base64... " );
- int base64len = 0;
- array^base64 = gcnew array(1000);
- do
- {
- base64len = reader->ReadBase64( base64, 0, 50 );
- for ( int i = 0; i < base64len; i++ )
- Console::Write( base64[ i ] );
- }
- while ( reader->Name->Equals( "Base64" ) );
-
- // Read the BinHex data. Write the decoded
- // bytes to the console.
- Console::WriteLine( "\r\nReading BinHex..." );
- int binhexlen = 0;
- array^binhex = gcnew array(1000);
- do
- {
- binhexlen = reader->ReadBinHex( binhex, 0, 50 );
- for ( int i = 0; i < binhexlen; i++ )
- Console::Write( binhex[ i ] );
- }
- while ( reader->Name->Equals( "BinHex" ) );
- }
- finally
- {
- Console::WriteLine();
- Console::WriteLine( "Processing of the file {0} complete.", filename );
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp
deleted file mode 100644
index f4197a14142..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-
-// Reads an XML document using ReadChars
-int main()
-{
- XmlTextReader^ reader = nullptr;
- String^ filename = "items.xml";
- try
- {
-
- // Declare variables used by ReadChars
- array^buffer;
- int iCnt = 0;
- int charbuffersize;
-
- // Load the reader with the data file. Ignore white space.
- reader = gcnew XmlTextReader( filename );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Set variables used by ReadChars.
- charbuffersize = 10;
- buffer = gcnew array(charbuffersize);
-
- // Parse the file. Read the element content
- // using the ReadChars method.
- reader->MoveToContent();
- while ( (iCnt = reader->ReadChars( buffer, 0, charbuffersize )) > 0 )
- {
-
- // Print out chars read and the buffer contents.
- Console::WriteLine( " Chars read to buffer:{0}", iCnt );
- Console::WriteLine( " Buffer: [{0}]", gcnew String( buffer,0,iCnt ) );
-
- // Clear the buffer.
- Array::Clear( buffer, 0, charbuffersize );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp
deleted file mode 100644
index f64733ec447..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-void ReadXML( XmlParserContext^ context, String^ xmlFrag, WhitespaceHandling ws )
-{
-
- //Create the reader and specify the WhitespaceHandling setting.
- XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context );
- reader->WhitespaceHandling = ws;
-
- //Parse the XML and display each of the nodes.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::WriteLine( "{0}: <{1}>", reader->NodeType, reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::WriteLine( "{0}: {1}", reader->NodeType, reader->Value );
- break;
-
- case XmlNodeType::EndElement:
- Console::WriteLine( "{0}: {1}>", reader->NodeType, reader->Name );
- break;
-
- case XmlNodeType::Whitespace:
- Console::WriteLine( "{0}:", reader->NodeType );
- break;
-
- case XmlNodeType::SignificantWhitespace:
- Console::WriteLine( "{0}:", reader->NodeType );
- break;
- }
- }
-
-
- //Close the reader.
- reader->Close();
-}
-
-int main()
-{
-
- //Create the XML fragment to be parsed.
- String^ xmlFrag = " "
- " Pride And Prejudice"
- " novel"
- "";
-
- //Create the XmlNamespaceManager.
- NameTable^ nt = gcnew NameTable;
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt );
-
- //Create the XmlParserContext.
- XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::Default );
- Console::WriteLine( "Read the XML and ignore all white space..." );
- ReadXML( context, xmlFrag, WhitespaceHandling::None );
- Console::WriteLine( "\r\nRead the XML including white space nodes..." );
- ReadXML( context, xmlFrag, WhitespaceHandling::All );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp
deleted file mode 100644
index fb1cc689964..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- //Create a writer to write XML to the console.
- XmlTextWriter^ writer = nullptr;
- writer = gcnew XmlTextWriter( Console::Out );
-
- //Use indentation for readability.
- writer->Formatting = Formatting::Indented;
- writer->Indentation = 4;
-
- //Write an element (this one is the root).
- writer->WriteStartElement( "book" );
-
- //Write the title element.
- writer->WriteStartElement( "title" );
- writer->WriteString( "Pride And Prejudice" );
- writer->WriteEndElement();
-
- //Write the close tag for the root element.
- writer->WriteEndElement();
-
- //Write the XML to file and close the writer.
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp
deleted file mode 100644
index f9eaffb0162..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextWriter^ writer = nullptr;
- String^ filename = "sampledata.xml";
- writer = gcnew XmlTextWriter( filename, nullptr );
-
- //Use indenting for readability.
- writer->Formatting = Formatting::Indented;
-
- //Write the XML delcaration
- writer->WriteStartDocument();
-
- //Write the ProcessingInstruction node.
- String^ PItext = "type=\"text/xsl\" href=\"book.xsl\"";
- writer->WriteProcessingInstruction( "xml-stylesheet", PItext );
-
- //Write the DocumentType node.
- writer->WriteDocType( "book", nullptr, nullptr, "" );
-
- //Write a Comment node.
- writer->WriteComment( "sample XML" );
-
- //Write the root element.
- writer->WriteStartElement( "book" );
-
- //Write the genre attribute.
- writer->WriteAttributeString( "genre", "novel" );
-
- //Write the ISBN attribute.
- writer->WriteAttributeString( "ISBN", "1-8630-014" );
-
- //Write the title.
- writer->WriteElementString( "title", "The Handmaid's Tale" );
-
- //Write the style element.
- writer->WriteStartElement( "style" );
- writer->WriteEntityRef( "h" );
- writer->WriteEndElement();
-
- //Write the price.
- writer->WriteElementString( "price", "19.95" );
-
- //Write CDATA.
- writer->WriteCData( "Prices 15% off!!" );
-
- //Write the close tag for the root element.
- writer->WriteEndElement();
- writer->WriteEndDocument();
-
- //Write the XML to file and close the writer.
- writer->Flush();
- writer->Close();
-
- //Load the file into an XmlDocument to ensure well formed XML.
- XmlDocument^ doc = gcnew XmlDocument;
-
- //Preserve white space for readability.
- doc->PreserveWhitespace = true;
-
- //Load the file.
- doc->Load( filename );
-
- //Display the XML content to the console.
- Console::Write( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp
deleted file mode 100644
index 51d524810dc..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- //Create a writer to write XML to the console.
- XmlTextWriter^ writer = nullptr;
- writer = gcnew XmlTextWriter( Console::Out );
-
- //Use indentation for readability.
- writer->Formatting = Formatting::Indented;
-
- //Write an element (this one is the root).
- writer->WriteStartElement( "order" );
-
- //Write some attributes.
- writer->WriteAttributeString( "date", "2/19/01" );
- writer->WriteAttributeString( "orderID", "136A5" );
-
- //Write a full end element. Because this element has no
- //content, calling WriteEndElement would have written a
- //short end tag '/>'.
- writer->WriteFullEndElement();
-
- //Write the XML to file and close the writer
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp
deleted file mode 100644
index 2adeaa8ff54..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextWriter^ writer = nullptr;
- String^ filename = "sampledata.xml";
- writer = gcnew XmlTextWriter( filename, nullptr );
-
- // Use indenting for readability.
- writer->Formatting = Formatting::Indented;
-
- // Write the root element.
- writer->WriteStartElement( "schema" );
-
- // Write the namespace declarations.
- writer->WriteAttributeString( "xmlns", nullptr, "http://www.w3.org/2001/XMLSchema" );
- writer->WriteAttributeString( "xmlns", "po", nullptr, "http://contoso.com/po" );
- writer->WriteStartElement( "element" );
- writer->WriteAttributeString( "name", "purchaseOrder" );
-
- // Write the type attribute.
- writer->WriteStartAttribute( nullptr, "type", nullptr );
- writer->WriteQualifiedName( "PurchaseOrder", "http://contoso.com/po" );
- writer->WriteEndAttribute();
- writer->WriteEndElement();
-
- // Write the close tag for the root element.
- writer->WriteEndElement();
-
- // Write the XML to file and close the writer.
- writer->Flush();
- writer->Close();
-
- // Read the file back in and parse to ensure well formed XML.
- XmlDocument^ doc = gcnew XmlDocument;
-
- // Preserve white space for readability.
- doc->PreserveWhitespace = true;
-
- // Load the file.
- doc->Load( filename );
-
- // Write the XML content to the console.
- Console::Write( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp
deleted file mode 100644
index 147d3385162..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create a writer that outputs to the console.
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
-
- // Write the root element.
- writer->WriteStartElement( "Items" );
-
- // Write a string using WriteRaw. Note that the special
- // characters are not escaped.
- writer->WriteStartElement( "Item" );
- writer->WriteString( "Write unescaped text: " );
- writer->WriteRaw( "this & that" );
- writer->WriteEndElement();
-
- // Write the same string using WriteString. Note that the
- // special characters are escaped.
- writer->WriteStartElement( "Item" );
- writer->WriteString( "Write the same string using WriteString: " );
- writer->WriteString( "this & that" );
- writer->WriteEndElement();
-
- // Write the close tag for the root element.
- writer->WriteEndElement();
-
- // Write the XML to file and close the writer.
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp
deleted file mode 100644
index 7ebefe6b4d0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextWriter^ writer = nullptr;
- String^ filename = "sampledata.xml";
- writer = gcnew XmlTextWriter( filename, nullptr );
-
- //Use indenting for readability.
- writer->Formatting = Formatting::Indented;
-
- //Write the XML delcaration.
- writer->WriteStartDocument();
-
- //Write the ProcessingInstruction node.
- String^ PItext = "type='text/xsl' href='book.xsl'";
- writer->WriteProcessingInstruction( "xml-stylesheet", PItext );
-
- //Write the DocumentType node.
- writer->WriteDocType( "book", nullptr, nullptr, "" );
-
- //Write a Comment node.
- writer->WriteComment( "sample XML" );
-
- //Write a root element.
- writer->WriteStartElement( "book" );
-
- //Write the genre attribute.
- writer->WriteAttributeString( "genre", "novel" );
-
- //Write the ISBN attribute.
- writer->WriteAttributeString( "ISBN", "1-8630-014" );
-
- //Write the title.
- writer->WriteElementString( "title", "The Handmaid's Tale" );
-
- //Write the style element.
- writer->WriteStartElement( "style" );
- writer->WriteEntityRef( "h" );
- writer->WriteEndElement();
-
- //Write the price.
- writer->WriteElementString( "price", "19.95" );
-
- //Write CDATA.
- writer->WriteCData( "Prices 15% off!!" );
-
- //Write the close tag for the root element.
- writer->WriteEndElement();
- writer->WriteEndDocument();
-
- //Write the XML to file and close the writer.
- writer->Flush();
- writer->Close();
-
- //Load the file into an XmlDocument to ensure well formed XML.
- XmlDocument^ doc = gcnew XmlDocument;
-
- //Preserve white space for readability.
- doc->PreserveWhitespace = true;
-
- //Load the file.
- doc->Load( filename );
-
- //Display the XML content to the console.
- Console::Write( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp
deleted file mode 100644
index d18c68662b6..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- String^ filename = "sampledata.xml";
- XmlTextWriter^ writer = gcnew XmlTextWriter( filename, nullptr );
-
- //Use indenting for readability.
- writer->Formatting = Formatting::Indented;
- writer->WriteComment( "sample XML fragment" );
-
- //Write an element (this one is the root).
- writer->WriteStartElement( "bookstore" );
-
- //Write the namespace declaration.
- writer->WriteAttributeString( "xmlns", "bk", nullptr, "urn:samples" );
- writer->WriteStartElement( "book" );
-
- //Lookup the prefix and then write the ISBN attribute.
- String^ prefix = writer->LookupPrefix( "urn:samples" );
- writer->WriteStartAttribute( prefix, "ISBN", "urn:samples" );
- writer->WriteString( "1-861003-78" );
- writer->WriteEndAttribute();
-
- //Write the title.
- writer->WriteStartElement( "title" );
- writer->WriteString( "The Handmaid's Tale" );
- writer->WriteEndElement();
-
- //Write the price.
- writer->WriteElementString( "price", "19.95" );
-
- //Write the style element.
- writer->WriteStartElement( prefix, "style", "urn:samples" );
- writer->WriteString( "hardcover" );
- writer->WriteEndElement();
-
- //Write the end tag for the book element.
- writer->WriteEndElement();
-
- //Write the close tag for the root element.
- writer->WriteEndElement();
-
- //Write the XML to file and close the writer.
- writer->Flush();
- writer->Close();
-
- //Read the file back in and parse to ensure well formed XML.
- XmlDocument^ doc = gcnew XmlDocument;
-
- //Preserve white space for readability.
- doc->PreserveWhitespace = true;
-
- //Load the file
- doc->Load( filename );
-
- //Write the XML content to the console.
- Console::Write( doc->InnerXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp
deleted file mode 100644
index ef94526fc30..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlTextWriter^ writer = nullptr;
- try
- {
- writer = gcnew XmlTextWriter( Console::Out );
-
- // Write an element.
- writer->WriteStartElement( "address" );
-
- // Write an email address using entities
- // for the @ and . characters.
- writer->WriteString( "someone" );
- writer->WriteCharEntity( '@' );
- writer->WriteString( "example" );
- writer->WriteCharEntity( '.' );
- writer->WriteString( "com" );
- writer->WriteEndElement();
- }
- finally
- {
-
- // Close the writer.
- if ( writer != nullptr )
- writer->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp
deleted file mode 100644
index e5fd8acae1e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the writer.
- XmlTextWriter^ writer = nullptr;
- writer = gcnew XmlTextWriter( "ws.html", nullptr );
-
- // Write an element (this one is the root).
- writer->WriteStartElement( "p" );
-
- // Write the xml:space attribute.
- writer->WriteAttributeString( "xml", "space", nullptr, "preserve" );
-
- // Verify that xml:space is set properly.
- if ( writer->XmlSpace == XmlSpace::Preserve )
- Console::WriteLine( "xmlspace is correct!" );
-
-
- // Write out the HTML elements. Insert white space
- // between 'something' and 'Big'
- writer->WriteString( "something" );
- writer->WriteWhitespace( " " );
- writer->WriteElementString( "b", "B" );
- writer->WriteString( "ig" );
-
- // Write the root end element.
- writer->WriteEndElement();
-
- // Write the XML to file and close the writer.
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp
deleted file mode 100644
index be6e39b350c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-
-int main()
-{
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- Uri^ baseUri = gcnew Uri( "http://servername/tmp/test.xsl" );
- Uri^ fulluri = resolver->ResolveUri( baseUri, "includefile.xsl" );
-
- // Get a stream object containing the XSL file
- Stream^ s = dynamic_cast(resolver->GetEntity( fulluri, nullptr, Stream::typeid ));
-
- // Read the stream object displaying the contents of the XSL file
- XmlTextReader^ reader = gcnew XmlTextReader( s );
- while ( reader->Read() )
- {
- Console::WriteLine( reader->ReadOuterXml() );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp
deleted file mode 100644
index 15790751077..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-public ref class Sample
-{
-private:
- XmlNode^ currNode;
- XmlTextReader^ reader;
-
-public:
- Sample()
- {
- String^ filename = "space.xml";
- XmlDocument^ doc = gcnew XmlDocument;
- doc->LoadXml( ""
- "Eva"
- "Corets"
- "" );
- Console::WriteLine( "InnerText before..." );
- Console::WriteLine( doc->DocumentElement->InnerText );
-
- // Add white space.
- currNode = doc->DocumentElement;
- XmlWhitespace^ ws = doc->CreateWhitespace( "\r\n" );
- currNode->InsertAfter( ws, currNode->FirstChild );
- Console::WriteLine();
- Console::WriteLine( "InnerText after..." );
- Console::WriteLine( doc->DocumentElement->InnerText );
-
- // Save and then display the file.
- doc->Save( filename );
- Console::WriteLine();
- Console::WriteLine( "Reading file..." );
- ReadFile( filename );
- }
-
-
- // Parse the file and display each node.
- void ReadFile( String^ filename )
- {
- try
- {
- reader = gcnew XmlTextReader( filename );
- String^ sNodeType = nullptr;
- while ( reader->Read() )
- {
- sNodeType = NodeTypeToString( reader->NodeType );
-
- // Print the node type, name, and value.
- Console::WriteLine( "{0}<{1}> {2}", sNodeType, reader->Name, reader->Value );
- }
- }
- finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
- }
-
- static String^ NodeTypeToString( XmlNodeType nodetype )
- {
- String^ sNodeType = nullptr;
- switch ( nodetype )
- {
- case XmlNodeType::None:
- sNodeType = "None";
- break;
-
- case XmlNodeType::Element:
- sNodeType = "Element";
- break;
-
- case XmlNodeType::Attribute:
- sNodeType = "Attribute";
- break;
-
- case XmlNodeType::Text:
- sNodeType = "Text";
- break;
-
- case XmlNodeType::Comment:
- sNodeType = "Comment";
- break;
-
- case XmlNodeType::Document:
- sNodeType = "Document";
- break;
-
- case XmlNodeType::Whitespace:
- sNodeType = "Whitespace";
- break;
-
- case XmlNodeType::SignificantWhitespace:
- sNodeType = "SignificantWhitespace";
- break;
-
- case XmlNodeType::EndElement:
- sNodeType = "EndElement";
- break;
- }
- return sNodeType;
- }
-
-};
-
-int main()
-{
- gcnew Sample;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp
deleted file mode 100644
index fed23d6f782..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-
-int main()
-{
- String^ filename = "books.xml";
- String^ stylesheet = "output.xsl";
-
- //Load the stylesheet.
- XslTransform^ xslt = gcnew XslTransform;
- xslt->Load( stylesheet );
-
- //Load the file to transform.
- XPathDocument^ doc = gcnew XPathDocument( filename );
-
- //Create an XmlTextWriter which outputs to the console.
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
-
- //Transform the file and send the output to the console.
- xslt->Transform(doc,nullptr,writer,nullptr);
- writer->Close();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp
deleted file mode 100644
index 3c119776397..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- schema->Items->Add(element);
- element->Name = "stringElementWithAnyAttribute";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
- element->SchemaType = complexType;
-
- //
- XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent();
- complexType->ContentModel = simpleContent;
-
- //
- XmlSchemaSimpleContentExtension^ extension = gcnew XmlSchemaSimpleContentExtension();
- simpleContent->Content = extension;
- extension->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaAnyAttribute^ anyAttribute = gcnew XmlSchemaAnyAttribute();
- extension->AnyAttribute = anyAttribute;
- anyAttribute->Namespace = "##targetNamespace";
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp
deleted file mode 100644
index 92d06d54db3..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlTextReader^ xtr = gcnew XmlTextReader("example.xsd");
- XmlSchema^ schema = XmlSchema::Read(xtr, gcnew ValidationEventHandler(ValidationCallbackOne));
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- for each (XmlSchemaObject^ schemaObject in compiledSchema->Items)
- {
- if (schemaObject->GetType() == XmlSchemaSimpleType::typeid)
- {
- XmlSchemaSimpleType^ simpleType = dynamic_cast(schemaObject);
- Console::WriteLine("{0} {1}", simpleType->Name, simpleType->Datatype->ValueType);
- }
- if (schemaObject->GetType() == XmlSchemaComplexType::typeid)
- {
- XmlSchemaComplexType^ complexType = dynamic_cast(schemaObject);
- Console::WriteLine("{0} {1}", complexType->Name, complexType->Datatype->ValueType);
- }
- }
- xtr->Close();
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp
deleted file mode 100644
index 78ca73c17ae..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType();
- simpleType->Name = "northwestStates";
- schema->Items->Add(simpleType);
-
- //
- XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation();
- simpleType->Annotation = annNorthwestStates;
-
- // States in the Pacific Northwest of US
- XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation();
- annNorthwestStates->Items->Add(docNorthwestStates);
- docNorthwestStates->Markup = TextToNodeArray("States in the Pacific Northwest of US");
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- simpleType->Content = restriction;
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaEnumerationFacet^ enumerationWA = gcnew XmlSchemaEnumerationFacet();
- restriction->Facets->Add(enumerationWA);
- enumerationWA->Value = "WA";
-
- //
- XmlSchemaAnnotation^ annWA = gcnew XmlSchemaAnnotation();
- enumerationWA->Annotation = annWA;
-
- // Washington
- XmlSchemaDocumentation^ docWA = gcnew XmlSchemaDocumentation();
- annWA->Items->Add(docWA);
- docWA->Markup = TextToNodeArray("Washington");
-
- //
- XmlSchemaEnumerationFacet^ enumerationOR = gcnew XmlSchemaEnumerationFacet();
- restriction->Facets->Add(enumerationOR);
- enumerationOR->Value = "OR";
-
- //
- XmlSchemaAnnotation^ annOR = gcnew XmlSchemaAnnotation();
- enumerationOR->Annotation = annOR;
-
- // Oregon
- XmlSchemaDocumentation^ docOR = gcnew XmlSchemaDocumentation();
- annOR->Items->Add(docOR);
- docOR->Markup = TextToNodeArray("Oregon");
-
- //
- XmlSchemaEnumerationFacet^ enumerationID = gcnew XmlSchemaEnumerationFacet();
- restriction->Facets->Add(enumerationID);
- enumerationID->Value = "ID";
-
- //
- XmlSchemaAnnotation^ annID = gcnew XmlSchemaAnnotation();
- enumerationID->Annotation = annID;
-
- // Idaho
- XmlSchemaDocumentation^ docID = gcnew XmlSchemaDocumentation();
- annID->Items->Add(docID);
- docID->Markup = TextToNodeArray("Idaho");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
- static array^ TextToNodeArray(String^ text)
- {
- XmlDocument^ doc = gcnew XmlDocument();
- array^ nodes = gcnew array {doc->CreateTextNode(text)};
- return nodes;
- }
-
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp
deleted file mode 100644
index cb71c94ba29..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaElement^ elementCat = gcnew XmlSchemaElement();
- schema->Items->Add(elementCat);
- elementCat->Name = "cat";
- elementCat->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementDog = gcnew XmlSchemaElement();
- schema->Items->Add(elementDog);
- elementDog->Name = "dog";
- elementDog->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaElement^ elementRedDog = gcnew XmlSchemaElement();
- schema->Items->Add(elementRedDog);
- elementRedDog->Name = "redDog";
- elementRedDog->SubstitutionGroup = gcnew XmlQualifiedName("dog");
-
- //
- XmlSchemaElement^ elementBrownDog = gcnew XmlSchemaElement();
- schema->Items->Add(elementBrownDog);
- elementBrownDog->Name = "brownDog";
- elementBrownDog->SubstitutionGroup = gcnew XmlQualifiedName("dog");
-
- //
- XmlSchemaElement^ elementPets = gcnew XmlSchemaElement();
- schema->Items->Add(elementPets);
- elementPets->Name = "pets";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
- elementPets->SchemaType = complexType;
-
- //
- XmlSchemaChoice^ choice = gcnew XmlSchemaChoice();
- complexType->Particle = choice;
- choice->MinOccurs = 0;
- choice->MaxOccursString = "unbounded";
-
- //
- XmlSchemaElement^ catRef = gcnew XmlSchemaElement();
- choice->Items->Add(catRef);
- catRef->RefName = gcnew XmlQualifiedName("cat");
-
- //
- XmlSchemaElement^ dogRef = gcnew XmlSchemaElement();
- choice->Items->Add(dogRef);
- dogRef->RefName = gcnew XmlQualifiedName("dog");
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp
deleted file mode 100644
index acf2f9e018f..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-class XmlSchemaExamples
-{
-public:
-
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ RatingType = gcnew XmlSchemaSimpleType();
- RatingType->Name = "RatingType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaTotalDigitsFacet^ totalDigits = gcnew XmlSchemaTotalDigitsFacet();
- totalDigits->Value = "2";
- restriction->Facets->Add(totalDigits);
-
- //
- XmlSchemaFractionDigitsFacet^ fractionDigits = gcnew XmlSchemaFractionDigitsFacet();
- fractionDigits->Value = "1";
- restriction->Facets->Add(fractionDigits);
-
- RatingType->Content = restriction;
-
- schema->Items->Add(RatingType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "movie";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ ratingAttribute = gcnew XmlSchemaAttribute();
- ratingAttribute->Name = "rating";
- ratingAttribute->SchemaTypeName = gcnew XmlQualifiedName("RatingType", "");
- complexType->Attributes->Add(ratingAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-};
-
-int main()
-{
- XmlSchemaExamples::Main();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp
deleted file mode 100644
index 777c38d292a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class ImportIncludeSample
-{
-private:
- static void ValidationCallBack(Object^ sender, ValidationEventArgs^ args)
- {
-
- if (args->Severity == XmlSeverityType::Warning)
- Console::Write("WARNING: ");
- else if (args->Severity == XmlSeverityType::Error)
- Console::Write("ERROR: ");
-
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
- schema->ElementFormDefault = XmlSchemaForm::Qualified;
- schema->TargetNamespace = "http://www.w3.org/2001/05/XMLInfoset";
-
- //
- XmlSchemaImport^ import = gcnew XmlSchemaImport();
- import->Namespace = "http://www.example.com/IPO";
- schema->Includes->Add(import);
-
- //
- XmlSchemaInclude^ include = gcnew XmlSchemaInclude();
- include->SchemaLocation = "example.xsd";
- schema->Includes->Add(include);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-
-};
-
-int main()
-{
- ImportIncludeSample::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp
deleted file mode 100644
index 89d0bf0c37b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::Schema;
-public ref class XmlSchemaObjectGenerator
-{
-private:
- static void ValidationCallback( Object^ /*sender*/, ValidationEventArgs^ args )
- {
- if ( args->Severity == XmlSeverityType::Warning )
- Console::Write( "WARNING: " );
- else
- if ( args->Severity == XmlSeverityType::Error )
- Console::Write( "ERROR: " );
-
- Console::WriteLine( args->Message );
- }
-
- // XmlSchemaObjectGenerator
- int main()
- {
- XmlTextReader^ tr = gcnew XmlTextReader( "empty.xsd" );
- XmlSchema^ schema = XmlSchema::Read( tr, gcnew ValidationEventHandler( XmlSchemaObjectGenerator::ValidationCallback ) );
- schema->ElementFormDefault = XmlSchemaForm::Qualified;
- schema->TargetNamespace = "http://www.example.com/Report";
- {
- XmlSchemaElement^ element = gcnew XmlSchemaElement;
- element->Name = "purchaseReport";
- XmlSchemaComplexType^ element_complexType = gcnew XmlSchemaComplexType;
- XmlSchemaSequence^ element_complexType_sequence = gcnew XmlSchemaSequence;
- {
- XmlSchemaElement^ element_complexType_sequence_element = gcnew XmlSchemaElement;
- element_complexType_sequence_element->Name = "region";
- element_complexType_sequence_element->SchemaTypeName = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" );
- {
- XmlSchemaKeyref^ element_complexType_sequence_element_keyref = gcnew XmlSchemaKeyref;
- element_complexType_sequence_element_keyref->Name = "dummy2";
- element_complexType_sequence_element_keyref->Selector = gcnew XmlSchemaXPath;
- element_complexType_sequence_element_keyref->Selector->XPath = "r:zip/r:part";
- {
- XmlSchemaXPath^ field = gcnew XmlSchemaXPath;
- field->XPath = "@number";
- element_complexType_sequence_element_keyref->Fields->Add( field );
- }
- element_complexType_sequence_element_keyref->Refer = gcnew XmlQualifiedName( "pNumKey","http://www.example.com/Report" );
- element_complexType_sequence_element->Constraints->Add( element_complexType_sequence_element_keyref );
- }
- element_complexType_sequence->Items->Add( element_complexType_sequence_element );
- }
- element_complexType->Particle = element_complexType_sequence;
- {
- XmlSchemaAttribute^ element_complexType_attribute = gcnew XmlSchemaAttribute;
- element_complexType_attribute->Name = "periodEnding";
- element_complexType_attribute->SchemaTypeName = gcnew XmlQualifiedName( "date","http://www.w3.org/2001/XMLSchema" );
- element_complexType->Attributes->Add( element_complexType_attribute );
- }
- element->SchemaType = element_complexType;
- {
- XmlSchemaKey^ element_key = gcnew XmlSchemaKey;
- element_key->Name = "pNumKey";
- element_key->Selector = gcnew XmlSchemaXPath;
- element_key->Selector->XPath = "r:parts/r:part";
- {
- XmlSchemaXPath^ field = gcnew XmlSchemaXPath;
- field->XPath = "@number";
- element_key->Fields->Add( field );
- }
- element->Constraints->Add( element_key );
- }
- schema->Items->Add( element );
- }
- schema->Write( Console::Out );
-
- return 0;
- } // main
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp
deleted file mode 100644
index 47765242264..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType();
- ZipCodeType->Name = "ZipCodeType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaLengthFacet^ length = gcnew XmlSchemaLengthFacet();
- length->Value = "5";
- restriction->Facets->Add(length);
-
- ZipCodeType->Content = restriction;
-
- schema->Items->Add(ZipCodeType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "Address";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute();
- ZipCodeAttribute->Name = "ZipCode";
- ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", "");
- complexType->Attributes->Add(ZipCodeAttribute);
-
- element->SchemaType = complexType;
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp
deleted file mode 100644
index a66dd7e2553..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ WaitQueueLengthType = gcnew XmlSchemaSimpleType();
- WaitQueueLengthType->Name = "WaitQueueLengthType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMaxExclusiveFacet^ maxExclusive = gcnew XmlSchemaMaxExclusiveFacet();
- maxExclusive->Value = "5";
- restriction->Facets->Add(maxExclusive);
-
- WaitQueueLengthType->Content = restriction;
-
- schema->Items->Add(WaitQueueLengthType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "Lobby";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ WaitQueueLengthAttribute = gcnew XmlSchemaAttribute();
- WaitQueueLengthAttribute->Name = "WaitQueueLength";
- WaitQueueLengthAttribute->SchemaTypeName = gcnew XmlQualifiedName("WaitQueueLengthType", "");
- complexType->Attributes->Add(WaitQueueLengthAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp
deleted file mode 100644
index f27f5519922..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ WaitQueueLengthType = gcnew XmlSchemaSimpleType();
- WaitQueueLengthType->Name = "WaitQueueLengthType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet();
- maxInclusive->Value = "5";
- restriction->Facets->Add(maxInclusive);
-
- WaitQueueLengthType->Content = restriction;
-
- schema->Items->Add(WaitQueueLengthType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "Lobby";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ WaitQueueLengthAttribute = gcnew XmlSchemaAttribute();
- WaitQueueLengthAttribute->Name = "WaitQueueLength";
- WaitQueueLengthAttribute->SchemaTypeName = gcnew XmlQualifiedName("WaitQueueLengthType", "");
- complexType->Attributes->Add(WaitQueueLengthAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp
deleted file mode 100644
index b50d96ac18d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType();
- ZipCodeType->Name = "ZipCodeType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMaxLengthFacet^ maxLength = gcnew XmlSchemaMaxLengthFacet();
- maxLength->Value = "10";
- restriction->Facets->Add(maxLength);
-
- ZipCodeType->Content = restriction;
-
- schema->Items->Add(ZipCodeType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "Address";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute();
- ZipCodeAttribute->Name = "ZipCode";
- ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", "");
-
- complexType->Attributes->Add(ZipCodeAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp
deleted file mode 100644
index 34816fb1131..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ OrderQuantityType = gcnew XmlSchemaSimpleType();
- OrderQuantityType->Name = "OrderQuantityType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMinExclusiveFacet^ MinExclusive = gcnew XmlSchemaMinExclusiveFacet();
- MinExclusive->Value = "5";
- restriction->Facets->Add(MinExclusive);
-
- OrderQuantityType->Content = restriction;
-
- schema->Items->Add(OrderQuantityType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "item";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ OrderQuantityAttribute = gcnew XmlSchemaAttribute();
- OrderQuantityAttribute->Name = "OrderQuantity";
- OrderQuantityAttribute->SchemaTypeName = gcnew XmlQualifiedName("OrderQuantityType", "");
- complexType->Attributes->Add(OrderQuantityAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp
deleted file mode 100644
index 8b460bf9a13..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ OrderQuantityType = gcnew XmlSchemaSimpleType();
- OrderQuantityType->Name = "OrderQuantityType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMinInclusiveFacet^ minInclusive = gcnew XmlSchemaMinInclusiveFacet();
- minInclusive->Value = "5";
- restriction->Facets->Add(minInclusive);
-
- OrderQuantityType->Content = restriction;
-
- schema->Items->Add(OrderQuantityType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "item";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ OrderQuantityAttribute = gcnew XmlSchemaAttribute();
- OrderQuantityAttribute->Name = "OrderQuantity";
- OrderQuantityAttribute->SchemaTypeName = gcnew XmlQualifiedName("OrderQuantityType", "");
- complexType->Attributes->Add(OrderQuantityAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp
deleted file mode 100644
index 7bc0e93f86c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
-
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType();
- ZipCodeType->Name = "ZipCodeType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaMinLengthFacet^ minLength = gcnew XmlSchemaMinLengthFacet();
- minLength->Value = "5";
- restriction->Facets->Add(minLength);
-
- ZipCodeType->Content = restriction;
-
- schema->Items->Add(ZipCodeType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "Address";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute();
- ZipCodeAttribute->Name = "ZipCode";
- ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", "");
- complexType->Attributes->Add(ZipCodeAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp
deleted file mode 100644
index c21f9400afa..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType();
- ZipCodeType->Name = "ZipCodeType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaPatternFacet^ pattern = gcnew XmlSchemaPatternFacet();
- pattern->Value = "[0-9]{5}(-[0-9]{4})?";
- restriction->Facets->Add(pattern);
-
- ZipCodeType->Content = restriction;
-
- schema->Items->Add(ZipCodeType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "Address";
-
- //
- XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute();
- ZipCodeAttribute->Name = "ZipCode";
- ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", "");
- complexType->Attributes->Add(ZipCodeAttribute);
-
- element->SchemaType = complexType;
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp
deleted file mode 100644
index 2f67440b88f..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ StringOrIntType = gcnew XmlSchemaSimpleType();
- StringOrIntType->Name = "StringOrIntType";
- schema->Items->Add(StringOrIntType);
-
- //
- XmlSchemaSimpleTypeUnion^ union1 = gcnew XmlSchemaSimpleTypeUnion();
- StringOrIntType->Content = union1;
-
- //
- XmlSchemaSimpleType^ simpleType1 = gcnew XmlSchemaSimpleType();
- union1->BaseTypes->Add(simpleType1);
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction1 = gcnew XmlSchemaSimpleTypeRestriction();
- restriction1->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
- simpleType1->Content = restriction1;
-
- //
- XmlSchemaSimpleType^ simpleType2 = gcnew XmlSchemaSimpleType();
- union1->BaseTypes->Add(simpleType2);
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction2 = gcnew XmlSchemaSimpleTypeRestriction();
- restriction2->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
- simpleType2->Content = restriction2;
-
-
- //
- XmlSchemaElement^ elementSize = gcnew XmlSchemaElement();
- elementSize->Name = "size";
- elementSize->SchemaTypeName = gcnew XmlQualifiedName("StringOrIntType");
- schema->Items->Add(elementSize);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp
deleted file mode 100644
index 27611f0c5e7..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaComplexType^ customerOrderType = gcnew XmlSchemaComplexType();
- customerOrderType->Name = "customerOrderType";
-
- //
- XmlSchemaSequence^ sequence1 = gcnew XmlSchemaSequence();
-
- //
- XmlSchemaElement^ item = gcnew XmlSchemaElement();
- item->MinOccurs = 0;
- item->MaxOccursString = "unbounded";
- item->Name = "item";
-
- //
- XmlSchemaComplexType^ ct1 = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaAttribute^ itemID = gcnew XmlSchemaAttribute();
- itemID->Name = "itemID";
- itemID->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- ct1->Attributes->Add(itemID);
-
- //
- item->SchemaType = ct1;
-
- //
- sequence1->Items->Add(item);
- customerOrderType->Particle = sequence1;
-
- //
- XmlSchemaAttribute^ CustomerID = gcnew XmlSchemaAttribute();
- CustomerID->Name = "CustomerID";
- CustomerID->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- customerOrderType->Attributes->Add(CustomerID);
-
- //
- schema->Items->Add(customerOrderType);
-
- //
- XmlSchemaElement^ ordersByCustomer = gcnew XmlSchemaElement();
- ordersByCustomer->Name = "ordersByCustomer";
-
- //
- XmlSchemaComplexType^ ct2 = gcnew XmlSchemaComplexType();
-
- //
- XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence();
-
- //
- XmlSchemaElement^ customerOrders = gcnew XmlSchemaElement();
- customerOrders->MinOccurs = 0;
- customerOrders->MaxOccursString = "unbounded";
- customerOrders->Name = "customerOrders";
- customerOrders->SchemaTypeName = gcnew XmlQualifiedName("customerOrderType", "");
-
- //
- sequence2->Items->Add(customerOrders);
-
- //
- ct2->Particle = sequence2;
- ordersByCustomer->SchemaType = ct2;
-
- //
- XmlSchemaUnique^ element_unique = gcnew XmlSchemaUnique();
- element_unique->Name = "oneCustomerOrdersforEachCustomerID";
-
- //
- element_unique->Selector = gcnew XmlSchemaXPath();
- element_unique->Selector->XPath = "customerOrders";
-
- //
- XmlSchemaXPath^ field = gcnew XmlSchemaXPath();
- field->XPath = "@customerID";
-
- //
- element_unique->Fields->Add(field);
- ordersByCustomer->Constraints->Add(element_unique);
-
- //
- schema->Items->Add(ordersByCustomer);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp
deleted file mode 100644
index 82b40e0837b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XMLSchemaExamples
-{
-private:
- static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args)
- {
- Console::WriteLine(args->Message);
- }
-
-public:
- static void Main()
- {
- XmlSchema^ schema = gcnew XmlSchema();
-
- //
- XmlSchemaSimpleType^ NameType = gcnew XmlSchemaSimpleType();
- NameType->Name = "NameType";
-
- //
- XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction();
- restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
-
- //
- XmlSchemaWhiteSpaceFacet^ whiteSpace = gcnew XmlSchemaWhiteSpaceFacet();
- whiteSpace->Value = "collapse";
- restriction->Facets->Add(whiteSpace);
-
- NameType->Content = restriction;
-
- schema->Items->Add(NameType);
-
- //
- XmlSchemaElement^ element = gcnew XmlSchemaElement();
- element->Name = "LastName";
- element->SchemaTypeName = gcnew XmlQualifiedName("NameType", "");
-
- schema->Items->Add(element);
-
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne);
- schemaSet->Add(schema);
- schemaSet->Compile();
-
- XmlSchema^ compiledSchema = nullptr;
-
- for each (XmlSchema^ schema1 in schemaSet->Schemas())
- {
- compiledSchema = schema1;
- }
-
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable());
- nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
- compiledSchema->Write(Console::Out, nsmgr);
- }
-};
-
-int main()
-{
- XMLSchemaExamples::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp b/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp
deleted file mode 100644
index 31d19ed131b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::XPath;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "books.xml" );
-
- // Create an XPathNavigator and select all books by Plato.
- XPathNavigator^ nav = doc->CreateNavigator();
- XPathNodeIterator^ ni = nav->Select("descendant::book[author/name='Plato']");
- ni->MoveNext();
-
- // Get the first matching node and change the book price.
- XmlNode^ book = dynamic_cast(ni->Current)->GetNode();
- book->LastChild->InnerText = "12.95";
- Console::WriteLine( book->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp b/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp
deleted file mode 100644
index 8bc4192df74..00000000000
--- a/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XML fragment to be parsed.
- String^ xmlFrag = "\n"
- "\n"
- "\n"
- "240\n"
- "\n"
- "\n";
-
- // Create the XmlNamespaceManager.
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( gcnew NameTable );
-
- // Create the XmlParserContext.
- XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None );
-
- // Create the reader.
- XmlValidatingReader^ reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context );
- IXmlLineInfo^ lineInfo = (dynamic_cast(reader));
- if ( lineInfo->HasLineInfo() )
- {
-
- // Parse the XML and display each node.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition );
- Console::WriteLine( "< {0}>", reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition );
- Console::WriteLine( " {0}", reader->Value );
- break;
-
- case XmlNodeType::EndElement:
- Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition );
- Console::WriteLine( " {0}>", reader->Name );
- break;
- }
- }
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp b/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp
deleted file mode 100644
index 27ae8903478..00000000000
--- a/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
-
- //
- NameTable^ nt = gcnew NameTable;
- Object^ book = nt->Add( "book" );
- Object^ price = nt->Add( "price" );
-
- // Create the reader.
- XmlReaderSettings ^ settings = gcnew XmlReaderSettings;
- settings->NameTable = nt;
- XmlReader^ reader = XmlReader::Create( (String^)"books.xml", settings );
- reader->MoveToContent();
- reader->ReadToDescendant( "book" );
- if ( System::Object::ReferenceEquals( book, reader->Name ) )
- {
-
- // Do additional processing.
- }
- //
- //Close the reader.
- reader->Close();
-}
-
diff --git a/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp b/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp
deleted file mode 100644
index 711f1bfbba1..00000000000
--- a/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class Sample
-{
-private:
- static void Validate(String^ filename, XmlSchemaSet^ schemaSet)
- {
- Console::WriteLine();
- Console::WriteLine("\r\nValidating XML file {0}...", filename->ToString());
-
- XmlSchema^ compiledSchema;
-
- for each (XmlSchema^ schema in schemaSet->Schemas())
- {
- compiledSchema = schema;
- }
-
- XmlReaderSettings^ settings = gcnew XmlReaderSettings();
- settings->Schemas->Add(compiledSchema);
- settings->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack);
- settings->ValidationType = ValidationType::Schema;
-
- //Create the schema validating reader.
- XmlReader^ vreader = XmlReader::Create(filename, settings);
-
- while (vreader->Read()) { }
-
- //Close the reader.
- vreader->Close();
- }
-
- //Display any warnings or errors.
- static void ValidationCallBack(Object^ sender, ValidationEventArgs^ args)
- {
- if (args->Severity == XmlSeverityType::Warning)
- Console::WriteLine("\tWarning: Matching schema not found. No validation occurred." + args->Message);
- else
- Console::WriteLine("\tValidation error: " + args->Message);
- }
-
-public:
- static void Main()
- {
- //Load the XmlSchemaSet.
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- schemaSet->Add("urn:bookstore-schema", "books.xsd");
-
- //Validate the file using the schema stored in the schema set.
- //Any elements belonging to the namespace "urn:cd-schema" generate
- //a warning because there is no schema matching that namespace.
- Validate("store.xml", schemaSet);
- Console::ReadLine();
- }
-};
-
-int main()
-{
- Sample::Main();
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp b/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp
deleted file mode 100644
index beabf44763b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp
+++ /dev/null
@@ -1,1166 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::XPath;
-using namespace System::Collections;
-
-ref class XPathNavigatorMethods
-{
-public:
-
- static String^ contosobooks = "C:\\Documents and Settings\\dylanm\\My Documents\\contosoBooks.xml";
-
- static void XPathNavigatorMethods_AppendChild1()
- {
- // XPathNavigator->AppendChild()
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlWriter^ pages = navigator->AppendChild();
- pages->WriteElementString("pages", "100");
- pages->Close();
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_AppendChild2()
- {
- // XPathNavigator->AppendChild(string)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- navigator->AppendChild("100");
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
-
- static void XPathNavigatorMethods_AppendChild3()
- {
- // XPathNavigator->AppendChile(XmlReader^)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlReader^ pages = XmlReader::Create(gcnew StringReader("100"));
-
- navigator->AppendChild(pages);
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_AppendChild4()
- {
- // XPathNavigator->AppendChild(XPathNavigator^)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlDocument^ childNodes = gcnew XmlDocument();
- childNodes->Load(gcnew StringReader("100"));
- XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator();
-
-
- if (childNodesNavigator->MoveToChild("pages", "http://www.contoso.com/books"))
- {
- navigator->AppendChild(childNodesNavigator);
- }
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_AppendChildElement()
- {
- // XPathNavigator->AppendChildElement(string, string, string, string)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- navigator->AppendChildElement(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100");
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_Clone()
- {
- // XPathNavigator->Clone()
-
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- // Select all books authored by Melville.
- XPathNodeIterator^ nodes = navigator->Select("descendant::book[author/last-name='Melville']");
-
- while (nodes->MoveNext())
- {
- // Clone the navigator returned by the Current property.
- // Use the cloned navigator to get the title element.
- XPathNavigator^ clone = nodes->Current->Clone();
- clone->MoveToFirstChild();
- Console::WriteLine("Book title: {0}", clone->Value);
- }
- //
- }
-
- static void XPathNavigatorMethods_CreateAttribute()
- {
- // XPathNavigator->CreateAttribute(string, string, string, string)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- navigator->CreateAttribute("", "discount", "", "1.00");
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_CreateAttributes()
- {
- // XPathNavigator->CreateAttributes()
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlWriter^ attributes = navigator->CreateAttributes();
-
- attributes->WriteAttributeString("discount", "1.00");
- attributes->WriteAttributeString("currency", "USD");
- attributes->Close();
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_DeleteSelf()
- {
- // XPathNavigator->DeleteSelf()
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- navigator->DeleteSelf();
-
- Console::WriteLine("Position after delete: {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_DeleteRange()
- {
- // XPathNavigator->DeleteRange()
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable);
- manager->AddNamespace("bk", "http://www.contoso.com/books");
-
- XPathNavigator^ first = navigator->SelectSingleNode("/bk:bookstore/bk:book[1]", manager);
- XPathNavigator^ last = navigator->SelectSingleNode("/bk:bookstore/bk:book[2]", manager);
-
- navigator->MoveTo(first);
- navigator->DeleteRange(last);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_Evaluate1()
- {
- // XPathNavigator->Evaluate(string)
-
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- Double total = (double)navigator->Evaluate("sum(descendant::book/price)");
- Console::WriteLine("Total price for all books: {0}", total.ToString());
- //
- }
-
- static void XPathNavigatorMethods_Evaluate2()
- {
- // XPathNavigator->Evaluate(XPathExpression)
-
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XPathExpression^ query = navigator->Compile("sum(descendant::book/price)");
-
- Double total = (double)navigator->Evaluate(query);
- Console::WriteLine("Total price for all books: {0}", total.ToString());
- //
- }
-
- static void XPathNavigatorMethods_Evaluate3()
- {
- // XPathNavigator->Evaluate(string, IXmlNamespaceResolver)
-
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable);
- manager->AddNamespace("bk", "http://www.contoso.com/books");
-
- Double total = (double)navigator->Evaluate("sum(descendant::bk:book/bk:price)", manager);
- Console::WriteLine("Total price for all books: {0}", total.ToString());
- //
- }
-
- static void XPathNavigatorMethods_Evaluate4()
- {
- // XPathNavigator->Evaluate(XPathExpression, XPathNodeIterator^)
-
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XPathNodeIterator^ nodes = navigator->Select("//book");
- XPathExpression^ query = nodes->Current->Compile("sum(descendant::price)");
-
- Double total = (double)navigator->Evaluate(query, nodes);
- Console::WriteLine("Total price for all books: {0}", total.ToString());
- //
- }
-
- static void XPathNavigatorMethods_InsertAfter1()
- {
- // XPathNavigator->InsertAfter()
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlWriter^ pages = navigator->InsertAfter();
- pages->WriteElementString("pages", "100");
- pages->Close();
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertAfter2()
- {
- // XPathNavigator->InsertAfter(string)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- navigator->InsertAfter("100");
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertAfter3()
- {
- // XPathNavigator->InsertAfter(XmlReader^)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlReader^ pages = XmlReader::Create(gcnew StringReader("100"));
-
- navigator->InsertAfter(pages);
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertAfter4()
- {
- // XPathNavigator->InsertAfter(XPathNavigator^)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlDocument^ childNodes = gcnew XmlDocument();
- childNodes->Load(gcnew StringReader("100"));
- XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator();
-
- navigator->InsertAfter(childNodesNavigator);
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertBefore1()
- {
- // XPathNavigator->InsertBefore()
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlWriter^ pages = navigator->InsertBefore();
- pages->WriteElementString("pages", "100");
- pages->Close();
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertBefore2()
- {
- // XPathNavigator->InsertBefore(string)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- navigator->InsertBefore("100");
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertBefore3()
- {
- // XPathNavigator->InsertBefore(XmlReader^)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlReader^ pages = XmlReader::Create(gcnew StringReader("100"));
-
- navigator->InsertBefore(pages);
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertBefore4()
- {
- // XPathNavigator->InsertBefore(XPathNavigator^)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlDocument^ childNodes = gcnew XmlDocument();
- childNodes->Load(gcnew StringReader("100"));
- XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator();
-
- navigator->InsertBefore(childNodesNavigator);
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertElementAfter()
- {
- // XPathNavigator->InsertElementAfter(string, string, string, string)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- navigator->InsertElementAfter(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100");
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_InsertElementBefore()
- {
- // XPathNavigator->InsertElementBefore(string, string, string, string)
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- navigator->InsertElementBefore(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100");
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_Matches()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- // Select all book nodes.
- XPathNodeIterator^ nodes = navigator->SelectDescendants("book", "", false);
-
- // Select all book nodes that have the matching attribute value.
- XPathExpression^ expr = navigator->Compile("book[@genre='novel']");
- while (nodes->MoveNext())
- {
- XPathNavigator^ navigator2 = nodes->Current->Clone();
- if (navigator2->Matches(expr))
- {
- navigator2->MoveToFirstChild();
- Console::WriteLine("Book title: {0}", navigator2->Value);
- }
- }
- //
- }
-
- static void XPathNavigatorMethods_MoveToFollowing1()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToFollowing(XPathNodeType::Element);
-
- Console::WriteLine("Position: {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_MoveToFollowing2()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToFollowing("price", "http://www.contoso.com/books");
-
- Console::WriteLine("Position: {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_MoveToFollowing3()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToFollowing("price", "http://www.contoso.com/books");
- XPathNavigator^ boundary = navigator->Clone();
-
- navigator->MoveToRoot();
-
- while (navigator->MoveToFollowing(XPathNodeType::Text, boundary))
- {
- Console::WriteLine(navigator->OuterXml);
- }
- //
- }
-
- static void XPathNavigatorMethods_MoveToFollowing4()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToFollowing("book", "http://www.contoso.com/books");
- XPathNavigator^ boundary = navigator->Clone();
- boundary->MoveToFollowing("first-name", "http://www.contoso.com/books");
-
- navigator->MoveToFollowing("price", "http://www.contoso.com/books", boundary);
-
- Console::WriteLine("Position (after boundary): {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
-
- navigator->MoveToFollowing("title", "http://www.contoso.com/books", boundary);
-
- Console::WriteLine("Position (before boundary): {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- //
- static void XPathNavigatorMethods_MoveToNext()
- {
-
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
- XPathNodeIterator^ nodeset = navigator->Select("descendant::book[author/last-name='Melville']");
-
- while (nodeset->MoveNext())
- {
- // Clone iterator here when working with it.
- RecursiveWalk(nodeset->Current->Clone());
- }
- }
-
- static void RecursiveWalk(XPathNavigator^ navigator)
- {
- switch (navigator->NodeType)
- {
- case XPathNodeType::Element:
- if (navigator->Prefix == String::Empty)
- Console::WriteLine("<{0}>", navigator->LocalName);
- else
- Console::Write("<{0}:{1}>", navigator->Prefix, navigator->LocalName);
- Console::WriteLine("\t" + navigator->NamespaceURI);
- break;
- case XPathNodeType::Text:
- Console::WriteLine("\t" + navigator->Value);
- break;
- }
-
- if (navigator->MoveToFirstChild())
- {
- do
- {
- RecursiveWalk(navigator);
- } while (navigator->MoveToNext());
-
- navigator->MoveToParent();
- if (navigator->NodeType == XPathNodeType::Element)
- Console::WriteLine("{0}>", navigator->Name);
- }
- else
- {
- if (navigator->NodeType == XPathNodeType::Element)
- {
- Console::WriteLine("{0}>", navigator->Name);
- }
- }
- }
- //
-
- static void XPathNavigatorMethods_PrependChild1()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlWriter^ pages = navigator->PrependChild();
- pages->WriteElementString("pages", "100");
- pages->Close();
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_PrependChild2()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- navigator->PrependChild("100");
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_PrependChild3()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlReader^ pages = XmlReader::Create(gcnew StringReader("100"));
-
- navigator->PrependChild(pages);
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_PrependChild4()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlDocument^ childNodes = gcnew XmlDocument();
- childNodes->Load(gcnew StringReader("100"));
- XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator();
-
- navigator->PrependChild(childNodesNavigator);
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_PrependChildElement()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- navigator->PrependChildElement(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100");
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_ReadSubtree()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlReader^ reader = navigator->ReadSubtree();
-
- while (reader->Read())
- {
- Console::WriteLine(reader->ReadInnerXml());
- }
-
- reader->Close();
- //
- }
-
- static void XPathNavigatorMethods_ReplaceRange()
- {
- // XPathNavigator->ReplaceRange()
-
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable);
- manager->AddNamespace("bk", "http://www.contoso.com/books");
-
- XPathNavigator^ first = navigator->SelectSingleNode("/bk:bookstore/bk:book[1]", manager);
- XPathNavigator^ last = navigator->SelectSingleNode("/bk:bookstore/bk:book[2]", manager);
-
- navigator->MoveTo(first);
- XmlWriter^ newRange = navigator->ReplaceRange(last);
- newRange->WriteStartElement("book");
- newRange->WriteAttributeString("genre", "");
- newRange->WriteAttributeString("publicationdate", "2005-04-07");
- newRange->WriteAttributeString("ISBN", "0");
- newRange->WriteStartElement("title");
- newRange->WriteString("New Book");
- newRange->WriteEndElement();
- newRange->WriteStartElement("author");
- newRange->WriteStartElement("first-name");
- newRange->WriteString("First Name");
- newRange->WriteEndElement();
- newRange->WriteStartElement("last-name");
- newRange->WriteString("Last Name");
- newRange->WriteEndElement();
- newRange->WriteEndElement();
- newRange->WriteElementString("price", "$0.00");
- newRange->WriteEndElement();
- newRange->Close();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_ReplaceSelf1()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- navigator->ReplaceSelf("100");
-
- Console::WriteLine("Position after delete: {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_ReplaceSelf2()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlReader^ pages = XmlReader::Create(gcnew StringReader("100"));
-
- navigator->ReplaceSelf(pages);
-
- Console::WriteLine("Position after delete: {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_ReplaceSelf3()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- XmlDocument^ childNodes = gcnew XmlDocument();
- childNodes->Load(gcnew StringReader("100"));
- XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator();
-
- navigator->ReplaceSelf(childNodesNavigator);
-
- Console::WriteLine("Position after delete: {0}", navigator->Name);
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_Select1()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XPathNodeIterator^ nodes = navigator->Select("/bookstore/book");
- nodes->MoveNext();
- XPathNavigator^ nodesNavigator = nodes->Current;
-
- XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false);
-
- while (nodesText->MoveNext())
- Console::WriteLine(nodesText->Current->Value);
- //
- }
-
- static void XPathNavigatorMethods_Select2()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XPathExpression^ query = navigator->Compile("/bookstore/book");
- XPathNodeIterator^ nodes = navigator->Select(query);
- XPathNavigator^ nodesNavigator = nodes->Current;
-
- XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false);
-
- while (nodesText->MoveNext())
- {
- Console::WriteLine(nodesText->Current->Value);
- }
- //
- }
-
- static void XPathNavigatorMethods_Select3()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable);
- manager->AddNamespace("bk", "http://www.contoso.com/books");
-
- XPathNodeIterator^ nodes = navigator->Select("/bk:bookstore/bk:book/bk:price", manager);
- // Move to the first node bk:price node.
- if(nodes->MoveNext())
- {
- // Now nodes.Current points to the first selected node.
- XPathNavigator^ nodesNavigator = nodes->Current;
-
- // Select all the descendants of the current price node.
- XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false);
-
- while(nodesText->MoveNext())
- {
- Console::WriteLine(nodesText->Current->Value);
- }
- }
- //
- }
-
- static void XPathNavigatorMethods_SelectAncestorsChildrenDescendants()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- // Select all the descendant nodes of the book node.
- XPathNodeIterator^ bookDescendants = navigator->SelectDescendants("", "http://www.contoso.com/books", false);
-
- // Display the LocalName of each descendant node.
- Console::WriteLine("Descendant nodes of the book node:");
- while (bookDescendants->MoveNext())
- {
- Console::WriteLine(bookDescendants->Current->Name);
- }
-
- // Select all the child nodes of the book node.
- XPathNodeIterator^ bookChildren = navigator->SelectChildren("", "http://www.contoso.com/books");
-
- // Display the LocalName of each child node.
- Console::WriteLine("\nChild nodes of the book node:");
- while (bookChildren->MoveNext())
- {
- Console::WriteLine(bookChildren->Current->Name);
- }
-
- // Select all the ancestor nodes of the title node.
- navigator->MoveToChild("title", "http://www.contoso.com/books");
-
- XPathNodeIterator^ bookAncestors = navigator->SelectAncestors("", "http://www.contoso.com/books", false);
-
- // Display the LocalName of each ancestor node.
- Console::WriteLine("\nAncestor nodes of the title node:");
-
- while (bookAncestors->MoveNext())
- {
- Console::WriteLine(bookAncestors->Current->Name);
- }
- //
- }
-
- static void XPathNavigatorMethods_SelectSingleNode1()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XPathNavigator^ node = navigator->SelectSingleNode("//title");
- Console::WriteLine(node->InnerXml);
- //
- }
-
- static void XPathNavigatorMethods_SelectSingleNode2()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XPathExpression^ query = navigator->Compile("//title");
-
- XPathNavigator^ node = navigator->SelectSingleNode(query);
- Console::WriteLine(node->InnerXml);
- //
- }
-
- static void XPathNavigatorMethods_SelectSingleNode3()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable);
- manager->AddNamespace("bk", "http://www.contoso.com/books");
-
- XPathNavigator^ node = navigator->SelectSingleNode("//bk:title", manager);
- Console::WriteLine(node->InnerXml);
- //
- }
-
- static void XPathNavigatorMethods_SetTypedValue()
- {
- //
- XmlReaderSettings^ settings = gcnew XmlReaderSettings();
- settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd");
- settings->ValidationType = ValidationType::Schema;
-
- XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings);
- XmlDocument^ document = gcnew XmlDocument();
- document->Load(reader);
-
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- Decimal^ price = gcnew Decimal(19.99);
- navigator->SetTypedValue(price);
-
- navigator->MoveToParent();
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_SetValue()
- {
- //
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable);
- manager->AddNamespace("bk", "http://www.contoso.com/books");
-
- for each (XPathNavigator^ nav in navigator->Select("//bk:price", manager))
- {
- if(nav->Value == "11.99")
- {
- nav->SetValue("12.99");
- }
- }
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorMethods_WriteSubtree()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- XmlWriter^ writer = XmlWriter::Create("contosoBook.xml");
- navigator->WriteSubtree(writer);
-
- writer->Close();
- //
- }
-
- static void XPathNavigatorMethods_MoveToNextAttribute()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- // Select all book nodes and display all attributes on each book.
- XPathNodeIterator^ nodes = navigator->SelectDescendants("book", "", false);
- while (nodes->MoveNext())
- {
- XPathNavigator^ navigator2 = nodes->Current->Clone();
- navigator2->MoveToFirstAttribute();
- Console::WriteLine("{0} = {1}", navigator2->Name, navigator2->Value);
-
- while (navigator2->MoveToNextAttribute())
- {
- Console::WriteLine("{0} = {1}", navigator2->Name, navigator2->Value);
- }
-
- Console::WriteLine();
- }
- //
- }
-
- static void XPathNavigatorMethods_BasicMoveTos()
- {
- //
- // Load the XML document.
- XmlDocument^ document = gcnew XmlDocument();
- document->Load("contosoBooks.xml");
-
- // Create the XPathNavigator.
- XPathNavigator^ navigator = document->CreateNavigator();
-
- // Create an XmlNamespaceManager used to handle namespaces
- // found in the XML document.
- XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable);
- manager->AddNamespace("bk", "http://www.contoso.com/books");
-
- // Move to the last book node using the SelectSingleNode method.
- navigator = navigator->SelectSingleNode("//bk:book[last()]", manager);
- Console::WriteLine("Last book node: \n===============\n{0}", navigator->OuterXml);
-
- // Move to the previous book node and write it to the console
- // if the move was successful.
- if (navigator->MoveToPrevious())
- {
- Console::WriteLine("\nSecond book node: \n=================\n{0}",
- navigator->OuterXml);
- }
-
- // Move to the first book node and write it to the console
- // if the move was successful.
- if (navigator->MoveToFirst())
- {
- Console::WriteLine("\nFirst book node: \n================\n{0}",
- navigator->OuterXml);
- }
-
- // Move to the parent bookstore node and write it to the console
- // if the move was successful.
- if (navigator->MoveToParent())
- {
- Console::WriteLine("\nParent bookstore node: \n======================\n{0}",
- navigator->OuterXml);
- }
-
- // Move to the first child node of the bookstore node and write
- // it to the console if the move was successful.
- if (navigator->MoveToFirstChild())
- {
- Console::WriteLine("\nFirst book node: \n================\n{0}",
- navigator->OuterXml);
- }
-
- // Move to the root node and write it to the console.
- navigator->MoveToRoot();
- Console::WriteLine("\nRoot node: \n==========\n{0}",
- navigator->OuterXml);
- //
- }
- static void XPathNavigatorMethods_TwoWaysToIterateOverXPathNavigator()
- {
- XPathDocument^ doc = gcnew XPathDocument(gcnew StringReader(""));
- XPathNavigator^ nav = doc->CreateNavigator();
- XPathNodeIterator^ nodeIterator = nav->SelectDescendants("", "", false);
-
- //
- while (nodeIterator->MoveNext())
- {
- XPathNavigator^ n = nodeIterator->Current;
- Console::WriteLine(n->LocalName);
- }
- //
-
- //
- for each (XPathNavigator^ n in nodeIterator)
- Console::WriteLine(n->LocalName);
- //
- }
-
-
-};
-
-int main()
-{
- return 0;
-};
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp b/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp
deleted file mode 100644
index 98a87366e0c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::XPath;
-using namespace System::Collections;
-
-class XPathNavigatorProperties
-{
-public:
-
- static void XPathNavigatorProperties_CanEdit()
- {
- //
- XPathDocument^ readOnlyDocument = gcnew XPathDocument("books.xml");
- XPathNavigator^ readOnlyNavigator = readOnlyDocument->CreateNavigator();
-
- XmlDocument^ editableDocument = gcnew XmlDocument();
- editableDocument->Load("books.xml");
- XPathNavigator^ editableNavigator = editableDocument->CreateNavigator();
-
- Console::WriteLine("XPathNavigator.CanEdit from XPathDocument: {0}", readOnlyNavigator->CanEdit);
- Console::WriteLine("XPathNavigator.CanEdit from XmlDocument: {0}", editableNavigator->CanEdit);
- //
- }
-
- static void XPathNavigatorProperties_InnerXml()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- Console::WriteLine(navigator->InnerXml);
- //
- }
-
- static void XPathNavigatorProperties_NavigatorComparer()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("books.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
- Hashtable^ table = gcnew Hashtable(XPathNavigator::NavigatorComparer);
-
- // Add nodes to the Hashtable.
- for each (XPathNavigator^ navigator2 in navigator->Select("//book"))
- {
- Object^ value = navigator2->Evaluate("string(./title)");
- table->Add(navigator2->Clone(), value);
- Console::WriteLine("Added book with title {0}", value);
- }
-
- Console::WriteLine(table->Count);
- Console::WriteLine("Does the Hashtable have the book \"The Confidence Man\"?");
- Console::WriteLine(table->Contains(navigator->SelectSingleNode("//book[title='The Confidence Man']")));
- //
- }
-
- static void XPathNavigatorProperties_OuterXml()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
-
- Console::WriteLine(navigator->OuterXml);
- //
- }
-
- static void XPathNavigatorProperties_ValueAs()
- {
- //
- XPathDocument^ document = gcnew XPathDocument("valueas.xml");
- XPathNavigator^ navigator = document->CreateNavigator();
-
- // ValueAsBoolean
- navigator->MoveToChild("root", "");
- navigator->MoveToChild("booleanElement", "");
- bool^ booleanValue = navigator->ValueAsBoolean;
- Console::WriteLine(navigator->LocalName + ": " + booleanValue);
-
- // ValueAsDateTime
- navigator->MoveToNext("dateTimeElement", "");
- DateTime^ dateTimeValue = navigator->ValueAsDateTime;
- Console::WriteLine(navigator->LocalName + ": " + dateTimeValue);
-
- // ValueAsDouble, ValueAsInt32, ValueAsInt64, ValueAsSingle
- navigator->MoveToNext("numberElement", "");
- Double doubleValue = navigator->ValueAsDouble;
- Int32 int32Value = navigator->ValueAsInt;
- Int64 int64Value = navigator->ValueAsLong;
- Console::WriteLine(navigator->LocalName + ": " + doubleValue);
- Console::WriteLine(navigator->LocalName + ": " + int32Value);
- Console::WriteLine(navigator->LocalName + ": " + int64Value);
- //
- }
-
- static void XPathNavigatorProperties_ValueType()
- {
- //
- // Create an XmlReaderSettings object with the contosoBooks.xsd schema.
- XmlReaderSettings^ settings = gcnew XmlReaderSettings();
- settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd");
- settings->ValidationType = ValidationType::Schema;
-
- // Create an XmlReader object with the contosoBooks.xml file and its schema.
- XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings);
-
- XPathDocument^ document = gcnew XPathDocument(reader);
- XPathNavigator^ navigator = document->CreateNavigator();
-
- navigator->MoveToChild("bookstore", "http://www.contoso.com/books");
- navigator->MoveToChild("book", "http://www.contoso.com/books");
- navigator->MoveToChild("price", "http://www.contoso.com/books");
-
- // Display the current type of the price element.
- Console::WriteLine(navigator->ValueType);
-
- // Get the value of the price element as a string and display it.
- String^ price = dynamic_cast(navigator->ValueAs(String::typeid));
- Console::WriteLine(price);
- //
- }
-};
-
-int main()
-{
- return 0;
-}
diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp
deleted file mode 100644
index 47d9622fae0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Encode and decode a name with spaces.
- String^ name1 = XmlConvert::EncodeName( "Order Detail" );
- Console::WriteLine( "Encoded name: {0}", name1 );
- Console::WriteLine( "Decoded name: {0}", XmlConvert::DecodeName( name1 ) );
-
- // Encode and decode a local name.
- String^ name2 = XmlConvert::EncodeLocalName( "a:book" );
- Console::WriteLine( "Encoded local name: {0}", name2 );
- Console::WriteLine( "Decoded local name: {0}", XmlConvert::DecodeName( name2 ) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp
deleted file mode 100644
index c3d8da70f59..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = gcnew XmlTextReader( "orderData.xml" );
-
- //Parse the file and pull out the order date and price.
- while ( reader->Read() )
- {
- if ( reader->NodeType == XmlNodeType::Element )
- {
- if ( reader->Name->Equals( "order" ) )
- {
- DateTime orderDate = XmlConvert::ToDateTime( reader->GetAttribute( "date" ) );
- Console::WriteLine( "order date: {0}", orderDate.ToString() );
- }
- else
- if ( reader->Name->Equals( "price" ) )
- {
- Double price = XmlConvert::ToDouble( reader->ReadInnerXml() );
- Console::WriteLine( "price: {0}", price );
- }
- }
- }
-
-
- //Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp
deleted file mode 100644
index a3e011767f0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-int main()
-{
- XmlTextWriter^ writer = gcnew XmlTextWriter( "out.xml", nullptr );
- String^ tag = "item name";
- try
- {
-
- // Write the root element.
- writer->WriteStartElement( "root" );
- writer->WriteStartElement( XmlConvert::VerifyName( tag ) );
- }
- catch ( XmlException^ e )
- {
- Console::WriteLine( e->Message );
- Console::WriteLine( "Convert to a valid name..." );
- writer->WriteStartElement( XmlConvert::EncodeName( tag ) );
- }
-
- writer->WriteString( "hammer" );
- writer->WriteEndElement();
-
- // Write the end tag for the root element.
- writer->WriteEndElement();
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp
deleted file mode 100644
index f69ebbfb60c..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Xml;
-
-int main()
-{
- // Create an XmlDataDocument.
- XmlDataDocument^ doc = gcnew XmlDataDocument;
-
- // Load the schema file.
- doc->DataSet->ReadXmlSchema( "store.xsd" );
-
- // Load the XML data.
- doc->Load( "2books.xml" );
-
- //Change the price on the first book.
- XmlElement^ root = doc->DocumentElement;
- DataRow^ row = doc->GetRowFromElement( safe_cast(root->FirstChild) );
- row["price"] = "12.95";
- Console::WriteLine( "Display the modified XML data..." );
- Console::WriteLine( doc->DocumentElement->OuterXml );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp
deleted file mode 100644
index 631d04fa9a1..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Xml;
-int main()
-{
- // Create an XmlDataDocument.
- XmlDataDocument^ doc = gcnew XmlDataDocument;
-
- // Load the schema file.
- doc->DataSet->ReadXmlSchema( "store.xsd" );
-
- // Load the XML data.
- XmlTextReader^ reader = gcnew XmlTextReader( "2books.xml" );
- reader->MoveToContent(); // Moves the reader to the root node.
- doc->Load( reader );
-
- // Update the price on the first book using the DataSet methods.
- DataTable^ books = doc->DataSet->Tables["book"];
- books->Rows[0]["price"] = "12.95";
- Console::WriteLine( "Display the modified XML data..." );
- doc->Save( Console::Out );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp b/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp
deleted file mode 100644
index 85250f42094..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-public ref class Sample
-{
-public:
- static void DisplayEntities( XmlNamedNodeMap^ nMap )
- {
- for ( int i = 0; i < nMap->Count; i++ )
- {
- XmlEntity^ ent = dynamic_cast(nMap->Item( i ));
- Console::Write( " {0} ", ent->NodeType );
- Console::Write( " {0} ", ent->Name );
- Console::Write( " {0} ", ent->NotationName );
- Console::Write( " {0} ", ent->PublicId );
- Console::Write( " {0} ", ent->SystemId );
- Console::WriteLine();
-
- }
- }
-
-};
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "doment.xml" );
- Console::WriteLine( "Display information on all entities..." );
- XmlNamedNodeMap^ nMap = doc->DocumentType->Entities;
- Sample^ MySample = gcnew Sample;
- MySample->DisplayEntities( nMap );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp
deleted file mode 100644
index 3424276fabf..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Collections;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "booksort.xml" );
-
- // Create an XmlNamespaceManager for resolving namespaces.
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable );
- nsmgr->AddNamespace( "bk", "urn:samples" );
-
- // Select and display the value of all the ISBN attributes.
- XmlNodeList^ nodeList;
- XmlElement^ root = doc->DocumentElement;
- nodeList = root->SelectNodes( "/bookstore/book/@bk:ISBN", nsmgr );
- IEnumerator^ myEnum = nodeList->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- XmlNode^ isbn = safe_cast(myEnum->Current);
- Console::WriteLine( isbn->Value );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp
deleted file mode 100644
index 3cc1ad791d3..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "booksort.xml" );
-
- //Create an XmlNamespaceManager for resolving namespaces.
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable );
- nsmgr->AddNamespace( "bk", "urn:samples" );
-
- //Select the book node with the matching attribute value.
- XmlNode^ book;
- XmlElement^ root = doc->DocumentElement;
- book = root->SelectSingleNode( "descendant::book->Item[@bk:ISBN='1-861001-57-6']", nsmgr );
- Console::WriteLine( book->OuterXml );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp
deleted file mode 100644
index f460ecd9f3d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( L"newbooks.xml" );
-
- // Create an XmlNamespaceManager to resolve the default namespace.
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable );
- nsmgr->AddNamespace( L"bk", L"urn:newbooks-schema" );
-
- // Select the first book written by an author whose last name is Atwood.
- XmlNode^ book;
- XmlElement^ root = doc->DocumentElement;
- book = root->SelectSingleNode( L"descendant::bk:book[bk:author/bk:last-name='Atwood']", nsmgr );
- Console::WriteLine( book->OuterXml );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp b/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp
deleted file mode 100644
index ab467b652be..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-public ref class Sample
-{
-public:
- void Run( String^ args )
- {
- // Create and load the XML document.
- Console::WriteLine( "Loading file {0} ...", args );
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( args );
-
- //Create the event handlers.
- doc->NodeChanged += gcnew XmlNodeChangedEventHandler( this, &Sample::MyNodeChangedEvent );
- doc->NodeInserted += gcnew XmlNodeChangedEventHandler( this, &Sample::MyNodeInsertedEvent );
-
- // Change the book price.
- doc->DocumentElement->LastChild->InnerText = "5.95";
-
- // Add a new element.
- XmlElement^ newElem = doc->CreateElement( "style" );
- newElem->InnerText = "hardcover";
- doc->DocumentElement->AppendChild( newElem );
- Console::WriteLine( "\r\nDisplay the modified XML..." );
- Console::WriteLine( doc->OuterXml );
- }
-
- // Handle the NodeChanged event.
-private:
- void MyNodeChangedEvent( Object^ /*src*/, XmlNodeChangedEventArgs^ args )
- {
- Console::Write( "Node Changed Event: <{0}> changed", args->Node->Name );
- if ( args->Node->Value != nullptr )
- {
- Console::WriteLine( " with value {0}", args->Node->Value );
- }
- else
- Console::WriteLine( "" );
- }
-
- // Handle the NodeInserted event.
- void MyNodeInsertedEvent( Object^ /*src*/, XmlNodeChangedEventArgs^ args )
- {
- Console::Write( "Node Inserted Event: <{0}> inserted", args->Node->Name );
- if ( args->Node->Value != nullptr )
- {
- Console::WriteLine( " with value {0}", args->Node->Value );
- }
- else
- Console::WriteLine( "" );
- }
-};
-// End class
-
-int main()
-{
- Sample^ mySample = gcnew Sample;
- mySample->Run( "book.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp b/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp
deleted file mode 100644
index 5e7a6c8360b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-void DisplayNotations( XmlNamedNodeMap^ nMap )
-{
- for ( int i = 0; i < nMap->Count; i++ )
- {
- XmlNotation^ note = dynamic_cast(nMap->Item( i ));
- Console::Write( " {0} ", note->NodeType );
- Console::Write( " {0} ", note->Name );
- Console::Write( " {0} ", note->PublicId );
- Console::Write( " {0} ", note->SystemId );
- Console::WriteLine();
-
- }
-}
-
-int main()
-{
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "doment.xml" );
- Console::WriteLine( "Display information on all notations..." );
- XmlNamedNodeMap^ nMap = doc->DocumentType->Notations;
- DisplayNotations( nMap );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp
deleted file mode 100644
index a3f97a98a5a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::IO;
-
-// Display any validation errors.
-static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e )
-{
- Console::WriteLine( L"Validation Error: {0}", e->Message );
-}
-
-int main()
-{
- // Set the validation settings.
- XmlReaderSettings^ settings = gcnew XmlReaderSettings;
- settings->DtdProcessing = DtdProcessing::Parse;
- settings->ValidationType = ValidationType::DTD;
- settings->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack );
-
- // Create the XmlReader object.
- XmlReader^ reader = XmlReader::Create( L"itemDTD.xml", settings );
-
- // Parse the file.
- while ( reader->Read() )
- ;
-
- return 1;
-}
-//
-
diff --git a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp
deleted file mode 100644
index 2c42e5cc4eb..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::IO;
-int main()
-{
-
- //
- // Set the reader settings.
- XmlReaderSettings^ settings = gcnew XmlReaderSettings;
- settings->IgnoreComments = true;
- settings->IgnoreProcessingInstructions = true;
- settings->IgnoreWhitespace = true;
-
- //
- //
- // Create a resolver with default credentials.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- resolver->Credentials = System::Net::CredentialCache::DefaultCredentials;
-
- // Set the reader settings object to use the resolver.
- settings->XmlResolver = resolver;
-
- // Create the XmlReader object.
- XmlReader^ reader = XmlReader::Create( L"http://ServerName/data/books.xml", settings );
-
- //
- // Parse the file.
- while ( reader->Read() )
- ;
-
- return 1;
-}
-
diff --git a/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp b/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp
deleted file mode 100644
index f202c678601..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::IO;
-
-// Display any validation errors.
-static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e )
-{
- Console::WriteLine( L"Validation Error:\n {0}", e->Message );
- Console::WriteLine();
-}
-
-int main()
-{
- // Create the XmlSchemaSet class.
- XmlSchemaSet^ sc = gcnew XmlSchemaSet;
-
- // Add the schema to the collection.
- sc->Add( L"urn:bookstore-schema", L"books.xsd" );
-
- // Set the validation settings.
- XmlReaderSettings^ settings = gcnew XmlReaderSettings;
- settings->ValidationType = ValidationType::Schema;
- settings->Schemas = sc;
- settings->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack);
-
- // Create the XmlReader object.
- XmlReader^ reader = XmlReader::Create( L"booksSchemaFail.xml", settings );
-
- // Parse the file.
- while ( reader->Read() )
- ;
-
- return 1;
-}
-// The example displays output like the following:
-// Validation Error:
-// The element 'book' in namespace 'urn:bookstore-schema' has invalid child element 'author'
-// in namespace 'urn:bookstore-schema'. List of possible elements expected: 'title' in
-// namespace 'urn:bookstore-schema'.
-//
-// Validation Error:
-// The element 'author' in namespace 'urn:bookstore-schema' has invalid child element 'name'
-// in namespace 'urn:bookstore-schema'. List of possible elements expected: 'first-name' in
-// namespace 'urn:bookstore-schema'.
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp
deleted file mode 100644
index 8ad92c04292..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-public ref class Sample
-{
-private:
- //Display the schema error information.
- static void ValidationCallBack( Object^ sender, ValidationEventArgs^ args )
- {
- Console::WriteLine( "Invalid XSD schema: {0}", args->Exception->Message );
- }
-
-public:
- static void main()
- {
- // Create the schema collection.
- XmlSchemaCollection^ xsc = gcnew XmlSchemaCollection;
-
- //Set an event handler to manage invalid schemas.
- xsc->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack );
-
- //Add the schema to the collection.
- xsc->Add( nullptr, "invalid.xsd" );
- }
-};
-
-int main()
-{
- Sample::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp
deleted file mode 100644
index d496898fad0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-public ref class Sample
-{
-private:
- // Display any errors.
- static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e )
- {
- Console::WriteLine( "Validation Error: {0}", e->Message );
- }
-
-public:
- static void main()
- {
- array^ args = Environment::GetCommandLineArgs();
- String^ UserName = args[ 1 ];
- String^ SecurelyStoredPassword = args[ 2 ];
- String^ Domain = args[ 3 ];
-
- //
- XmlSchemaCollection^ sc = gcnew XmlSchemaCollection;
- sc->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack );
-
- // Create a resolver with the necessary credentials.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- System::Net::NetworkCredential^ nc;
- nc = gcnew System::Net::NetworkCredential( UserName,SecurelyStoredPassword,Domain );
- resolver->Credentials = nc;
-
- // Add the new schema to the collection.
- sc->Add( nullptr, gcnew XmlTextReader( "sample.xsd" ), resolver );
- //
-
- if ( sc->Count > 0 )
- {
- XmlTextReader^ tr = gcnew XmlTextReader( "notValidXSD.xml" );
- XmlValidatingReader^ rdr = gcnew XmlValidatingReader( tr );
-
- rdr->ValidationType = ValidationType::Schema;
- rdr->Schemas->Add( sc );
- rdr->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack );
- while ( rdr->Read() );
- }
- }
-};
-
-int main()
-{
- Sample::main();
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp
deleted file mode 100644
index 16126254e5a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::IO;
-public ref class ValidXSD
-{
-public:
- static void main()
- {
- XmlSchemaCollection^ sc = gcnew XmlSchemaCollection;
- sc->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack );
- sc->Add( nullptr, "books.xsd" );
- if ( sc->Count > 0 )
- {
- XmlTextReader^ tr = gcnew XmlTextReader( "notValidXSD.xml" );
- XmlValidatingReader^ rdr = gcnew XmlValidatingReader( tr );
- rdr->ValidationType = ValidationType::Schema;
- rdr->Schemas->Add( sc );
- rdr->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack );
- while ( rdr->Read() )
- ;
- }
- }
-
-
-private:
- static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e )
- {
- Console::WriteLine( "Validation Error: {0}", e->Message );
- }
-
-};
-
-int main()
-{
- ValidXSD::main();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp
deleted file mode 100644
index 0d338c1f4c0..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-ref class XmlSchemaInferenceExamples
-{
-public:
-
- static void Main()
- {
-
- }
-
- static void XmlSchemaInference_OverallExample()
- {
- //
- XmlReader^ reader = XmlReader::Create("contosoBooks.xml");
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- XmlSchemaInference^ schema = gcnew XmlSchemaInference();
-
- schemaSet = schema->InferSchema(reader);
-
- for each (XmlSchema^ s in schemaSet->Schemas())
- {
- s->Write(Console::Out);
- }
- //
- }
-
- static void XmlSchemaInference_Occurrence()
- {
- //
- XmlReader^ reader = XmlReader::Create("input.xml");
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- XmlSchemaInference^ schema = gcnew XmlSchemaInference();
-
- schema->Occurrence = XmlSchemaInference::InferenceOption::Relaxed;
-
- schemaSet = schema->InferSchema(reader);
-
- for each (XmlSchema^ s in schemaSet->Schemas())
- {
- s->Write(Console::Out);
- }
- //
- }
-
- static void XmlSchemaInference_TypeInference()
- {
- //
- XmlReader^ reader = XmlReader::Create("input.xml");
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- XmlSchemaInference^ schema = gcnew XmlSchemaInference();
-
- schema->TypeInference = XmlSchemaInference::InferenceOption::Relaxed;
-
- schemaSet = schema->InferSchema(reader);
-
- for each (XmlSchema^ s in schemaSet->Schemas())
- {
- s->Write(Console::Out);
- }
- //
- }
-
- static void XmlSchemaInference_RefinementProcess()
- {
- //
- XmlReader^ reader = XmlReader::Create("item1.xml");
- XmlReader^ reader1 = XmlReader::Create("item2.xml");
- XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet();
- XmlSchemaInference^ inference = gcnew XmlSchemaInference();
- schemaSet = inference->InferSchema(reader);
-
- // Display the inferred schema.
- Console::WriteLine("Original schema:\n");
- for each (XmlSchema^ schema in schemaSet->Schemas("http://www.contoso.com/items"))
- {
- schema->Write(Console::Out);
- }
-
- // Use the additional data in item2.xml to refine the original schema.
- schemaSet = inference->InferSchema(reader1, schemaSet);
-
- // Display the refined schema.
- Console::WriteLine("\n\nRefined schema:\n");
- for each (XmlSchema^ schema in schemaSet->Schemas("http://www.contoso.com/items"))
- {
- schema->Write(Console::Out);
- }
- //
- }
-};
-
-int main()
-{
- XmlSchemaInferenceExamples::Main();
- return 0;
-}
diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp
deleted file mode 100644
index 1f3adf25c44..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-static void booksSettingsValidationEventHandler( Object^ /*sender*/, ValidationEventArgs^ e )
-{
- if ( e->Severity == XmlSeverityType::Warning )
- {
- Console::Write( L"WARNING: " );
- Console::WriteLine( e->Message );
- }
- else
- if ( e->Severity == XmlSeverityType::Error )
- {
- Console::Write( L"ERROR: " );
- Console::WriteLine( e->Message );
- }
-}
-
-int main()
-{
- XmlReaderSettings^ booksSettings = gcnew XmlReaderSettings;
- booksSettings->Schemas->Add( L"http://www.contoso.com/books", L"books.xsd" );
- booksSettings->ValidationType = ValidationType::Schema;
- booksSettings->ValidationEventHandler += gcnew ValidationEventHandler( booksSettingsValidationEventHandler );
- XmlReader^ books = XmlReader::Create( L"books.xml", booksSettings );
- while ( books->Read() )
- {}
-
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp
deleted file mode 100644
index ccf73e57aee..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Net;
-int main()
-{
-
- // Create the reader.
- XmlTextReader^ reader = gcnew XmlTextReader( "http://myServer/data/books.xml" );
-
- // Create a secure resolver with default credentials.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- XmlSecureResolver^ sResolver = gcnew XmlSecureResolver( resolver,"http://myServer/data/" );
- sResolver->Credentials = CredentialCache::DefaultCredentials;
-
- // Use the secure resolver to resolve resources.
- reader->XmlResolver = sResolver;
-
- // Parse the file.
- while ( reader->Read() )
- {
-
- // Do any additional processing here.
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp
deleted file mode 100644
index 3da4b5ed406..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Security;
-using namespace System::Security::Policy;
-using namespace System::Net;
-
-// NOTE: To test, replace www.contoso.com w/ the local string
-
-//
-Object^ GetFile( String^ fileURL, XmlResolver^ resolver )
-{
- // Generate the default PermissionSet using the file URL.
- Evidence^ evidence = XmlSecureResolver::CreateEvidenceForUrl( fileURL );
- PermissionSet^ myPermissions = SecurityManager::ResolvePolicy( evidence );
-
- // Modify the PermissionSet to only allow access to http://www.contoso.com.
- // Create a WebPermission which only allows access to http://www.contoso.com.
- WebPermission^ myWebPermission = gcnew WebPermission(
- NetworkAccess::Connect,"http://www.contoso.com" );
- // Replace the existing WebPermission in myPermissions with the updated WebPermission.
- myPermissions->SetPermission( myWebPermission );
-
- // Use the modified PermissionSet to construct the XmlSecureResolver.
- XmlSecureResolver^ sResolver = gcnew XmlSecureResolver( resolver,myPermissions );
-
- // Get the object.
- Uri^ fullUri = sResolver->ResolveUri( nullptr, fileURL );
- return sResolver->GetEntity( fullUri, nullptr, nullptr );
-}
-//
-
-int main()
-{
- Stream^ s = (Stream^)(GetFile( "http://localhost/data/books.xml",
- gcnew XmlUrlResolver ));
- XmlTextReader^ reader = gcnew XmlTextReader( s );
-}
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp
deleted file mode 100644
index 91be2b8ba6b..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XML fragment to be parsed.
- String^ xmlFrag = " Pride And Prejudice novel ";
-
- // Create the XmlNamespaceManager.
- NameTable^ nt = gcnew NameTable;
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt );
- nsmgr->AddNamespace( "bk", "urn:sample" );
-
- // Create the XmlParserContext.
- XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None );
-
- // Create the reader.
- XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context );
-
- // Parse the XML. If they exist, display the prefix and
- // namespace URI of each element.
- while ( reader->Read() )
- {
- if ( reader->IsStartElement() )
- {
- if ( reader->Prefix == String::Empty )
- Console::WriteLine( "< {0}>", reader->LocalName );
- else
- {
- Console::Write( "< {0}: {1}>", reader->Prefix, reader->LocalName );
- Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI );
- }
- }
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp
deleted file mode 100644
index 5ef9f82c8ce..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XML fragment to be parsed.
- String^ xmlFrag = "\n"
- "\n"
- "\n"
- "240\n"
- "\n"
- "\n";
-
- // Create the XmlNamespaceManager.
- NameTable^ nt = gcnew NameTable;
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt );
-
- // Create the XmlParserContext.
- XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None );
-
- // Create the reader.
- XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context );
-
- // Parse the XML and display each node.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition );
- Console::WriteLine( "< {0}>", reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition );
- Console::WriteLine( " {0}", reader->Value );
- break;
-
- case XmlNodeType::EndElement:
- Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition );
- Console::WriteLine( " {0}>", reader->Name );
- break;
- }
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp
deleted file mode 100644
index d7a782ca81e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XML fragment to be parsed.
- String^ xmlFrag = " \n"
- " \n";
-
- // Create the XmlNamespaceManager.
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( gcnew NameTable );
-
- // Create the XmlParserContext.
- XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::Preserve );
-
- // Create the reader.
- XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context );
-
- // Show attribute value normalization.
- reader->Read();
- reader->Normalization = false;
- Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr1" ) );
- reader->Normalization = true;
- Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr1" ) );
-
- // Set Normalization back to false. This allows the reader to accept
- // character entities in the to range. If Normalization had
- // been set to true, character entities in this range throw an exception.
- reader->Normalization = false;
- reader->Read();
- reader->MoveToContent();
- Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr2" ) );
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp
deleted file mode 100644
index 67a11857486..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = nullptr;
- __try
- {
-
- // Create the XML fragment to be parsed.
- String^ xmlFrag = "";
-
- // Create the XmlParserContext.
- XmlParserContext^ context;
- String^ subset = "";
- context = gcnew XmlParserContext( nullptr,nullptr,"book",nullptr,nullptr,subset,"","",XmlSpace::None );
-
- // Create the reader.
- reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context );
-
- // Read the misc attribute. The attribute is parsed
- // into multiple text and entity reference nodes.
- reader->MoveToContent();
- reader->MoveToAttribute( "misc" );
- while ( reader->ReadAttributeValue() )
- {
- if ( reader->NodeType == XmlNodeType::EntityReference )
- Console::WriteLine( " {0} {1}", reader->NodeType, reader->Name );
- else
- Console::WriteLine( " {0} {1}", reader->NodeType, reader->Value );
- }
- }
- __finally
- {
- if ( reader != nullptr )
- reader->Close();
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp
deleted file mode 100644
index 43944b7d4c9..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml;
-int main()
-{
- Encoding^ enc = gcnew UTF8Encoding;
- array^utf8Buffer = enc->GetBytes( " 12345 " );
- enc = gcnew UnicodeEncoding;
- array^unicodeBuffer = enc->GetBytes( " root " );
- MemoryStream^ memStrm = gcnew MemoryStream;
- memStrm->Write( unicodeBuffer, 0, unicodeBuffer->Length );
- memStrm->Write( utf8Buffer, 0, utf8Buffer->Length );
- memStrm->Position = 0;
- XmlTextReader^ reader = gcnew XmlTextReader( memStrm );
- while ( reader->Read() )
- {
- Console::WriteLine( "NodeType: {0}", reader->NodeType );
- if ( XmlNodeType::EndElement == reader->NodeType && "root" == reader->Name )
- break;
- if ( XmlNodeType::EndElement == reader->NodeType )
- reader->ResetState();
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp
deleted file mode 100644
index baa5d62f323..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the XML fragment to be parsed.
- String^ xmlFrag = " Colour Analysis Color Analysis ";
-
- // Create the XmlNamespaceManager.
- NameTable^ nt = gcnew NameTable;
- XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt );
-
- // Create the XmlParserContext.
- XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None );
-
- // Create the reader.
- XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Parse the XML and display each of the nodes, including the xml:lang setting.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::WriteLine( "{0}: < {1}>", reader->XmlLang, reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::WriteLine( "{0}: {1}", reader->XmlLang, reader->Value );
- break;
-
- case XmlNodeType::EndElement:
- Console::WriteLine( "{0}: {1}>", reader->XmlLang, reader->Name );
- break;
- }
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp
deleted file mode 100644
index dcc839cdab3..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Net;
-int main()
-{
-
- // Create the reader.
- XmlTextReader^ reader = gcnew XmlTextReader( "http://myServer/data/books.xml" );
-
- // Supply the credentials necessary to access the Web server.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- resolver->Credentials = CredentialCache::DefaultCredentials;
- reader->XmlResolver = resolver;
-
- // Parse the file.
- while ( reader->Read() )
- {
-
- // Do any additional processing here.
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp
deleted file mode 100644
index ae4be95667f..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = gcnew XmlTextReader( "authors.xml" );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Parse the file. Return white space only if an
- // xml:space='preserve' attribute is found.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::Write( "<{0}>", reader->Name );
- if ( reader->XmlSpace == XmlSpace::Preserve )
- reader->WhitespaceHandling = WhitespaceHandling::Significant;
- break;
-
- case XmlNodeType::Text:
- Console::Write( reader->Value );
- break;
-
- case XmlNodeType::EndElement:
- Console::Write( "{0}>", reader->Name );
- break;
-
- case XmlNodeType::SignificantWhitespace:
- Console::Write( reader->Value );
- break;
- }
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp
deleted file mode 100644
index 32f5080e71f..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- String^ xmlData = "\r\n Oberon's Legacy\r\n 5.95\r\n ";
-
- // Create the reader.
- XmlTextReader^ reader = gcnew XmlTextReader( gcnew StringReader( xmlData ) );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Display each element node.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::Write( "<{0}>", reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::Write( reader->Value );
- break;
-
- case XmlNodeType::EndElement:
- Console::Write( "{0}>", reader->Name );
- break;
- }
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp
deleted file mode 100644
index 7457e02c9e8..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
-
- // Use indenting for readability
- writer->Formatting = Formatting::Indented;
-
- // Write an XML fragment.
- writer->WriteStartElement( "book" );
- writer->WriteElementString( "title", "Pride And Prejudice" );
- writer->WriteEndElement();
- writer->Flush();
-
- // Write another XML fragment.
- writer->WriteStartElement( "cd" );
- writer->WriteElementString( "title", "Americana" );
- writer->WriteEndElement();
- writer->Flush();
-
- // Close the writer.
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp
deleted file mode 100644
index ff9fd542be2..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create a writer to write XML to the console.
- XmlWriterSettings^ settings = gcnew XmlWriterSettings;
- settings->Indent = true;
- settings->OmitXmlDeclaration = true;
- XmlWriter^ writer = XmlWriter::Create( Console::Out, settings );
-
- // Write the book element.
- writer->WriteStartElement( L"book" );
-
- // Write the title element.
- writer->WriteStartElement( L"title" );
- writer->WriteString( L"Pride And Prejudice" );
- writer->WriteEndElement();
-
- // Write the close tag for the root element.
- writer->WriteEndElement();
-
- // Write the XML and close the writer.
- writer->Close();
- return 1;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp
deleted file mode 100644
index ca3bcbf4373..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-void main()
-{
-
- // Create an XmlWriter to write XML fragments.
- XmlWriterSettings^ settings = gcnew XmlWriterSettings;
- settings->ConformanceLevel = ConformanceLevel::Fragment;
- settings->Indent = true;
- XmlWriter^ writer = XmlWriter::Create( Console::Out, settings );
-
- // Write an XML fragment.
- writer->WriteStartElement( L"book" );
- writer->WriteElementString( L"title", L"Pride And Prejudice" );
- writer->WriteEndElement();
- writer->Flush();
-
- // Write another XML fragment.
- writer->WriteStartElement( L"cd" );
- writer->WriteElementString( L"title", L"Americana" );
- writer->WriteEndElement();
- writer->Flush();
-
- // Close the writer.
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp
deleted file mode 100644
index 59b7bac475a..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-void main()
-{
- XmlWriter^ writer = nullptr;
- writer = XmlWriter::Create( L"sampledata.xml" );
-
- // Write the root element.
- writer->WriteStartElement( L"book" );
-
- // Write the xmlns:bk="urn:book" namespace declaration.
- writer->WriteAttributeString( L"xmlns", L"bk", nullptr, L"urn:book" );
-
- // Write the bk:ISBN="1-800-925" attribute.
- writer->WriteAttributeString( L"ISBN", L"urn:book", L"1-800-925" );
- writer->WriteElementString( L"price", L"19.95" );
-
- // Write the close tag for the root element.
- writer->WriteEndElement();
-
- // Write the XML to file and close the writer.
- writer->Flush();
- writer->Close();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp
deleted file mode 100644
index cd4481a5f86..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-void main()
-{
- XmlReader^ reader = XmlReader::Create( L"test1.xml" );
- XmlWriterSettings^ settings = gcnew XmlWriterSettings;
- settings->Indent = true;
- XmlWriter^ writer = XmlWriter::Create( Console::Out );
- while ( reader->Read() )
- {
- if ( reader->NodeType == XmlNodeType::Element )
- {
- writer->WriteStartElement( reader->Name->ToUpper() );
- writer->WriteAttributes( reader, false );
- if ( reader->IsEmptyElement )
- writer->WriteEndElement();
- }
- else
- if ( reader->NodeType == XmlNodeType::EndElement )
- {
- writer->WriteEndElement();
- }
- }
-
- writer->Close();
- reader->Close();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp
deleted file mode 100644
index af773508941..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Text;
-ref class TestBase64
-{
-private:
- static int bufferSize = 4096;
-
-public:
-
- // Use the WriteBase64 method to create an XML document. The object
- // passed by the user is encoded and included in the document.
- void EncodeXmlFile( String^ xmlFileName, FileStream^ fileOld )
- {
- array^buffer = gcnew array(bufferSize);
- int readByte = 0;
- XmlTextWriter^ xw = gcnew XmlTextWriter( xmlFileName,Encoding::UTF8 );
- xw->WriteStartDocument();
- xw->WriteStartElement( "root" );
-
- // Create a Char writer.
- BinaryReader^ br = gcnew BinaryReader( fileOld );
-
- // Set the file pointer to the end.
- try
- {
- do
- {
- readByte = br->Read( buffer, 0, bufferSize );
- xw->WriteBase64( buffer, 0, readByte );
- }
- while ( bufferSize <= readByte );
- }
- catch ( Exception^ ex )
- {
- EndOfStreamException^ ex1 = gcnew EndOfStreamException;
- if ( ex1->Equals( ex ) )
- Console::WriteLine( "We are at end of file" );
- else
- Console::WriteLine( ex );
- }
-
- xw->WriteEndElement();
- xw->WriteEndDocument();
- xw->Flush();
- xw->Close();
- }
-
- // Use the ReadBase64 method to decode the new XML document
- // and generate the original object.
- void DecodeOrignalObject( String^ xmlFileName, FileStream^ fileNew )
- {
- array^buffer = gcnew array(bufferSize);
- int readByte = 0;
-
- // Create a file to write the bmp back.
- BinaryWriter^ bw = gcnew BinaryWriter( fileNew );
- XmlTextReader^ tr = gcnew XmlTextReader( xmlFileName );
- tr->MoveToContent();
- Console::WriteLine( tr->Name );
- do
- {
- readByte = tr->ReadBase64( buffer, 0, bufferSize );
- bw->Write( buffer, 0, readByte );
- }
- while ( readByte >= bufferSize );
-
- bw->Flush();
- }
-
- // Compare the two files.
- bool CompareResult( FileStream^ fileOld, FileStream^ fileNew )
- {
- int readByteOld = 0;
- int readByteNew = 0;
- int count;
- int readByte = 0;
- array^bufferOld = gcnew array(bufferSize);
- array^bufferNew = gcnew array(bufferSize);
- BinaryReader^ binaryReaderOld = gcnew BinaryReader( fileOld );
- BinaryReader^ binaryReaderNew = gcnew BinaryReader( fileNew );
- binaryReaderOld->BaseStream->Seek( 0, SeekOrigin::Begin );
- binaryReaderNew->BaseStream->Seek( 0, SeekOrigin::Begin );
- do
- {
- readByteOld = binaryReaderOld->Read( bufferOld, 0, bufferSize );
- readByteNew = binaryReaderNew->Read( bufferNew, 0, bufferSize );
- if ( readByteOld != readByteNew )
- return false;
-
- for ( count = 0; count < bufferSize; ++count )
- if ( bufferOld[ count ] != bufferNew[ count ] )
- return false;
- }
- while ( count < readByte );
-
- return true;
- }
-
- // Display the usage statement.
- void Usage()
- {
- Console::WriteLine( "TestBase64 sourceFile, targetFile \n" );
- Console::WriteLine( "For example: TestBase64 winlogon.bmp, target.bmp\n" );
- }
-};
-
-int main()
-{
- array^args = Environment::GetCommandLineArgs();
- TestBase64^ testBase64 = gcnew TestBase64;
-
- // Check that the usage is correct.
- if ( args->Length < 3 )
- {
- testBase64->Usage();
- return 1;
- }
-
- FileStream^ fileOld = gcnew FileStream( args[ 1 ],FileMode::OpenOrCreate,FileAccess::Read,FileShare::Read );
- testBase64->EncodeXmlFile( "temp.xml", fileOld );
- FileStream^ fileNew = gcnew FileStream( args[ 2 ],FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite );
- testBase64->DecodeOrignalObject( "temp.xml", fileNew );
-
- // Compare the two files.
- if ( testBase64->CompareResult( fileOld, fileNew ) )
- Console::WriteLine( "The recreated binary file {0} is the same as {1}", args[ 2 ], args[ 1 ] );
- else
- Console::WriteLine( "The recreated binary file {0} is not the same as {1}", args[ 2 ], args[ 1 ] );
-
- fileOld->Flush();
- fileNew->Flush();
- fileOld->Close();
- fileNew->Close();
- return 0;
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp
deleted file mode 100644
index 1b8726a4f19..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-public ref class Sample
-{
-private:
- static String^ m_Document = L"sampledata.xml";
-
-public:
- static void Main()
- {
- XmlWriter^ writer = nullptr;
- try
- {
- XmlWriterSettings^ settings = gcnew XmlWriterSettings;
- settings->Indent = true;
- writer = XmlWriter::Create( m_Document,settings );
- writer->WriteComment( L"sample XML fragment" );
-
- // Write an element (this one is the root).
- writer->WriteStartElement( L"book" );
-
- // Write the namespace declaration.
- writer->WriteAttributeString( L"xmlns", L"bk", nullptr, L"urn:samples" );
-
- // Write the genre attribute.
- writer->WriteAttributeString( L"genre", L"novel" );
-
- // Write the title.
- writer->WriteStartElement( L"title" );
- writer->WriteString( L"The Handmaid's Tale" );
- writer->WriteEndElement();
-
- // Write the price.
- writer->WriteElementString( L"price", L"19.95" );
-
- // Lookup the prefix and write the ISBN element.
- String^ prefix = writer->LookupPrefix( L"urn:samples" );
- writer->WriteStartElement( prefix, L"ISBN", L"urn:samples" );
- writer->WriteString( L"1-861003-78" );
- writer->WriteEndElement();
-
- // Write the style element (shows a different way to handle prefixes).
- writer->WriteElementString( L"style", L"urn:samples", L"hardcover" );
-
- // Write the close tag for the root element.
- writer->WriteEndElement();
-
- // Write the XML to file and close the writer.
- writer->Flush();
- writer->Close();
- }
- finally
- {
- if ( writer != nullptr )
- writer->Close();
- }
-
- }
-
-};
-
-void main()
-{
- Sample::Main();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp
deleted file mode 100644
index a34c595c6da..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- XmlTextReader^ reader = gcnew XmlTextReader( "books.xml" );
- reader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Move the reader to the first book element.
- reader->MoveToContent();
- reader->Read();
-
- // Create a writer that outputs to the console.
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
- writer->Formatting = Formatting::Indented;
-
- // Write the start tag.
- writer->WriteStartElement( "myBooks" );
-
- // Write the first book.
- writer->WriteNode( reader, false );
-
- // Skip the second book.
- reader->Skip();
-
- // Write the last book.
- writer->WriteNode( reader, false );
- writer->WriteEndElement();
-
- // Close the writer and the reader.
- writer->Close();
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp b/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp
deleted file mode 100644
index c26844cce27..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-
-int main()
-{
- //
- // Create a resolver with default credentials.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- resolver->Credentials = System::Net::CredentialCache::DefaultCredentials;
-
- // Create the XslTransform object.
- XslTransform^ xslt = gcnew XslTransform;
-
- // Load the stylesheet.
- xslt->Load( "http://myServer/data/authors.xsl", resolver );
-
- // Transform the file.
- xslt->Transform( "books.xml", "books.html", resolver );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp
deleted file mode 100644
index c1c69b21c5d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-int main()
-{
- String^ filename = "books.xml";
- String^ stylesheet = "titles.xsl";
-
- // Create the reader to load the stylesheet.
- // Move the reader to the xsl:stylesheet node.
- XmlTextReader^ reader = gcnew XmlTextReader( stylesheet );
- reader->Read();
- reader->Read();
-
- // Create the XslTransform object and load the stylesheet.
- XslTransform^ xslt = gcnew XslTransform;
- xslt->Load( reader );
-
- // Load the file to transform.
- XPathDocument^ doc = gcnew XPathDocument( filename );
-
- // Create an XmlTextWriter which outputs to the console.
- XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out );
-
- // Transform the file and send the output to the console.
- xslt->Transform(doc,nullptr,writer);
- writer->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp
deleted file mode 100644
index 589fa928b67..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-void TransformFile( XmlReader^ xsltReader, String^ secureURL );
-int main()
-{
- String^ stylesheet = "c:\\tmp\\output.xsl";
- String^ myURL = "http://localhost/data";
- XmlTextReader^ reader = gcnew XmlTextReader( stylesheet );
- TransformFile( reader, myURL );
-}
-
-
-// Perform an XSLT transformation where xsltReader is an XmlReader containing
-// a stylesheet and secureURI is a trusted URI that can be used to create Evidence.
-//
-void TransformFile( XmlReader^ xsltReader, String^ secureURL )
-{
-
- // Load the stylesheet using a default XmlUrlResolver and Evidence
- // created using the trusted URL.
- XslTransform^ xslt = gcnew XslTransform;
- xslt->Load( xsltReader, gcnew XmlUrlResolver, XmlSecureResolver::CreateEvidenceForUrl( secureURL ) );
-
- // Transform the file.
- xslt->Transform("books.xml","books.html",gcnew XmlUrlResolver);
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp
deleted file mode 100644
index 4b4ca81384f..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-
-int main()
-{
-//
- XmlDocument^ doc = gcnew XmlDocument;
- doc->Load( "books.xml" );
-
- // Modify the XML file.
- XmlElement^ root = doc->DocumentElement;
- root->FirstChild->LastChild->InnerText = "12.95";
-
- // Create an XPathNavigator to use for the transform.
- XPathNavigator^ nav = root->CreateNavigator();
-
- // Transform the file.
- XslTransform^ xslt = gcnew XslTransform;
- xslt->Load( "output.xsl" );
- XmlTextWriter^ writer = gcnew XmlTextWriter( "books.html", nullptr );
- xslt->Transform( nav, nullptr, writer, nullptr);
-//
-}
diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp
deleted file mode 100644
index 93872c9a3c6..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-using namespace System::Xml::XPath;
-
-int main()
-{
- array^ args = Environment::GetCommandLineArgs();
- String^ UserName = args[ 1 ];
- String^ SecurelyStoredPassword = args[ 2 ];
- String^ Domain = args[ 3 ];
-
- //
- // Create the XslTransform object.
- XslTransform^ xslt = gcnew XslTransform;
-
- // Load the stylesheet.
- xslt->Load( "titles.xsl" );
-
- // Create a resolver and specify the necessary credentials.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- System::Net::NetworkCredential^ myCred;
- myCred = gcnew System::Net::NetworkCredential( UserName, SecurelyStoredPassword, Domain );
- resolver->Credentials = myCred;
-
- // Transform the file using the resolver. The resolver is used
- // to process the XSLT document() function.
- XPathDocument^ doc = gcnew XPathDocument( "books.xml" );
- XmlReader^ reader = xslt->Transform( doc, nullptr, resolver );
-
- // Load the reader into a new document for more processing.
- XmlDocument^ xmldoc = gcnew XmlDocument;
- xmldoc->Load( reader );
- //
-
- Console::WriteLine( xmldoc->OuterXml );
-}
diff --git a/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp b/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp
deleted file mode 100644
index 326d279b9ae..00000000000
--- a/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Xsl;
-
-int main()
-{
- //
- // Create the XslTransform object.
- XslTransform^ xslt = gcnew XslTransform;
-
- // Load the stylesheet.
- xslt->Load( "output.xsl" );
-
- // Transform the file.
- xslt->Transform("books.xml","books.html");
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp
deleted file mode 100644
index df2c6373e93..00000000000
--- a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*System::Net::HttpWebRequest->AddRange(int, int)
-This program demonstrates 'AddRange(int, int)' method of 'HttpWebRequest class.
-A new 'HttpWebRequest' Object* is created. The number of characters of the response to be received can be
-restricted by the 'AddRange' method.By calling 'AddRange(50, 150)' on the 'HttpWebRequest' Object* the content
-of the response page is restricted from the 50th character to 150th charater. The response of the request is
-obtained and displayed to the console.
-*/
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Net;
-
-int main()
-{
- try
- {
-//
- // Create a New 'HttpWebRequest' object.
- HttpWebRequest^ myHttpWebRequest1 =
- (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) );
- myHttpWebRequest1->AddRange( 1000);
- Console::WriteLine("Call AddRange(1000)");
- Console::Write("Resulting Headers: ");
- Console::WriteLine(myHttpWebRequest1->Headers);
-
- HttpWebRequest^ myHttpWebRequest2 =
- (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) );
- myHttpWebRequest2->AddRange(-1000);
- Console::WriteLine("Call AddRange(-1000)");
- Console::Write("Resulting Headers: ");
- Console::WriteLine(myHttpWebRequest2->Headers);
-
-//
- }
- catch ( WebException^ e )
- {
- Console::WriteLine( "\nWebException Caught!" );
- Console::WriteLine( "Message : {0} ", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nException Caught!" );
- Console::WriteLine( "Message : {0} ", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp
deleted file mode 100644
index 68d09127497..00000000000
--- a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*System::Net::HttpWebRequest->AddRange(int, int)
-This program demonstrates 'AddRange(int, int)' method of 'HttpWebRequest class.
-A new 'HttpWebRequest' Object* is created. The number of characters of the response to be received can be
-restricted by the 'AddRange' method.By calling 'AddRange(50, 150)' on the 'HttpWebRequest' Object* the content
-of the response page is restricted from the 50th character to 150th charater. The response of the request is
-obtained and displayed to the console.
-*/
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Net;
-
-int main()
-{
- try
- {
-//
- // Create a New 'HttpWebRequest' object.
- HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) );
- myHttpWebRequest->AddRange( 50, 150 );
- Console::WriteLine("Call AddRange(50, 150)");
- Console::Write("Resulting Request Headers: ");
- Console::WriteLine(myHttpWebRequest->Headers);
-
- // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
- HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() );
-
- // Displays the headers in the response received
- Console::Write("Resulting Response Headers: ");
- Console::WriteLine(myHttpWebResponse->Headers);
-
- // Display the contents of the page to the console.
- Stream^ streamResponse = myHttpWebResponse->GetResponseStream();
- StreamReader^ streamRead = gcnew StreamReader( streamResponse );
- array^ readBuffer = gcnew array(256);
- int count = streamRead->Read( readBuffer, 0, 256 );
- Console::WriteLine( "\nThe HTML contents of the page from 50th to 150 charaters are :\n " );
- while ( count > 0 )
- {
- String^ outputData = gcnew String( readBuffer,0,count );
- Console::WriteLine( outputData );
- count = streamRead->Read( readBuffer, 0, 256 );
- }
- streamRead->Close();
- streamResponse->Close();
- myHttpWebResponse->Close();
-//
- Console::WriteLine( "\nPress 'Enter' Key to Continue..........." );
- Console::Read();
- }
- catch ( WebException^ e )
- {
- Console::WriteLine( "\nWebException Caught!" );
- Console::WriteLine( "Message : {0} ", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nException Caught!" );
- Console::WriteLine( "Message : {0} ", e->Message );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp
deleted file mode 100644
index 557ea7d00c8..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class XClass
-{
-public:
-
- /* Apply the XmlAnyElementAttribute to a field returning an array
- of XmlElement objects. */
-
- [XmlAnyElement]
- array^AllElements;
-};
-
-public ref class Test
-{
-public:
- void DeserializeObject( String^ filename )
- {
- // Create an XmlSerializer.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( XClass::typeid );
-
- // To read a file, a FileStream is needed.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
-
- // Deserialize the class.
- XClass^ x = dynamic_cast(mySerializer->Deserialize( fs ));
-
- // Read the element names and values.
- System::Collections::IEnumerator^ myEnum = x->AllElements->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- XmlElement^ xel = safe_cast(myEnum->Current);
- Console::WriteLine( "{0}: {1}", xel->LocalName, xel->Value );
- }
- }
-};
-
-int main()
-{
- Test^ t = gcnew Test;
- t->DeserializeObject( "XFile.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp
deleted file mode 100644
index 7824f3ba5cb..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-public ref class Item
-{
-public:
-
- [XmlElement(ElementName="OrderItem")]
- String^ ItemName;
- String^ ItemCode;
- Decimal ItemPrice;
- int ItemQuantity;
-};
-
-public ref class BookItem: public Item
-{
-public:
- String^ Title;
- String^ Author;
- String^ ISBN;
-};
-
-// This is the class that will be serialized.
-public ref class MyRootClass
-{
-private:
- array- ^items;
-
-public:
-
- /* Here is a simple way to serialize the array as XML. Using the
- XmlArrayAttribute, assign an element name and namespace. The
- IsNullable property determines whether the element will be
- generated if the field is set to a null value. If set to true,
- the default, setting it to a null value will cause the XML
- xsi:null attribute to be generated. */
-
- [XmlArray(ElementName="MyStrings",
- Namespace="http://www.cpandl.com",IsNullable=true)]
- array^MyStringArray;
-
- /* Here is a more complex example of applying an
- XmlArrayAttribute. The Items property can contain both Item
- and BookItem objects. Use the XmlArrayItemAttribute to specify
- that both types can be inserted into the array. */
- [XmlArrayItem(ElementName="Item",
- IsNullable=true,
- Type=Item::typeid,
- Namespace="http://www.cpandl.com"),
- XmlArrayItem(ElementName="BookItem",
- IsNullable=true,
- Type=BookItem::typeid,
- Namespace="http://www.cohowinery.com")]
- [XmlArray]
- property array
- ^ Items
- {
- array
- ^ get()
- {
- return items;
- }
-
- void set( array
- ^value )
- {
- items = value;
- }
- }
-};
-
-public ref class Run
-{
-public:
- void SerializeDocument( String^ filename )
- {
- // Creates a new XmlSerializer.
- XmlSerializer^ s = gcnew XmlSerializer( MyRootClass::typeid );
-
- // Writing the file requires a StreamWriter.
- TextWriter^ myWriter = gcnew StreamWriter( filename );
-
- // Creates an instance of the class to serialize.
- MyRootClass^ myRootClass = gcnew MyRootClass;
-
- /* Uses a basic method of creating an XML array: Create and
- populate a string array, and assign it to the
- MyStringArray property. */
- array^myString = {"Hello","world","!"};
- myRootClass->MyStringArray = myString;
-
- /* Uses a more advanced method of creating an array:
- create instances of the Item and BookItem, where BookItem
- is derived from Item. */
- Item^ item1 = gcnew Item;
- BookItem^ item2 = gcnew BookItem;
-
- // Sets the objects' properties.
- item1->ItemName = "Widget1";
- item1->ItemCode = "w1";
- item1->ItemPrice = 231;
- item1->ItemQuantity = 3;
- item2->ItemCode = "w2";
- item2->ItemPrice = 123;
- item2->ItemQuantity = 7;
- item2->ISBN = "34982333";
- item2->Title = "Book of Widgets";
- item2->Author = "John Smith";
-
- // Fills the array with the items.
- array
- ^myItems = {item1,item2};
-
- // Sets the class's Items property to the array.
- myRootClass->Items = myItems;
-
- /* Serializes the class, writes it to disk, and closes
- the TextWriter. */
- s->Serialize( myWriter, myRootClass );
- myWriter->Close();
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeDocument( "books.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp
deleted file mode 100644
index dc6cfc478ab..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Book
-{
-public:
- String^ Title;
- String^ Author;
- String^ ISBN;
-};
-
-public ref class Library
-{
-private:
- array^books;
-
-public:
-
- [XmlArray(ElementName="My_Books")]
- property array^ Books
- {
- array^ get()
- {
- return books;
- }
-
- void set( array^value )
- {
- books = value;
- }
- }
-};
-
-int main()
-{
- String^ filename = "ArrayExample.xml";
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid );
- TextWriter^ t = gcnew StreamWriter( filename );
- XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces;
- ns->Add( "bk", "http://wwww.contoso.com" );
- Book^ b1 = gcnew Book;
- b1->Title = "MyBook Title";
- b1->Author = "An Author";
- b1->ISBN = "00000000";
- Book^ b2 = gcnew Book;
- b2->Title = "Another Title";
- b2->Author = "Another Author";
- b2->ISBN = "0000000";
- Library^ myLibrary = gcnew Library;
- array^myBooks = {b1,b2};
- myLibrary->Books = myBooks;
- mySerializer->Serialize( t, myLibrary, ns );
- t->Close();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp
deleted file mode 100644
index 84965bcbf7a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::Serialization;
-public ref class Winery
-{
-public:
- String^ Name;
-};
-
-public ref class VacationCompany
-{
-public:
- String^ Name;
-};
-
-public ref class Enterprises
-{
-private:
- array^wineries;
- array^companies;
-
-public:
-
- // Sets the Form property to qualified, and specifies the namespace.
- [XmlArray(Form=XmlSchemaForm::Qualified,ElementName="Company",
- Namespace="http://www.cohowinery.com")]
- property array^ Wineries
- {
- array^ get()
- {
- return wineries;
- }
- void set( array^value )
- {
- wineries = value;
- }
- }
-
- [XmlArray(Form=XmlSchemaForm::Qualified,ElementName="Company",
- Namespace="http://www.treyresearch.com")]
- property array^ Companies
- {
- array^ get()
- {
- return companies;
- }
- void set( array^value )
- {
- companies = value;
- }
- }
-};
-
-int main()
-{
- String^ filename = "MyEnterprises.xml";
-
- // Creates an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Enterprises::typeid );
-
- // Writing file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Creates an instance of the XmlSerializerNamespaces class.
- XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces;
-
- // Adds namespaces and prefixes for the XML document instance.
- ns->Add( "winery", "http://www.cohowinery.com" );
- ns->Add( "vacationCompany", "http://www.treyresearch.com" );
-
- // Creates an instance of the class that will be serialized.
- Enterprises^ myEnterprises = gcnew Enterprises;
-
- // Creates objects and adds to the array.
- Winery^ w1 = gcnew Winery;
- w1->Name = "cohowinery";
- array^myWinery = {w1};
- myEnterprises->Wineries = myWinery;
- VacationCompany^ com1 = gcnew VacationCompany;
- com1->Name = "adventure-works";
- array^myCompany = {com1};
- myEnterprises->Companies = myCompany;
-
- // Serializes the class, and closes the TextWriter.
- mySerializer->Serialize( writer, myEnterprises, ns );
- writer->Close();
-}
-
-void ReadEnterprises( String^ filename )
-{
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Enterprises::typeid );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Enterprises^ myEnterprises = dynamic_cast(mySerializer->Deserialize( fs ));
- for ( int i = 0; i < myEnterprises->Wineries->Length; i++ )
- {
- Console::WriteLine( myEnterprises->Wineries[ i ]->Name );
- }
- for ( int i = 0; i < myEnterprises->Companies->Length; i++ )
- {
- Console::WriteLine( myEnterprises->Companies[ i ]->Name );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp
deleted file mode 100644
index b04f9de845e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class MyClass
-{
-public:
-
- [XmlArray(IsNullable=true)]
- array^IsNullableIsTrueArray;
-
- [XmlArray(IsNullable=false)]
- array^IsNullableIsFalseArray;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp
deleted file mode 100644
index ffc20656b48..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Book
-{
-public:
- String^ Title;
- String^ Author;
- String^ ISBN;
-
- [XmlAttributeAttribute]
- String^ Publisher;
-};
-
-public ref class Periodical
-{
-private:
- String^ title;
-
-public:
-
- property String^ Title
- {
- String^ get()
- {
- return title;
- }
- void set( String^ value )
- {
- title = value;
- }
- }
-};
-
-public ref class Library
-{
-private:
- array^books;
- array^periodicals;
-
-public:
-
- /* This element will be qualified with the prefix
- that is associated with the namespace http://wwww.cpandl.com. */
- [XmlArray(ElementName="Titles",
- Namespace="http://wwww.cpandl.com")]
- property array^ Books
- {
- array^ get()
- {
- return books;
- }
- void set( array^value )
- {
- books = value;
- }
- }
-
- /* This element will be qualified with the prefix that is
- associated with the namespace http://www.proseware.com. */
- [XmlArray(ElementName="Titles",Namespace=
- "http://www.proseware.com")]
- property array^ Periodicals
- {
- array^ get()
- {
- return periodicals;
- }
- void set( array^value )
- {
- periodicals = value;
- }
- }
-};
-
-void WriteBook( String^ filename )
-{
- // Creates a new XmlSerializer.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid );
-
- // Writing the file requires a StreamWriter.
- TextWriter^ myStreamWriter = gcnew StreamWriter( filename );
-
- /* Creates an XmlSerializerNamespaces and adds prefixes and
- namespaces to be used. */
- XmlSerializerNamespaces^ myNamespaces = gcnew XmlSerializerNamespaces;
- myNamespaces->Add( "books", "http://wwww.cpandl.com" );
- myNamespaces->Add( "magazines", "http://www.proseware.com" );
-
- // Creates an instance of the class to be serialized.
- Library^ myLibrary = gcnew Library;
-
- // Creates two book objects.
- Book^ b1 = gcnew Book;
- b1->Title = "My Book Title";
- b1->Author = "An Author";
- b1->ISBN = "000000000";
- b1->Publisher = "Microsoft Press";
- Book^ b2 = gcnew Book;
- b2->Title = "Another Book Title";
- b2->Author = "Another Author";
- b2->ISBN = "00000001";
- b2->Publisher = "Another Press";
-
- /* Creates an array using the objects, and sets the Books property
- to the array. */
- array^myBooks = {b1,b2};
- myLibrary->Books = myBooks;
-
- // Creates two Periodical objects.
- Periodical^ per1 = gcnew Periodical;
- per1->Title = "My Magazine Title";
- Periodical^ per2 = gcnew Periodical;
- per2->Title = "Another Magazine Title";
-
- // Sets the Periodicals property to the array.
- array^myPeridocials = {per1,per2};
- myLibrary->Periodicals = myPeridocials;
-
- // Serializes the myLibrary object.
- mySerializer->Serialize( myStreamWriter, myLibrary, myNamespaces );
- myStreamWriter->Close();
-}
-
-void ReadBook( String^ filename )
-{
- /* Creates an instance of an XmlSerializer
- with the class used to read the document. */
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid );
-
- // A FileStream is needed to read the file.
- FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open );
- Library^ myLibrary = dynamic_cast(mySerializer->Deserialize( myFileStream ));
-
- // Reads each book in the array returned by the Books property.
- for ( int i = 0; i < myLibrary->Books->Length; i++ )
- {
- Console::WriteLine( myLibrary->Books[ i ]->Title );
- Console::WriteLine( myLibrary->Books[ i ]->Author );
- Console::WriteLine( myLibrary->Books[ i ]->ISBN );
- Console::WriteLine( myLibrary->Books[ i ]->Publisher );
- Console::WriteLine();
- }
- for ( int i = 0; i < myLibrary->Periodicals->Length; i++ )
- {
- Console::WriteLine( myLibrary->Periodicals[ i ]->Title );
- }
-}
-
-int main()
-{
- WriteBook( "MyLibrary.xml" );
- ReadBook( "MyLibrary.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp
deleted file mode 100644
index 78a6040f3fa..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class MyClass
-{
-public:
-
- [XmlArrayAttribute]
- array^MyStringArray;
-
- [XmlArrayAttribute]
- array^MyIntegerArray;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp
deleted file mode 100644
index 9b68919eff8..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class MyClass
-{
-public:
-
- [XmlArrayAttribute("MyStrings")]
- array^MyStringArray;
-
- [XmlArrayAttribute(ElementName="MyIntegers")]
- array^MyIntegerArray;
-};
-
-int main()
-{
- String^ filename = "MyClass.xml";
-
- // Creates a new instance of the XmlSerializer class.
- XmlSerializer^ s = gcnew XmlSerializer( MyClass::typeid );
-
- // Needs a StreamWriter to write the file.
- TextWriter^ myWriter = gcnew StreamWriter( filename );
- MyClass^ myClass = gcnew MyClass;
-
- // Creates and populates a string array, then assigns
- // it to the MyStringArray property.
- array^myStrings = {"Hello","World","!"};
- myClass->MyStringArray = myStrings;
-
- /* Creates and populates an integer array, and assigns
- it to the MyIntegerArray property. */
- array^myIntegers = {1,2,3};
- myClass->MyIntegerArray = myIntegers;
-
- // Serializes the class, and writes it to disk.
- s->Serialize( myWriter, myClass );
- myWriter->Close();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp
deleted file mode 100644
index 7504aad63a3..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-public ref class Employee
-{
-public:
- String^ Name;
-};
-
-public ref class Manager: public Employee
-{
-public:
- int Level;
-};
-
-public ref class Group
-{
-public:
-
- /* The XmlArrayItemAttribute allows the XmlSerializer to insert
- both the base type (Employee) and derived type (Manager)
- into serialized arrays. */
-
- [XmlArrayItem(Manager::typeid),
- XmlArrayItem(Employee::typeid)]
- array^Employees;
-
- /* Use the XmlArrayItemAttribute to specify types allowed
- in an array of Object items. */
-
- [XmlArray]
- [XmlArrayItem(Int32::typeid,
- ElementName="MyNumber"),
- XmlArrayItem(String::typeid,
- ElementName="MyString"),
- XmlArrayItem(Manager::typeid)]
- array^ExtraInfo;
-};
-
-void SerializeObject( String^ filename )
-{
- // Creates a new XmlSerializer.
- XmlSerializer^ s = gcnew XmlSerializer( Group::typeid );
-
- // Writing the XML file to disk requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- Group^ group = gcnew Group;
- Manager^ manager = gcnew Manager;
- Employee^ emp1 = gcnew Employee;
- Employee^ emp2 = gcnew Employee;
- manager->Name = "Consuela";
- manager->Level = 3;
- emp1->Name = "Seiko";
- emp2->Name = "Martina";
- array^emps = {manager,emp1,emp2};
- group->Employees = emps;
-
- // Creates an int and a string and assigns to ExtraInfo.
- array^temp = {43,"Extra",manager};
- group->ExtraInfo = temp;
-
- // Serializes the object, and closes the StreamWriter.
- s->Serialize( writer, group );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- XmlSerializer^ x = gcnew XmlSerializer( Group::typeid );
- Group^ g = dynamic_cast(x->Deserialize( fs ));
- Console::WriteLine( "Members:" );
- System::Collections::IEnumerator^ myEnum = g->Employees->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Employee^ e = safe_cast(myEnum->Current);
- Console::WriteLine( "\t{0}", e->Name );
- }
-}
-
-int main()
-{
- SerializeObject( "TypeDoc.xml" );
- DeserializeObject( "TypeDoc.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp
deleted file mode 100644
index 1ad1f494f35..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-// By default, this class results in XML elements named "Vehicle".
-public ref class Vehicle
-{
-public:
- String^ id;
-};
-
-// By default, this class results in XML elements named "Car".
-public ref class Car: public Vehicle
-{
-public:
- String^ Maker;
-};
-
-public ref class Transportation
-{
-public:
-
- /* Specifies acceptable types and the ElementName generated
- for each object type. */
-
- [XmlArray("Vehicles")]
- [XmlArrayItem(Vehicle::typeid,ElementName="Transport"),
- XmlArrayItem(Car::typeid,ElementName="Automobile")]
- array^MyVehicles;
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp
deleted file mode 100644
index 6f0101ea001..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::Serialization;
-
-//
-public ref class Vehicle
-{
-public:
- String^ id;
-};
-
-public ref class Car: public Vehicle
-{
-public:
- String^ Maker;
-};
-
-public ref class Transportation
-{
-public:
-
- // Specifies the Form property value.
-
- [XmlArray("Vehicles")]
- [XmlArrayItem(Vehicle::typeid,
- Form=XmlSchemaForm::Unqualified),
- XmlArrayItem(Car::typeid,
- Form=XmlSchemaForm::Qualified)]
- array^MyVehicles;
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp
deleted file mode 100644
index 10b3c35b2f1..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-public ref class Employee
-{
-public:
- String^ Name;
-};
-
-public ref class Manager: public Employee
-{
-public:
- int Level;
-};
-
-public ref class Group
-{
-public:
-
- [XmlArray(IsNullable=true)]
- [XmlArrayItem(Manager::typeid,IsNullable=false),
- XmlArrayItem(Employee::typeid,IsNullable=false)]
- array^Employees;
-};
-
-void SerializeObject( String^ filename )
-{
- XmlSerializer^ s = gcnew XmlSerializer( Group::typeid );
-
- // To write the file, a TextWriter is required.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Creates the object to serialize.
- Group^ group = gcnew Group;
-
- // Creates a null Manager object.
- Manager^ mgr = nullptr;
-
- // Creates a null Employee object.
- Employee^ y = nullptr;
- array^temp = {mgr,y};
- group->Employees = temp;
-
- // Serializes the object and closes the TextWriter.
- s->Serialize( writer, group );
- writer->Close();
-}
-
-int main()
-{
- SerializeObject( "TypeDoc.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp
deleted file mode 100644
index 41cc05bd344..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Vehicle{};
-
-public ref class Car: public Vehicle{};
-
-//
-public ref class Transportation
-{
-public:
-
- // Sets the Namespace property.
-
- [XmlArrayItem(Car::typeid,Namespace="http://www.cpandl.com")]
- array^MyVehicles;
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp
deleted file mode 100644
index b249fa9707c..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-public ref class Person
-{
-public:
- String^ Name;
-};
-
-public ref class Manager: public Person
-{
-public:
- int Rank;
-};
-
-public ref class Group
-{
-public:
-
- /* The Type property instructs the XmlSerializer to accept both
- the Person and Manager types in the array. */
-
- [XmlArrayItem(Type=Manager::typeid),
- XmlArrayItem(Type=Person::typeid)]
- array^Staff;
-};
-
-void SerializeOrder( String^ filename )
-{
- // Creates an XmlSerializer.
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid );
-
- // Creates the Group object, and two array items.
- Group^ myGroup = gcnew Group;
- Person^ p1 = gcnew Person;
- p1->Name = "Jacki";
- Manager^ p2 = gcnew Manager;
- p2->Name = "Megan";
- p2->Rank = 2;
- array^myStaff = {p1,p2};
- myGroup->Staff = myStaff;
-
- // Serializes the object, and closes the StreamWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- xSer->Serialize( writer, myGroup );
-}
-
-int main()
-{
- SerializeOrder( "TypeEx.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp
deleted file mode 100644
index 153e7b6e3d2..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Vehicle
-{
-public:
- String^ id;
-};
-
-public ref class Car: public Vehicle
-{
-public:
- String^ Maker;
-};
-
-public ref class Transportation
-{
-public:
-
- [XmlArrayItem,
- XmlArrayItem(Car::typeid,ElementName="Automobile")]
- array^MyVehicles;
-};
-
-void SerializeObject( String^ filename )
-{
- // Creates an XmlSerializer for the Transportation class.
- XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid );
-
- // Writing the XML file to disk requires a TextWriter.
- TextWriter^ myTextWriter = gcnew StreamWriter( filename );
-
- // Creates the object to serialize.
- Transportation^ myTransportation = gcnew Transportation;
-
- // Creates objects to add to the array.
- Vehicle^ myVehicle = gcnew Vehicle;
- myVehicle->id = "A12345";
- Car^ myCar = gcnew Car;
- myCar->id = "Car 34";
- myCar->Maker = "FamousCarMaker";
- array^temp = {myVehicle,myCar};
- myTransportation->MyVehicles = temp;
-
- // Serializes the object, and closes the StreamWriter.
- MySerializer->Serialize( myTextWriter, myTransportation );
- myTextWriter->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- // Creates an XmlSerializer instance.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid );
- FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open );
- Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream ));
- for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ )
- {
- Console::WriteLine( myTransportation->MyVehicles[ i ]->id );
- }
-}
-
-int main()
-{
- SerializeObject( "XmlArrayItem1.xml" );
- DeserializeObject( "XmlArrayItem1.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp
deleted file mode 100644
index 27560a12758..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Vehicle
-{
-public:
- String^ id;
-};
-
-public ref class Car: public Vehicle
-{
-public:
- String^ Maker;
-};
-
-public ref class Transportation
-{
-public:
-
- [XmlArrayItem(ElementName="Transportation"),
- XmlArrayItem(Car::typeid,ElementName="Automobile")]
- array^MyVehicles;
-};
-
-void SerializeObject( String^ filename )
-{
- // Creates an XmlSerializer for the Transportation class.
- XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid );
-
- // Writing the XML file to disk requires a TextWriter.
- TextWriter^ myTextWriter = gcnew StreamWriter( filename );
- Transportation^ myTransportation = gcnew Transportation;
- Vehicle^ myVehicle = gcnew Vehicle;
- myVehicle->id = "A12345";
- Car^ myCar = gcnew Car;
- myCar->id = "Car 34";
- myCar->Maker = "FamousCarMaker";
- array^myVehicles = {myVehicle,myCar};
- myTransportation->MyVehicles = myVehicles;
-
- // Serializes the object, and closes the StreamWriter.
- MySerializer->Serialize( myTextWriter, myTransportation );
- myTextWriter->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- // Creates the serializer with the type to deserialize.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid );
- FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open );
- Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream ));
- for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ )
- {
- Console::WriteLine( myTransportation->MyVehicles[ i ]->id );
- }
-}
-
-int main()
-{
- SerializeObject( "XmlArrayItem2.xml" );
- DeserializeObject( "XmlArrayItem2.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp
deleted file mode 100644
index 8809b40c0af..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Vehicle
-{
-public:
- String^ id;
-};
-
-public ref class Car: public Vehicle
-{
-public:
- String^ Maker;
-};
-
-public ref class Transportation
-{
-public:
-
- [XmlArrayItem(Vehicle::typeid),
- XmlArrayItem(Car::typeid)]
- array^MyVehicles;
-};
-
-void SerializeObject( String^ filename )
-{
- // Creates an XmlSerializer.
- XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid );
-
- // Writing the XML file to disk requires a TextWriter.
- TextWriter^ myTextWriter = gcnew StreamWriter( filename );
- Transportation^ myTransportation = gcnew Transportation;
- Vehicle^ myVehicle = gcnew Vehicle;
- myVehicle->id = "A12345";
- Car^ myCar = gcnew Car;
- myCar->id = "Car 34";
- myCar->Maker = "FamousCarMaker";
- array^myVehicles = {myVehicle,myCar};
- myTransportation->MyVehicles = myVehicles;
-
- // Serializes the object, and closes the StreamWriter.
- MySerializer->Serialize( myTextWriter, myTransportation );
- myTextWriter->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- // Creates the serializer with the type to deserialize.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid );
- FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open );
- Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream ));
- for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ )
- {
- Console::WriteLine( myTransportation->MyVehicles[ i ]->id );
- }
-}
-
-int main()
-{
- SerializeObject( "XmlArrayItem3.xml" );
- DeserializeObject( "XmlArrayItem3.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp
deleted file mode 100644
index 6886a80fe91..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Vehicle
-{
-public:
- String^ id;
-};
-
-public ref class Car: public Vehicle
-{
-public:
- String^ Maker;
-};
-
-public ref class Transportation
-{
-public:
-
- [XmlArray]
- [XmlArrayItem("Transport",Vehicle::typeid),
- XmlArrayItem("Automobile",Car::typeid)]
- array^MyVehicles;
-};
-
-void SerializeObject( String^ filename )
-{
- // Creates an XmlSerializer for the Transportation class.
- XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid );
-
- // Writing the XML file to disk requires a TextWriter.
- TextWriter^ myTextWriter = gcnew StreamWriter( filename );
- Transportation^ myTransportation = gcnew Transportation;
- Vehicle^ myVehicle = gcnew Vehicle;
- myVehicle->id = "A12345";
- Car^ myCar = gcnew Car;
- myCar->id = "Car 34";
- myCar->Maker = "FamousCarMaker";
- array^myVehicles = {myVehicle,myCar};
- myTransportation->MyVehicles = myVehicles;
-
- // Serializes the object, and closes the StreamWriter.
- MySerializer->Serialize( myTextWriter, myTransportation );
- myTextWriter->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- // Creates an XmlSerializer.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid );
- FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open );
- Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream ));
- for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ )
- {
- Console::WriteLine( myTransportation->MyVehicles[ i ]->id );
- }
-}
-
-int main()
-{
- SerializeObject( "XmlArrayItem4.xml" );
- DeserializeObject( "XmlArrayItem4.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp
deleted file mode 100644
index ded3d3f240a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Schema;
-
-public ref class Group
-{
-public:
-
- [XmlAttributeAttribute(Namespace="http://www.cpandl.com")]
- String^ GroupName;
-
- [XmlAttributeAttribute(DataType="base64Binary")]
- array^GroupNumber;
-
- [XmlAttributeAttribute(DataType="date",AttributeName="CreationDate")]
- DateTime Today;
-};
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the object properties.
- myGroup->GroupName = ".NET";
- array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )};
- myGroup->GroupNumber = hexByte;
- DateTime myDate = DateTime(2001,1,10);
- myGroup->Today = myDate;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-int main()
-{
- SerializeObject( "Attributes.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp
deleted file mode 100644
index bf8889f6772..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Group
-{
-public:
-
- // Change the XML attribute name.
-
- [XmlAttributeAttribute(AttributeName="MgrName")]
- String^ Name;
- /* Use the AttributeName to collect all the XML attributes
- in the XML-document instance. */
-};
-
-void SerializeObject( String^ filename )
-{
- Console::WriteLine( "Serializing" );
-
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- /* Set the Name property, which will be generated
- as an XML attribute. */
- myGroup->Name = "Wallace";
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- Console::WriteLine( "Deserializing" );
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs ));
- Console::WriteLine( myGroup->Name );
-}
-
-int main()
-{
- /* To use the AttributeName to collect all the
- XML attributes. Call SerializeObject to generate
- an XML document and alter the document by adding
- new XML attributes to it. Then comment out the SerializeObject
- method, and call DeserializeObject. */
- SerializeObject( "MyAtts.xml" );
- DeserializeObject( "MyAtts.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp
deleted file mode 100644
index dbc9a73c48f..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class Group
-{
-public:
-
- [XmlAttributeAttribute(DataType="string")]
- String^ Name;
-
- [XmlAttributeAttribute(DataType="base64Binary")]
- array^Hex64Code;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp
deleted file mode 100644
index 37de504e9b7..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::Serialization;
-
-//
-public ref class Vehicle
-{
-public:
-
- [XmlAttributeAttribute(Form=XmlSchemaForm::Qualified)]
- String^ Maker;
-
- [XmlAttributeAttribute(Form=XmlSchemaForm::Unqualified)]
- String^ ModelID;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp
deleted file mode 100644
index 8cd4fd710f3..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class Car
-{
-public:
-
- [XmlAttributeAttribute(Namespace="Make")]
- String^ MakerName;
-
- [XmlAttributeAttribute(Namespace="Model")]
- String^ ModelName;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp
deleted file mode 100644
index 4dc40d33dd2..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void serializer_UnknownAttribute( Object^ /*sender*/, XmlAttributeEventArgs^ e )
- {
- System::Xml::XmlAttribute^ attr = e->Attr;
- Console::WriteLine( "Unknown Attribute Name and Value: {0} = '{1}'",
- attr->Name, attr->Value );
- Object^ x = e->ObjectBeingDeserialized;
- Console::WriteLine( "ObjectBeingDeserialized: {0}", x );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp
deleted file mode 100644
index 5d23724e8ea..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-public ref class Instrument
-{
-public:
- String^ Name;
-};
-
-public ref class Brass: public Instrument
-{
-public:
- bool IsValved;
-};
-
-public ref class Orchestra
-{
-public:
- array^Instruments;
-};
-
-void SerializeObject( String^ filename )
-{
- /* Each overridden field, property, or type requires
- an XmlAttributes object. */
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- /* Create an XmlElementAttribute to override the
- field that returns Instrument objects. The overridden field
- returns Brass objects instead. */
- XmlElementAttribute^ attr = gcnew XmlElementAttribute;
- attr->ElementName = "Brass";
- attr->Type = Brass::typeid;
-
- // Add the element to the collection of elements.
- attrs->XmlElements->Add( attr );
-
- // Create the XmlAttributeOverrides object.
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
-
- /* Add the type of the class that contains the overridden
- member and the XmlAttributes to override it with to the
- XmlAttributeOverrides object. */
- attrOverrides->Add( Orchestra::typeid, "Instruments", attrs );
-
- // Create the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create the object that will be serialized.
- Orchestra^ band = gcnew Orchestra;
-
- // Create an object of the derived type.
- Brass^ i = gcnew Brass;
- i->Name = "Trumpet";
- i->IsValved = true;
- array^myInstruments = {i};
- band->Instruments = myInstruments;
-
- // Serialize the object.
- s->Serialize( writer, band );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- // Create an XmlElementAttribute to override the Instrument.
- XmlElementAttribute^ attr = gcnew XmlElementAttribute;
- attr->ElementName = "Brass";
- attr->Type = Brass::typeid;
-
- // Add the XmlElementAttribute to the collection of objects.
- attrs->XmlElements->Add( attr );
- attrOverrides->Add( Orchestra::typeid, "Instruments", attrs );
-
- // Create the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Orchestra^ band = dynamic_cast(s->Deserialize( fs ));
- Console::WriteLine( "Brass:" );
-
- /* The difference between deserializing the overridden
- XML document and serializing it is this: To read the derived
- object values, you must declare an object of the derived type
- (Brass), and cast the Instrument instance to it. */
- Brass^ b;
- System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Instrument^ i = safe_cast(myEnum->Current);
- b = dynamic_cast(i);
- Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved );
- }
-}
-
-int main()
-{
- SerializeObject( "Override.xml" );
- DeserializeObject( "Override.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp
deleted file mode 100644
index e474a5694c3..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-ref class Band;
-ref class Instrument;
-
-/* This is the class that will be overridden. The XmlIncludeAttribute
-tells the XmlSerializer that the overriding type exists. */
-
-[XmlInclude(Band::typeid)]
-public ref class Orchestra
-{
-public:
- array^Instruments;
-};
-
-// This is the overriding class.
-public ref class Band: public Orchestra
-{
-public:
- String^ BandName;
-};
-
-public ref class Instrument
-{
-public:
- String^ Name;
-};
-
-void SerializeObject( String^ filename )
-{
- /* Each object that is being overridden requires
- an XmlAttributes object. */
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- // An XmlRootAttribute allows overriding the Orchestra class.
- XmlRootAttribute^ xmlRoot = gcnew XmlRootAttribute;
-
- // Set the object to the XmlAttribute.XmlRoot property.
- attrs->XmlRoot = xmlRoot;
-
- // Create an XmlAttributeOverrides object.
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
-
- // Add the XmlAttributes to the XmlAttributeOverrrides.
- attrOverrides->Add( Orchestra::typeid, attrs );
-
- // Create the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create the object using the derived class.
- Band^ band = gcnew Band;
- band->BandName = "NewBand";
-
- // Create an Instrument.
- Instrument^ i = gcnew Instrument;
- i->Name = "Trumpet";
- array^myInstruments = {i};
- band->Instruments = myInstruments;
-
- // Serialize the object.
- s->Serialize( writer, band );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlRootAttribute^ attr = gcnew XmlRootAttribute;
- attrs->XmlRoot = attr;
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
- attrOverrides->Add( Orchestra::typeid, "Instruments", attrs );
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
-
- // Deserialize the Band object.
- Band^ band = dynamic_cast(s->Deserialize( fs ));
- Console::WriteLine( "Brass:" );
- System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Instrument^ i = safe_cast(myEnum->Current);
- Console::WriteLine( i->Name );
- }
-}
-
-int main()
-{
- SerializeObject( "Override.xml" );
- DeserializeObject( "Override.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp
deleted file mode 100644
index ae9b594d0f2..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
- String^ GroupName;
-
- [XmlAttributeAttribute]
- int GroupCode;
-};
-
-public ref class Sample
-{
-public:
- XmlSerializer^ CreateOverrider()
- {
- // Create an XmlAttributeOverrides object.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
-
- /* Create an XmlAttributeAttribute to override the base class
- object's XmlAttributeAttribute object. Give the overriding object
- a new attribute name ("Code"). */
- XmlAttributeAttribute^ xAtt = gcnew XmlAttributeAttribute;
- xAtt->AttributeName = "Code";
-
- /* Create an instance of the XmlAttributes class and set the
- XmlAttribute property to the XmlAttributeAttribute object. */
- XmlAttributes^ attrs = gcnew XmlAttributes;
- attrs->XmlAttribute = xAtt;
-
- /* Add the XmlAttributes object to the XmlAttributeOverrides
- and specify the type and member name to override. */
- xOver->Add( Group::typeid, "GroupCode", attrs );
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver );
- return xSer;
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp
deleted file mode 100644
index d9d43cdf6b3..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
- String^ GroupName;
-
- [XmlAttributeAttribute]
- int GroupCode;
-};
-
-public ref class Sample
-{
-public:
- XmlSerializer^ CreateOverrider()
- {
- // Create an XmlSerializer with overriding attributes.
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlRootAttribute^ xRoot = gcnew XmlRootAttribute;
-
- // Set a new Namespace and ElementName for the root element.
- xRoot->Namespace = "http://www.cpandl.com";
- xRoot->ElementName = "NewGroup";
- attrs->XmlRoot = xRoot;
- xOver->Add( Group::typeid, attrs );
-
- // Get the XmlAttributes object, based on the type.
- XmlAttributes^ tempAttrs;
- tempAttrs = xOver[ Group::typeid ];
-
- // Print the Namespace and ElementName of the root.
- Console::WriteLine( tempAttrs->XmlRoot->Namespace );
- Console::WriteLine( tempAttrs->XmlRoot->ElementName );
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver );
- return xSer;
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp
deleted file mode 100644
index 099c81b6664..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
- String^ GroupName;
-
- [XmlAttributeAttribute]
- int GroupCode;
-};
-
-public ref class Sample
-{
-public:
- XmlSerializer^ CreateOverrider()
- {
- // Create an XmlSerializer with overriding attributes.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
-
- /* Create an XmlAttributeAttribute object and set the
- AttributeName property. */
- XmlAttributeAttribute^ xAtt = gcnew XmlAttributeAttribute;
- xAtt->AttributeName = "Code";
-
- /* Create a new XmlAttributes object and set the
- XmlAttributeAttribute object to the XmlAttribute property. */
- XmlAttributes^ attrs = gcnew XmlAttributes;
- attrs->XmlAttribute = xAtt;
-
- /* Add the XmlAttributes to the XmlAttributeOverrides object. The
- name of the overridden attribute must be specified. */
- xOver->Add( Group::typeid, "GroupCode", attrs );
-
- // Get the XmlAttributes object for the type and member.
- XmlAttributes^ tempAttrs;
- tempAttrs = xOver[Group::typeid, "GroupCode"];
- Console::WriteLine( tempAttrs->XmlAttribute->AttributeName );
-
- // Create the XmlSerializer instance and return it.
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver );
- return xSer;
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp
deleted file mode 100644
index c0960e934fc..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Member
-{
-public:
- String^ MemberName;
-};
-
-
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
-
- // This field will be overridden.
- array^Members;
-};
-
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Creating XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAttrs = gcnew XmlAttributes;
-
- // Add an override for the XmlArray.
- XmlArrayAttribute^ xArray = gcnew XmlArrayAttribute( "Staff" );
- xArray->Namespace = "http://www.cpandl.com";
- xAttrs->XmlArray = xArray;
- xOver->Add( Group::typeid, "Members", xAttrs );
-
- // Create the XmlSerializer and return it.
- return gcnew XmlSerializer( Group::typeid,xOver );
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrider();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the object properties.
- Member^ m = gcnew Member;
- m->MemberName = "Paul";
- array^temp = {m};
- myGroup->Members = temp;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = CreateOverrider();
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs ));
- System::Collections::IEnumerator^ myEnum = myGroup->Members->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Member^ m = safe_cast(myEnum->Current);
- Console::WriteLine( m->MemberName );
- }
-}
-
-int main()
-{
- SerializeObject( "OverrideArray.xml" );
- DeserializeObject( "OverrideArray.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp
deleted file mode 100644
index d2aff93a0ce..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Member
-{
-public:
- String^ MemberName;
-};
-
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
- array^Members;
-};
-
-public ref class NewMember: public Member
-{
-public:
- int MemberID;
-};
-
-public ref class RetiredMember: public NewMember
-{
-public:
- DateTime RetireDate;
-};
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAttrs = gcnew XmlAttributes;
-
- // Add an override for the XmlArrayItem.
- XmlArrayItemAttribute^ xArrayItem = gcnew XmlArrayItemAttribute( NewMember::typeid );
- xArrayItem->Namespace = "http://www.cpandl.com";
- xAttrs->XmlArrayItems->Add( xArrayItem );
-
- // Add a second override.
- XmlArrayItemAttribute^ xArrayItem2 = gcnew XmlArrayItemAttribute( RetiredMember::typeid );
- xArrayItem2->Namespace = "http://www.cpandl.com";
- xAttrs->XmlArrayItems->Add( xArrayItem2 );
-
- // Add all overrides to XmlAttribueOverrides object.
- xOver->Add( Group::typeid, "Members", xAttrs );
-
- // Create the XmlSerializer and return it.
- return gcnew XmlSerializer( Group::typeid,xOver );
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrider();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the object properties.
- NewMember^ m = gcnew NewMember;
- m->MemberName = "Paul";
- m->MemberID = 2;
-
- // Create a second member.
- RetiredMember^ m2 = gcnew RetiredMember;
- m2->MemberName = "Renaldo";
- m2->MemberID = 23;
- m2->RetireDate = DateTime(2000,10,10);
- array^temp = {m,m2};
- myGroup->Members = temp;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = CreateOverrider();
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs ));
- System::Collections::IEnumerator^ myEnum = myGroup->Members->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Member^ m = safe_cast(myEnum->Current);
- Console::WriteLine( m->MemberName );
- }
-}
-
-int main()
-{
- SerializeObject( "OverrideArrayItem.xml" );
- DeserializeObject( "OverrideArrayItem.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp
deleted file mode 100644
index 080d02f704e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
-
- // This is the attribute that will be overridden.
-
- [XmlAttributeAttribute]
- String^ GroupName;
- int GroupNumber;
-};
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAttrs = gcnew XmlAttributes;
-
- /* Create an overriding XmlAttributeAttribute set it to
- the XmlAttribute property of the XmlAttributes object.*/
- XmlAttributeAttribute^ xAttribute = gcnew XmlAttributeAttribute( "SplinterName" );
- xAttrs->XmlAttribute = xAttribute;
-
- // Add to the XmlAttributeOverrides. Specify the member name.
- xOver->Add( Group::typeid, "GroupName", xAttrs );
-
- // Create the XmlSerializer and return it.
- return gcnew XmlSerializer( Group::typeid,xOver );
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrider();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- /* Set the Name property, which will be generated
- as an XML attribute. */
- myGroup->GroupName = ".NET";
- myGroup->GroupNumber = 1;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = CreateOverrider();
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs ));
- Console::WriteLine( myGroup->GroupName );
- Console::WriteLine( myGroup->GroupNumber );
-}
-
-int main()
-{
- SerializeObject( "OverrideAttribute.xml" );
- DeserializeObject( "OverrideAttribute.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp
deleted file mode 100644
index 79e6e301177..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-public ref class Instrument
-{
-public:
- String^ Name;
-};
-
-public ref class Brass: public Instrument
-{
-public:
- bool IsValved;
-};
-
-public ref class Orchestra
-{
-public:
- array^Instruments;
-};
-
-void SerializeObject( String^ filename )
-{
- /* Each overridden field, property, or type requires
- an XmlAttributes object. */
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- /* Create an XmlElementAttribute to override the
- field that returns Instrument objects. The overridden field
- returns Brass objects instead. */
- XmlElementAttribute^ attr = gcnew XmlElementAttribute;
- attr->ElementName = "Brass";
- attr->Type = Brass::typeid;
-
- // Add the element to the collection of elements.
- attrs->XmlElements->Add( attr );
-
- // Create the XmlAttributeOverrides object.
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
-
- /* Add the type of the class that contains the overridden
- member and the XmlAttributes to override it with to the
- XmlAttributeOverrides object. */
- attrOverrides->Add( Orchestra::typeid, "Instruments", attrs );
-
- // Create the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create the object that will be serialized.
- Orchestra^ band = gcnew Orchestra;
-
- // Create an object of the derived type.
- Brass^ i = gcnew Brass;
- i->Name = "Trumpet";
- i->IsValved = true;
- array^myInstruments = {i};
- band->Instruments = myInstruments;
-
- // Serialize the object.
- s->Serialize( writer, band );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- // Create an XmlElementAttribute to override the Instrument.
- XmlElementAttribute^ attr = gcnew XmlElementAttribute;
- attr->ElementName = "Brass";
- attr->Type = Brass::typeid;
-
- // Add the element to the collection of elements.
- attrs->XmlElements->Add( attr );
- attrOverrides->Add( Orchestra::typeid, "Instruments", attrs );
-
- // Create the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Orchestra^ band = dynamic_cast(s->Deserialize( fs ));
- Console::WriteLine( "Brass:" );
-
- /* The difference between deserializing the overridden
- XML document and serializing it is this: To read the derived
- object values, you must declare an object of the derived type
- (Brass), and cast the Instrument instance to it. */
- Brass^ b;
- System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Instrument^ i = safe_cast(myEnum->Current);
- b = dynamic_cast(i);
- Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved );
- }
-}
-
-int main()
-{
- SerializeObject( "Override.xml" );
- DeserializeObject( "Override.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp
deleted file mode 100644
index 40f6a96deb7..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::ComponentModel;
-
-// This is the class that will be serialized.
-public ref class Pet
-{
-public:
-
- // The default value for the Animal field is "Dog".
-
- [DefaultValueAttribute("Dog")]
- String^ Animal;
-};
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAttrs = gcnew XmlAttributes;
-
- // Add an override for the default value of the GroupName.
- Object^ defaultAnimal = "Cat";
- xAttrs->XmlDefaultValue = defaultAnimal;
-
- // Add all the XmlAttributes to the XmlAttributeOverrides object.
- xOver->Add( Pet::typeid, "Animal", xAttrs );
-
- // Create the XmlSerializer and return it.
- return gcnew XmlSerializer( Pet::typeid,xOver );
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrider();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Pet^ myPet = gcnew Pet;
-
- /* Set the Animal property. If you set it to the default value,
- which is "Cat" (the value assigned to the XmlDefaultValue
- of the XmlAttributes object), no value will be serialized.
- If you change the value to any other value (including "Dog"),
- the value will be serialized.
- */
- // The default value "Cat" will be assigned (nothing serialized).
- myPet->Animal = "";
-
- // Uncommenting the next line also results in the default
- // value because Cat is the default value (not serialized).
- // myPet.Animal = "Cat";
- // Uncomment the next line to see the value serialized:
- // myPet.Animal = "fish";
- // This will also be serialized because Dog is not the
- // default anymore.
- // myPet.Animal = "Dog";
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myPet );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = CreateOverrider();
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Pet^ myPet = dynamic_cast(mySerializer->Deserialize( fs ));
- Console::WriteLine( myPet->Animal );
-}
-
-int main()
-{
- SerializeObject( "OverrideDefaultValue.xml" );
- DeserializeObject( "OverrideDefaultValue.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp
deleted file mode 100644
index dc3a90e6177..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Collections;
-using namespace System::Xml;
-
-public ref class Car
-{
-public:
- String^ Name;
-};
-
-public ref class Plane
-{
-public:
- String^ Name;
-};
-
-public ref class Truck
-{
-public:
- String^ Name;
-};
-
-public ref class Train
-{
-public:
- String^ Name;
-};
-
-public ref class Transportation
-{
-public:
-
- // Subsequent code overrides these two XmlElementAttributes.
-
- [XmlElement(Car::typeid),
- XmlElement(Plane::typeid)]
- ArrayList^ Vehicles;
-};
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributes and XmlAttributeOverrides objects.
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
-
- /* Create an XmlElementAttribute to override
- the Vehicles property. */
- XmlElementAttribute^ xElement1 = gcnew XmlElementAttribute( Truck::typeid );
-
- // Add the XmlElementAttribute to the collection.
- attrs->XmlElements->Add( xElement1 );
-
- /* Create a second XmlElementAttribute, and
- add it to the collection. */
- XmlElementAttribute^ xElement2 = gcnew XmlElementAttribute( Train::typeid );
- attrs->XmlElements->Add( xElement2 );
-
- /* Add the XmlAttributes to the XmlAttributeOverrides,
- specifying the member to override. */
- xOver->Add( Transportation::typeid, "Vehicles", attrs );
-
- // Create the XmlSerializer, and return it.
- XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver );
- return xSer;
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an XmlSerializer instance.
- XmlSerializer^ xSer = CreateOverrider();
-
- // Create the object and serialize it.
- Transportation^ myTransportation = gcnew Transportation;
-
- /* Create two new override objects that can be
- inserted into the array. */
- myTransportation->Vehicles = gcnew ArrayList;
- Truck^ myTruck = gcnew Truck;
- myTruck->Name = "MyTruck";
- Train^ myTrain = gcnew Train;
- myTrain->Name = "MyTrain";
- myTransportation->Vehicles->Add( myTruck );
- myTransportation->Vehicles->Add( myTrain );
- TextWriter^ writer = gcnew StreamWriter( filename );
- xSer->Serialize( writer, myTransportation );
-}
-
-int main()
-{
- SerializeObject( "OverrideElement.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp
deleted file mode 100644
index 9b65599120b..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public enum class FoodType
-{
- // Subsequent code overrides these enumerations.
- Low, High
-};
-
-// This is the class that will be serialized.
-public ref class Food
-{
-public:
- FoodType Type;
-};
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAttrs = gcnew XmlAttributes;
-
- // Add an XmlEnumAttribute for the FoodType.Low enumeration.
- XmlEnumAttribute^ xEnum = gcnew XmlEnumAttribute;
- xEnum->Name = "Cold";
- xAttrs->XmlEnum = xEnum;
- xOver->Add( FoodType::typeid, "Low", xAttrs );
-
- // Add an XmlEnumAttribute for the FoodType.High enumeration.
- xAttrs = gcnew XmlAttributes;
- xEnum = gcnew XmlEnumAttribute;
- xEnum->Name = "Hot";
- xAttrs->XmlEnum = xEnum;
- xOver->Add( FoodType::typeid, "High", xAttrs );
-
- // Create the XmlSerializer, and return it.
- return gcnew XmlSerializer( Food::typeid,xOver );
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrider();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Food^ myFood = gcnew Food;
-
- // Set the object properties.
- myFood->Type = FoodType::High;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myFood );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = CreateOverrider();
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Food^ myFood = dynamic_cast(mySerializer->Deserialize( fs ));
- Console::WriteLine( myFood->Type );
-}
-
-int main()
-{
- SerializeObject( "OverrideEnum.xml" );
- DeserializeObject( "OverrideEnum.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp
deleted file mode 100644
index 1f586f80547..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
-
- // The GroupName value will be serialized--unless it's overridden.
- String^ GroupName;
-
- /* This field will be ignored when serialized--
- unless it's overridden. */
-
- [XmlIgnoreAttribute]
- String^ Comment;
-};
-
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- /* Setting XmlIgnore to false overrides the XmlIgnoreAttribute
- applied to the Comment field. Thus it will be serialized.*/
- attrs->XmlIgnore = false;
- xOver->Add( Group::typeid, "Comment", attrs );
-
- /* Use the XmlIgnore to instruct the XmlSerializer to ignore
- the GroupName instead. */
- attrs = gcnew XmlAttributes;
- attrs->XmlIgnore = true;
- xOver->Add( Group::typeid, "GroupName", attrs );
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver );
- return xSer;
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an XmlSerializer instance.
- XmlSerializer^ xSer = CreateOverrider();
-
- // Create the object to serialize and set its properties.
- Group^ myGroup = gcnew Group;
- myGroup->GroupName = ".NET";
- myGroup->Comment = "My Comment...";
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Serialize the object and close the TextWriter.
- xSer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-int main()
-{
- SerializeObject( "IgnoreXml.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp
deleted file mode 100644
index 42c1f3a3503..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
- String^ GroupName;
-
- [XmlAttributeAttribute]
- int GroupCode;
-};
-
-// Return an XmlSerializer for overriding attributes.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributes and XmlAttributeOverrides objects.
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlRootAttribute^ xRoot = gcnew XmlRootAttribute;
-
- // Set a new Namespace and ElementName for the root element.
- xRoot->Namespace = "http://www.cpandl.com";
- xRoot->ElementName = "NewGroup";
- attrs->XmlRoot = xRoot;
-
- /* Add the XmlAttributes object to the XmlAttributeOverrides.
- No member name is needed because the whole class is
- overridden. */
- xOver->Add( Group::typeid, attrs );
-
- // Get the XmlAttributes object, based on the type.
- XmlAttributes^ tempAttrs;
- tempAttrs = xOver[ Group::typeid ];
-
- // Print the Namespace and ElementName of the root.
- Console::WriteLine( tempAttrs->XmlRoot->Namespace );
- Console::WriteLine( tempAttrs->XmlRoot->ElementName );
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver );
- return xSer;
-}
-
-void SerializeObject( String^ filename )
-{
- // Create the XmlSerializer using the CreateOverrider method.
- XmlSerializer^ xSer = CreateOverrider();
-
- // Create the object to serialize.
- Group^ myGroup = gcnew Group;
- myGroup->GroupName = ".NET";
- myGroup->GroupCode = 123;
-
- // To write the file, a TextWriter is required.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Serialize the object and close the TextWriter.
- xSer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-int main()
-{
- SerializeObject( "OverrideRoot.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp
deleted file mode 100644
index e2732ed2c57..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class Group
-{
-public:
- String^ GroupName;
-
- // This field will be serialized as XML text.
- String^ Comment;
-};
-
-// Return an XmlSerializer to be used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAttrs = gcnew XmlAttributes;
-
- /* Create an XmlTextAttribute and assign it to the XmlText
- property. This instructs the XmlSerializer to treat the
- Comment field as XML text. */
- XmlTextAttribute^ xText = gcnew XmlTextAttribute;
- xAttrs->XmlText = xText;
- xOver->Add( Group::typeid, "Comment", xAttrs );
-
- // Create the XmlSerializer, and return it.
- return gcnew XmlSerializer( Group::typeid,xOver );
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrider();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the object properties.
- myGroup->GroupName = ".NET";
- myGroup->Comment = "Great Stuff!";
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = CreateOverrider();
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs ));
- Console::WriteLine( myGroup->GroupName );
- Console::WriteLine( myGroup->Comment );
-}
-
-int main()
-{
- SerializeObject( "OverrideText.xml" );
- DeserializeObject( "OverrideText.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp
deleted file mode 100644
index d2cccc13596..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-public ref class Car
-{
-public:
- int ID;
-};
-
-public ref class Transportation
-{
-public:
- array^Cars;
-};
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlAttributes and XmlAttributeOverrides objects.
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
-
- /* Create an XmlTypeAttribute and change the name of the
- XML type. */
- XmlTypeAttribute^ xType = gcnew XmlTypeAttribute;
- xType->TypeName = "Autos";
-
- // Set the XmlTypeAttribute to the XmlType property.
- attrs->XmlType = xType;
-
- /* Add the XmlAttributes to the XmlAttributeOverrides,
- specifying the member to override. */
- xOver->Add( Car::typeid, attrs );
-
- // Create the XmlSerializer, and return it.
- XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver );
- return xSer;
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an XmlSerializer instance.
- XmlSerializer^ xSer = CreateOverrider();
-
- // Create object and serialize it.
- Transportation^ myTransportation = gcnew Transportation;
- Car^ c1 = gcnew Car;
- c1->ID = 12;
- Car^ c2 = gcnew Car;
- c2->ID = 44;
- array^temp0 = {c1,c2};
- myTransportation->Cars = temp0;
-
- // To write the file, a TextWriter is required.
- TextWriter^ writer = gcnew StreamWriter( filename );
- xSer->Serialize( writer, myTransportation );
-}
-
-int main()
-{
- SerializeObject( "XmlType.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp
deleted file mode 100644
index eea4fa29c6d..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-public ref class Employee
-{
-public:
- String^ Name;
-};
-
-public ref class Manager: public Employee
-{
-public:
- int Level;
-};
-
-public ref class Group
-{
-public:
-
- /* Set the element name and namespace of the XML element.
- By applying an XmlElementAttribute to an array, you instruct
- the XmlSerializer to serialize the array as a series of XML
- elements, instead of a nested set of elements. */
-
- [XmlElement(
- ElementName="Members",
- Namespace="http://www.cpandl.com")]
- array^Employees;
-
- [XmlElement(DataType="snippet1>",
- ElementName="Building")]
- double GroupID;
-
- [XmlElement(DataType="hexBinary")]
- array^HexBytes;
-
- [XmlElement(DataType="boolean")]
- bool IsActive;
-
- [XmlElement(Type=::Manager::typeid)]
- Employee^ Manager;
-
- [XmlElement(Int32::typeid,
- ElementName="ObjectNumber"),
- XmlElement(String::typeid,
- ElementName="ObjectString")]
- ArrayList^ ExtraInfo;
-};
-
-void SerializeObject( String^ filename )
-{
- // Create the XmlSerializer.
- XmlSerializer^ s = gcnew XmlSerializer( Group::typeid );
-
- // To write the file, a TextWriter is required.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- /* Create an instance of the group to serialize, and set
- its properties. */
- Group^ group = gcnew Group;
- group->GroupID = 10.089f;
- group->IsActive = false;
- array^temp0 = {Convert::ToByte( 100 )};
- group->HexBytes = temp0;
- Employee^ x = gcnew Employee;
- Employee^ y = gcnew Employee;
- x->Name = "Jack";
- y->Name = "Jill";
- array^temp1 = {x,y};
- group->Employees = temp1;
- Manager^ mgr = gcnew Manager;
- mgr->Name = "Sara";
- mgr->Level = 4;
- group->Manager = mgr;
-
- /* Add a number and a string to the
- ArrayList returned by the ExtraInfo property. */
- group->ExtraInfo = gcnew ArrayList;
- group->ExtraInfo->Add( 42 );
- group->ExtraInfo->Add( "Answer" );
-
- // Serialize the object, and close the TextWriter.
- s->Serialize( writer, group );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- XmlSerializer^ x = gcnew XmlSerializer( Group::typeid );
- Group^ g = dynamic_cast(x->Deserialize( fs ));
- Console::WriteLine( g->Manager->Name );
- Console::WriteLine( g->GroupID );
- Console::WriteLine( g->HexBytes[ 0 ] );
- IEnumerator^ myEnum = g->Employees->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Employee^ e = safe_cast(myEnum->Current);
- Console::WriteLine( e->Name );
- }
-}
-
-int main()
-{
- SerializeObject( "FirstDoc.xml" );
- DeserializeObject( "FirstDoc.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp
deleted file mode 100644
index dac3339b9d7..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-public ref class Group
-{
-public:
-
- /* Apply two XmlElementAttributes to the field. Set the DataType
- to string an int to allow the ArrayList to accept
- both types. The Namespace is also set to different values
- for each type. */
-
- [XmlElement(DataType="string",
- Type=String::typeid,
- Namespace="http://www.cpandl.com"),
- XmlElement(DataType="snippet1>",
- Namespace="http://www.cohowinery.com",
- Type=Int32::typeid)]
- ArrayList^ ExtraInfo;
-};
-
-void SerializeObject( String^ filename )
-{
- // A TextWriter is needed to write the file.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Group::typeid );
-
- // Create the object to serialize.
- Group^ myGroup = gcnew Group;
-
- /* Add a string and an integer to the ArrayList returned
- by the ExtraInfo field. */
- myGroup->ExtraInfo = gcnew ArrayList;
- myGroup->ExtraInfo->Add( "hello" );
- myGroup->ExtraInfo->Add( 100 );
-
- // Serialize the object and close the TextWriter.
- s->Serialize( writer, myGroup );
- writer->Close();
-}
-
-int main()
-{
- SerializeObject( "ElementTypes.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp
deleted file mode 100644
index c73eab60f3b..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-//
-// This is the class that will be serialized.
-public ref class XClass
-{
-public:
- /* The XML element name will be XName
- instead of the default ClassName. */
- [XmlElement(ElementName="XName")]
- String^ ClassName;
-};
-//
-
-int main(){}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp
deleted file mode 100644
index 323a5e3febf..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::Serialization;
-
-//
-public ref class MyClass
-{
-public:
-
- [XmlElement(Form=XmlSchemaForm::Unqualified)]
- String^ ClassName;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp
deleted file mode 100644
index 496244672df..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class MyClass
-{
-public:
-
- [XmlElement(IsNullable=false)]
- String^ Group;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp
deleted file mode 100644
index 217959b7fad..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Employee
-{
-public:
- String^ Name;
-};
-
-public ref class Manager: public Employee
-{
-public:
- int Level;
-};
-
-public ref class Group
-{
-public:
-
- [XmlElement(Manager::typeid)]
- array^Staff;
-
- [XmlElement(Int32::typeid),
- XmlElement(String::typeid),
- XmlElement(DateTime::typeid)]
- ArrayList^ ExtraInfo;
-};
-
-void SerializeObject( String^ filename )
-{
- // Create an XmlSerializer instance.
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid );
-
- // Create object and serialize it.
- Group^ myGroup = gcnew Group;
- Manager^ e1 = gcnew Manager;
- e1->Name = "Manager1";
- Manager^ m1 = gcnew Manager;
- m1->Name = "Manager2";
- m1->Level = 4;
- array^emps = {e1,m1};
- myGroup->Staff = emps;
- myGroup->ExtraInfo = gcnew ArrayList;
- myGroup->ExtraInfo->Add( ".NET" );
- myGroup->ExtraInfo->Add( 42 );
- myGroup->ExtraInfo->Add( DateTime(2001,1,1) );
- TextWriter^ writer = gcnew StreamWriter( filename );
- xSer->Serialize( writer, myGroup );
- writer->Close();
-}
-
-int main()
-{
- SerializeObject( "TypeEx.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp
deleted file mode 100644
index f06647e1954..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class MyClass
-{
-public:
-
- [XmlElement]
- String^ TeacherName;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp
deleted file mode 100644
index a92464e29dc..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class Transportation
-{
-public:
-
- [XmlElement("Cars")]
- String^ Vehicles;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp
deleted file mode 100644
index 701b642c490..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-public ref class Instrument
-{
-public:
- String^ Name;
-};
-
-public ref class Brass: public Instrument
-{
-public:
- bool IsValved;
-};
-
-public ref class Orchestra
-{
-public:
- array^Instruments;
-};
-
-void SerializeObject( String^ filename )
-{
- // To write the file, a TextWriter is required.
- TextWriter^ writer = gcnew StreamWriter( filename );
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- // Creates an XmlElementAttribute that overrides the Instrument type.
- XmlElementAttribute^ attr = gcnew XmlElementAttribute( Brass::typeid );
- attr->ElementName = "Brass";
-
- // Adds the element to the collection of elements.
- attrs->XmlElements->Add( attr );
- attrOverrides->Add( Orchestra::typeid, "Instruments", attrs );
-
- // Creates the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
-
- // Creates the object to serialize.
- Orchestra^ band = gcnew Orchestra;
-
- // Creates an object of the derived type.
- Brass^ i = gcnew Brass;
- i->Name = "Trumpet";
- i->IsValved = true;
- array^myInstruments = {i};
- band->Instruments = myInstruments;
- s->Serialize( writer, band );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- // Creates an XmlElementAttribute that override the Instrument type.
- XmlElementAttribute^ attr = gcnew XmlElementAttribute( Brass::typeid );
- attr->ElementName = "Brass";
-
- // Adds the element to the collection of elements.
- attrs->XmlElements->Add( attr );
- attrOverrides->Add( Orchestra::typeid, "Instruments", attrs );
-
- // Creates the XmlSerializer using the XmlAttributeOverrides.
- XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Orchestra^ band = dynamic_cast(s->Deserialize( fs ));
- Console::WriteLine( "Brass:" );
-
- /* Deserializing differs from serializing. To read the
- derived-object values, declare an object of the derived
- type (Brass) and cast the Instrument instance to it. */
- Brass^ b;
- System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Instrument^ i = safe_cast(myEnum->Current);
- b = dynamic_cast(i);
- Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved );
- }
-}
-
-int main()
-{
- SerializeObject( "Override.xml" );
- DeserializeObject( "Override.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp
deleted file mode 100644
index 000e548b46f..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Collections;
-using namespace System::Xml;
-
-public ref class Car
-{
-public:
- String^ Name;
-};
-
-public ref class Plane
-{
-public:
- String^ Name;
-};
-
-public ref class Truck
-{
-public:
- String^ Name;
-};
-
-public ref class Train
-{
-public:
- String^ Name;
-};
-
-public ref class Transportation
-{
-public:
-
- // Override these two XmlElementAttributes.
-
- [XmlElement(Car::typeid),
- XmlElement(Plane::typeid)]
- ArrayList^ Vehicles;
-};
-
-XmlSerializer^ CreateOverrider()
-{
- // Create XmlAtrributes and XmlAttributeOverrides instances.
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
-
- /* Create an XmlElementAttributes object to override
- one of the attributes applied to the Vehicles property. */
- XmlElementAttribute^ xElement1 = gcnew XmlElementAttribute( Truck::typeid );
-
- // Add the XmlElementAttribute to the collection.
- attrs->XmlElements->Add( xElement1 );
-
- /* Create a second XmlElementAttribute and
- add it to the collection. */
- XmlElementAttribute^ xElement2 = gcnew XmlElementAttribute( Train::typeid );
- attrs->XmlElements->Add( xElement2 );
-
- /* Add the XmlAttributes to the XmlAttributeOverrides,
- specifying the member to override. */
- xOver->Add( Transportation::typeid, "Vehicles", attrs );
-
- // Create the XmlSerializer, and return it.
- XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver );
- return xSer;
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an XmlSerializer instance.
- XmlSerializer^ xSer = CreateOverrider();
-
- // Create the object.
- Transportation^ myTransportation = gcnew Transportation;
-
- /* Create two new, overriding objects that can be
- inserted into the Vehicles array. */
- myTransportation->Vehicles = gcnew ArrayList;
- Truck^ myTruck = gcnew Truck;
- myTruck->Name = "MyTruck";
- Train^ myTrain = gcnew Train;
- myTrain->Name = "MyTrain";
- myTransportation->Vehicles->Add( myTruck );
- myTransportation->Vehicles->Add( myTrain );
- TextWriter^ writer = gcnew StreamWriter( filename );
- xSer->Serialize( writer, myTransportation );
-}
-
-int main()
-{
- SerializeObject( "OverrideElement.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp
deleted file mode 100644
index 3933ca7d495..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Truck{
- // Class added so sample will compile
-};
-
-public ref class Train{
- // Class added so sample will compile
-};
-
-public ref class Transportation{
- // Class added so sample will compile
-};
-
-public ref class Sample
-{
- //
-public:
- XmlSerializer^ CreateOverrider()
- {
- // Create XmlAttributes and XmlAttributeOverrides instances.
-
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlAttributeOverrides^ xOver =
- gcnew XmlAttributeOverrides;
-
- /* Create an XmlElementAttributes to override
- the Vehicles property. */
- XmlElementAttribute^ xElement1 =
- gcnew XmlElementAttribute( Truck::typeid );
- // Add the XmlElementAttribute to the collection.
- attrs->XmlElements->Add( xElement1 );
-
- /* Create a second XmlElementAttribute, and
- add to the collection. */
- XmlElementAttribute^ xElement2 =
- gcnew XmlElementAttribute( Train::typeid );
- attrs->XmlElements->Add( xElement2 );
-
- /* Add the XmlAttributes to the XmlAttributeOverrides,
- specifying the member to override. */
- xOver->Add( Transportation::typeid, "Vehicles", attrs );
-
- // Create the XmlSerializer, and return it.
- XmlSerializer^ xSer = gcnew XmlSerializer(
- Transportation::typeid,xOver );
- return xSer;
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp
deleted file mode 100644
index b82f373dbe0..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public enum class EmployeeStatus
-{
- [XmlEnum(Name = "Single")]
- One,
- [XmlEnum(Name = "Double")]
- Two,
- [XmlEnum(Name = "Triple")]
- Three
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp
deleted file mode 100644
index d494e993e3e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public enum class EmployeeStatus
-{
- [XmlEnum("Single")]
- One,
- [XmlEnum("Double")]
- Two,
- [XmlEnum("Triple")]
- Three
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp
deleted file mode 100644
index d7f0debeaec..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public enum class FoodType
-{
- // Subsequent code overrides these enumerations.
- Low, High
-};
-
-// This is the class that will be serialized.
-public ref class Food
-{
-public:
- FoodType Type;
-};
-
-// Return an XmlSerializer used for overriding.
-XmlSerializer^ CreateOverrider()
-{
- // Create the XmlOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAttrs = gcnew XmlAttributes;
-
- // Add an XmlEnumAttribute for the FoodType.Low enumeration.
- XmlEnumAttribute^ xEnum = gcnew XmlEnumAttribute;
- xEnum->Name = "Cold";
- xAttrs->XmlEnum = xEnum;
- xOver->Add( FoodType::typeid, "Low", xAttrs );
-
- // Add an XmlEnumAttribute for the FoodType.High enumeration.
- xAttrs = gcnew XmlAttributes;
- xEnum = gcnew XmlEnumAttribute;
- xEnum->Name = "Hot";
- xAttrs->XmlEnum = xEnum;
- xOver->Add( FoodType::typeid, "High", xAttrs );
-
- // Create the XmlSerializer, and return it.
- return gcnew XmlSerializer( Food::typeid,xOver );
-}
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrider();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Food^ myFood = gcnew Food;
-
- // Set the object properties.
- myFood->Type = FoodType::High;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myFood );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = CreateOverrider();
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Food^ myFood = dynamic_cast(mySerializer->Deserialize( fs ));
- Console::WriteLine( myFood->Type );
-}
-
-int main()
-{
- SerializeObject( "OverrideEnum.xml" );
- DeserializeObject( "OverrideEnum.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp
deleted file mode 100644
index 7298f812c7a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class Group
-{
-public:
-
- // The XmlSerializer ignores this field.
-
- [XmlIgnore]
- String^ Comment;
-
- // The XmlSerializer serializes this field.
- String^ GroupName;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp
deleted file mode 100644
index cbfdda004f2..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-ref class Employee;
-
-ref class Manager;
-
-ref class Group
-{
-public:
- array^Employees;
-};
-
-// Instruct the XmlSerializer to accept Manager types as well.
-[XmlInclude(Manager::typeid)]
-public ref class Employee
-{
-public:
- String^ Name;
-};
-
-public ref class Manager: public Employee
-{
-public:
- int Level;
-};
-
-void SerializeObject( String^ filename )
-{
- XmlSerializer^ s = gcnew XmlSerializer( Group::typeid );
- TextWriter^ writer = gcnew StreamWriter( filename );
- Group^ group = gcnew Group;
- Manager^ manager = gcnew Manager;
- Employee^ emp1 = gcnew Employee;
- Employee^ emp2 = gcnew Employee;
- manager->Name = "Zeus";
- manager->Level = 2;
- emp1->Name = "Ares";
- emp2->Name = "Artemis";
- array^emps = {manager,emp1,emp2};
- group->Employees = emps;
- s->Serialize( writer, group );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- XmlSerializer^ x = gcnew XmlSerializer( Group::typeid );
- Group^ g = dynamic_cast(x->Deserialize( fs ));
- Console::Write( "Members:" );
- System::Collections::IEnumerator^ myEnum = g->Employees->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Employee^ e = safe_cast(myEnum->Current);
- Console::WriteLine( "\t{0}", e->Name );
- }
-}
-
-int main()
-{
- SerializeObject( "IncludeExample.xml" );
- DeserializeObject( "IncludeExample.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp
deleted file mode 100644
index 8ba6ec67f15..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Web::Services;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-public ref class Vehicle{};
-
-public ref class Car: public Vehicle{};
-
-public ref class Truck: public Vehicle{};
-
-public ref class Sample
-{
-public:
-
- [WebMethodAttribute]
- [XmlInclude(Car::typeid)]
- [XmlInclude(Truck::typeid)]
- Vehicle^ ReturnVehicle( int i )
- {
- if ( i == 0 )
- return gcnew Car;
- else
- return gcnew Truck;
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp
deleted file mode 100644
index 78b7ac99698..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp
deleted file mode 100644
index de9d0304ae4..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
-private:
- //
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- Console::WriteLine( "UnknownNode Name: {0}", e->Name );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp
deleted file mode 100644
index 68985474069..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp
deleted file mode 100644
index bd6a1e29d72..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- XmlNodeType myNodeType = e->NodeType;
- Console::WriteLine( myNodeType );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp
deleted file mode 100644
index 88a67fdab41..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- Object^ o = e->ObjectBeingDeserialized;
- Console::WriteLine( "Object being deserialized: {0}", o );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp
deleted file mode 100644
index a4734b7e012..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- Console::WriteLine( "UnknownNode Text: {0}", e->Text );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp
deleted file mode 100644
index b4318feda2a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Class1
-{
- //
-private:
- void DeserializeItem( String^ filename )
- {
- XmlSerializer^ mySerializer = gcnew XmlSerializer( ObjectToDeserialize::typeid );
-
- // Add an instance of the delegate to the event.
- mySerializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Class1::Serializer_UnknownNode );
-
- // A FileStream is needed to read the file to deserialize.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- ObjectToDeserialize^ o = dynamic_cast(mySerializer->Deserialize( fs ));
- }
-
- void Serializer_UnknownNode( Object^ sender, XmlNodeEventArgs^ e )
- {
- Console::WriteLine( "UnknownNode Name: {0}", e->Name );
- Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName );
- Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI );
- Console::WriteLine( "UnknownNode Text: {0}", e->Text );
- Object^ o = e->ObjectBeingDeserialized;
- Console::WriteLine( "Object being deserialized {0}", o );
- XmlNodeType myNodeType = e->NodeType;
- Console::WriteLine( myNodeType );
- }
- //
-
-public:
-
- ref class ObjectToDeserialize{};
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp
deleted file mode 100644
index 705ea6b1244..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::Serialization;
-
-[XmlRoot(Namespace="www.contoso.com",
-ElementName="MyGroupName",
-DataType="string",
-IsNullable=true)]
-public ref class Group
-{
-private:
- String^ groupNameValue;
-
-public:
-
- // Insert code for the Group class.
- Group(){}
-
- Group( String^ groupNameVal )
- {
- groupNameValue = groupNameVal;
- }
-
- property String^ GroupName
- {
- String^ get()
- {
- return groupNameValue;
- }
- void set( String^ value )
- {
- groupNameValue = value;
- }
-
- }
-
-};
-
-void SerializeGroup()
-{
- // Create an instance of the Group class, and an
- // instance of the XmlSerializer to serialize it.
- Group^ myGroup = gcnew Group( "Redmond" );
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
-
- // A FileStream is used to write the file.
- FileStream^ fs = gcnew FileStream( "group.xml",FileMode::Create );
- ser->Serialize( fs, myGroup );
- fs->Close();
- Console::WriteLine( myGroup->GroupName );
- Console::WriteLine( "Done" );
- Console::ReadLine();
-}
-
-int main()
-{
- SerializeGroup();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp
deleted file mode 100644
index 9780f3bb003..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-
-// Apply the XmlRootAttribute and set the IsNullable property to false.
-
-[XmlRoot(IsNullable=false)]
-public ref class Group
-{
-public:
- String^ Name;
-};
-
-void SerializeObject( String^ filename )
-{
- XmlSerializer^ s = gcnew XmlSerializer( Group::typeid );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create the object to serialize.
- Group^ mygroup = nullptr;
-
- // Serialize the object, and close the TextWriter.
- s->Serialize( writer, mygroup );
- writer->Close();
-}
-
-int main()
-{
- Console::WriteLine( "Running" );
- SerializeObject( "NullDoc.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp
deleted file mode 100644
index 4d0cd2a4a61..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-
-[XmlRoot(Namespace="http://www.cpandl.com")]
-public ref class Group{};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp
deleted file mode 100644
index ee176b3d4b4..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that is the default root element.
-public ref class MyClass
-{
-public:
- String^ Name;
-};
-
-XmlSerializer^ CreateOverrider();
-void SerializeOrder( String^ filename )
-{
- // Create an XmlSerializer instance using the method below.
- XmlSerializer^ xSer = CreateOverrider();
-
- // Create the object, and set its Name property.
- MyClass^ myClass = gcnew MyClass;
- myClass->Name = "New Class Name";
-
- // Serialize the class, and close the TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- xSer->Serialize( writer, myClass );
- writer->Close();
-}
-
-// Return an XmlSerializer to override the root serialization.
-XmlSerializer^ CreateOverrider()
-{
- // Create an XmlAttributes to override the default root element.
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- // Create an XmlRootAttribute and set its element name and namespace.
- XmlRootAttribute^ xRoot = gcnew XmlRootAttribute;
- xRoot->ElementName = "OverriddenRootElementName";
- xRoot->Namespace = "http://www.microsoft.com";
-
- // Set the XmlRoot property to the XmlRoot object.
- attrs->XmlRoot = xRoot;
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
-
- /* Add the XmlAttributes object to the
- XmlAttributeOverrides object. */
- xOver->Add( MyClass::typeid, attrs );
-
- // Create the Serializer, and return it.
- XmlSerializer^ xSer = gcnew XmlSerializer( MyClass::typeid,xOver );
- return xSer;
-}
-
-int main()
-{
- SerializeOrder( "OverrideAttribute.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp
deleted file mode 100644
index 0bfeccd401c..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::IO;
-ref class Address;
-ref class OrderedItem;
-
-/* The XmlRootAttribute allows you to set an alternate name
- (PurchaseOrder) of the XML element, the element namespace; by
- default, the XmlSerializer uses the class name. The attribute
- also allows you to set the XML namespace for the element. Lastly,
- the attribute sets the IsNullable property, which specifies whether
- the xsi:null attribute appears if the class instance is set to
- a null reference. */
-
-[XmlRootAttribute("PurchaseOrder",Namespace="http://www.cpandl.com",
-IsNullable=false)]
-public ref class PurchaseOrder
-{
-public:
- Address^ ShipTo;
- String^ OrderDate;
-
- /* The XmlArrayAttribute changes the XML element name
- from the default of "OrderedItems" to "Items". */
-
- [XmlArrayAttribute("Items")]
- array^OrderedItems;
- Decimal SubTotal;
- Decimal ShipCost;
- Decimal TotalCost;
-};
-
-public ref class Address
-{
-public:
-
- /* The XmlAttribute instructs the XmlSerializer to serialize the Name
- field as an XML attribute instead of an XML element (the default
- behavior). */
-
- [XmlAttributeAttribute]
- String^ Name;
- String^ Line1;
-
- /* Setting the IsNullable property to false instructs the
- XmlSerializer that the XML attribute will not appear if
- the City field is set to a null reference. */
-
- [XmlElementAttribute(IsNullable=false)]
- String^ City;
- String^ State;
- String^ Zip;
-};
-
-public ref class OrderedItem
-{
-public:
- String^ ItemName;
- String^ Description;
- Decimal UnitPrice;
- int Quantity;
- Decimal LineTotal;
-
- /* Calculate is a custom method that calculates the price per item,
- and stores the value in a field. */
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-
-};
-
-public ref class Test
-{
-public:
- static void main()
- {
- // Read and write purchase orders.
- Test^ t = gcnew Test;
- t->CreatePO( "po.xml" );
- t->ReadPO( "po.xml" );
- }
-
-private:
- void CreatePO( String^ filename )
- {
- // Create an instance of the XmlSerializer class;
- // specify the type of object to serialize.
- XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid );
- TextWriter^ writer = gcnew StreamWriter( filename );
- PurchaseOrder^ po = gcnew PurchaseOrder;
-
- // Create an address to ship and bill to.
- Address^ billAddress = gcnew Address;
- billAddress->Name = "Teresa Atkinson";
- billAddress->Line1 = "1 Main St.";
- billAddress->City = "AnyTown";
- billAddress->State = "WA";
- billAddress->Zip = "00000";
-
- // Set ShipTo and BillTo to the same addressee.
- po->ShipTo = billAddress;
- po->OrderDate = System::DateTime::Now.ToLongDateString();
-
- // Create an OrderedItem object.
- OrderedItem^ i1 = gcnew OrderedItem;
- i1->ItemName = "Widget S";
- i1->Description = "Small widget";
- i1->UnitPrice = (Decimal)5.23;
- i1->Quantity = 3;
- i1->Calculate();
-
- // Insert the item into the array.
- array^items = {i1};
- po->OrderedItems = items;
-
- // Calculate the total cost.
- Decimal subTotal = Decimal(0);
- System::Collections::IEnumerator^ myEnum = items->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- OrderedItem^ oi = safe_cast(myEnum->Current);
- subTotal = subTotal + oi->LineTotal;
- }
-
- po->SubTotal = subTotal;
- po->ShipCost = (Decimal)12.51;
- po->TotalCost = po->SubTotal + po->ShipCost;
-
- // Serialize the purchase order, and close the TextWriter.
- serializer->Serialize( writer, po );
- writer->Close();
- }
-
-protected:
- void ReadPO( String^ filename )
- {
- // Create an instance of the XmlSerializer class;
- // specify the type of object to be deserialized.
- XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid );
-
- /* If the XML document has been altered with unknown
- nodes or attributes, handle them with the
- UnknownNode and UnknownAttribute events.*/
- serializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Test::serializer_UnknownNode );
- serializer->UnknownAttribute += gcnew XmlAttributeEventHandler( this, &Test::serializer_UnknownAttribute );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
-
- // Declare an object variable of the type to be deserialized.
- PurchaseOrder^ po;
-
- /* Use the Deserialize method to restore the object's state with
- data from the XML document. */
- po = dynamic_cast(serializer->Deserialize( fs ));
-
- // Read the order date.
- Console::WriteLine( "OrderDate: {0}", po->OrderDate );
-
- // Read the shipping address.
- Address^ shipTo = po->ShipTo;
- ReadAddress( shipTo, "Ship To:" );
-
- // Read the list of ordered items.
- array^items = po->OrderedItems;
- Console::WriteLine( "Items to be shipped:" );
- System::Collections::IEnumerator^ myEnum1 = items->GetEnumerator();
- while ( myEnum1->MoveNext() )
- {
- OrderedItem^ oi = safe_cast(myEnum1->Current);
- Console::WriteLine( "\t{0}\t{1}\t{2}\t{3}\t{4}", oi->ItemName, oi->Description, oi->UnitPrice, oi->Quantity, oi->LineTotal );
- }
-
- Console::WriteLine( "\t\t\t\t\t Subtotal\t{0}", po->SubTotal );
- Console::WriteLine( "\t\t\t\t\t Shipping\t{0}", po->ShipCost );
- Console::WriteLine( "\t\t\t\t\t Total\t\t{0}", po->TotalCost );
- }
-
- void ReadAddress( Address^ a, String^ label )
- {
- // Read the fields of the Address object.
- Console::WriteLine( label );
- Console::WriteLine( "\t{0}", a->Name );
- Console::WriteLine( "\t{0}", a->Line1 );
- Console::WriteLine( "\t{0}", a->City );
- Console::WriteLine( "\t{0}", a->State );
- Console::WriteLine( "\t{0}", a->Zip );
- Console::WriteLine();
- }
-
-private:
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- Console::WriteLine( "Unknown Node:{0}\t{1}", e->Name, e->Text );
- }
-
- void serializer_UnknownAttribute( Object^ /*sender*/, XmlAttributeEventArgs^ e )
- {
- System::Xml::XmlAttribute^ attr = e->Attr;
- Console::WriteLine( "Unknown attribute {0}='{1}'", attr->Name, attr->Value );
- }
-};
-
-int main()
-{
- Test::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp
deleted file mode 100644
index b488c27b932..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void TestDocument( String^ filename, Type^ objType )
- {
- // Using a FileStream, create an XmlTextReader.
- Stream^ fs = gcnew FileStream( filename,FileMode::Open );
- XmlReader^ reader = gcnew XmlTextReader( fs );
- XmlSerializer^ serializer = gcnew XmlSerializer( objType );
- if ( serializer->CanDeserialize( reader ) )
- {
- Object^ o = serializer->Deserialize( reader );
- }
- fs->Close();
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp
deleted file mode 100644
index 542444fb61a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be deserialized.
-public ref class OrderedItem
-{
-public:
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ ItemName;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ Description;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal UnitPrice;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- int Quantity;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void DeserializeObject(String^ filename)
-{
- Console::WriteLine("Reading with Stream");
-
- // Create an instance of the XmlSerializer.
- XmlSerializer^ serializer = gcnew XmlSerializer(OrderedItem::typeid);
-
- // Declare an object variable of the type to be deserialized.
- OrderedItem^ i;
-
- // Reading the XML document requires a FileStream.
- Stream^ reader = gcnew FileStream(filename, FileMode::Open);
-
- try
- {
- // Call the Deserialize method to restore the object's state.
- i = dynamic_cast(serializer->Deserialize(reader));
- }
- finally
- {
- delete reader;
- }
-
- // Write out the properties of the object.
- Console::Write("{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal);
-}
-
-int main()
-{
- // Read a purchase order.
- DeserializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp
deleted file mode 100644
index b803c3b61af..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be deserialized.
-public ref class OrderedItem
-{
-public:
- String^ ItemName;
- String^ Description;
- Decimal UnitPrice;
- int Quantity;
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void DeserializeObject( String^ filename )
-{
- Console::WriteLine( "Reading with TextReader" );
-
- // Create an instance of the XmlSerializer specifying type.
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
-
- /* Create a TextReader to read the file. Specify an
- Encoding to use. */
- TextReader^ reader = gcnew StreamReader( filename,Encoding::Unicode );
-
- // Declare an object variable of the type to be deserialized.
- OrderedItem^ i;
-
- // Use the Deserialize method to restore the object's state.
- i = dynamic_cast(serializer->Deserialize( reader ));
-
- // Write out the properties of the object.
- Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal );
-}
-
-int main()
-{
- // Read a purchase order.
- DeserializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp
deleted file mode 100644
index 3b2738346ee..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be deserialized.
-public ref class OrderedItem
-{
-public:
- String^ ItemName;
- String^ Description;
- Decimal UnitPrice;
- int Quantity;
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void DeserializeObject( String^ filename )
-{
- Console::WriteLine( "Reading with XmlReader" );
-
- // Create an instance of the XmlSerializer specifying type and namespace.
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- XmlReader^ reader = gcnew XmlTextReader( fs );
-
- // Declare an object variable of the type to be deserialized.
- OrderedItem^ i;
-
- // Use the Deserialize method to restore the object's state.
- i = dynamic_cast(serializer->Deserialize( reader ));
-
- // Write out the properties of the object.
- Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal );
-}
-
-int main()
-{
- // Read a purchase order.
- DeserializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp
deleted file mode 100644
index a9b0d0bf54e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-/* Three classes are included here. Each one will
-be used to create three XmlSerializer objects. */
-public ref class Instrument
-{
-public:
- String^ InstrumentName;
-};
-
-public ref class Player
-{
-public:
- String^ PlayerName;
-};
-
-public ref class Piece
-{
-public:
- String^ PieceName;
-};
-
-void GetSerializers()
-{
- // Create an array of types.
- array^types = gcnew array(3);
- types[ 0 ] = Instrument::typeid;
- types[ 1 ] = Player::typeid;
- types[ 2 ] = Piece::typeid;
-
- // Create an array for XmlSerializer objects.
- array^serializers = gcnew array(3);
- serializers = XmlSerializer::FromTypes( types );
-
- // Create one Instrument and serialize it.
- Instrument^ i = gcnew Instrument;
- i->InstrumentName = "Piano";
-
- // Create a TextWriter to write with.
- TextWriter^ writer = gcnew StreamWriter( "Inst.xml" );
- serializers[ 0 ]->Serialize( writer, i );
- writer->Close();
-}
-
-int main()
-{
- GetSerializers();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp
deleted file mode 100644
index deb65e2782e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class OrderedItem
-{
-public:
- String^ ItemName;
- String^ Description;
- Decimal UnitPrice;
- int Quantity;
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void SerializeObject( String^ filename )
-{
- Console::WriteLine( "Writing With TextWriter" );
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
- OrderedItem^ i = gcnew OrderedItem;
- i->ItemName = "Widget";
- i->Description = "Regular Widget";
- i->Quantity = 10;
- i->UnitPrice = (Decimal)2.30;
- i->Calculate();
-
- /* Create a StreamWriter to write with. First create a FileStream
- object, and create the StreamWriter specifying an Encoding to use. */
- FileStream^ fs = gcnew FileStream( filename,FileMode::Create );
- TextWriter^ writer = gcnew StreamWriter( fs,gcnew UTF8Encoding );
-
- // Serialize using the XmlTextWriter.
- serializer->Serialize( writer, i );
- writer->Close();
-}
-
-int main()
-{
- // Write a purchase order.
- SerializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp
deleted file mode 100644
index c635e566468..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class OrderedItem
-{
-public:
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ ItemName;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ Description;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal UnitPrice;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- int Quantity;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void SerializeObject( String^ filename )
-{
- Console::WriteLine( "Writing With TextWriter" );
-
- // Create an XmlSerializer instance using the type.
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
- OrderedItem^ i = gcnew OrderedItem;
- i->ItemName = "Widget";
- i->Description = "Regular Widget";
- i->Quantity = 10;
- i->UnitPrice = (Decimal)2.30;
- i->Calculate();
-
- // Create an XmlSerializerNamespaces object.
- XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces;
-
- // Add two namespaces with prefixes.
- ns->Add( "inventory", "http://www.cpandl.com" );
- ns->Add( "money", "http://www.cohowinery.com" );
-
- // Create a StreamWriter to write with.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- /* Serialize using the object using the TextWriter
- and namespaces. */
- serializer->Serialize( writer, i, ns );
- writer->Close();
-}
-
-int main()
-{
- // Write a purchase order.
- SerializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp
deleted file mode 100644
index 053d871e78a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class OrderedItem
-{
-public:
- String^ ItemName;
- String^ Description;
- Decimal UnitPrice;
- int Quantity;
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void SerializeObject( String^ filename )
-{
- Console::WriteLine( "Writing With Stream" );
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
- OrderedItem^ i = gcnew OrderedItem;
- i->ItemName = "Widget";
- i->Description = "Regular Widget";
- i->Quantity = 10;
- i->UnitPrice = (Decimal)2.30;
- i->Calculate();
-
- // Create a FileStream to write with.
- Stream^ writer = gcnew FileStream( filename,FileMode::Create );
-
- // Serialize the object, and close the TextWriter
- serializer->Serialize( writer, i );
- writer->Close();
-}
-
-int main()
-{
- // Write a purchase order.
- SerializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp
deleted file mode 100644
index baf2cd1b7c8..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class OrderedItem
-{
-public:
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ ItemName;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ Description;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal UnitPrice;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- int Quantity;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void SerializeObject( String^ filename )
-{
- Console::WriteLine( "Writing With Stream" );
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
- OrderedItem^ i = gcnew OrderedItem;
- i->ItemName = "Widget";
- i->Description = "Regular Widget";
- i->Quantity = 10;
- i->UnitPrice = (Decimal)2.30;
- i->Calculate();
-
- // Create an XmlSerializerNamespaces object.
- XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces;
-
- // Add two prefix-namespace pairs.
- ns->Add( "inventory", "http://www.cpandl.com" );
- ns->Add( "money", "http://www.cohowinery.com" );
-
- // Create a FileStream to write with.
- Stream^ writer = gcnew FileStream( filename,FileMode::Create );
-
- // Serialize the object, and close the TextWriter
- serializer->Serialize( writer, i, ns );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- Console::WriteLine( "Reading with Stream" );
-
- // Create an instance of the XmlSerializer.
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
-
- // Writing the file requires a Stream.
- Stream^ reader = gcnew FileStream( filename,FileMode::Open );
-
- // Declare an object variable of the type to be deserialized.
- OrderedItem^ i;
-
- /* Use the Deserialize method to restore the object's state
- using data from the XML document. */
- i = dynamic_cast(serializer->Deserialize( reader ));
-
- // Write out the properties of the object.
- Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal );
-}
-
-int main()
-{
- // Write a purchase order.
- SerializeObject( "simple.xml" );
- DeserializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp
deleted file mode 100644
index 1774c451ee4..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class OrderedItem
-{
-public:
- String^ ItemName;
- String^ Description;
- Decimal UnitPrice;
- int Quantity;
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void SerializeObject( String^ filename )
-{
- Console::WriteLine( "Writing With XmlTextWriter" );
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
- OrderedItem^ i = gcnew OrderedItem;
- i->ItemName = "Widget";
- i->Description = "Regular Widget";
- i->Quantity = 10;
- i->UnitPrice = (Decimal)2.30;
- i->Calculate();
-
- // Create an XmlTextWriter using a FileStream.
- Stream^ fs = gcnew FileStream( filename,FileMode::Create );
- XmlWriter^ writer = gcnew XmlTextWriter( fs,Encoding::Unicode );
-
- // Serialize using the XmlTextWriter.
- serializer->Serialize( writer, i );
- writer->Close();
-}
-
-int main()
-{
- // Write a purchase order.
- SerializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp
deleted file mode 100644
index 8a82ba5a382..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class OrderedItem
-{
-public:
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ ItemName;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ Description;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal UnitPrice;
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- int Quantity;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal LineTotal;
-
- // A custom method used to calculate price per item.
- void Calculate()
- {
- LineTotal = UnitPrice * Quantity;
- }
-};
-
-void SerializeObject( String^ filename )
-{
- Console::WriteLine( "Writing With XmlTextWriter" );
- XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid );
- OrderedItem^ i = gcnew OrderedItem;
- i->ItemName = "Widget";
- i->Description = "Regular Widget";
- i->Quantity = 10;
- i->UnitPrice = (Decimal)2.30;
- i->Calculate();
-
- // Create an XmlSerializerNamespaces object.
- XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces;
-
- // Add two namespaces with prefixes.
- ns->Add( "inventory", "http://www.cpandl.com" );
- ns->Add( "money", "http://www.cohowinery.com" );
-
- // Create an XmlTextWriter using a FileStream.
- Stream^ fs = gcnew FileStream( filename,FileMode::Create );
- XmlWriter^ writer = gcnew XmlTextWriter( fs,gcnew UTF8Encoding );
-
- // Serialize using the XmlTextWriter.
- serializer->Serialize( writer, i, ns );
- writer->Close();
-}
-
-int main()
-{
- // Write a purchase order.
- SerializeObject( "simple.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp
deleted file mode 100644
index cef506f6c43..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-public ref class Group
-{
-public:
- String^ GroupName;
-};
-
-public ref class Test
-{
-public:
- static void main()
- {
- Test^ t = gcnew Test;
-
- // Deserialize the file containing unknown elements.
- t->DeserializeObject( "UnknownAttributes.xml" );
- }
-
-private:
- void Serializer_UnknownAttribute( Object^ sender, XmlAttributeEventArgs^ e )
- {
- Console::WriteLine( "Unknown Attribute" );
- Console::WriteLine( "\t{0} {1}", e->Attr->Name, e->Attr->InnerXml );
- Console::WriteLine( "\t LineNumber: {0}", e->LineNumber );
- Console::WriteLine( "\t LinePosition: {0}", e->LinePosition );
- Group^ x = dynamic_cast(e->ObjectBeingDeserialized);
- Console::WriteLine( x->GroupName );
- Console::WriteLine( sender );
- }
-
- void DeserializeObject( String^ filename )
- {
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
-
- // Add a delegate to handle unknown element events.
- ser->UnknownAttribute += gcnew XmlAttributeEventHandler( this, &Test::Serializer_UnknownAttribute );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ g = dynamic_cast(ser->Deserialize( fs ));
- fs->Close();
- }
-};
-
-int main()
-{
- Test::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp
deleted file mode 100644
index 57d80144134..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Group
-{
-public:
-
- // Only the GroupName field will be known.
- String^ GroupName;
-};
-
-public ref class Test
-{
-public:
- static void main()
- {
- Test^ t = gcnew Test;
- t->DeserializeObject( "UnknownNodes.xml" );
- }
-
-private:
- void DeserializeObject( String^ filename )
- {
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- mySerializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Test::serializer_UnknownNode );
- Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs ));
- fs->Close();
- }
-
-private:
- void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e )
- {
- Console::WriteLine( "UnknownNode Name: {0}", e->Name );
- Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName );
- Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI );
- Console::WriteLine( "UnknownNode Text: {0}", e->Text );
- XmlNodeType myNodeType = e->NodeType;
- Console::WriteLine( "NodeType: {0}", myNodeType );
- Group^ myGroup = dynamic_cast(e->ObjectBeingDeserialized);
- Console::WriteLine( "GroupName: {0}", myGroup->GroupName );
- Console::WriteLine();
- }
-};
-
-int main()
-{
- Test::main();
-}
-
-/* Paste this XML into a file named UnknownNodes:
-
-
- MyGroup
- Large
- 444
- West
-
- 1
- Thing1
-
- element
-
-
-
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp
deleted file mode 100644
index 1df7c03435e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-
-
-//
-// Beginning of the HighSchool.dll
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-namespace HighSchool
-{
- public ref class Student
- {
- public:
- String^ Name;
- int ID;
- };
-
- public ref class MyClass
- {
- public:
- array^Students;
- };
-}
-
-namespace College
-{
-
-using namespace HighSchool;
- public ref class Graduate: public HighSchool::Student
- {
- public:
- Graduate(){}
-
- // Add a new field named University.
- String^ University;
-
- // Use extra types to use this field.
- array^Info;
- };
-
- public ref class Address
- {
- public:
- String^ City;
- };
-
- public ref class Phone
- {
- public:
- String^ Number;
- };
-
- public ref class Run
- {
- public:
- static void main()
- {
- Run^ test = gcnew Run;
- test->WriteOverriddenAttributes( "College.xml" );
- test->ReadOverriddenAttributes( "College.xml" );
- }
-
- private:
- void WriteOverriddenAttributes( String^ filename )
- {
- // Writing the file requires a TextWriter.
- TextWriter^ myStreamWriter = gcnew StreamWriter( filename );
-
- // Create an XMLAttributeOverrides class.
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
-
- // Create the XmlAttributes class.
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- /* Override the Student class. "Alumni" is the name
- of the overriding element in the XML output. */
- XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid );
-
- /* Add the XmlElementAttribute to the collection of
- elements in the XmlAttributes object. */
- attrs->XmlElements->Add( attr );
-
- /* Add the XmlAttributes to the XmlAttributeOverrides.
- "Students" is the name being overridden. */
- attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs );
-
- // Create array of extra types.
- array^extraTypes = gcnew array(2);
- extraTypes[ 0 ] = Address::typeid;
- extraTypes[ 1 ] = Phone::typeid;
-
- // Create an XmlRootAttribute.
- XmlRootAttribute^ root = gcnew XmlRootAttribute( "Graduates" );
-
- /* Create the XmlSerializer with the
- XmlAttributeOverrides object. */
- XmlSerializer^ mySerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides,extraTypes,root,"http://www.microsoft.com" );
- MyClass ^ myClass = gcnew MyClass;
- Graduate^ g1 = gcnew Graduate;
- g1->Name = "Jacki";
- g1->ID = 1;
- g1->University = "Alma";
- Graduate^ g2 = gcnew Graduate;
- g2->Name = "Megan";
- g2->ID = 2;
- g2->University = "CM";
- array^myArray = {g1,g2};
- myClass->Students = myArray;
-
- // Create extra information.
- Address^ a1 = gcnew Address;
- a1->City = "Ionia";
- Address^ a2 = gcnew Address;
- a2->City = "Stamford";
- Phone^ p1 = gcnew Phone;
- p1->Number = "555-0101";
- Phone^ p2 = gcnew Phone;
- p2->Number = "555-0100";
- array^o1 = {a1,p1};
- array^o2 = {a2,p2};
- g1->Info = o1;
- g2->Info = o2;
- mySerializer->Serialize( myStreamWriter, myClass );
- myStreamWriter->Close();
- }
-
- void ReadOverriddenAttributes( String^ filename )
- {
- /* The majority of the code here is the same as that in the
- WriteOverriddenAttributes method. Because the XML being read
- doesn't conform to the schema defined by the DLL, the
- XMLAttributesOverrides must be used to create an
- XmlSerializer instance to read the XML document.*/
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid );
- attrs->XmlElements->Add( attr );
- attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs );
- array^extraTypes = gcnew array(2);
- extraTypes[ 0 ] = Address::typeid;
- extraTypes[ 1 ] = Phone::typeid;
- XmlRootAttribute^ root = gcnew XmlRootAttribute( "Graduates" );
- XmlSerializer^ readSerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides,extraTypes,root,"http://www.microsoft.com" );
-
- // A FileStream object is required to read the file.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- MyClass ^ myClass;
- myClass = dynamic_cast(readSerializer->Deserialize( fs ));
-
- /* Here is the difference between reading and writing an
- XML document: You must declare an object of the derived
- type (Graduate) and cast the Student instance to it.*/
- Graduate^ g;
- Address^ a;
- Phone^ p;
- System::Collections::IEnumerator^ myEnum = myClass->Students->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Graduate^ grad = safe_cast(myEnum->Current);
- g = dynamic_cast(grad);
- Console::Write( "{0}\t", g->Name );
- Console::Write( "{0}\t", g->ID );
- Console::Write( "{0}\n", g->University );
- a = dynamic_cast(g->Info[ 0 ]);
- Console::WriteLine( a->City );
- p = dynamic_cast(g->Info[ 1 ]);
- Console::WriteLine( p->Number );
- }
- }
- };
-}
-
-int main()
-{
- College::Run::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp
deleted file mode 100644
index 173d91e6ff3..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Class1
-{
- //
-private:
- void SerializeObject( String^ filename )
- {
- XmlSerializer^ serializer = gcnew XmlSerializer(
- OrderedItem::typeid,"http://www.cpandl.com" );
-
- // Create an instance of the class to be serialized.
- OrderedItem^ i = gcnew OrderedItem;
-
- // Insert code to set property values.
-
- // Writing the document requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- // Serialize the object, and close the TextWriter
- serializer->Serialize( writer, i );
- writer->Close();
- }
-
- void DeserializeObject( String^ filename )
- {
- XmlSerializer^ serializer = gcnew XmlSerializer(
- OrderedItem::typeid,"http://www.cpandl.com" );
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
-
- // Declare an object variable of the type to be deserialized.
- OrderedItem^ i;
-
- // Deserialize the object.
- i = dynamic_cast(serializer->Deserialize( fs ));
-
- // Insert code to use the properties and methods of the object.
- }
- //
-
-public:
- ref class OrderedItem{
- // Members of OrderedItem go here
- };
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp
deleted file mode 100644
index 2ce08d9f7a1..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Class1
-{
- //
-private:
- void SerializeObject( String^ filename )
- {
- // Create an XmlRootAttribute, and set its properties.
- XmlRootAttribute^ xRoot = gcnew XmlRootAttribute;
- xRoot->ElementName = "CustomRoot";
- xRoot->Namespace = "http://www.cpandl.com";
- xRoot->IsNullable = true;
-
- // Construct the XmlSerializer with the XmlRootAttribute.
- XmlSerializer^ serializer = gcnew XmlSerializer(
- OrderedItem::typeid,xRoot );
-
- // Create an instance of the object to serialize.
- OrderedItem^ i = gcnew OrderedItem;
- // Insert code to set properties of the ordered item.
-
- // Writing the document requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- serializer->Serialize( writer, i );
- writer->Close();
- }
-
- void DeserializeObject( String^ filename )
- {
- // Create an XmlRootAttribute, and set its properties.
- XmlRootAttribute^ xRoot = gcnew XmlRootAttribute;
- xRoot->ElementName = "CustomRoot";
- xRoot->Namespace = "http://www.cpandl.com";
- xRoot->IsNullable = true;
-
- XmlSerializer^ serializer = gcnew XmlSerializer(
- OrderedItem::typeid,xRoot );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- // Deserialize the object.
- OrderedItem^ i = dynamic_cast(serializer->Deserialize( fs ));
- // Insert code to use the object's properties and methods.
- }
- //
-
-public:
- ref class OrderedItem{
- // Members of OrderedItem go here
- };
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp
deleted file mode 100644
index 669af6e0644..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-ref class Address;
-ref class Phone;
-
-// This defines the object that will be serialized.
-public ref class Teacher
-{
-public:
- String^ Name;
- Teacher(){}
-
- /* Note that the Info field returns an array of objects.
- Any object can be added to the array by adding the
- object type to the array passed to the extraTypes argument. */
-
- [XmlArray(ElementName="ExtraInfo",IsNullable=true)]
- array^Info;
- Phone^ PhoneInfo;
-};
-
-
-// This defines one of the extra types to be included.
-public ref class Address
-{
-public:
- String^ City;
- Address(){}
-
- Address( String^ city )
- {
- City = city;
- }
-};
-
-// Another extra type to include.
-public ref class Phone
-{
-public:
- String^ PhoneNumber;
- Phone(){}
-
- Phone( String^ phoneNumber )
- {
- PhoneNumber = phoneNumber;
- }
-};
-
-// Another type, derived from Phone
-public ref class InternationalPhone: public Phone
-{
-public:
- String^ CountryCode;
- InternationalPhone(){}
-
- InternationalPhone( String^ countryCode )
- {
- CountryCode = countryCode;
- }
-};
-
-public ref class Run
-{
-public:
- static void main()
- {
- Run^ test = gcnew Run;
- test->SerializeObject( "Teacher.xml" );
- test->DeserializeObject( "Teacher.xml" );
- }
-
-private:
- void SerializeObject( String^ filename )
- {
- // Writing the file requires a TextWriter.
- TextWriter^ myStreamWriter = gcnew StreamWriter( filename );
-
- // Create a Type array.
- array^extraTypes = gcnew array(3);
- extraTypes[ 0 ] = Address::typeid;
- extraTypes[ 1 ] = Phone::typeid;
- extraTypes[ 2 ] = InternationalPhone::typeid;
-
- // Create the XmlSerializer instance.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Teacher::typeid,extraTypes );
- Teacher^ teacher = gcnew Teacher;
- teacher->Name = "Mike";
-
- // Add extra types to the Teacher object
- array^info = gcnew array(2);
- info[ 0 ] = gcnew Address( "Springville" );
- info[ 1 ] = gcnew Phone( "555-0100" );
- teacher->Info = info;
- teacher->PhoneInfo = gcnew InternationalPhone( "000" );
- mySerializer->Serialize( myStreamWriter, teacher );
- myStreamWriter->Close();
- }
-
- void DeserializeObject( String^ filename )
- {
- // Create a Type array.
- array^extraTypes = gcnew array(3);
- extraTypes[ 0 ] = Address::typeid;
- extraTypes[ 1 ] = Phone::typeid;
- extraTypes[ 2 ] = InternationalPhone::typeid;
-
- // Create the XmlSerializer instance.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Teacher::typeid,extraTypes );
-
- // Reading a file requires a FileStream.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Teacher^ teacher = dynamic_cast(mySerializer->Deserialize( fs ));
-
- // Read the extra information.
- Address^ a = dynamic_cast(teacher->Info[ 0 ]);
- Phone^ p = dynamic_cast(teacher->Info[ 1 ]);
- InternationalPhone^ Ip = dynamic_cast(teacher->PhoneInfo);
- Console::WriteLine( teacher->Name );
- Console::WriteLine( a->City );
- Console::WriteLine( p->PhoneNumber );
- Console::WriteLine( Ip->CountryCode );
- }
-};
-
-int main()
-{
- Run::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp
deleted file mode 100644
index 0050ba6a3ce..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-//
-// Beginning of HighSchool.dll
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-namespace HighSchool
-{
- public ref class Student
- {
- public:
- String^ Name;
- int ID;
- };
-
- public ref class MyClass
- {
- public:
- array^Students;
- };
-}
-
-namespace College
-{
-
-using namespace HighSchool;
- public ref class Graduate: public HighSchool::Student
- {
- public:
- Graduate(){}
-
- // Add a new field named University.
- String^ University;
- };
-
- public ref class Run
- {
- public:
- static void main()
- {
- Run^ test = gcnew Run;
- test->WriteOverriddenAttributes( "College.xml" );
- test->ReadOverriddenAttributes( "College.xml" );
- }
-
- private:
- void WriteOverriddenAttributes( String^ filename )
- {
- // Writing the file requires a TextWriter.
- TextWriter^ myStreamWriter = gcnew StreamWriter( filename );
-
- // Create an XMLAttributeOverrides class.
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
-
- // Create the XmlAttributes class.
- XmlAttributes^ attrs = gcnew XmlAttributes;
-
- /* Override the Student class. "Alumni" is the name
- of the overriding element in the XML output. */
- XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid );
-
- /* Add the XmlElementAttribute to the collection of
- elements in the XmlAttributes object. */
- attrs->XmlElements->Add( attr );
-
- /* Add the XmlAttributes to the XmlAttributeOverrides.
- "Students" is the name being overridden. */
- attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs );
-
- // Create the XmlSerializer.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides );
- MyClass ^ myClass = gcnew MyClass;
- Graduate^ g1 = gcnew Graduate;
- g1->Name = "Jackie";
- g1->ID = 1;
- g1->University = "Alma Mater";
- Graduate^ g2 = gcnew Graduate;
- g2->Name = "Megan";
- g2->ID = 2;
- g2->University = "CM";
- array^myArray = {g1,g2};
- myClass->Students = myArray;
- mySerializer->Serialize( myStreamWriter, myClass );
- myStreamWriter->Close();
- }
-
- void ReadOverriddenAttributes( String^ filename )
- {
- /* The majority of the code here is the same as that in the
- WriteOverriddenAttributes method. Because the XML being read
- doesn't conform to the schema defined by the DLL, the
- XMLAttributesOverrides must be used to create an
- XmlSerializer instance to read the XML document.*/
- XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid );
- attrs->XmlElements->Add( attr );
- attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs );
- XmlSerializer^ readSerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides );
-
- // To read the file, a FileStream object is required.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- MyClass ^ myClass;
- myClass = dynamic_cast(readSerializer->Deserialize( fs ));
-
- /* Here is the difference between reading and writing an
- XML document: You must declare an object of the derived
- type (Graduate) and cast the Student instance to it.*/
- Graduate^ g;
- System::Collections::IEnumerator^ myEnum = myClass->Students->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Graduate^ grad = safe_cast(myEnum->Current);
- g = dynamic_cast(grad);
- Console::Write( "{0}\t", g->Name );
- Console::Write( "{0}\t", g->ID );
- Console::Write( "{0}\n", g->University );
- }
- }
- };
-}
-
-int main()
-{
- College::Run::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp
deleted file mode 100644
index 6dabc064fb4..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void SerializeObject( String^ filename )
- {
- XmlSerializer^ serializer =
- gcnew XmlSerializer( OrderedItem::typeid );
-
- // Create an instance of the class to be serialized.
- OrderedItem^ i = gcnew OrderedItem;
-
- // Set the public property values.
- i->ItemName = "Widget";
- i->Description = "Regular Widget";
- i->Quantity = 10;
- i->UnitPrice = (Decimal)2.30;
-
- // Writing the document requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Serialize the object, and close the TextWriter.
- serializer->Serialize( writer, i );
- writer->Close();
- }
-
-public:
- // This is the class that will be serialized.
- ref class OrderedItem
- {
- public:
- String^ ItemName;
- String^ Description;
- Decimal UnitPrice;
- int Quantity;
- };
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp
deleted file mode 100644
index 01f91598da8..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Price
-{
-public:
-
- [XmlAttributeAttribute(Namespace="http://www.cpandl.com")]
- String^ currency;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Decimal price;
-};
-
-[XmlType(Namespace="http://www.cpandl.com")]
-public ref class Book
-{
-public:
-
- [XmlElement(Namespace="http://www.cpandl.com")]
- String^ TITLE;
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Price^ PRICE;
-};
-
-public ref class Books
-{
-public:
-
- [XmlElement(Namespace="http://www.cohowinery.com")]
- Book^ Book;
-};
-
-public ref class Run
-{
-public:
- static void main()
- {
- Run^ test = gcnew Run;
- test->SerializeObject( "XmlNamespaces.xml" );
- }
-
- void SerializeObject( String^ filename )
- {
- XmlSerializer^ s = gcnew XmlSerializer( Books::typeid );
-
- // Writing a file requires a TextWriter.
- TextWriter^ t = gcnew StreamWriter( filename );
-
- /* Create an XmlSerializerNamespaces object and add two
- prefix-namespace pairs. */
- XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces;
- ns->Add( "books", "http://www.cpandl.com" );
- ns->Add( "money", "http://www.cohowinery.com" );
-
- // Create a Book instance.
- Book^ b = gcnew Book;
- b->TITLE = "A Book Title";
- Price^ p = gcnew Price;
- p->price = (Decimal)9.95;
- p->currency = "US Dollar";
- b->PRICE = p;
- Books^ bks = gcnew Books;
- bks->Book = b;
- s->Serialize( t, bks, ns );
- t->Close();
- }
-};
-
-int main()
-{
- Run::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp
deleted file mode 100644
index 825b960ef4a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- XmlSerializerNamespaces^ AddNamespaces()
- {
- XmlSerializerNamespaces^ xmlNamespaces =
- gcnew XmlSerializerNamespaces;
-
- // Add three prefix-namespace pairs.
- xmlNamespaces->Add( "money", "http://www.cpandl.com" );
- xmlNamespaces->Add( "books", "http://www.cohowinery.com" );
- xmlNamespaces->Add( "software", "http://www.microsoft.com" );
-
- return xmlNamespaces;
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp
deleted file mode 100644
index 89a101a18a2..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- void PrintNamespacePairs( XmlSerializerNamespaces^ namespaces )
- {
- array^ qualifiedNames = namespaces->ToArray();
- for ( int i = 0; i < qualifiedNames->Length; i++ )
- {
- Console::WriteLine( "{0}\t{1}",
- qualifiedNames[ i ]->Name, qualifiedNames[ i ]->Namespace );
- }
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp
deleted file mode 100644
index 58d5dd55649..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Sample
-{
- //
-private:
- XmlSerializerNamespaces^ CreateFromQNames()
- {
- XmlQualifiedName^ q1 =
- gcnew XmlQualifiedName( "money","http://www.cohowinery.com" );
-
- XmlQualifiedName^ q2 =
- gcnew XmlQualifiedName( "books","http://www.cpandl.com" );
-
- array^ names = { q1, q2 };
-
- return gcnew XmlSerializerNamespaces( names );
- }
- //
-};
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp
deleted file mode 100644
index fadecdb274e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml::Serialization;
-using namespace System::IO;
-
-public ref class Group1
-{
-public:
-
- // The XmlTextAttribute with type set to string informs the
- // XmlSerializer that strings should be serialized as XML text.
-
- [XmlText(String::typeid)]
- [XmlElement(Int32::typeid)]
- [XmlElement(Double::typeid)]
- array^All;
- Group1()
- {
- array^temp = {321,"One",2,3.0,"Two"};
- All = temp;
- }
-};
-
-public enum class GroupType
-{
- Small, Medium, Large
-};
-
-public ref class Group2
-{
-public:
-
- [XmlText(Type=GroupType::typeid)]
- GroupType Type;
-};
-
-public ref class Group3
-{
-public:
-
- [XmlText(Type=DateTime::typeid)]
- DateTime CreationTime;
- Group3()
- {
- CreationTime = DateTime::Now;
- }
-};
-
-public ref class Test
-{
-public:
- static void main()
- {
- Test^ t = gcnew Test;
- t->SerializeArray( "XmlText1.xml" );
- t->SerializeEnum( "XmlText2.xml" );
- t->SerializeDateTime( "XmlText3.xml" );
- }
-
-private:
- void SerializeArray( String^ filename )
- {
- XmlSerializer^ ser = gcnew XmlSerializer( Group1::typeid );
- Group1^ myGroup1 = gcnew Group1;
- TextWriter^ writer = gcnew StreamWriter( filename );
- ser->Serialize( writer, myGroup1 );
- writer->Close();
- }
-
- void SerializeEnum( String^ filename )
- {
- XmlSerializer^ ser = gcnew XmlSerializer( Group2::typeid );
- Group2^ myGroup = gcnew Group2;
- myGroup->Type = GroupType::Medium;
- TextWriter^ writer = gcnew StreamWriter( filename );
- ser->Serialize( writer, myGroup );
- writer->Close();
- }
-
- void SerializeDateTime( String^ filename )
- {
- XmlSerializer^ ser = gcnew XmlSerializer( Group3::typeid );
- Group3^ myGroup = gcnew Group3;
- TextWriter^ writer = gcnew StreamWriter( filename );
- ser->Serialize( writer, myGroup );
- writer->Close();
- }
-};
-
-int main()
-{
- Test::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp
deleted file mode 100644
index d6719698f71..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Schema;
-
-public ref class Group
-{
-public:
- String^ GroupName;
- String^ Comment;
-};
-
-public ref class Test
-{
-public:
- static void main()
- {
- Test^ t = gcnew Test;
- t->SerializerOrder( "TextOverride.xml" );
- }
-
- /* Create an instance of the XmlSerializer class that overrides
- the default way it serializes an object. */
- XmlSerializer^ CreateOverrider()
- {
- /* Create instances of the XmlAttributes and
- XmlAttributeOverrides classes. */
- XmlAttributes^ attrs = gcnew XmlAttributes;
- XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;
-
- /* Create an XmlTextAttribute to override the default
- serialization process. */
- XmlTextAttribute^ xText = gcnew XmlTextAttribute;
- attrs->XmlText = xText;
-
- // Add the XmlAttributes to the XmlAttributeOverrides.
- xOver->Add( Group::typeid, "Comment", attrs );
-
- // Create the XmlSerializer, and return it.
- XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver );
- return xSer;
- }
-
- void SerializerOrder( String^ filename )
- {
- // Create an XmlSerializer instance.
- XmlSerializer^ xSer = CreateOverrider();
-
- // Create the object and serialize it.
- Group^ myGroup = gcnew Group;
- myGroup->Comment = "This is a great product.";
- TextWriter^ writer = gcnew StreamWriter( filename );
- xSer->Serialize( writer, myGroup );
- }
-};
-
-int main()
-{
- Test::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp
deleted file mode 100644
index 0b402e1de87..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-
-[XmlType(Namespace="http://www.cpandl.com",
-TypeName="GroupMember")]
-public ref class Person
-{
-public:
- String^ Name;
-};
-
-
-[XmlType(Namespace="http://www.cohowinery.com",
-TypeName="GroupAddress")]
-public ref class Address
-{
-public:
- String^ Line1;
- String^ Line2;
- String^ City;
- String^ State;
- String^ Zip;
-};
-
-public ref class Group
-{
-public:
- array^Staff;
- Person^ Manager;
- Address^ Location;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp
deleted file mode 100644
index 592b8ccb053..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-
-[XmlType(IncludeInSchema=false)]
-public ref class ExtraneousInfo{};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp
deleted file mode 100644
index 04919033ae5..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-
-[XmlType(Namespace="http://www.cpandl.com")]
-public ref class Book{};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp
deleted file mode 100644
index 87847fcbb3e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-//
-ref class Person;
-ref class Job;
-ref class Group
-{
-public:
- array^Staff;
-};
-
-
-[XmlType(TypeName="Employee",
-Namespace="http://www.cpandl.com")]
-public ref class Person
-{
-public:
- String^ PersonName;
- Job^ Position;
-};
-
-
-[XmlType(TypeName="Occupation",
-Namespace="http://www.cohowinery.com")]
-public ref class Job
-{
-public:
- String^ JobName;
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp b/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp
deleted file mode 100644
index 1418ec5d414..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::IO;
-
-public ref class Forest
-{
- // Set the NestingLevel for each array. The first
- // attribute (NestingLevel = 0) is optional.
-public:
- [XmlArrayItem(ElementName = "tree", NestingLevel = 0)]
- [XmlArrayItem(ElementName = "branch", NestingLevel = 1)]
- [XmlArrayItem(ElementName = "leaf",NestingLevel = 2)]
- array^>^>^ TreeArray;
-};
-
-int main()
-{
- XmlSerializer^ serializer = gcnew XmlSerializer(Forest::typeid);
-
- Forest^ constructedForest = gcnew Forest();
- array^>^>^ tree =
- gcnew array^>^>(2);
-
- array^>^ firstBranch = gcnew array^>(1);
- firstBranch[0] = gcnew array{"One"};
- tree[0] = firstBranch;
-
- array^>^ secondBranch = gcnew array^>(2);
- secondBranch[0] = gcnew array{"One","Two"};
- secondBranch[1] = gcnew array{"One","Two","Three"};
- tree[1] = secondBranch;
-
- constructedForest->TreeArray = tree;
-
- serializer->Serialize(Console::Out, constructedForest);
-}
-
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp
deleted file mode 100644
index 076a9f19088..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Schema;
-using namespace System::ComponentModel;
-public ref class Group
-{
-public:
-
- // The default is set to .NET.
-
- [DefaultValue(".NET")]
- String^ GroupName;
-};
-
-public ref class Run
-{
-public:
- void SerializeOriginal( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Setting the GroupName to '.NET' is like not setting it at all
- // because it is the default value. So no value will be
- // serialized, and on deserialization it will appear as a blank.
- myGroup->GroupName = ".NET";
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
- }
-
- void SerializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class
- // that overrides the serialization.
- XmlSerializer^ overRideSerializer = CreateOverrideSerializer();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // The specifies that the default value is now
- // 'Team1'. So setting the GroupName to '.NET' means
- // the value will be serialized.
- myGroup->GroupName = ".NET";
-
- // Serialize the class, and close the TextWriter.
- overRideSerializer->Serialize( writer, myGroup );
- writer->Close();
- }
-
- void DeserializeOriginal( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid );
-
- // Reading the file requires a TextReader.
- TextReader^ reader = gcnew StreamReader( filename );
-
- // Deserialize and cast the Object*.
- Group^ myGroup;
- myGroup = safe_cast(mySerializer->Deserialize( reader ));
- Console::WriteLine( myGroup->GroupName );
- Console::WriteLine();
- }
-
- void DeserializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ overRideSerializer = CreateOverrideSerializer();
-
- // Reading the file requires a TextReader.
- TextReader^ reader = gcnew StreamReader( filename );
-
- // Deserialize and cast the Object*.
- Group^ myGroup;
- myGroup = safe_cast(overRideSerializer->Deserialize( reader ));
- Console::WriteLine( myGroup->GroupName );
- }
-
-private:
- XmlSerializer^ CreateOverrideSerializer()
- {
- SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides;
- SoapAttributes^ soapAtts = gcnew SoapAttributes;
-
- // Create a new DefaultValueAttribute Object* for the GroupName
- // property.
- DefaultValueAttribute^ newDefault = gcnew DefaultValueAttribute( "Team1" );
- soapAtts->SoapDefaultValue = newDefault;
- mySoapAttributeOverrides->Add( Group::typeid, "GroupName", soapAtts );
-
- // Create an XmlTypeMapping that is used to create an instance
- // of the XmlSerializer. Then return the XmlSerializer Object*.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid );
- XmlSerializer^ ser = gcnew XmlSerializer( myMapping );
- return ser;
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeOriginal( "SoapOriginal.xml" );
- test->SerializeOverride( "mySoapAttributeOverridesideAttributes.xml" );
- test->DeserializeOriginal( "SoapOriginal.xml" );
- test->DeserializeOverride( "mySoapAttributeOverridesideAttributes.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp
deleted file mode 100644
index 6c2fca3bb4d..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Schema;
-
-//using namespace System::Runtime::Remoting::Metadata;
-public ref class Vehicle
-{
-public:
- String^ licenseNumber;
-};
-
-
-[SoapInclude(Vehicle::typeid)]
-public ref class Group
-{
-public:
-
- [SoapAttributeAttribute(Namespace="http://www.cpandl.com")]
- String^ GroupName;
-
- [SoapAttributeAttribute(DataType="base64Binary")]
- array^GroupNumber;
-
- [SoapAttributeAttribute(DataType="date",AttributeName="CreationDate")]
- DateTime Today;
-
- [SoapElement(DataType="nonNegativeInteger",ElementName="PosInt")]
- String^ PostitiveInt;
- Vehicle^ GroupVehicle;
-};
-
-public ref class Run
-{
-public:
- void SerializeObject( String^ filename )
- {
- // Create an instance of the XmlSerializer class that
- // can generate encoded SOAP messages.
- XmlSerializer^ mySerializer = ReturnSOAPSerializer();
- Group^ myGroup = MakeGroup();
-
- // Writing the file requires a TextWriter.
- XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 );
- writer->Formatting = Formatting::Indented;
- writer->WriteStartElement( "wrapper" );
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->WriteEndElement();
- writer->Close();
- }
-
-
-private:
- Group^ MakeGroup()
- {
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the Object* properties.
- myGroup->GroupName = ".NET";
- array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )};
- myGroup->GroupNumber = hexByte;
- DateTime myDate = DateTime(2002,5,2);
- myGroup->Today = myDate;
- myGroup->PostitiveInt = "10000";
- myGroup->GroupVehicle = gcnew Vehicle;
- myGroup->GroupVehicle->licenseNumber = "1234";
- return myGroup;
- }
-
-public:
- void DeserializeObject( String^ filename )
- {
- // Create an instance of the XmlSerializer class that
- // can generate encoded SOAP messages.
- XmlSerializer^ mySerializer = ReturnSOAPSerializer();
-
- // Reading the file requires an XmlTextReader.
- XmlTextReader^ reader = gcnew XmlTextReader( filename );
- reader->ReadStartElement( "wrapper" );
-
- // Deserialize and cast the Object*.
- Group^ myGroup;
- myGroup = safe_cast(mySerializer->Deserialize( reader ));
- reader->ReadEndElement();
- reader->Close();
- }
-
-private:
- XmlSerializer^ ReturnSOAPSerializer()
- {
-
- // Create an instance of the XmlSerializer class.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid );
- return gcnew XmlSerializer( myMapping );
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeObject( "SoapAtts.xml" );
- test->DeserializeObject( "SoapAtts.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp
deleted file mode 100644
index ca2b9a2176d..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Group
-{
-public:
-
- // This attribute will be overridden.
-
- [SoapAttributeAttribute(Namespace="http://www.cpandl.com")]
- String^ GroupName;
-};
-
-public ref class Run
-{
-public:
- void SerializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class
- // that overrides the serialization.
- XmlSerializer^ overRideSerializer = CreateOverrideSerializer();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the Object* properties.
- myGroup->GroupName = ".NET";
-
- // Serialize the class, and close the TextWriter.
- overRideSerializer->Serialize( writer, myGroup );
- writer->Close();
- }
-
-private:
- XmlSerializer^ CreateOverrideSerializer()
- {
- SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides;
- SoapAttributes^ mySoapAttributes = gcnew SoapAttributes;
-
- // Create a new SoapAttributeAttribute to the
- // one applied to the Group class. The resulting XML
- // stream will use the new namespace and attribute name.
- SoapAttributeAttribute^ mySoapAttribute = gcnew SoapAttributeAttribute;
- mySoapAttribute->AttributeName = "TeamName";
-
- // Change the Namespace.
- mySoapAttribute->Namespace = "http://www.cohowinery.com";
- mySoapAttributes->SoapAttribute = mySoapAttribute;
- mySoapAttributeOverrides->Add( Group::typeid, "GroupName", mySoapAttributes );
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid );
- XmlSerializer^ ser = gcnew XmlSerializer( myMapping );
- return ser;
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeOverride( "SoapOveride.xml" );
-}
-
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp
deleted file mode 100644
index 723d53337e0..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-public ref class Group
-{
-public:
- // Override the serialization of this member.
- String^ GroupName;
-};
-
-public ref class Run
-{
-public:
- void SerializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class
- // that overrides the serialization.
- XmlSerializer^ overRideSerializer = CreateOverrideSerializer();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the object properties.
- myGroup->GroupName = ".NET";
-
- // Serialize the class, and close the TextWriter.
- overRideSerializer->Serialize( writer, myGroup );
- writer->Close();
- }
-
-private:
- XmlSerializer^ CreateOverrideSerializer()
- {
- SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides;
- SoapAttributes^ mySoapAttributes = gcnew SoapAttributes;
- SoapElementAttribute^ mySoapElement = gcnew SoapElementAttribute;
- mySoapElement->ElementName = "TeamName";
- mySoapAttributes->SoapElement = mySoapElement;
-
- // Add the SoapAttributes to the
- // mySoapAttributeOverridesrides object.
- mySoapAttributeOverrides->Add( Group::typeid, "GroupName", mySoapAttributes );
-
- // Get the SoapAttributes with the Item property.
- SoapAttributes^ thisSoapAtts = mySoapAttributeOverrides[Group::typeid, "GroupName"];
- Console::WriteLine( "New serialized element name: {0}", thisSoapAtts->SoapElement->ElementName );
-
- // Create an XmlTypeMapping that is used to create an instance
- // of the XmlSerializer. Then return the XmlSerializer object.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->
- ImportTypeMapping( Group::typeid );
- XmlSerializer^ ser = gcnew XmlSerializer( myMapping );
-
- return ser;
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeOverride( "GetSoapAttributes.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp
deleted file mode 100644
index e35e9d519f2..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-// The name of this type will be overridden using
-// the SoapTypeAttribute.
-public ref class Group
-{
-public:
- String^ GroupName;
-};
-
-public ref class Run
-{
-public:
- void SerializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class
- // that overrides the serialization.
- XmlSerializer^ overRideSerializer = CreateOverrideSerializer();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the object properties.
- myGroup->GroupName = ".NET";
-
- // Serialize the class, and close the TextWriter.
- overRideSerializer->Serialize( writer, myGroup );
- writer->Close();
- }
-
-private:
- XmlSerializer^ CreateOverrideSerializer()
- {
- SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides;
- SoapAttributes^ mySoapAttributes = gcnew SoapAttributes;
- SoapTypeAttribute^ mySoapType = gcnew SoapTypeAttribute;
- mySoapType->TypeName = "Team";
- mySoapAttributes->SoapType = mySoapType;
-
- // Add the SoapAttributes to the
- // mySoapAttributeOverridesrides object.
- mySoapAttributeOverrides->Add( Group::typeid, mySoapAttributes );
-
- // Get the SoapAttributes with the Item property.
- SoapAttributes^ thisSoapAtts = mySoapAttributeOverrides[ Group::typeid ];
- Console::WriteLine( "New serialized type name: {0}", thisSoapAtts->SoapType->TypeName );
-
- // Create an XmlTypeMapping that is used to create an instance
- // of the XmlSerializer. Then return the XmlSerializer object.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->
- ImportTypeMapping( Group::typeid );
- XmlSerializer^ ser = gcnew XmlSerializer( myMapping );
- return ser;
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeOverride( "GetSoapAttributes2.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp
deleted file mode 100644
index cd4ad348629..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Schema;
-ref class Car;
-
-// SoapInclude allows Vehicle to accept Car type.
-
-[SoapInclude(Car::typeid)]
-public ref class Vehicle abstract
-{
-public:
- String^ licenseNumber;
- DateTime makeDate;
-};
-
-public ref class Car: public Vehicle{};
-
-public enum class GroupType
-{
- // These enums can be overridden.
- [SoapEnum("Small")]
- A,
- [SoapEnum("Large")]
- B
-};
-
-public ref class Group
-{
-public:
-
- [SoapAttributeAttribute(Namespace="http://www.cpandl.com")]
- String^ GroupName;
-
- [SoapAttributeAttribute(DataType="base64Binary")]
- array^GroupNumber;
-
- [SoapAttributeAttribute(DataType="date",AttributeName="CreationDate")]
- DateTime Today;
-
- [SoapElement(DataType="nonNegativeInteger",ElementName="PosInt")]
- String^ PostitiveInt;
-
- // This is ignored when serialized unless it's overridden.
-
- [SoapIgnore]
- bool IgnoreThis;
- GroupType Grouptype;
- Vehicle^ MyVehicle;
-
- // The SoapInclude allows the method to return a Car.
-
- [SoapInclude(Car::typeid)]
- Vehicle^ myCar( String^ licNumber )
- {
- Vehicle^ v;
- if ( licNumber->Equals( "" ) )
- {
- v = gcnew Car;
- v->licenseNumber = "!!!!!!";
- }
- else
- {
- v = gcnew Car;
- v->licenseNumber = licNumber;
- }
-
- return v;
- }
-};
-
-public ref class Run
-{
-public:
- static void main()
- {
- Run^ test = gcnew Run;
- test->SerializeOriginal( "SoapOriginal.xml" );
- test->SerializeOverride( "SoapOverrides.xml" );
- test->DeserializeOriginal( "SoapOriginal.xml" );
- test->DeserializeOverride( "SoapOverrides.xml" );
- }
-
- void SerializeOriginal( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid );
- XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping );
- Group^ myGroup = MakeGroup();
-
- // Writing the file requires a TextWriter.
- XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 );
- writer->Formatting = Formatting::Indented;
- writer->WriteStartElement( "wrapper" );
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->WriteEndElement();
- writer->Close();
- }
-
- void SerializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class
- // that overrides the serialization.
- XmlSerializer^ overRideSerializer = CreateOverrideSerializer();
- Group^ myGroup = MakeGroup();
-
- // Writing the file requires a TextWriter.
- XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 );
- writer->Formatting = Formatting::Indented;
- writer->WriteStartElement( "wrapper" );
-
- // Serialize the class, and close the TextWriter.
- overRideSerializer->Serialize( writer, myGroup );
- writer->WriteEndElement();
- writer->Close();
- }
-
-private:
- Group^ MakeGroup()
- {
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the object properties.
- myGroup->GroupName = ".NET";
- array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )};
- myGroup->GroupNumber = hexByte;
- DateTime myDate = DateTime(2002,5,2);
- myGroup->Today = myDate;
- myGroup->PostitiveInt = "10000";
- myGroup->IgnoreThis = true;
- myGroup->Grouptype = GroupType::B;
- Car^ thisCar = dynamic_cast(myGroup->myCar( "1234566" ));
- myGroup->MyVehicle = thisCar;
- return myGroup;
- }
-
-public:
- void DeserializeOriginal( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid );
- XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping );
-
- // Reading the file requires an XmlTextReader.
- XmlTextReader^ reader = gcnew XmlTextReader( filename );
- reader->ReadStartElement( "wrapper" );
-
- // Deserialize and cast the object.
- Group^ myGroup;
- myGroup = dynamic_cast(mySerializer->Deserialize( reader ));
- reader->ReadEndElement();
- reader->Close();
- }
-
- void DeserializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ overRideSerializer = CreateOverrideSerializer();
-
- // Reading the file requires an XmlTextReader.
- XmlTextReader^ reader = gcnew XmlTextReader( filename );
- reader->ReadStartElement( "wrapper" );
-
- // Deserialize and cast the object.
- Group^ myGroup;
- myGroup = dynamic_cast(overRideSerializer->Deserialize( reader ));
- reader->ReadEndElement();
- reader->Close();
- ReadGroup( myGroup );
- }
-
-private:
- void ReadGroup( Group^ myGroup )
- {
- Console::WriteLine( myGroup->GroupName );
- Console::WriteLine( myGroup->GroupNumber[ 0 ] );
- Console::WriteLine( myGroup->GroupNumber[ 1 ] );
- Console::WriteLine( myGroup->Today );
- Console::WriteLine( myGroup->PostitiveInt );
- Console::WriteLine( myGroup->IgnoreThis );
- Console::WriteLine();
- }
-
- XmlSerializer^ CreateOverrideSerializer()
- {
- SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides;
- SoapAttributes^ soapAtts = gcnew SoapAttributes;
- SoapElementAttribute^ mySoapElement = gcnew SoapElementAttribute;
- mySoapElement->ElementName = "xxxx";
- soapAtts->SoapElement = mySoapElement;
- mySoapAttributeOverrides->Add( Group::typeid, "PostitiveInt", soapAtts );
-
- // Override the IgnoreThis property.
- SoapIgnoreAttribute^ myIgnore = gcnew SoapIgnoreAttribute;
- soapAtts = gcnew SoapAttributes;
- soapAtts->SoapIgnore = false;
- mySoapAttributeOverrides->Add( Group::typeid, "IgnoreThis", soapAtts );
-
- // Override the GroupType enumeration.
- soapAtts = gcnew SoapAttributes;
- SoapEnumAttribute^ xSoapEnum = gcnew SoapEnumAttribute;
- xSoapEnum->Name = "Over1000";
- soapAtts->GroupType::SoapEnum = xSoapEnum;
-
- // Add the SoapAttributes to the
- // mySoapAttributeOverridesrides object.
- mySoapAttributeOverrides->Add( GroupType::typeid, "A", soapAtts );
-
- // Create second enumeration and add it.
- soapAtts = gcnew SoapAttributes;
- xSoapEnum = gcnew SoapEnumAttribute;
- xSoapEnum->Name = "ZeroTo1000";
- soapAtts->GroupType::SoapEnum = xSoapEnum;
- mySoapAttributeOverrides->Add( GroupType::typeid, "B", soapAtts );
-
- // Override the Group type.
- soapAtts = gcnew SoapAttributes;
- SoapTypeAttribute^ soapType = gcnew SoapTypeAttribute;
- soapType->TypeName = "Team";
- soapAtts->SoapType = soapType;
- mySoapAttributeOverrides->Add( Group::typeid, soapAtts );
-
- // Create an XmlTypeMapping that is used to create an instance
- // of the XmlSerializer. Then return the XmlSerializer object.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid );
- XmlSerializer^ ser = gcnew XmlSerializer( myMapping );
- return ser;
- }
-};
-
-int main()
-{
- Run::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp
deleted file mode 100644
index bbc969c59c5..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Collections;
-using namespace System::Xml;
-using namespace System::Text;
-public ref class Thing
-{
-public:
-
- [SoapElement(IsNullable=true)]
- String^ ThingName;
-};
-
-public ref class Transportation
-{
-public:
-
- // The SoapElementAttribute specifies that the
- // generated XML element name will be S"Wheels"
- // instead of S"Vehicle".
-
- [SoapElement("Wheels")]
- String^ Vehicle;
-
- [SoapElement(DataType="dateTime")]
- DateTime CreationDate;
-
- [SoapElement(IsNullable=true)]
- Thing^ thing;
-};
-
-public ref class Test
-{
-public:
-
- // Return an XmlSerializer used for overriding.
- XmlSerializer^ CreateSoapOverrider()
- {
- // Create the SoapAttributes and SoapAttributeOverrides objects.
- SoapAttributes^ soapAttrs = gcnew SoapAttributes;
- SoapAttributeOverrides^ soapOverrides = gcnew SoapAttributeOverrides;
-
- // Create an SoapElementAttribute to the Vehicles property.
- SoapElementAttribute^ soapElement1 = gcnew SoapElementAttribute( "Truck" );
-
- // Set the SoapElement to the Object*.
- soapAttrs->SoapElement = soapElement1;
-
- // Add the SoapAttributes to the SoapAttributeOverrides,specifying the member to.
- soapOverrides->Add( Transportation::typeid, "Vehicle", soapAttrs );
-
- // Create the XmlSerializer, and return it.
- XmlTypeMapping^ myTypeMapping = (gcnew SoapReflectionImporter( soapOverrides ))->ImportTypeMapping( Transportation::typeid );
- return gcnew XmlSerializer( myTypeMapping );
- }
-
- void SerializeOverride( String^ filename )
- {
- // Create an XmlSerializer instance.
- XmlSerializer^ ser = CreateSoapOverrider();
-
- // Create the Object* and serialize it.
- Transportation^ myTransportation = gcnew Transportation;
- myTransportation->Vehicle = "MyCar";
- myTransportation->CreationDate = DateTime::Now;
- myTransportation->thing = gcnew Thing;
- XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 );
- writer->Formatting = Formatting::Indented;
- writer->WriteStartElement( "wrapper" );
- ser->Serialize( writer, myTransportation );
- writer->WriteEndElement();
- writer->Close();
- }
-
- void SerializeObject( String^ filename )
- {
- // Create an XmlSerializer instance.
- XmlSerializer^ ser = gcnew XmlSerializer( Transportation::typeid );
- Transportation^ myTransportation = gcnew Transportation;
- myTransportation->Vehicle = "MyCar";
- myTransportation->CreationDate = DateTime::Now;
- myTransportation->thing = gcnew Thing;
- XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 );
- writer->Formatting = Formatting::Indented;
- writer->WriteStartElement( "wrapper" );
- ser->Serialize( writer, myTransportation );
- writer->WriteEndElement();
- writer->Close();
- }
-};
-
-int main()
-{
- Test^ t = gcnew Test;
- t->SerializeObject( "SoapElementOriginal.xml" );
- t->SerializeOverride( "SoapElementOverride.xml" );
- Console::WriteLine( "Finished writing two XML files." );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp
deleted file mode 100644
index a91c48a0ab8..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public enum class GroupType
-{
- // Use the SoapEnumAttribute to instruct the XmlSerializer
- // to generate Small and Large instead of A and B.
- [SoapEnum("Small")]
- A,
- [SoapEnum("Large")]
- B
-};
-
-public ref class Group
-{
-public:
- String^ GroupName;
- GroupType Grouptype;
-};
-
-public ref class Run
-{
-public:
- void SerializeObject( String^ filename )
- {
- // Create an instance of the XmlSerializer Class.
- XmlTypeMapping^ mapp = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid );
- XmlSerializer^ mySerializer = gcnew XmlSerializer( mapp );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an instance of the Class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the Object* properties.
- myGroup->GroupName = ".NET";
- myGroup->Grouptype = GroupType::A;
-
- // Serialize the Class, and close the TextWriter.
- mySerializer->Serialize( writer, myGroup );
- writer->Close();
- }
-
- void SerializeOverride( String^ fileName )
- {
- SoapAttributeOverrides^ soapOver = gcnew SoapAttributeOverrides;
- SoapAttributes^ SoapAtts = gcnew SoapAttributes;
-
- // Add a SoapEnumAttribute for the GroupType::A enumerator.
- // Instead of 'A' it will be S"West".
- SoapEnumAttribute^ soapEnum = gcnew SoapEnumAttribute( "West" );
-
- // Override the S"A" enumerator.
- SoapAtts->GroupType::SoapEnum = soapEnum;
- soapOver->Add( GroupType::typeid, "A", SoapAtts );
-
- // Add another SoapEnumAttribute for the GroupType::B enumerator.
- // Instead of //B// it will be S"East".
- SoapAtts = gcnew SoapAttributes;
- soapEnum = gcnew SoapEnumAttribute;
- soapEnum->Name = "East";
- SoapAtts->GroupType::SoapEnum = soapEnum;
- soapOver->Add( GroupType::typeid, "B", SoapAtts );
-
- // Create an XmlSerializer used for overriding.
- XmlTypeMapping^ map = (gcnew SoapReflectionImporter( soapOver ))->ImportTypeMapping( Group::typeid );
- XmlSerializer^ ser = gcnew XmlSerializer( map );
- Group^ myGroup = gcnew Group;
- myGroup->GroupName = ".NET";
- myGroup->Grouptype = GroupType::B;
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( fileName );
- ser->Serialize( writer, myGroup );
- writer->Close();
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeObject( "SoapEnum.xml" );
- test->SerializeOverride( "SoapOverride.xml" );
- Console::WriteLine( "Fininished writing two files" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp
deleted file mode 100644
index 1c316326d9c..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-[SoapType("EmployeeType")]
-public ref class Employee
-{
-public:
- String^ Name;
-};
-
-
-// The SoapType is overridden when the
-// SerializeOverride method is called.
-
-[SoapType("SoapGroupType","http://www.cohowinery.com")]
-public ref class Group
-{
-public:
- String^ GroupName;
- array^Employees;
-};
-
-public ref class Run
-{
-public:
- void SerializeOriginal( String^ filename )
- {
- // Create an instance of the XmlSerializer class that
- // can be used for serializing as a SOAP message.
- XmlTypeMapping^ mapp = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid );
- XmlSerializer^ mySerializer = gcnew XmlSerializer( mapp );
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an XML text writer.
- XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( writer );
- xmlWriter->Formatting = Formatting::Indented;
- xmlWriter->Indentation = 2;
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the Object* properties.
- myGroup->GroupName = ".NET";
- Employee^ e1 = gcnew Employee;
- e1->Name = "Pat";
- myGroup->Employees = gcnew array(1);
- myGroup->Employees[ 0 ] = e1;
-
- // Write the root element.
- xmlWriter->WriteStartElement( "root" );
-
- // Serialize the class.
- mySerializer->Serialize( xmlWriter, myGroup );
-
- // Close the root tag.
- xmlWriter->WriteEndElement();
-
- // Close the XmlWriter.
- xmlWriter->Close();
-
- // Close the TextWriter.
- writer->Close();
- }
-
- void SerializeOverride( String^ filename )
- {
- // Create an instance of the XmlSerializer class that
- // uses a SoapAttributeOverrides Object*.
- XmlSerializer^ mySerializer = CreateOverrideSerializer();
-
- // Writing the file requires a TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create an XML text writer.
- XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( writer );
- xmlWriter->Formatting = Formatting::Indented;
- xmlWriter->Indentation = 2;
-
- // Create an instance of the class that will be serialized.
- Group^ myGroup = gcnew Group;
-
- // Set the Object* properties.
- myGroup->GroupName = ".NET";
- Employee^ e1 = gcnew Employee;
- e1->Name = "Pat";
- myGroup->Employees = gcnew array(1);
- myGroup->Employees[ 0 ] = e1;
-
- // Write the root element.
- xmlWriter->WriteStartElement( "root" );
-
- // Serialize the class.
- mySerializer->Serialize( xmlWriter, myGroup );
-
- // Close the root tag.
- xmlWriter->WriteEndElement();
-
- // Close the XmlWriter.
- xmlWriter->Close();
-
- // Close the TextWriter.
- writer->Close();
- }
-
- void DeserializeObject( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlSerializer^ mySerializer = CreateOverrideSerializer();
-
- // Reading the file requires a TextReader.
- TextReader^ reader = gcnew StreamReader( filename );
-
- // Create an XML text reader.
- XmlTextReader^ xmlReader = gcnew XmlTextReader( reader );
- xmlReader->ReadStartElement();
-
- // Deserialize and cast the object.
- Group^ myGroup;
- myGroup = dynamic_cast(mySerializer->Deserialize( xmlReader ));
- xmlReader->ReadEndElement();
- Console::WriteLine( "The GroupName is {0}", myGroup->GroupName );
- Console::WriteLine( "Look at the SoapType.xml and SoapType2.xml "
- "files for the generated XML." );
-
- // Close the readers.
- xmlReader->Close();
- reader->Close();
- }
-
-private:
- XmlSerializer^ CreateOverrideSerializer()
- {
- // Create and return an XmlSerializer instance used to
- // and create SOAP messages.
- SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides;
- SoapAttributes^ soapAtts = gcnew SoapAttributes;
-
- // Override the SoapTypeAttribute.
- SoapTypeAttribute^ soapType = gcnew SoapTypeAttribute;
- soapType->TypeName = "Team";
- soapType->IncludeInSchema = false;
- soapType->Namespace = "http://www.microsoft.com";
- soapAtts->SoapType = soapType;
- mySoapAttributeOverrides->Add( Group::typeid, soapAtts );
-
- // Create an XmlTypeMapping that is used to create an instance
- // of the XmlSerializer. Then return the XmlSerializer Object*.
- XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid );
- XmlSerializer^ ser = gcnew XmlSerializer( myMapping );
- return ser;
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->SerializeOriginal( "SoapType.xml" );
- test->SerializeOverride( "SoapType2.xml" );
- test->DeserializeObject( "SoapType2.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp b/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp
deleted file mode 100644
index 0f5bd7c7799..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::Xml::Schema;
-
-ref class Vehicle;
-
-[SoapInclude(Vehicle::typeid)]
-public ref class Vehicle
-{
-public:
- String^ licenseNumber;
-};
-
-
-// You must use the SoapIncludeAttribute to inform the XmlSerializer
-// that the Vehicle type should be recognized when deserializing.
-
-[SoapInclude(Vehicle::typeid)]
-public ref class Group
-{
-public:
- String^ GroupName;
- Vehicle^ GroupVehicle;
-};
-
-public ref class Run
-{
-public:
- void DeserializeObject( String^ filename )
- {
- // Create an instance of the XmlSerializer class.
- XmlTypeMapping^ myMapping = ((gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ));
- XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping );
- mySerializer->UnreferencedObject += gcnew UnreferencedObjectEventHandler( this, &Run::Serializer_UnreferencedObject );
-
- // Reading the file requires an XmlTextReader.
- XmlTextReader^ reader = gcnew XmlTextReader( filename );
- reader->ReadStartElement();
-
- // Deserialize and cast the object.
- Group^ myGroup;
- myGroup = dynamic_cast(mySerializer->Deserialize( reader ));
- reader->ReadEndElement();
- reader->Close();
- }
-
-private:
- void Serializer_UnreferencedObject( Object^ /*sender*/, UnreferencedObjectEventArgs^ e )
- {
- Console::WriteLine( "UnreferencedObject:" );
- Console::WriteLine( "ID: {0}", e->UnreferencedId );
- Console::WriteLine( "UnreferencedObject: {0}", e->UnreferencedObject );
- Vehicle^ myVehicle = dynamic_cast(e->UnreferencedObject);
- Console::WriteLine( "License: {0}", myVehicle->licenseNumber );
- }
-};
-
-int main()
-{
- Run^ test = gcnew Run;
- test->DeserializeObject( "UnrefObj.xml" );
-}
-
-// The file named S"UnrefObj.xml" should contain this XML:
-//
-//
-//
-//
-// ABCD
-//
-//
-// 1234
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp
deleted file mode 100644
index 165da0b159e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-// System.Xml.Serialization.XmlAttributeAttribute.XmlAttributeAttribute()
-// System.Xml.Serialization.XmlAttributeAttribute.XmlAttributeAttribute(String)
-/* The following example demonstrates the XmlAttributeAttribute constructor.
-* This sample serializes a class named 'Student'. The StudentName property is
-* serialized as an XML attribute. It also serializes a class named 'Book'.
-*/
-//
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-// This is the class that will be serialized.
-public ref class Student
-{
-public:
- String^ StudentName;
- int StudentNumber;
-};
-
-public ref class Book
-{
-public:
- String^ BookName;
- int BookNumber;
-};
-
-void SerializeObject( String^ studentFilename, String^ bookFilename )
-{
- XmlSerializer^ mySerializer;
- TextWriter^ writer;
-
- // Create the XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ myXmlAttributeOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ myXmlAttributes = gcnew XmlAttributes;
-
- /* Create an XmlAttributeAttribute set it to
- the XmlAttribute property of the XmlAttributes object.*/
- XmlAttributeAttribute^ myXmlAttributeAttribute = gcnew XmlAttributeAttribute;
- myXmlAttributeAttribute->AttributeName = "Name";
- myXmlAttributes->XmlAttribute = myXmlAttributeAttribute;
-
- // Add to the XmlAttributeOverrides. Specify the member name.
- myXmlAttributeOverrides->Add( Student::typeid, "StudentName", myXmlAttributes );
-
- // Create the XmlSerializer.
- mySerializer = gcnew XmlSerializer( Student::typeid,myXmlAttributeOverrides );
- writer = gcnew StreamWriter( studentFilename );
-
- // Create an instance of the class that will be serialized.
- Student^ myStudent = gcnew Student;
-
- // Set the Name property, which will be generated as an XML attribute.
- myStudent->StudentName = "James";
- myStudent->StudentNumber = 1;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myStudent );
- writer->Close();
-
- // Create the XmlAttributeOverrides and XmlAttributes objects.
- XmlAttributeOverrides^ myXmlBookAttributeOverrides = gcnew XmlAttributeOverrides;
- XmlAttributes^ myXmlBookAttributes = gcnew XmlAttributes;
-
- /* Create an XmlAttributeAttribute set it to
- the XmlAttribute property of the XmlAttributes object.*/
- XmlAttributeAttribute^ myXmlBookAttributeAttribute = gcnew XmlAttributeAttribute( "Name" );
- myXmlBookAttributes->XmlAttribute = myXmlBookAttributeAttribute;
-
- // Add to the XmlAttributeOverrides. Specify the member name.
- myXmlBookAttributeOverrides->Add( Book::typeid, "BookName", myXmlBookAttributes );
-
- // Create the XmlSerializer.
- mySerializer = gcnew XmlSerializer( Book::typeid,myXmlBookAttributeOverrides );
- writer = gcnew StreamWriter( bookFilename );
-
- // Create an instance of the class that will be serialized.
- Book^ myBook = gcnew Book;
-
- // Set the Name property, which will be generated as an XML attribute.
- myBook->BookName = ".NET";
- myBook->BookNumber = 10;
-
- // Serialize the class, and close the TextWriter.
- mySerializer->Serialize( writer, myBook );
- writer->Close();
-}
-
-int main()
-{
- SerializeObject( "Student.xml", "Book.xml" );
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp
deleted file mode 100644
index a12e4ff3e02..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// System::Xml::Serialization::XmlRootAttribute.XmlRootAttribute(String*)
-
-/* The following example demonstrates the constructor
-'XmlRootAttribute(String*)' of class 'XmlRootAttribute'.
-This program demonstrates 'Student' class to
-which the 'XmlRootAttribute(String*)' constructor has been applied.
-*/
-
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that is the default root element.
-public ref class Student
-{
-public:
- String^ Name;
-};
-
-public ref class XMLRootAttributeClass
-{
-//
-public:
- void SerializeOrder( String^ filename )
- {
- // Create an XmlSerializer instance using the method below.
- XmlSerializer^ myXmlSerializer = CreateOverrider();
-
- // Create the object, and set its Name property.
- Student^ myStudent = gcnew Student;
- myStudent->Name = "Student class1";
-
- // Serialize the class, and close the TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- myXmlSerializer->Serialize( writer, myStudent );
- writer->Close();
- }
-
- // Return an XmlSerializer to the root serialization.
- XmlSerializer^ CreateOverrider()
- {
- // Create an XmlAttributes to the default root element.
- XmlAttributes^ myXmlAttributes = gcnew XmlAttributes;
-
- // Create an XmlRootAttribute overloaded constructer
- // and set its namespace.
- XmlRootAttribute^ myXmlRootAttribute =
- gcnew XmlRootAttribute( "OverriddenRootElementName" );
- myXmlRootAttribute->Namespace = "http://www.microsoft.com";
-
- // Set the XmlRoot property to the XmlRoot object.
- myXmlAttributes->XmlRoot = myXmlRootAttribute;
- XmlAttributeOverrides^ myXmlAttributeOverrides =
- gcnew XmlAttributeOverrides;
-
- // Add the XmlAttributes object to the XmlAttributeOverrides object
- myXmlAttributeOverrides->Add( Student::typeid, myXmlAttributes );
-
- // Create the Serializer, and return it.
- XmlSerializer^ myXmlSerializer = gcnew XmlSerializer(
- Student::typeid, myXmlAttributeOverrides );
- return myXmlSerializer;
- }
-//
-};
-
-int main()
-{
- XMLRootAttributeClass^ myXMLRootAttributeClass =
- gcnew XMLRootAttributeClass;
- myXMLRootAttributeClass->SerializeOrder(
- "XMLRootAttributeConstructor.xml" );
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp
deleted file mode 100644
index c87e784d7f0..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// System::Xml::Serialization::XmlRootAttribute.ElementName
-
-// The following example demonstrates the property
-// 'ElementName' of class 'XmlRootAttribute'.
-// This program demonstrates 'Student' class to
-// which the 'ElementName' property has been applied.
-
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-// This is the class that is the default root element.
-public ref class Student
-{
-public:
- String^ Name;
-};
-
-public ref class XMLRootAttributeClass
-{
-//
-public:
- void SerializeOrder( String^ filename )
- {
- // Create an XmlSerializer instance using the method below.
- XmlSerializer^ myXmlSerializer = CreateOverrider();
-
- // Create the object, and set its Name property.
- Student^ myStudent = gcnew Student;
- myStudent->Name = "Student class1";
-
- // Serialize the class, and close the TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- myXmlSerializer->Serialize( writer, myStudent );
- writer->Close();
- }
-
- // Return an XmlSerializer to the root serialization.
- XmlSerializer^ CreateOverrider()
- {
- // Create an XmlAttributes to the default root element.
- XmlAttributes^ myXmlAttributes = gcnew XmlAttributes;
-
- // Create an XmlRootAttribute and set its element name and namespace.
- XmlRootAttribute^ myXmlRootAttribute = gcnew XmlRootAttribute;
- myXmlRootAttribute->ElementName = "OverriddenRootElementName";
- myXmlRootAttribute->Namespace = "http://www.microsoft.com";
-
- // Set the XmlRoot property to the XmlRoot object.
- myXmlAttributes->XmlRoot = myXmlRootAttribute;
- XmlAttributeOverrides^ myXmlAttributeOverrides =
- gcnew XmlAttributeOverrides;
-
- // Add the XmlAttributes object to the XmlAttributeOverrides object.
- myXmlAttributeOverrides->Add( Student::typeid, myXmlAttributes );
-
- // Create the Serializer, and return it.
- XmlSerializer^ myXmlSerializer = gcnew XmlSerializer(
- Student::typeid, myXmlAttributeOverrides );
- return myXmlSerializer;
- }
-//
-};
-
-int main()
-{
- XMLRootAttributeClass^ myXMLRootAttributeClass =
- gcnew XMLRootAttributeClass;
- myXMLRootAttributeClass->SerializeOrder(
- "XMLRootAttributeConstuctor.xml" );
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp
deleted file mode 100644
index d2b959c3203..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-// System::Xml::Serialization::XmlTypeAttribute.XmlTypeAttribute()
-// System::Xml::Serialization::XmlTypeAttribute.XmlTypeAttribute(String*)
-// The following example demonstrates the contructors 'XmlTypeAttribute()'
-// and 'XmlTypeAttribute(String*)' of class 'XmlTypeAttribute'.
-// This program demonstrates 'Person' and 'Address' classes to
-// which the 'XmlTypeAttribute' has been applied. This sample then
-// serializes an Object* of class 'Person' into an XML document.
-//
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-public ref class Address
-{
-public:
- String^ state;
- String^ zip;
-};
-
-public ref class Person
-{
-public:
- String^ personName;
- Address^ address;
-};
-
-public ref class PersonTypeAttribute
-{
-public:
- XmlSerializer^ CreateOverrider()
- {
- XmlAttributeOverrides^ personOverride = gcnew XmlAttributeOverrides;
- XmlAttributes^ personAttributes = gcnew XmlAttributes;
- XmlTypeAttribute^ personType = gcnew XmlTypeAttribute;
- personType->TypeName = "Employee";
- personType->Namespace = "http://www.microsoft.com";
- personAttributes->XmlType = personType;
- XmlAttributes^ addressAttributes = gcnew XmlAttributes;
-
- // Create 'XmlTypeAttribute' with 'TypeName' as an argument.
- XmlTypeAttribute^ addressType = gcnew XmlTypeAttribute( "Address" );
- addressType->Namespace = "http://www.microsoft.com";
- addressAttributes->XmlType = addressType;
- personOverride->Add( Person::typeid, personAttributes );
- personOverride->Add( Address::typeid, addressAttributes );
- XmlSerializer^ myXmlSerializer = gcnew XmlSerializer( Person::typeid,personOverride );
- return myXmlSerializer;
- }
-
- void SerializeObject( String^ filename )
- {
- XmlSerializer^ myXmlSerializer = CreateOverrider();
- Address^ myAddress = gcnew Address;
- myAddress->state = "AAA";
- myAddress->zip = "11111";
- Person^ myPerson = gcnew Person;
- myPerson->personName = "Smith";
- myPerson->address = myAddress;
-
- // Serialize to a file.
- TextWriter^ writer = gcnew StreamWriter( filename );
- myXmlSerializer->Serialize( writer, myPerson );
- }
-};
-
-int main()
-{
- PersonTypeAttribute^ myPersonTypeAttribute = gcnew PersonTypeAttribute;
- myPersonTypeAttribute->SerializeObject( "XmlType.xml" );
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp
deleted file mode 100644
index 5c3508dc8e8..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-
-public ref class Group
-{
-public:
- String^ GroupName;
-
- // The UnknownAttributes array will be used to collect all unknown
- // attributes found when deserializing.
-
- [XmlAnyAttributeAttribute]
- array^XAttributes;
-};
-
-void SerializeObject( String^ filename, Object^ g )
-{
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
- TextWriter^ writer = gcnew StreamWriter( filename );
- ser->Serialize( writer, g );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ g = safe_cast(ser->Deserialize( fs ));
- fs->Close();
-
- // Write out the data, including unknown attributes.
- Console::WriteLine( g->GroupName );
- Console::WriteLine( "Number of unknown attributes: {0}", g->XAttributes->Length );
- for ( IEnumerator ^ e = g->XAttributes->GetEnumerator(); e->MoveNext(); )
- {
- XmlAttribute^ xAtt = safe_cast(e->Current);
- Console::WriteLine( "{0}: {1}", xAtt->Name, xAtt->InnerXml );
- }
- SerializeObject( "AttributesAdded.xml", g );
-}
-
-int main()
-{
- // Deserialize the file containing unknown attributes.
- DeserializeObject( "UnknownAttributes.xml" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp
deleted file mode 100644
index 31e83e62519..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-public ref class Group
-{
-public:
- String^ GroupName;
-
- // The Things array will be used to collect all unknown
- // attributes found when deserializing.
- array^Things;
-};
-
-XmlSerializer^ CreateOverrideSerializer();
-void DeserializeObject( String^ filename )
-{
- // Use the CreateOverrideSerializer to return an instance
- // of the XmlSerializer customized for overrides.
- XmlSerializer^ ser = CreateOverrideSerializer();
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ g = safe_cast(ser->Deserialize( fs ));
- fs->Close();
- Console::WriteLine( g->GroupName );
- Console::WriteLine( g->Things->Length );
- for ( IEnumerator ^ e = g->Things->GetEnumerator(); e->MoveNext(); )
- {
- XmlAttribute^ xAtt = safe_cast(e->Current);
- Console::WriteLine( "{0}: {1}", xAtt->Name, xAtt->InnerXml );
- }
-}
-
-XmlSerializer^ CreateOverrideSerializer()
-{
- // Override the Things field to capture all
- // unknown XML attributes.
- XmlAnyAttributeAttribute^ myAnyAttribute = gcnew XmlAnyAttributeAttribute;
- XmlAttributeOverrides^ xOverride = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAtts = gcnew XmlAttributes;
- xAtts->XmlAnyAttribute = myAnyAttribute;
- xOverride->Add( Group::typeid, "Things", xAtts );
- return gcnew XmlSerializer( Group::typeid,xOverride );
-}
-
-int main()
-{
- DeserializeObject( "UnknownAttributes.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp
deleted file mode 100644
index 9915009fc75..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Text;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-[XmlRoot(Namespace="http://www.cohowinery.com")]
-public ref class Group
-{
-public:
- String^ GroupName;
-
- // This is for serializing Employee elements.
-
- [XmlAnyElement(Name="Employee")]
- array^UnknownEmployees;
-
- // This is for serializing City elements.
-
- [XmlAnyElement
- (Name="City",
- Namespace="http://www.cpandl.com")]
- array^UnknownCity;
-
- // This one is for all other unknown elements.
-
- [XmlAnyElement]
- array^UnknownElements;
-};
-
-void SerializeObject( String^ filename )
-{
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
-
- // Create an XmlNamespaces to use.
- XmlSerializerNamespaces^ namespaces = gcnew XmlSerializerNamespaces;
- namespaces->Add( "c", "http://www.cohowinery.com" );
- namespaces->Add( "i", "http://www.cpandl.com" );
- Group^ myGroup = gcnew Group;
-
- // Create arrays of arbitrary XmlElement objects.
- // First create an XmlDocument, used to create the
- // XmlElement objects.
- XmlDocument^ xDoc = gcnew XmlDocument;
-
- // Create an array of Employee XmlElement objects.
- XmlElement^ El1 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" );
- El1->InnerText = "John";
- XmlElement^ El2 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" );
- El2->InnerText = "Joan";
- XmlElement^ El3 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" );
- El3->InnerText = "Jim";
- array^employees = {El1,El2,El3};
- myGroup->UnknownEmployees = employees;
-
- // Create an array of City XmlElement objects.
- XmlElement^ inf1 = xDoc->CreateElement( "City", "http://www.cpandl.com" );
- inf1->InnerText = "Tokyo";
- XmlElement^ inf2 = xDoc->CreateElement( "City", "http://www.cpandl.com" );
- inf2->InnerText = "New York";
- XmlElement^ inf3 = xDoc->CreateElement( "City", "http://www.cpandl.com" );
- inf3->InnerText = "Rome";
- array^cities = {inf1,inf2,inf3};
- myGroup->UnknownCity = cities;
- XmlElement^ xEl1 = xDoc->CreateElement( "bld" );
- xEl1->InnerText = "42";
- XmlElement^ xEl2 = xDoc->CreateElement( "Region" );
- xEl2->InnerText = "West";
- XmlElement^ xEl3 = xDoc->CreateElement( "type" );
- xEl3->InnerText = "Technical";
- array^elements = {xEl1,xEl2,xEl3};
- myGroup->UnknownElements = elements;
-
- // Serialize the class, and close the TextWriter.
- TextWriter^ writer = gcnew StreamWriter( filename );
- ser->Serialize( writer, myGroup, namespaces );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ myGroup;
- myGroup = safe_cast(ser->Deserialize( fs ));
- fs->Close();
- for ( int i = 0; i < myGroup->UnknownEmployees->Length; ++i )
- {
- XmlElement^ xEmp = myGroup->UnknownEmployees[ i ];
- Console::WriteLine( "{0}: {1}", xEmp->LocalName, xEmp->InnerText );
- }
- for ( int i = 0; i < myGroup->UnknownCity->Length; ++i )
- {
- XmlElement^ xCity = myGroup->UnknownCity[ i ];
- Console::WriteLine( "{0}: {1}", xCity->LocalName, xCity->InnerText );
- }
- for ( int i = 0; i < myGroup->UnknownElements->Length; ++i )
- {
- XmlElement^ xEmp = myGroup->UnknownElements[ i ];
- Console::WriteLine( "{0}: {1}", xEmp->LocalName, xEmp->InnerText );
- }
-}
-
-int main()
-{
- SerializeObject( "AnyElementArray.xml" );
- DeserializeObject( "AnyElementArray.xml" );
- Console::WriteLine( "Done" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp
deleted file mode 100644
index 9787259757c..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::IO;
-using namespace System::Xml::Schema;
-public ref class Item
-{
-public:
- String^ ItemID;
- Item(){}
-
- Item( String^ id )
- {
- ItemID = id;
- }
-};
-
-public ref class NewItem: public Item
-{
-public:
- String^ Category;
- NewItem(){}
-
- NewItem( String^ id, String^ cat )
- {
- ItemID = id;
- Category = cat;
- }
-};
-
-public ref class PurchaseOrder
-{
-public:
-
- [XmlArrayItem(DataType="gMonth",
- ElementName="MyMonths",
- Namespace="http://www.cohowinery.com")]
- array^Months;
-
- [XmlArrayItem(Item::typeid),XmlArrayItem(NewItem::typeid)]
- array- ^Items;
-
- [XmlArray(IsNullable=true)]
- [XmlArrayItem(String::typeid),
- XmlArrayItem(Double::typeid),
- XmlArrayItem(NewItem::typeid)]
- array^Things;
-};
-
-void SerializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class;
- // specify the type of object to serialize.
- XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid );
- TextWriter^ writer = gcnew StreamWriter( filename );
-
- // Create a PurchaseOrder and set its properties.
- PurchaseOrder^ po = gcnew PurchaseOrder;
- array^months = {"March","May","August"};
- po->Months = months;
- array
- ^items = {gcnew Item( "a1" ),gcnew NewItem( "b1","book" )};
- po->Items = items;
- array^things = {"String",2003.31,gcnew NewItem( "Item100","book" )};
- po->Things = things;
-
- // Serialize the purchase order, and close the TextWriter.
- serializer->Serialize( writer, po );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- // Create an instance of the XmlSerializer class;
- // specify the type of object to be deserialized.
- XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
-
- // Declare an object variable of the type to be deserialized.
- PurchaseOrder^ po;
-
- /* Use the Deserialize method to restore the object's state with
- data from the XML document. */
- po = safe_cast(serializer->Deserialize( fs ));
- for ( int i = 0; i < po->Months->Length; ++i )
- Console::WriteLine( po->Months[ i ] );
- for ( int i = 0; i < po->Items->Length; ++i )
- Console::WriteLine( po->Items[ i ]->ItemID );
- for ( int i = 0; i < po->Things->Length; ++i )
- Console::WriteLine( po->Things[ i ] );
-}
-
-int main()
-{
- // Read and write purchase orders.
- SerializeObject( "ArrayItemEx.xml" );
- DeserializeObject( "ArrayItemEx.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp
deleted file mode 100644
index 37278b0a8b3..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-public ref class Group
-{
-public:
- String^ GroupName;
-
- [XmlAnyElement]
- array^Things;
-};
-
-void SerializeObject( String^ filename );
-void DeserializeObject( String^ filename );
-XmlSerializer^ CreateOverrideSerializer();
-int main()
-{
- // 1 Run this and create the XML document.
- // 2 Add new elements to the XML document.
- // 3 Comment out the next line, and uncomment
- // the DeserializeObject line to deserialize the
- // XML document and see unknown elements.
- SerializeObject( "UnknownElements.xml" );
-
- // DeserializeObject(S"UnknownElements.xml");
-}
-
-void SerializeObject( String^ filename )
-{
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
- TextWriter^ writer = gcnew StreamWriter( filename );
- Group^ g = gcnew Group;
- g->GroupName = "MyGroup";
- ser->Serialize( writer, g );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ ser = CreateOverrideSerializer();
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ g = safe_cast(ser->Deserialize( fs ));
- fs->Close();
- Console::WriteLine( g->GroupName );
- Console::WriteLine( g->Things->Length );
- for ( int i = 0; i < g->Things->Length; ++i )
- {
- XmlElement^ xelement = safe_cast(g->Things[ i ]);
- Console::WriteLine( "{0}: {1}", xelement->Name, xelement->InnerXml );
- }
-}
-
-XmlSerializer^ CreateOverrideSerializer()
-{
- XmlAnyElementAttribute^ myAnyElement = gcnew XmlAnyElementAttribute;
- XmlAttributeOverrides^ xOverride = gcnew XmlAttributeOverrides;
- XmlAttributes^ xAtts = gcnew XmlAttributes;
- xAtts->XmlAnyElements->Add( myAnyElement );
- xOverride->Add( Group::typeid, "Things", xAtts );
- return gcnew XmlSerializer( Group::typeid,xOverride );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp
deleted file mode 100644
index a86b3632f06..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-public ref class Student
-{
-public:
-
- [XmlAttributeAttribute]
- String^ Name;
-
- [XmlNamespaceDeclarationsAttribute]
- XmlSerializerNamespaces^ myNamespaces;
-};
-
-void SerializeStudent( String^ filename );
-void DeserializeStudent( String^ filename );
-int main()
-{
- SerializeStudent( "Student.xml" );
- DeserializeStudent( "Student.xml" );
-}
-
-void SerializeStudent( String^ filename )
-{
- XmlAttributes^ atts = gcnew XmlAttributes;
-
- // Set to true to preserve namespaces,
- // or false to ignore them.
- atts->Xmlns = true;
- XmlAttributeOverrides^ xover = gcnew XmlAttributeOverrides;
-
- // Add the XmlAttributes and specify the name of the element
- // containing namespaces.
- xover->Add( Student::typeid, "myNamespaces", atts );
-
- // Create the XmlSerializer using the
- // XmlAttributeOverrides object.
- XmlSerializer^ xser = gcnew XmlSerializer( Student::typeid,xover );
- Student^ myStudent = gcnew Student;
- XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces;
- ns->Add( "myns1", "http://www.cpandl.com" );
- ns->Add( "myns2", "http://www.cohowinery.com" );
- myStudent->myNamespaces = ns;
- myStudent->Name = "Student1";
- FileStream^ fs = gcnew FileStream( filename,FileMode::Create );
- xser->Serialize( fs, myStudent );
- fs->Close();
-}
-
-void DeserializeStudent( String^ filename )
-{
- XmlAttributes^ atts = gcnew XmlAttributes;
-
- // Set to true to preserve namespaces, or false to ignore them.
- atts->Xmlns = true;
- XmlAttributeOverrides^ xover = gcnew XmlAttributeOverrides;
-
- // Add the XmlAttributes and specify the name of the
- // element containing namespaces.
- xover->Add( Student::typeid, "myNamespaces", atts );
-
- // Create the XmlSerializer using the
- // XmlAttributeOverrides object.
- XmlSerializer^ xser = gcnew XmlSerializer( Student::typeid,xover );
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Student^ myStudent;
- myStudent = safe_cast(xser->Deserialize( fs ));
- fs->Close();
-
- // Use the ToArray method to get an array of
- // XmlQualifiedName objects.
- array^qNames = myStudent->myNamespaces->ToArray();
- for ( int i = 0; i < qNames->Length; i++ )
- {
- Console::WriteLine( "{0}:{1}", qNames[ i ]->Name, qNames[ i ]->Namespace );
-
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp
deleted file mode 100644
index 51329745b7a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::IO;
-
-[XmlType(IncludeInSchema=false)]
-
-public enum class ItemChoiceType
-{
- None, Word, Number, DecimalNumber
-};
-
-public enum class MoreChoices
-{
- None, Item, Amount, Temp
-};
-
-public ref class Choices
-{
-public:
-
- // The MyChoice field can be set to any one of
- // the types below.
-
- [XmlChoiceIdentifier("EnumType")]
- [XmlElement("Word",String::typeid)]
- [XmlElement("Number",Int32::typeid)]
- [XmlElement("DecimalNumber",Double::typeid)]
- Object^ MyChoice;
-
- // Don't serialize this field. The EnumType field
- // contains the enumeration value that corresponds
- // to the MyChoice field value.
-
- [XmlIgnore]
- ItemChoiceType EnumType;
-
- // The ManyChoices field can contain an array
- // of choices. Each choice must be matched to
- // an array item in the ChoiceArray field.
-
- [XmlChoiceIdentifier("ChoiceArray")]
- [XmlElement("Item",String::typeid)]
- [XmlElement("Amount",Int32::typeid)]
- [XmlElement("Temp",Double::typeid)]
- array^ManyChoices;
-
- // TheChoiceArray field contains the enumeration
- // values, one for each item in the ManyChoices array.
-
- [XmlIgnore]
- array^ChoiceArray;
-};
-
-void SerializeObject( String^ filename );
-void DeserializeObject( String^ filename );
-int main()
-{
- SerializeObject( "Choices.xml" );
- DeserializeObject( "Choices.xml" );
-}
-
-void SerializeObject( String^ filename )
-{
- XmlSerializer^ mySerializer = gcnew XmlSerializer( Choices::typeid );
- TextWriter^ writer = gcnew StreamWriter( filename );
- Choices^ myChoices = gcnew Choices;
-
- // Set the MyChoice field to a string. Set the
- // EnumType to Word.
- myChoices->MyChoice = "Book";
- myChoices->EnumType = ItemChoiceType::Word;
-
- // Populate an object array with three items, one
- // of each enumeration type. Set the array to the
- // ManyChoices field.
- array^strChoices = {"Food",5,98.6};
- myChoices->ManyChoices = strChoices;
-
- // For each item in the ManyChoices array, add an
- // enumeration value.
- array^ itmChoices = {MoreChoices::Item,MoreChoices::Amount,MoreChoices::Temp};
- myChoices->ChoiceArray = itmChoices;
- mySerializer->Serialize( writer, myChoices );
- writer->Close();
-}
-
-void DeserializeObject( String^ filename )
-{
- XmlSerializer^ ser = gcnew XmlSerializer( Choices::typeid );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Choices^ myChoices = safe_cast(ser->Deserialize( fs ));
- fs->Close();
-
- // Disambiguate the MyChoice value using the enumeration.
- if ( myChoices->EnumType == ItemChoiceType::Word )
- {
- Console::WriteLine( "Word: {0}", myChoices->MyChoice->ToString() );
- }
- else
- if ( myChoices->EnumType == ItemChoiceType::Number )
- {
- Console::WriteLine( "Number: {0}", myChoices->MyChoice->ToString() );
- }
- else
- if ( myChoices->EnumType == ItemChoiceType::DecimalNumber )
- {
- Console::WriteLine( "DecimalNumber: {0}", myChoices->MyChoice->ToString() );
- }
-
- // Disambiguate the ManyChoices values using the enumerations.
- for ( int i = 0; i < myChoices->ManyChoices->Length; i++ )
- {
- if ( myChoices->ChoiceArray[ i ] == MoreChoices::Item )
- Console::WriteLine( "Item: {0}", myChoices->ManyChoices[ i ] );
- else
- if ( myChoices->ChoiceArray[ i ] == MoreChoices::Amount )
- Console::WriteLine( "Amount: ", myChoices->ManyChoices[ i ]->ToString() );
- if ( myChoices->ChoiceArray[ i ] == MoreChoices::Temp )
- Console::WriteLine( "Temp: {0}", myChoices->ManyChoices[ i ]->ToString() );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp
deleted file mode 100644
index 61dea2ac426..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::Serialization;
-public ref class Person: public IXmlSerializable
-{
-private:
-
- // Private state
- String^ personName;
-
-public:
-
- // Constructors
- Person( String^ name )
- {
- personName = name;
- }
-
- Person()
- {
- personName = nullptr;
- }
-
- // Xml Serialization Infrastructure
- //
- virtual void WriteXml( XmlWriter^ writer )
- {
- writer->WriteString( personName );
- }
- //
-
- //
- virtual void ReadXml( XmlReader^ reader )
- {
- personName = reader->ReadString();
- }
- //
-
- //
- virtual XmlSchema^ GetSchema()
- {
- return nullptr;
- }
- //
-
- // Print
- virtual String^ ToString() override
- {
- return (personName);
- }
-};
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp
deleted file mode 100644
index f5ab5ef1cb0..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-
-int main()
-{
- XmlSerializer^ serializer = gcnew XmlSerializer( Person::typeid );
- FileStream^ file = gcnew FileStream( "test.xml",FileMode::Open );
- Person^ aPerson = dynamic_cast(serializer->Deserialize( file ));
- Console::WriteLine( aPerson );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp
deleted file mode 100644
index 35d2a29a532..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-
-int main()
-{
- // Create a person object.
- Person ^ fred = gcnew Person( "Fred Flintstone" );
-
- // Serialize the object to a file.
- XmlTextWriter^ writer = gcnew XmlTextWriter( "test.xml", nullptr );
- XmlSerializer^ serializer = gcnew XmlSerializer( Person::typeid );
- serializer->Serialize( writer, fred );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp
deleted file mode 100644
index 22cef24ad7a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-public ref class Group
-{
-public:
- String^ GroupName;
-};
-
-public ref class Test
-{
-private:
- void Serializer_UnknownElement( Object^ sender, XmlElementEventArgs^ e )
- {
- Console::WriteLine( "Unknown Element" );
- Console::Write( "\t {0}", e->Element->Name );
- Console::WriteLine( " {0}", e->Element->InnerXml );
- Console::WriteLine( "\t LineNumber: {0}", e->LineNumber );
- Console::WriteLine( "\t LinePosition: {0}", e->LinePosition );
- Group^ x = dynamic_cast(e->ObjectBeingDeserialized);
- Console::WriteLine( x->GroupName );
- Console::WriteLine( sender );
- }
-
-public:
- void DeserializeObject( String^ filename )
- {
- XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );
-
- // Add a delegate to handle unknown element events.
- ser->UnknownElement += gcnew XmlElementEventHandler( this, &Test::Serializer_UnknownElement );
-
- // A FileStream is needed to read the XML document.
- FileStream^ fs = gcnew FileStream( filename,FileMode::Open );
- Group^ g = dynamic_cast(ser->Deserialize( fs ));
- fs->Close();
- }
-};
-
-int main()
-{
- Test^ t = gcnew Test;
-
- // Deserialize the file containing unknown elements.
- t->DeserializeObject( "UnknownElements.xml" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp
deleted file mode 100644
index e453759982a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// System::Xml::Serialization::XmlSerializerNamespaces.constructor
-
-// The following example demonstrates the constructor of class
-// XmlSerializerNamespaces. This sample serializes an Object* of 'MyPriceClass'
-// into an XML document.
-
-#using
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Serialization;
-using namespace System::IO;
-
-public ref class MyPriceClass
-{
-public:
- [XmlAttributeAttribute]
- String^ Units;
- Decimal Price;
-};
-
-public ref class MyBook
-{
-public:
- String^ BookName;
- String^ Author;
- MyPriceClass^ BookPrice;
- String^ Description;
-};
-
-public ref class MyMainClass
-{
-//
-public:
- void CreateBook( String^ filename )
- {
- try
- {
- // Create instance of XmlSerializerNamespaces and add the namespaces.
- XmlSerializerNamespaces^ myNameSpaces = gcnew XmlSerializerNamespaces;
- myNameSpaces->Add( "BookName", "http://www.cpandl.com" );
-
- // Create instance of XmlSerializer and specify the type of object
- // to be serialized.
- XmlSerializer^ mySerializerObject =
- gcnew XmlSerializer( MyBook::typeid );
-
- TextWriter^ myWriter = gcnew StreamWriter( filename );
- // Create object to be serialized.
- MyBook^ myXMLBook = gcnew MyBook;
-
- myXMLBook->Author = "XMLAuthor";
- myXMLBook->BookName = "DIG THE XML";
- myXMLBook->Description = "This is a XML Book";
-
- MyPriceClass^ myBookPrice = gcnew MyPriceClass;
- myBookPrice->Price = (Decimal)45.89;
- myBookPrice->Units = "$";
- myXMLBook->BookPrice = myBookPrice;
-
- // Serialize the object.
- mySerializerObject->Serialize( myWriter, myXMLBook, myNameSpaces );
- myWriter->Close();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0} occurred", e->Message );
- }
- }
-//
-};
-
-int main()
-{
- MyMainClass^ myMain = gcnew MyMainClass;
- // Create the XML document.
- myMain->CreateBook( "myBook.xml" );
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp
deleted file mode 100644
index 8f321e5bf24..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml::Serialization;
-using namespace System::Collections;
-using namespace System::Xml;
-using namespace System::Text;
-
-public ref class Thing
-{
-public:
- String^ ThingName;
-};
-
-[SoapType("TheGroup","http://www.cohowinery.com")]
-public ref class Group
-{
-public:
- String^ GroupName;
- array^Things;
-
- [SoapElement(DataType="language")]
- static String^ Lang = "en";
-
- [SoapElement(DataType="integer")]
- String^ MyNumber;
-
- [SoapElement(DataType="duration")]
- static String^ ReDate = "8/31/01";
-};
-
-void GetMap( String^ filename )
-{
- // Create an XmlSerializer instance.
- SoapReflectionImporter^ sri = gcnew SoapReflectionImporter;
- XmlTypeMapping^ map = sri->ImportTypeMapping( Group::typeid );
- Console::WriteLine( "ElementName: {0}", map->ElementName );
- Console::WriteLine( "Namespace: {0}", map->Namespace );
- Console::WriteLine( "TypeFullName: {0}", map->TypeFullName );
- Console::WriteLine( "TypeName: {0}", map->TypeName );
- XmlSerializer^ ser = gcnew XmlSerializer( map );
- Group^ xGroup = gcnew Group;
- xGroup->GroupName = "MyCar";
- xGroup->MyNumber = "5454";
- xGroup->Things = gcnew array(2); // {new Thing(), new Thing()};
- xGroup->Things[ 0 ] = gcnew Thing;
- xGroup->Things[ 1 ] = gcnew Thing;
-
- // To write the outer wrapper, use an XmlTextWriter.
- XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 );
- writer->Formatting = Formatting::Indented;
- writer->WriteStartElement( "wrapper" );
- ser->Serialize( writer, xGroup );
- writer->WriteEndElement();
- writer->Close();
-}
-
-int main()
-{
- GetMap( "MyMap.xml" );
-}
-//
diff --git a/xml/System.Text.RegularExpressions/Match.xml b/xml/System.Text.RegularExpressions/Match.xml
index fcbd7c7c70f..5b96a920302 100644
--- a/xml/System.Text.RegularExpressions/Match.xml
+++ b/xml/System.Text.RegularExpressions/Match.xml
@@ -227,7 +227,6 @@ The following examples use the regular expression `Console\.Write(Line)?`. The r
## Examples
The following example attempts to match a regular expression pattern against a sample string. The example uses the property to store information that is retrieved by the match for display to the console.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp" id="Snippet8":::
:::code language="csharp" source="~/snippets/csharp/System.Text.RegularExpressions/Match/Groups/snippet8.cs" interactive="try-dotnet" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/regex match, nextmatch, groups, captures/vb/snippet8.vb" id="Snippet8":::
@@ -294,7 +293,6 @@ The following examples use the regular expression `Console\.Write(Line)?`. The r
## Examples
The following example uses the method to capture regular expression matches beyond the first match.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp" id="Snippet8":::
:::code language="csharp" source="~/snippets/csharp/System.Text.RegularExpressions/Match/Groups/snippet8.cs" interactive="try-dotnet" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/regex match, nextmatch, groups, captures/vb/snippet8.vb" id="Snippet8":::
diff --git a/xml/System.Text.RegularExpressions/MatchCollection.xml b/xml/System.Text.RegularExpressions/MatchCollection.xml
index 3ee8714070c..30727b99502 100644
--- a/xml/System.Text.RegularExpressions/MatchCollection.xml
+++ b/xml/System.Text.RegularExpressions/MatchCollection.xml
@@ -124,7 +124,6 @@
## Examples
The following example illustrates the use of the class to interrogate a set of instances.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp" id="Snippet0":::
:::code language="csharp" source="~/snippets/csharp/System.Text.RegularExpressions/MatchCollection/Overview/words.cs" interactive="try-dotnet" id="Snippet0":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Regex_Words/VB/words.vb" id="Snippet0":::
diff --git a/xml/System.Text.RegularExpressions/MatchEvaluator.xml b/xml/System.Text.RegularExpressions/MatchEvaluator.xml
index fe842edbf9d..e26b38fa2f5 100644
--- a/xml/System.Text.RegularExpressions/MatchEvaluator.xml
+++ b/xml/System.Text.RegularExpressions/MatchEvaluator.xml
@@ -63,20 +63,19 @@
Represents the method that is called each time a regular expression match is found during a method operation.
A string returned by the method that is represented by the delegate.
- delegate method to perform a custom verification or manipulation operation for each match found by a replacement method such as . For each matched string, the method calls the delegate method with a object that represents the match. The delegate method performs whatever processing you prefer and returns a string that the method substitutes for the matched string.
+
+
+
+## Examples
+ The following code example uses the delegate to replace every matched group of characters with the number of the match occurrence.
-## Remarks
- You can use a delegate method to perform a custom verification or manipulation operation for each match found by a replacement method such as . For each matched string, the method calls the delegate method with a object that represents the match. The delegate method performs whatever processing you prefer and returns a string that the method substitutes for the matched string.
-
-
-
-## Examples
- The following code example uses the delegate to replace every matched group of characters with the number of the match occurrence.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text.RegularExpressions/MatchEvaluator/Overview/regexreplace.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/VB/regexreplace.vb" id="Snippet1":::
-
+
]]>
diff --git a/xml/System.Text.RegularExpressions/Regex.xml b/xml/System.Text.RegularExpressions/Regex.xml
index 1144af68573..917aec0f9af 100644
--- a/xml/System.Text.RegularExpressions/Regex.xml
+++ b/xml/System.Text.RegularExpressions/Regex.xml
@@ -3746,7 +3746,6 @@ For more details about `startat`, see the Remarks section of to encode Unicode characters outside of the ASCII range.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/Overview/snippet.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/VB/snippet.vb" id="Snippet1":::
@@ -145,7 +144,6 @@
## Examples
The following example demonstrates how to create a new instance and display the name of the encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/.ctor/ctor.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/VB/ctor.vb" id="Snippet1":::
@@ -268,7 +266,6 @@
## Examples
The following example demonstrates how to use the method to return the number of bytes required to encode a string using .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetByteCount/getbytecount-string.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/VB/getbytecount-string.vb" id="Snippet1":::
@@ -436,7 +433,6 @@
## Examples
The following example demonstrates how to use the method to return the number of bytes required to encode an array of Unicode characters using .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetByteCount/getbytecount-char[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/VB/getbytecount-char[]-int32-int32.vb" id="Snippet1":::
@@ -700,7 +696,6 @@
## Examples
The following example demonstrates how to use the method to encode a range of characters from a string and store the encoded characters in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetBytes/getbytes-string-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/VB/getbytes-string-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -807,7 +802,6 @@
## Examples
The following example demonstrates how to use the method to encode a range of elements from a Unicode character array and store the encoded bytes in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetBytes/getbytes-char[]-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/VB/getbytes-char[]-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -1040,7 +1034,6 @@
## Examples
The following example demonstrates how to use the method to return the number of characters produced by decoding a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetCharCount/getcharcount-byte[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/VB/getcharcount-byte[]-int32-int32.vb" id="Snippet1":::
@@ -1305,7 +1298,6 @@
## Examples
The following example demonstrates how to decode a range of elements from a byte array and store the result in a set of elements in a Unicode character array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetChars/getchars-byte[]-int32-int32-char[]-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/VB/getchars-byte[]-int32-int32-char[]-int32.vb" id="Snippet1":::
@@ -1524,7 +1516,6 @@
## Examples
The following example demonstrates how to use the method to calculate the bytes required to encode a specified number of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetMaxByteCount/getmaxbytecount-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/VB/getmaxbytecount-int32.vb" id="Snippet1":::
@@ -1602,7 +1593,6 @@
## Examples
The following example demonstrates how to use the method to calculate the maximum number of characters needed to decode a specified number of bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetMaxCharCount/getmaxcharcount-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/VB/getmaxcharcount-int32.vb" id="Snippet1":::
@@ -1718,7 +1708,6 @@
## Examples
The following example demonstrates how to use the method to convert a byte array into a .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/ASCIIEncoding/GetString/getstring-byte[].cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/VB/getstring-byte[].vb" id="Snippet1":::
diff --git a/xml/System.Text/Decoder.xml b/xml/System.Text/Decoder.xml
index d869e58dd73..720bd3c84ca 100644
--- a/xml/System.Text/Decoder.xml
+++ b/xml/System.Text/Decoder.xml
@@ -83,7 +83,6 @@ The method determines how many charac
to convert two different byte arrays into a character array. One of the character's bytes spans the arrays. This is similar to what a object does internally when reading a stream.
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Decoder/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Decoder Example/VB/source.vb" id="Snippet1":::
]]>
@@ -147,7 +146,6 @@ The following example demonstrates the use of a to co
## Examples
The following example demonstrates two techniques for initializing a new instance.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Decoder/.ctor/ctor.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/VB/ctor.vb" id="Snippet1":::
@@ -809,7 +807,6 @@ The following example uses the method to c
## Examples
The following code example demonstrates how to use the method to calculate the number of characters required to decode the specified range of bytes in the array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Decoder/GetCharCount/getcharcount-byte[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/VB/getcharcount-byte[]-int32-int32.vb" id="Snippet1":::
@@ -1161,7 +1158,6 @@ The following example uses the method to c
## Examples
The following example demonstrates how to decode a range of elements from a byte array and store them in a Unicode character array. The method is used to calculate the number of characters needed to store the decoded elements in the array `bytes`. The method decodes the specified elements in the byte array and stores them in the new character array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Decoder/GetChars/getchars-byte[]-int32-int32-char[]-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/VB/getchars-byte[]-int32-int32-char[]-int32.vb" id="Snippet1":::
diff --git a/xml/System.Text/DecoderExceptionFallback.xml b/xml/System.Text/DecoderExceptionFallback.xml
index 906c98ef131..e097ca870a0 100644
--- a/xml/System.Text/DecoderExceptionFallback.xml
+++ b/xml/System.Text/DecoderExceptionFallback.xml
@@ -63,26 +63,25 @@
Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an input character. The fallback throws an exception instead of decoding the input byte sequence. This class cannot be inherited.
- class. Specifically, the encoding type's `GetBytes` method encodes a character to a byte sequence, and the `GetChars` method decodes a byte sequence to a character.
+
+ A decoding operation can fail if the input byte sequence cannot be mapped by the encoding. For example, an object cannot decode a byte sequence that yields a character having a code point value that is outside the range U+0000 to U+007F.
+
+ In cases where an encoding or decoding conversion cannot be performed, the .NET Framework provides a failure-handling mechanism called a fallback. Your application can use the predefined .NET Framework decoder fallback, or it can create a custom decoder fallback derived from the and classes.
+
+ The .NET Framework provides two predefined classes that implement different fallback strategies for handling decoding conversion failures. The class substitutes a string provided in place of any input byte sequence that cannot be converted. After the substitute string is emitted, the decoding operation continues converting the remainder of the input. In contrast, the class throws a when an invalid byte sequence is encountered.
+
+
+
+## Examples
+ The following code example demonstrates the and classes.
-## Remarks
- An encoding maps a Unicode character to an encoded sequence of bytes, which can subsequently be transferred to a physical medium, such as a disk, or over a communications link. Characters can be mapped in various ways, and a particular encoding is represented by a type derived from the class. Specifically, the encoding type's `GetBytes` method encodes a character to a byte sequence, and the `GetChars` method decodes a byte sequence to a character.
-
- A decoding operation can fail if the input byte sequence cannot be mapped by the encoding. For example, an object cannot decode a byte sequence that yields a character having a code point value that is outside the range U+0000 to U+007F.
-
- In cases where an encoding or decoding conversion cannot be performed, the .NET Framework provides a failure-handling mechanism called a fallback. Your application can use the predefined .NET Framework decoder fallback, or it can create a custom decoder fallback derived from the and classes.
-
- The .NET Framework provides two predefined classes that implement different fallback strategies for handling decoding conversion failures. The class substitutes a string provided in place of any input byte sequence that cannot be converted. After the substitute string is emitted, the decoding operation continues converting the remainder of the input. In contrast, the class throws a when an invalid byte sequence is encountered.
-
-
-
-## Examples
- The following code example demonstrates the and classes.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/DecoderExceptionFallback/Overview/fallDecExc.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackDecExc/vb/fallDecExc.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackDecExc/vb/fallDecExc.vb" id="Snippet1":::
+
]]>
Understanding Encodings
@@ -171,11 +170,11 @@
Returns a decoder fallback buffer that throws an exception if it cannot convert a sequence of bytes to a character.
A decoder fallback buffer that throws an exception when it cannot decode a byte sequence.
- class, which is a subclass of the class. A object throws an exception whenever a sequence of bytes is passed to its method.
-
+ class, which is a subclass of the class. A object throws an exception whenever a sequence of bytes is passed to its method.
+
]]>
@@ -280,11 +279,11 @@
Retrieves the hash code for this instance.
The return value is always the same arbitrary value, and has no special significance.
- method always returns the same value, the application should not use this value to distinguish one object from another.
-
+ method always returns the same value, the application should not use this value to distinguish one object from another.
+
]]>
diff --git a/xml/System.Text/DecoderFallbackException.xml b/xml/System.Text/DecoderFallbackException.xml
index ae7f270d243..5803a895783 100644
--- a/xml/System.Text/DecoderFallbackException.xml
+++ b/xml/System.Text/DecoderFallbackException.xml
@@ -69,15 +69,14 @@
The exception that is thrown when a decoder fallback operation fails. This class cannot be inherited.
- and classes.
-## Examples
- The following code example demonstrates the and classes.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/DecoderExceptionFallback/Overview/fallDecExc.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackDecExc/vb/fallDecExc.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackDecExc/vb/fallDecExc.vb" id="Snippet1":::
+
]]>
@@ -133,11 +132,11 @@
Initializes a new instance of the class.
- property for this exception is set to COR_E_ARGUMENT (0x80070057).
-
+ property for this exception is set to COR_E_ARGUMENT (0x80070057).
+
]]>
@@ -186,11 +185,11 @@
An error message.
Initializes a new instance of the class. A parameter specifies the error message.
- property for this exception is set to COR_E_ARGUMENT (0x80070057).
-
+ property for this exception is set to COR_E_ARGUMENT (0x80070057).
+
]]>
@@ -241,11 +240,11 @@
The exception that caused this exception.
Initializes a new instance of the class. Parameters specify the error message and the inner exception that is the cause of this exception.
- property for this exception is set to COR_E_ARGUMENT (0x80070057).
-
+ property for this exception is set to COR_E_ARGUMENT (0x80070057).
+
]]>
@@ -298,11 +297,11 @@
The index position in of the byte that cannot be decoded.
Initializes a new instance of the class. Parameters specify the error message, the array of bytes being decoded, and the index of the byte that cannot be decoded.
- property for this exception is set to COR_E_ARGUMENT (0x80070057).
-
+ property for this exception is set to COR_E_ARGUMENT (0x80070057).
+
]]>
@@ -351,11 +350,11 @@
Gets the input byte sequence that caused the exception.
The input byte array that cannot be decoded.
- property to get the position in the input byte array of the byte that cannot be decoded.
-
+ property to get the position in the input byte array of the byte that cannot be decoded.
+
]]>
@@ -403,11 +402,11 @@
Gets the index position in the input byte sequence of the byte that caused the exception.
The index position in the input byte array of the byte that cannot be decoded. The index position is zero-based.
- property to retrieve the input byte array that contains the byte that cannot be decoded.
-
+ property to retrieve the input byte array that contains the byte that cannot be decoded.
+
]]>
diff --git a/xml/System.Text/DecoderReplacementFallback.xml b/xml/System.Text/DecoderReplacementFallback.xml
index 818918b7106..3ed787d0087 100644
--- a/xml/System.Text/DecoderReplacementFallback.xml
+++ b/xml/System.Text/DecoderReplacementFallback.xml
@@ -67,28 +67,27 @@
Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character. The fallback emits a user-specified replacement string instead of a decoded input byte sequence. This class cannot be inherited.
- object cannot decode a byte value greater than 0x7F. If an input byte sequence cannot be converted to an output character, a object emits a replacement string into the output to represent the original input byte sequence. The conversion process then continues to decode the remainder of the original input.
+
+ The replacement string used by a object is determined by the call to its class constructor. Two options are available:
+
+- Replacement with the default character. If you call the constructor, the replacement character is "?" (U+003F).
+
+- Replacement with a string of your choice. If you call the constructor, you provide the replacement string.
+
+ This class is one of two .NET Framework classes that implement different fallback strategies for handling decoding conversion failures. The other class is the class, which throws a when an invalid byte sequence is encountered.
+
+
+
+## Examples
+ The following code example demonstrates the class.
-## Remarks
- A common reason for an encoding or decoding operation to fail is if the underlying encoding class does not provide a mapping between a character and an equivalent byte sequence. For example, an object cannot decode a byte value greater than 0x7F. If an input byte sequence cannot be converted to an output character, a object emits a replacement string into the output to represent the original input byte sequence. The conversion process then continues to decode the remainder of the original input.
-
- The replacement string used by a object is determined by the call to its class constructor. Two options are available:
-
-- Replacement with the default character. If you call the constructor, the replacement character is "?" (U+003F).
-
-- Replacement with a string of your choice. If you call the constructor, you provide the replacement string.
-
- This class is one of two .NET Framework classes that implement different fallback strategies for handling decoding conversion failures. The other class is the class, which throws a when an invalid byte sequence is encountered.
-
-
-
-## Examples
- The following code example demonstrates the class.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/DecoderReplacementFallback/Overview/fallDecRpl.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackDecRpl/vb/fallDecRpl.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackDecRpl/vb/fallDecRpl.vb" id="Snippet1":::
+
]]>
@@ -144,11 +143,11 @@
Initializes a new instance of the class.
- object is "?".
-
+ object is "?".
+
]]>
@@ -195,11 +194,11 @@
A string that is emitted in a decoding operation in place of an input byte sequence that cannot be decoded.
Initializes a new instance of the class using a specified replacement string.
- object. A commonly used value is the Unicode "Replacement Character" (U+FFFD), which is specifically intended to replace an incoming character having a value that is unknown or unrepresentable in Unicode.
-
+ object. A commonly used value is the Unicode "Replacement Character" (U+FFFD), which is specifically intended to replace an incoming character having a value that is unknown or unrepresentable in Unicode.
+
]]>
@@ -400,11 +399,11 @@
Retrieves the hash code for the value of the object.
The hash code of the value of the object.
- object is the value of its property.
-
+ object is the value of its property.
+
]]>
diff --git a/xml/System.Text/Encoder.xml b/xml/System.Text/Encoder.xml
index 44b03ef06e8..3b1b3d9c2e4 100644
--- a/xml/System.Text/Encoder.xml
+++ b/xml/System.Text/Encoder.xml
@@ -85,7 +85,6 @@ A object maintains state information between successi
. Next, the array of characters is encoded using an .
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoder/Overview/snippet.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoder Example/VB/snippet.vb" id="Snippet1":::
]]>
@@ -148,7 +147,6 @@ The following example demonstrates how to convert an array of Unicode characters
## Examples
The following example demonstrates two techniques for initializing a new instance.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoder/.ctor/ctor.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/VB/ctor.vb" id="Snippet1":::
@@ -779,7 +777,6 @@ The following example demonstrates how to convert an array of Unicode characters
The following code example demonstrates how to use the method to return the number of bytes required to encode an array of characters using a Unicode .
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoder/GetByteCount/getbytecount-char[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/VB/getbytecount-char[]-int32-int32.vb" id="Snippet1":::
@@ -1024,7 +1021,6 @@ If your application is to convert many segments of an input stream, consider usi
## Examples
The following example demonstrates how to encode a range of elements from a character array and store the encoded bytes in a range of elements in a byte array. The method is used to determine the size of the array required by .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoder/GetBytes/getbytes-char[]-int32-int32-byte[]-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/VB/getbytes-char[]-int32-int32-byte[]-int32.vb" id="Snippet1":::
diff --git a/xml/System.Text/EncoderExceptionFallback.xml b/xml/System.Text/EncoderExceptionFallback.xml
index f81fb780759..cdb0158d924 100644
--- a/xml/System.Text/EncoderExceptionFallback.xml
+++ b/xml/System.Text/EncoderExceptionFallback.xml
@@ -63,26 +63,25 @@
Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an output byte sequence. The fallback throws an exception if an input character cannot be converted to an output byte sequence. This class cannot be inherited.
- class. Specifically, the encoding type's `GetBytes` method encodes a character to a byte sequence, and the `GetChars` method decodes a byte sequence to a character.
+
+ An encoding operation can fail if the input character cannot be represented by the encoding. For example, a object cannot encode a character that yields a Unicode code point value that is outside the range U+0000 to U+007F.
+
+ In cases where an encoding or decoding conversion cannot be performed, the .NET Framework provides a failure-handling mechanism called a fallback. Your application can use the predefined .NET Framework encoder fallback, or it can create a custom encoder fallback derived from the and classes.
+
+ The .NET Framework provides two predefined classes that implement different fallback strategies for handling encoding conversion failures. The class substitutes a string provided for any input character that cannot be converted. The substitute string is encoded in place of the invalid character, and then the encoding operation continues converting the remainder of the input. In contrast, the class throws a when an invalid character is encountered.
+
+
+
+## Examples
+ The following code example demonstrates the and classes.
-## Remarks
- An encoding maps a Unicode character to an encoded sequence of bytes, which can subsequently be transferred to a physical medium, such as a disk, or over a communications link. Characters can be mapped in various ways, and a particular encoding is represented by a type derived from the class. Specifically, the encoding type's `GetBytes` method encodes a character to a byte sequence, and the `GetChars` method decodes a byte sequence to a character.
-
- An encoding operation can fail if the input character cannot be represented by the encoding. For example, a object cannot encode a character that yields a Unicode code point value that is outside the range U+0000 to U+007F.
-
- In cases where an encoding or decoding conversion cannot be performed, the .NET Framework provides a failure-handling mechanism called a fallback. Your application can use the predefined .NET Framework encoder fallback, or it can create a custom encoder fallback derived from the and classes.
-
- The .NET Framework provides two predefined classes that implement different fallback strategies for handling encoding conversion failures. The class substitutes a string provided for any input character that cannot be converted. The substitute string is encoded in place of the invalid character, and then the encoding operation continues converting the remainder of the input. In contrast, the class throws a when an invalid character is encountered.
-
-
-
-## Examples
- The following code example demonstrates the and classes.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/EncoderExceptionFallback/Overview/fallEncExc.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncExc/vb/fallEncExc.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncExc/vb/fallEncExc.vb" id="Snippet1":::
+
]]>
Understanding Encodings
@@ -171,11 +170,11 @@
Returns an encoder fallback buffer that throws an exception if it cannot convert a character sequence to a byte sequence.
An encoder fallback buffer that throws an exception when it cannot encode a character sequence.
- class, which is a subclass of the class. An object throws an exception whenever characters are passed to its method.
-
+ class, which is a subclass of the class. An object throws an exception whenever characters are passed to its method.
+
]]>
@@ -280,11 +279,11 @@
Retrieves the hash code for this instance.
The return value is always the same arbitrary value, and has no special significance.
- method always returns the same value, the application should not use this value to distinguish one instance of the class from another.
-
+ method always returns the same value, the application should not use this value to distinguish one instance of the class from another.
+
]]>
diff --git a/xml/System.Text/EncoderFallbackException.xml b/xml/System.Text/EncoderFallbackException.xml
index 334e1c213a3..93dd2de32ee 100644
--- a/xml/System.Text/EncoderFallbackException.xml
+++ b/xml/System.Text/EncoderFallbackException.xml
@@ -69,15 +69,14 @@
The exception that is thrown when an encoder fallback operation fails. This class cannot be inherited.
- and classes.
-## Examples
- The following code example demonstrates the and classes.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/EncoderExceptionFallback/Overview/fallEncExc.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncExc/vb/fallEncExc.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncExc/vb/fallEncExc.vb" id="Snippet1":::
+
]]>
@@ -133,11 +132,11 @@
Initializes a new instance of the class.
- property for this exception is set to COR_E_ARGUMENT (0x80070057).
-
+ property for this exception is set to COR_E_ARGUMENT (0x80070057).
+
]]>
@@ -186,11 +185,11 @@
An error message.
Initializes a new instance of the class. A parameter specifies the error message.
- property for this exception is set to COR_E_ARGUMENT (0x80070057).
-
+ property for this exception is set to COR_E_ARGUMENT (0x80070057).
+
]]>
@@ -241,11 +240,11 @@
The exception that caused this exception.
Initializes a new instance of the class. Parameters specify the error message and the inner exception that is the cause of this exception.
- property for this exception is set to COR_E_ARGUMENT (0x80070057).
-
+ property for this exception is set to COR_E_ARGUMENT (0x80070057).
+
]]>
@@ -428,11 +427,11 @@
Gets the index position in the input buffer of the character that caused the exception.
The index position in the input buffer of the character that cannot be encoded.
-
diff --git a/xml/System.Text/EncoderReplacementFallback.xml b/xml/System.Text/EncoderReplacementFallback.xml
index b0a8e1e7833..3e9121d530b 100644
--- a/xml/System.Text/EncoderReplacementFallback.xml
+++ b/xml/System.Text/EncoderReplacementFallback.xml
@@ -67,30 +67,29 @@
Provides a failure handling mechanism, called a fallback, for an input character that cannot be converted to an output byte sequence. The fallback uses a user-specified replacement string instead of the original input character. This class cannot be inherited.
- object cannot encode a character having a Unicode code point value that is outside the range U+0000 to U+007F. If the input character cannot be converted to an output byte sequence, a object substitutes a specified replacement string for the original input character. The conversion process encodes the replacement string and then continues to process the remainder of the original input.
+
+ The replacement string used by an object is determined by the call to its class constructor. Two options are available:
+
+- Replacement with the default character. If you call the constructor, the replacement character is "?" (U+003F).
+
+- Replacement with a string of your choice. If you call the constructor, you provide the replacement string.
+
+ If you choose a fallback string to use with this class, make sure that the string is composed entirely of characters that can be encoded in the target encoding. Otherwise, a recursive fallback results, causing an .
+
+ This class is one of two .NET Framework classes that implement different fallback strategies for handling encoding conversion failures. The other class is the class, which throws an when an invalid character is encountered.
+
+
+
+## Examples
+ The following example demonstrates the class.
-## Remarks
- A common reason for an encoding or decoding operation to fail is if the underlying encoding class does not provide a mapping between a character and an equivalent byte sequence. For example, an object cannot encode a character having a Unicode code point value that is outside the range U+0000 to U+007F. If the input character cannot be converted to an output byte sequence, a object substitutes a specified replacement string for the original input character. The conversion process encodes the replacement string and then continues to process the remainder of the original input.
-
- The replacement string used by an object is determined by the call to its class constructor. Two options are available:
-
-- Replacement with the default character. If you call the constructor, the replacement character is "?" (U+003F).
-
-- Replacement with a string of your choice. If you call the constructor, you provide the replacement string.
-
- If you choose a fallback string to use with this class, make sure that the string is composed entirely of characters that can be encoded in the target encoding. Otherwise, a recursive fallback results, causing an .
-
- This class is one of two .NET Framework classes that implement different fallback strategies for handling encoding conversion failures. The other class is the class, which throws an when an invalid character is encountered.
-
-
-
-## Examples
- The following example demonstrates the class.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/EncoderReplacementFallback/Overview/fallEncRpl.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncRpl/vb/fallEncRpl.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncRpl/vb/fallEncRpl.vb" id="Snippet1":::
+
]]>
@@ -146,11 +145,11 @@
Initializes a new instance of the class.
- object is "?".
-
+ object is "?".
+
]]>
@@ -198,13 +197,13 @@
A string that is converted in an encoding operation in place of an input character that cannot be encoded.
Initializes a new instance of the class using a specified replacement string.
- object. You application must provide a `replacement` value that contains only characters that can be encoded in the target encoding. Otherwise, a recursive fallback results, causing an . For example, the fallback provided for an object cannot include the character "¿" (U+00BF) because that character is itself not a valid ASCII character.
-
- As a result of this, U+FFFD, which is a good choice for a fallback string for , is not generally a good choice for this class. Also, the null character (U+0000) cannot be used in the fallback string.
-
+ object. You application must provide a `replacement` value that contains only characters that can be encoded in the target encoding. Otherwise, a recursive fallback results, causing an . For example, the fallback provided for an object cannot include the character "¿" (U+00BF) because that character is itself not a valid ASCII character.
+
+ As a result of this, U+FFFD, which is a good choice for a fallback string for , is not generally a good choice for this class. Also, the null character (U+0000) cannot be used in the fallback string.
+
]]>
@@ -366,11 +365,11 @@
if the parameter specifies an object and the replacement string of that object is equal to the replacement string of this object; otherwise, .
- object is the value of its property.
-
+ object is the value of its property.
+
]]>
@@ -418,11 +417,11 @@
Retrieves the hash code for the value of the object.
The hash code of the value of the object.
- object is the value of its property.
-
+ object is the value of its property.
+
]]>
diff --git a/xml/System.Text/Encoding.xml b/xml/System.Text/Encoding.xml
index ed59e24cd76..9e36efb5add 100644
--- a/xml/System.Text/Encoding.xml
+++ b/xml/System.Text/Encoding.xml
@@ -91,7 +91,6 @@ The following example converts a string from one encoding to another.
> [!NOTE]
> The `byte[]` array is the only type in this example that contains the encoded data. The .NET `Char` and `String` types are themselves Unicode, so the call decodes the data back to Unicode.
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/Overview/convert.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/VB/convert.vb" id="Snippet1":::
]]>
@@ -360,7 +359,6 @@ The following example converts a string from one encoding to another.
The following example demonstrates the effect of the ASCII encoding on characters that are outside the ASCII range.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/ASCII/ascii.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/VB/ascii.vb" id="Snippet1":::
@@ -430,13 +428,11 @@ The following example demonstrates the effect of the ASCII encoding on character
## Examples
The following example reads a text file with a UTF-16 encoding using the big endian byte order.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BigEndianUnicode/bigendianunicode.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/VB/bigendianunicode.vb" id="Snippet1":::
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BigEndianUnicode/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
@@ -504,7 +500,6 @@ The following example demonstrates the effect of the ASCII encoding on character
## Examples
The following example retrieves the different names for each encoding and displays the encodings with one or more names that are different from . It displays but does not compare against it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BodyName/names.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Names/VB/names.vb" id="Snippet1":::
@@ -631,7 +626,6 @@ The following example demonstrates the effect of the ASCII encoding on character
## Examples
The following example retrieves the different names for each encoding and displays the encodings with one or more names that are different from . It displays but does not compare against it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BodyName/names.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Names/VB/names.vb" id="Snippet1":::
@@ -708,7 +702,6 @@ The following example demonstrates the effect of the ASCII encoding on character
## Examples
The following example converts a Unicode-encoded string to an ASCII-encoded string. Because the ASCII encoding object returned by the property uses replacement fallback and the Pi character is not part of the ASCII character set, the Pi character is replaced with a question mark, as the output from the example shows.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/Overview/convert.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/VB/convert.vb" id="Snippet1":::
@@ -1118,7 +1111,6 @@ The returned 's and . It displays but does not compare against it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BodyName/names.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Names/VB/names.vb" id="Snippet1":::
@@ -1195,7 +1187,6 @@ The returned 's and 's and 's and 's and 's and 's and 's and 's and 's and 's and 's and 's and 's and 's and 's and 's and method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/EncoderReplacementFallback/Overview/fallEncRpl.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncRpl/vb/fallEncRpl.vb" id="Snippet1":::
@@ -3870,7 +3841,6 @@ In .NET 5 and later versions, the code page name `utf-7` is not supported.
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/EncoderReplacementFallback/Overview/fallEncRpl.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.txt.fallbackEncRpl/vb/fallEncRpl.vb" id="Snippet1":::
@@ -3953,7 +3923,6 @@ In .NET 5 and later versions, the code page name `utf-7` is not supported.
## Examples
The following example checks the values of the Boolean properties of each encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetEncodings/isprops.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/VB/isprops.vb" id="Snippet1":::
@@ -4080,7 +4049,6 @@ In .NET 5 and later versions, the code page name `utf-7` is not supported.
## Examples
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BigEndianUnicode/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
@@ -4170,7 +4138,6 @@ In .NET 5 and later versions, the code page name `utf-7` is not supported.
## Examples
The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetCharCount/getchars.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/VB/getchars.vb" id="Snippet1":::
@@ -4272,7 +4239,6 @@ In .NET 5 and later versions, the code page name `utf-7` is not supported.
## Examples
The following example determines the byte order of the encoding based on the preamble.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetPreamble/preamble.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/VB/preamble.vb" id="Snippet1":::
@@ -4683,7 +4649,6 @@ The goal is to save this file, then open and decode it as a binary stream.
## Examples
The following example retrieves the different names for each encoding and displays the encodings with one or more names that are different from . It displays but does not compare against it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BodyName/names.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Names/VB/names.vb" id="Snippet1":::
@@ -4874,7 +4839,6 @@ The goal is to save this file, then open and decode it as a binary stream.
## Examples
The following example checks the values of the Boolean properties of each encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetEncodings/isprops.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/VB/isprops.vb" id="Snippet1":::
@@ -4931,7 +4895,6 @@ The goal is to save this file, then open and decode it as a binary stream.
## Examples
The following example checks the values of the Boolean properties of each encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetEncodings/isprops.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/VB/isprops.vb" id="Snippet1":::
@@ -4988,7 +4951,6 @@ The goal is to save this file, then open and decode it as a binary stream.
## Examples
The following example checks the values of the Boolean properties of each encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetEncodings/isprops.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/VB/isprops.vb" id="Snippet1":::
@@ -5045,7 +5007,6 @@ The goal is to save this file, then open and decode it as a binary stream.
## Examples
The following example checks the values of the Boolean properties of each encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetEncodings/isprops.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/VB/isprops.vb" id="Snippet1":::
@@ -5164,7 +5125,6 @@ The goal is to save this file, then open and decode it as a binary stream.
## Examples
The following example checks the values of the Boolean properties of each encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/GetEncodings/isprops.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/VB/isprops.vb" id="Snippet1":::
@@ -5501,7 +5461,6 @@ Starting with .NET Framework 4.6, .NET Framework includes one encoding provider,
## Examples
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BigEndianUnicode/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
@@ -5570,7 +5529,6 @@ Starting with .NET Framework 4.6, .NET Framework includes one encoding provider,
## Examples
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BigEndianUnicode/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
@@ -5640,7 +5598,6 @@ Starting with .NET Framework 4.6, .NET Framework includes one encoding provider,
## Examples
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BigEndianUnicode/getbytes_chararr.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/VB/getbytes_chararr.vb" id="Snippet1":::
@@ -5810,13 +5767,11 @@ Starting with .NET Framework 4.6, .NET Framework includes one encoding provider,
## Examples
The following example includes the in an HTML header.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/WebName/webname.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.WebName/VB/webname.vb" id="Snippet1":::
The following example retrieves the different names for each encoding and displays the encodings with one or more names that are different from . It displays but does not compare against it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/BodyName/names.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.Names/VB/names.vb" id="Snippet1":::
@@ -5878,7 +5833,6 @@ Starting with .NET Framework 4.6, .NET Framework includes one encoding provider,
## Examples
The following example determines the Windows code page that most closely corresponds to each encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/Encoding/WindowsCodePage/codepage.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/VB/codepage.vb" id="Snippet1":::
diff --git a/xml/System.Text/EncodingInfo.xml b/xml/System.Text/EncodingInfo.xml
index db117d447c3..27af0549c49 100644
--- a/xml/System.Text/EncodingInfo.xml
+++ b/xml/System.Text/EncodingInfo.xml
@@ -54,22 +54,21 @@
Provides basic information about an encoding.
- class. The method returns an array of this type.
+
+ This class is intended to provide minimal information about an encoding. To obtain additional information, the application should use the method to get an instance of the class, which contains more comprehensive information about the encoding it represents.
+
+
+
+## Examples
+ The following example uses the method to retrieve an object for each encoding supported by the .NET Framework. It then displays the value of each encoding's , , and property and compares them with the corresponding names.
-## Remarks
- This class is primarily used by the class. The method returns an array of this type.
-
- This class is intended to provide minimal information about an encoding. To obtain additional information, the application should use the method to get an instance of the class, which contains more comprehensive information about the encoding it represents.
-
-
-
-## Examples
- The following example uses the method to retrieve an object for each encoding supported by the .NET Framework. It then displays the value of each encoding's , , and property and compares them with the corresponding names.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/EncodingInfo/Overview/encodinginfo.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
+
]]>
@@ -148,20 +147,19 @@
Gets the code page identifier of the encoding.
The code page identifier of the encoding.
- .
-
-
-
-## Examples
- The following code example retrieves the different names for each encoding and compares them with the equivalent names.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp" id="Snippet1":::
+ .
+
+
+
+## Examples
+ The following code example retrieves the different names for each encoding and compares them with the equivalent names.
+
:::code language="csharp" source="~/snippets/csharp/System.Text/EncodingInfo/Overview/encodinginfo.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
+
]]>
@@ -205,20 +203,19 @@
Gets the human-readable description of the encoding.
The human-readable description of the encoding.
- property. Your applications should use for a name to pass to .
-
-
-
-## Examples
- The following code example retrieves the different names for each encoding and compares them with the equivalent names.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp" id="Snippet1":::
+ property. Your applications should use for a name to pass to .
+
+
+
+## Examples
+ The following code example retrieves the different names for each encoding and compares them with the equivalent names.
+
:::code language="csharp" source="~/snippets/csharp/System.Text/EncodingInfo/Overview/encodinginfo.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
+
]]>
@@ -275,11 +272,11 @@
if is a object and is equal to the current object; otherwise, .
- objects are equal if their properties are equal.
-
+ objects are equal if their properties are equal.
+
]]>
@@ -329,15 +326,14 @@
Returns a object that corresponds to the current object.
A object that corresponds to the current object.
- names.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp" id="Snippet1":::
+ names.
+
:::code language="csharp" source="~/snippets/csharp/System.Text/EncodingInfo/Overview/encodinginfo.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
+
]]>
@@ -384,11 +380,11 @@
Returns the hash code for the current object.
A 32-bit signed integer hash code.
- method is not suitable for distinguishing one object from another. If your application needs a unique hash code, it should override the method.
-
+ method is not suitable for distinguishing one object from another. If your application needs a unique hash code, it should override the method.
+
]]>
@@ -431,22 +427,21 @@
Gets the name registered with the Internet Assigned Numbers Authority (IANA) for the encoding.
The IANA name for the encoding.
- . This name is the same as the name represented by the property. When its value is the name of a standard, the actual implementation of the encoding may not conform in full to that standard. Your applications should use for a human-readable name.
-
- The method gets a complete list of supported encodings, uniquely distinguished by code page. If your application retrieves encodings using the property, note that some duplicate encodings are retrieved. For more about handling these duplicates, see the description of .
-
+ . This name is the same as the name represented by the property. When its value is the name of a standard, the actual implementation of the encoding may not conform in full to that standard. Your applications should use for a human-readable name.
+
+ The method gets a complete list of supported encodings, uniquely distinguished by code page. If your application retrieves encodings using the property, note that some duplicate encodings are retrieved. For more about handling these duplicates, see the description of .
+
For a list of supported names, see [Character Sets](https://www.iana.org/assignments/character-sets/character-sets.xhtml) on the [IANA website](https://www.iana.org).
-
-## Examples
- The following code example retrieves the different names for each encoding and compares them with the equivalent names.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp" id="Snippet1":::
+
+## Examples
+ The following code example retrieves the different names for each encoding and compares them with the equivalent names.
+
:::code language="csharp" source="~/snippets/csharp/System.Text/EncodingInfo/Overview/encodinginfo.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.EncodingInfo/VB/encodinginfo.vb" id="Snippet1":::
+
]]>
diff --git a/xml/System.Text/StringBuilder.xml b/xml/System.Text/StringBuilder.xml
index cde9833f26e..1d5e59862ae 100644
--- a/xml/System.Text/StringBuilder.xml
+++ b/xml/System.Text/StringBuilder.xml
@@ -79,7 +79,6 @@
class.
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Overview/StringBuilder.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Overview/StringBuilder.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/StringBuilder/VB/StringBuilder.vb" id="Snippet1":::
@@ -159,7 +158,6 @@ The following example shows how to call many of the methods defined by the constructor with no parameters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/.ctor/constructors.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/.ctor/constructors.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/VB/Form1.vb" id="Snippet1":::
@@ -229,7 +227,6 @@ The following example shows how to call many of the methods defined by the constructor with a specified capacity.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/.ctor/constructors.cs" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/.ctor/constructors.fs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/VB/Form1.vb" id="Snippet3":::
@@ -295,7 +292,6 @@ The following example shows how to call many of the methods defined by the constructor with the specified string.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/.ctor/constructors.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/.ctor/constructors.fs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/VB/Form1.vb" id="Snippet4":::
@@ -369,7 +365,6 @@ The following example shows how to call many of the methods defined by the constructor with a specified capacity and maximum capacity.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/.ctor/constructors.cs" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/.ctor/constructors.fs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/VB/Form1.vb" id="Snippet5":::
@@ -449,7 +444,6 @@ The following example shows how to call many of the methods defined by the constructor with an initial string and a specified capacity.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/.ctor/constructors.cs" id="Snippet7":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/.ctor/constructors.fs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/VB/Form1.vb" id="Snippet7":::
@@ -529,7 +523,6 @@ The following example shows how to call many of the methods defined by the constructor with the specified string.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp" id="Snippet6":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/.ctor/constructors.cs" id="Snippet6":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/.ctor/constructors.fs" id="Snippet6":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/VB/Form1.vb" id="Snippet6":::
@@ -2497,7 +2490,6 @@ The following example shows how to call many of the methods defined by the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/AppendFormat/appfmt.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/AppendFormat/appfmt.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.appendformat/VB/appfmt.vb" id="Snippet1":::
@@ -2626,7 +2618,6 @@ The following example shows how to call many of the methods defined by the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/AppendFormat/appfmt.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/AppendFormat/appfmt.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.appendformat/VB/appfmt.vb" id="Snippet1":::
@@ -2984,7 +2975,6 @@ The index of a format item is less than 0 (zero), or greater than or equal to th
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/AppendFormat/appfmt.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/AppendFormat/appfmt.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.appendformat/VB/appfmt.vb" id="Snippet1":::
@@ -3321,7 +3311,6 @@ The index of a format item is less than 0 (zero), or greater than or equal to th
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/AppendFormat/appfmt.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/AppendFormat/appfmt.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.appendformat/VB/appfmt.vb" id="Snippet1":::
@@ -3577,7 +3566,6 @@ The index of a format item is less than 0 (zero), or greater than or equal to th
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/AppendFormat/appfmt.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/AppendFormat/appfmt.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.appendformat/VB/appfmt.vb" id="Snippet1":::
@@ -4579,7 +4567,6 @@ The index of a format item is less than 0 (zero), or greater than or equal to th
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/AppendLine/al.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/AppendLine/al.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.appendline/VB/al.vb" id="Snippet1":::
@@ -4823,7 +4810,6 @@ The index of a format item is less than 0 (zero), or greater than or equal to th
## Examples
The following example demonstrates the property.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Capacity/cap.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Capacity/cap.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.ensurecapacity/VB/cap.vb" id="Snippet1":::
@@ -5087,7 +5073,6 @@ The following example instantiates a object wit
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/CopyTo/ct2.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/CopyTo/ct2.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.copyto2/VB/ct2.vb" id="Snippet1":::
@@ -5167,7 +5152,6 @@ The following example instantiates a object wit
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Capacity/cap.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Capacity/cap.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.ensurecapacity/VB/cap.vb" id="Snippet1":::
@@ -5297,7 +5281,6 @@ The `Equals` method performs an ordinal comparison to determine whether the char
## Examples
The following code uses the method to check whether two objects are equal. The method is called repeatedly after small changes are made to each object, and the results are displayed to the console.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Capacity/cap.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Capacity/cap.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.ensurecapacity/VB/cap.vb" id="Snippet1":::
@@ -5389,7 +5372,6 @@ foreach (ReadOnlyMemory chunk in sb.GetChunks())
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Insert/insert.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Insert/insert.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.insert/VB/insert.vb" id="Snippet1":::
@@ -6804,7 +6786,6 @@ The existing characters are shifted to make room for the character sequence in t
## Examples
The following example demonstrates the property.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Capacity/cap.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Capacity/cap.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.ensurecapacity/VB/cap.vb" id="Snippet1":::
@@ -6936,7 +6917,6 @@ In .NET Core and in the .NET Framework 4.0 and later versions, when you instanti
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Remove/remove.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Remove/remove.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.remove/VB/remove.vb" id="Snippet1":::
@@ -6964,7 +6944,6 @@ In .NET Core and in the .NET Framework 4.0 and later versions, when you instanti
## Examples
The following example demonstrates the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Replace/replace.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Replace/replace.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/stringbuilder.replace/VB/replace.vb" id="Snippet1":::
@@ -7494,7 +7473,6 @@ In .NET Core and in the .NET Framework 4.0 and later versions, when you instanti
## Examples
The following example demonstrates calling the method. This example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Text/StringBuilder/Overview/StringBuilder.cs" id="Snippet5":::
:::code language="fsharp" source="~/snippets/fsharp/System.Text/StringBuilder/Overview/StringBuilder.fs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/StringBuilder/VB/StringBuilder.vb" id="Snippet5":::
diff --git a/xml/System.Text/UTF32Encoding.xml b/xml/System.Text/UTF32Encoding.xml
index ac1e306372c..f2f6053a918 100644
--- a/xml/System.Text/UTF32Encoding.xml
+++ b/xml/System.Text/UTF32Encoding.xml
@@ -105,7 +105,6 @@
## Examples
The following example demonstrates the behavior of objects with and without error detection enabled. It creates a byte array whose last four bytes represent an invalid surrogate pair; the high surrogate U+D8FF is followed by an U+01FF, which is outside the range of low surrogates (0xDC00 through 0xDFFF). Without error detection, the UTF32 decoder uses replacement fallback to replace the invalid surrogate pair with REPLACEMENT CHARACTER (U+FFFD).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/Overview/errordetection.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/VB/ErrorDetection.vb" id="Snippet1":::
@@ -190,7 +189,6 @@
## Examples
The following example retrieves and displays the byte order mark for different instances.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/.ctor/getpreamble.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/VB/GetPreamble.vb" id="Snippet1":::
@@ -252,7 +250,6 @@
## Examples
The following example retrieves and displays the byte order mark for different instances.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/.ctor/getpreamble.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/VB/GetPreamble.vb" id="Snippet1":::
@@ -318,7 +315,6 @@
## Examples
The following example demonstrates the behavior of , both with error detection enabled and without.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/Overview/errordetection.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/VB/ErrorDetection.vb" id="Snippet1":::
@@ -397,7 +393,6 @@
## Examples
The following example creates objects using different parameter values and then checks them for equality.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/Equals/equals.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/VB/equals.vb" id="Snippet1":::
@@ -855,7 +850,6 @@
## Examples
The following example determines the number of bytes required to encode three characters from a character array, then encodes the characters and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetBytes/getbytes_chararr.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/VB/GetBytes_CharArr.vb" id="Snippet1":::
@@ -964,7 +958,6 @@
## Examples
The following example determines the number of bytes required to encode a string, then encodes the string and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetBytes/getbytes_string.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/VB/GetBytes_String.vb" id="Snippet1":::
@@ -1158,7 +1151,6 @@
## Examples
The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetCharCount/getchars.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/VB/GetChars.vb" id="Snippet1":::
@@ -1365,7 +1357,6 @@
## Examples
The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetCharCount/getchars.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/VB/GetChars.vb" id="Snippet1":::
@@ -1455,7 +1446,6 @@
## Examples
The following example uses an encoder and a decoder to encode a string into an array of bytes, and then decode the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetDecoder/encdec.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/VB/EncDec.vb" id="Snippet1":::
@@ -1521,7 +1511,6 @@
## Examples
The following example uses an encoder and a decoder to encode a string into an array of bytes, and then decode the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetDecoder/encdec.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/VB/EncDec.vb" id="Snippet1":::
@@ -1637,7 +1626,6 @@
## Examples
The following example determines the number of bytes required to encode a string, then encodes the string and displays the resulting bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetBytes/getbytes_string.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/VB/GetBytes_String.vb" id="Snippet1":::
@@ -1719,7 +1707,6 @@
## Examples
The following example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/GetCharCount/getchars.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/VB/GetChars.vb" id="Snippet1":::
@@ -1813,7 +1800,6 @@
## Examples
The following code example retrieves and displays the byte order mark for different instances.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF32Encoding/.ctor/getpreamble.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/VB/GetPreamble.vb" id="Snippet1":::
diff --git a/xml/System.Text/UTF7Encoding.xml b/xml/System.Text/UTF7Encoding.xml
index 3b3959ee35b..91ee5e3f7d1 100644
--- a/xml/System.Text/UTF7Encoding.xml
+++ b/xml/System.Text/UTF7Encoding.xml
@@ -86,7 +86,6 @@
## Examples
The following code example demonstrates how to use a to encode a string of Unicode characters and store them in a byte array. Notice that when the byte array is decoded back to a string, no data is lost.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/Overview/snippet.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/VB/snippet.vb" id="Snippet1":::
@@ -164,7 +163,6 @@
## Examples
The following code example demonstrates how to create a new instance and display the name of the encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/.ctor/ctor.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/VB/ctor.vb" id="Snippet1":::
@@ -232,7 +230,6 @@
## Examples
The following code example demonstrates how to create a new instance that allows optional characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/.ctor/ctor-boolean.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/VB/ctor-boolean.vb" id="Snippet1":::
@@ -382,7 +379,6 @@
## Examples
The following code example demonstrates how to use the method to return the number of bytes required to encode a character array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetByteCount/getbytecount-char[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/VB/getbytecount-char[]-int32-int32.vb" id="Snippet1":::
@@ -548,7 +544,6 @@
## Examples
The following code example demonstrates how to use the method to return the number of bytes required to encode an array of Unicode characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetByteCount/getbytecount-char[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/VB/getbytecount-char[]-int32-int32.vb" id="Snippet1":::
@@ -753,7 +748,6 @@
## Examples
The following code example demonstrates how to use the method to encode a range of characters from a and store the encoded bytes in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetBytes/getbytes-char[]-int32-int32-byte[]-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/VB/getbytes-char[]-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -863,7 +857,6 @@
## Examples
The following code example demonstrates how to use the method to encode a range of elements from a Unicode character array, and store the encoded bytes in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetBytes/getbytes-char[]-int32-int32-byte[]-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/VB/getbytes-char[]-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -1054,7 +1047,6 @@
## Examples
The following code example demonstrates how to use the method to return the number of characters produced by decoding a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetCharCount/getcharcount-byte[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/VB/getcharcount-byte[]-int32-int32.vb" id="Snippet1":::
@@ -1260,7 +1252,6 @@
## Examples
The following code example demonstrates how to use the method to decode a range of elements in a byte array and store the result in a character array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetChars/getchars-byte[]-int32-int32-char[]-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/VB/getchars-byte[]-int32-int32-char[]-int32.vb" id="Snippet1":::
@@ -1346,7 +1337,6 @@
## Examples
The following code example demonstrates how to use the method to obtain a decoder to convert the UTF-7 encoded bytes into a sequence of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetDecoder/getdecoder-.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/VB/getdecoder-.vb" id="Snippet1":::
@@ -1411,7 +1401,6 @@
## Examples
The following code example demonstrates how to use the method to obtain an encoder to convert a sequence of characters into a UTF-7 encoded sequence of bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetEncoder/getencoder-.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/VB/getencoder-.vb" id="Snippet1":::
@@ -1542,7 +1531,6 @@
## Examples
The following code example demonstrates how to use the method to return the maximum number of bytes required to encode a specified number of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetMaxByteCount/getmaxbytecount-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/VB/getmaxbytecount-int32.vb" id="Snippet1":::
@@ -1627,7 +1615,6 @@
## Examples
The following code example demonstrates how to use the method to return the maximum number of characters produced by decoding a specified number of bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetMaxCharCount/getmaxcharcount-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/VB/getmaxcharcount-int32.vb" id="Snippet1":::
@@ -1720,7 +1707,6 @@
## Examples
The following code example encodes a string into an array of bytes, and then decodes the bytes back into a string.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF7Encoding/GetString/getstring.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/VB/getstring.vb" id="Snippet1":::
diff --git a/xml/System.Text/UTF8Encoding.xml b/xml/System.Text/UTF8Encoding.xml
index fa109725ba7..4601e1cd32c 100644
--- a/xml/System.Text/UTF8Encoding.xml
+++ b/xml/System.Text/UTF8Encoding.xml
@@ -95,7 +95,6 @@
## Examples
The following example uses a object to encode a string of Unicode characters and store them in a byte array. The Unicode string includes two characters, Pi (U+03A0) and Sigma (U+03A3), that are outside the ASCII character range. When the encoded byte array is decoded back to a string, the Pi and Sigma characters are still present.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/Overview/snippet.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/VB/snippet.vb" id="Snippet1":::
@@ -172,7 +171,6 @@
## Examples
The following example creates a new instance and displays its name.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/.ctor/ctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/VB/ctor.vb" id="Snippet1":::
@@ -238,7 +236,6 @@
## Examples
The following example creates a new instance and specifies that a Unicode byte order mark prefix should be emitted by the method. The method then returns the Unicode byte order mark prefix.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/.ctor/ctor-boolean.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/VB/ctor-boolean.vb" id="Snippet1":::
@@ -307,7 +304,6 @@
## Examples
The following example creates a new instance, specifying that the method should not emit a Unicode byte order mark prefix, and an exception should be thrown when an invalid encoding is detected. The behavior of this constructor is compared to the default constructor, which does not throw an exception when an invalid encoding is detected. The two instances encode a character array that contains two high surrogates (U+D801 and U+D802) in a row, which is an invalid character sequence; a high surrogate should always be followed by a low surrogate.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/.ctor/ctor-boolean-boolean.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/VB/ctor-boolean-boolean.vb" id="Snippet1":::
@@ -386,7 +382,6 @@
## Examples
The following example uses the method to test whether the current object is equal to a different object. Four objects are created and compared and the results of the comparisons are displayed.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/Equals/equals-object.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/VB/equals-object.vb" id="Snippet1":::
@@ -998,7 +993,6 @@
## Examples
The following example uses the method to encode a range of characters from a string and stores the encoded bytes in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetBytes/getbytes-string-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/VB/getbytes-string-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -1110,7 +1104,6 @@
## Examples
The following example uses the method to encode a range of elements from a Unicode character array and store the encoded bytes in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetBytes/getbytes-char[]-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/VB/getbytes-char[]-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -1357,7 +1350,6 @@
## Examples
The following example uses the method to return the number of characters produced by decoding a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetCharCount/getcharcount-byte[]-int32-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/VB/getcharcount-byte[]-int32-int32.vb" id="Snippet1":::
@@ -1623,7 +1615,6 @@
## Examples
The following example uses the method to decode a range of elements in a byte array and store the result in a character array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetChars/getchars-byte[]-int32-int32-char[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/VB/getchars-byte[]-int32-int32-char[]-int32.vb" id="Snippet1":::
@@ -1715,7 +1706,6 @@
## Examples
The following example uses the method to obtain a UTF-8 decoder. The decoder converts a sequence of bytes into a sequence of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetDecoder/getdecoder-.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/VB/getdecoder-.vb" id="Snippet1":::
@@ -1783,7 +1773,6 @@
## Examples
The following example uses the method to obtain an encoder to convert a sequence of characters into a UTF-8 encoded sequence of bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetEncoder/getencoder-.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/VB/getencoder-.vb" id="Snippet1":::
@@ -1843,7 +1832,6 @@
## Examples
The following example uses the method to return a hash code for instances. Notice that the hash code returned by this method depends on the constructor used to create the object.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetHashCode/gethashcode-.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/VB/gethashcode-.vb" id="Snippet1":::
@@ -1916,7 +1904,6 @@
## Examples
The following example uses the method to return the maximum number of bytes required to encode a specified number of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetMaxByteCount/getmaxbytecount-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/VB/getmaxbytecount-int32.vb" id="Snippet1":::
@@ -2002,7 +1989,6 @@
## Examples
The following example uses the method to return the maximum number of characters produced by decoding a specified number of bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetMaxCharCount/getmaxcharcount-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/VB/getmaxcharcount-int32.vb" id="Snippet1":::
@@ -2094,7 +2080,6 @@
## Examples
The following example uses the method to return the Unicode byte order mark encoded in UTF-8 format. Notice that the parameterless constructor for does not provide a preamble.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UTF8Encoding/GetPreamble/getpreamble-.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/VB/getpreamble-.vb" id="Snippet1":::
diff --git a/xml/System.Text/UnicodeEncoding.xml b/xml/System.Text/UnicodeEncoding.xml
index 29d0f06f82e..6fcd7ab1e86 100644
--- a/xml/System.Text/UnicodeEncoding.xml
+++ b/xml/System.Text/UnicodeEncoding.xml
@@ -113,7 +113,6 @@
## Examples
The following example demonstrates how to encode a string of Unicode characters into a byte array by using a object. The byte array is decoded into a string to demonstrate that there is no loss of data.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/Overview/snippet.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/VB/snippet.vb" id="Snippet1":::
@@ -195,7 +194,6 @@
## Examples
The following example demonstrates how to create a new instance and display the name of the encoding.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/.ctor/ctor.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/VB/ctor.vb" id="Snippet1":::
@@ -263,7 +261,6 @@
## Examples
The following example demonstrates how to create a new instance specifying whether to support little endian or big endian byte ordering and the Unicode byte order mark.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/.ctor/ctor-boolean-boolean.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/VB/ctor-boolean-boolean.vb" id="Snippet1":::
@@ -332,7 +329,6 @@
## Examples
The following example demonstrates the behavior of , both with error detection enabled and without.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/.ctor/errordetection.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/VB/errordetection.vb" id="Snippet1":::
@@ -390,7 +386,6 @@
## Examples
The following example demonstrates how to return the value of and display it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/CharSize/charsize.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/VB/charsize.vb" id="Snippet1":::
@@ -470,7 +465,6 @@
## Examples
The following example demonstrates how to use the method to test whether the current object is equal to a different object. Five objects are created and compared, and the results of the comparisons are displayed.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/.ctor/ctor-boolean-boolean.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/VB/ctor-boolean-boolean.vb" id="Snippet1":::
@@ -976,7 +970,6 @@
## Examples
The following example demonstrates how to use the method to encode a range of characters from a and store the encoded bytes in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetBytes/getbytes-string-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/VB/getbytes-string-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -1087,7 +1080,6 @@
## Examples
The following example demonstrates how to encode a range of elements from a Unicode character array and store the encoded bytes in a range of elements in a byte array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetBytes/getbytes-char[]-int32-int32-byte[]-int32.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/VB/getbytes-char[]-int32-int32-byte[]-int32.vb" id="Snippet1":::
@@ -1286,7 +1278,6 @@
## Examples
The following example demonstrates how to use the method to return the number of characters produced by decoding a range of elements in a byte array using .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetCharCount/getcharcount-byte[]-int32-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/VB/getcharcount-byte[]-int32-int32.vb" id="Snippet1":::
@@ -1498,7 +1489,6 @@
## Examples
The following example demonstrates how to use the method to decode a range of elements in a byte array and store the result in a character array.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetChars/getchars-byte[]-int32-int32-char[]-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/VB/getchars-byte[]-int32-int32-char[]-int32.vb" id="Snippet1":::
@@ -1590,7 +1580,6 @@
## Examples
The following example uses an encoder and a decoder to encode a string into an array of bytes, and then decode the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetDecoder/encdec.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/VB/encdec.vb" id="Snippet1":::
@@ -1663,7 +1652,6 @@
## Examples
The following example uses an encoder and a decoder to encode a string into an array of bytes, and then decode the bytes into an array of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetDecoder/encdec.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/VB/encdec.vb" id="Snippet1":::
@@ -1785,7 +1773,6 @@
## Examples
The following example demonstrates how to use the method to return the maximum number of bytes required to encode a specified number of characters.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetMaxByteCount/getmaxbytecount-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/VB/getmaxbytecount-int32.vb" id="Snippet1":::
@@ -1871,7 +1858,6 @@
## Examples
The following example demonstrates how to use the method to return the maximum number of characters produced by decoding a specified number of bytes.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetMaxCharCount/getmaxcharcount-int32.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/VB/getmaxcharcount-int32.vb" id="Snippet1":::
@@ -1967,7 +1953,6 @@
## Examples
The following example demonstrates how to use the method to retrieve the Unicode byte order mark in big endian or little endian byte order for an instance of a .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Text/UnicodeEncoding/GetPreamble/getpreamble-.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/VB/getpreamble-.vb" id="Snippet1":::
diff --git a/xml/System.Threading/AbandonedMutexException.xml b/xml/System.Threading/AbandonedMutexException.xml
index 79d57cdd8a0..3b4e5fb73f8 100644
--- a/xml/System.Threading/AbandonedMutexException.xml
+++ b/xml/System.Threading/AbandonedMutexException.xml
@@ -84,7 +84,6 @@
> [!NOTE]
> The call to the method is interrupted by one of the abandoned mutexes. The other abandoned mutex could still cause an to be thrown by subsequent wait methods.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/AbandonedMutexException/Overview/koax.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/VB/koax.vb" id="Snippet1":::
@@ -654,7 +653,6 @@
> [!NOTE]
> The call to is interrupted by one of the abandoned mutexes. The other abandoned mutex could still cause an to be thrown by subsequent wait methods.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/AbandonedMutexException/Overview/koax.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/VB/koax.vb" id="Snippet1":::
diff --git a/xml/System.Threading/ApartmentState.xml b/xml/System.Threading/ApartmentState.xml
index ad24f5ff9cd..f2899077d78 100644
--- a/xml/System.Threading/ApartmentState.xml
+++ b/xml/System.Threading/ApartmentState.xml
@@ -54,24 +54,22 @@
Specifies the apartment state of a .
- property of the thread to one of the values of the enumeration. Because a given thread can only initialize a COM apartment once, you cannot change the apartment type after the first call to the unmanaged code.
-
- For more information, see , [Managed and Unmanaged Threading](https://msdn.microsoft.com/library/db425c20-4b2f-4433-bf96-76071c7881e5), and [Advanced COM Interoperability](https://msdn.microsoft.com/library/3ada36e5-2390-4d70-b490-6ad8de92f2fb).
-
-
-
-## Examples
- The following code example demonstrates how to set the apartment state of a thread.
-
+ property of the thread to one of the values of the enumeration. Because a given thread can only initialize a COM apartment once, you cannot change the apartment type after the first call to the unmanaged code.
+
+ For more information, see , [Managed and Unmanaged Threading](/previous-versions/dotnet/netframework-4.0/5s8ee185(v=vs.100)), and [Advanced COM Interoperability](/previous-versions/dotnet/netframework-4.0/bd9cdfyx(v=vs.100)).
+
+## Examples
+ The following code example demonstrates how to set the apartment state of a thread.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/ApartmentState/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/VB/source.vb" id="Snippet1":::
+
]]>
diff --git a/xml/System.Threading/AutoResetEvent.xml b/xml/System.Threading/AutoResetEvent.xml
index 6efeac22bcb..51552ecfdde 100644
--- a/xml/System.Threading/AutoResetEvent.xml
+++ b/xml/System.Threading/AutoResetEvent.xml
@@ -90,7 +90,6 @@ The following example shows how to use to
After the threads are released from the first , they wait on another that was created in the non-signaled state. All three threads block, so the method must be called three times to release them all.
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/AutoResetEvent/Overview/simplerisbetter.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/VB/simplerisbetter.vb" id="Snippet3":::
@@ -161,7 +160,6 @@ After the threads are released from the first method, to give the second thread a chance to execute. Otherwise, on a single-processor computer `Main` would write many values between any two read operations.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/AutoResetEvent/Overview/class1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/VB/class1.vb" id="Snippet1":::
diff --git a/xml/System.Threading/EventResetMode.xml b/xml/System.Threading/EventResetMode.xml
index 260cd15c1b7..af5936640d0 100644
--- a/xml/System.Threading/EventResetMode.xml
+++ b/xml/System.Threading/EventResetMode.xml
@@ -51,17 +51,16 @@
Indicates whether an is reset automatically or manually after receiving a signal.
- method overload to allow the main thread to signal a blocked thread and then wait until the thread finishes a task.
+
+ The example starts five threads and allows them to block on an created with the AutoReset flag, then releases one thread each time the user presses the ENTER key. The example then queues another five threads and releases them all using an created with the ManualReset flag.
-## Examples
- The following code example uses the method overload to allow the main thread to signal a blocked thread and then wait until the thread finishes a task.
-
- The example starts five threads and allows them to block on an created with the AutoReset flag, then releases one thread each time the user presses the ENTER key. The example then queues another five threads and releases them all using an created with the ManualReset flag.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/EventResetMode/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/VB/source.vb" id="Snippet1":::
+
]]>
diff --git a/xml/System.Threading/EventWaitHandle.xml b/xml/System.Threading/EventWaitHandle.xml
index 8a836999702..0f063d873ce 100644
--- a/xml/System.Threading/EventWaitHandle.xml
+++ b/xml/System.Threading/EventWaitHandle.xml
@@ -83,7 +83,6 @@ The class allows threads to communicate
The example starts five threads and allows them to block on an created with the flag, then releases one thread each time the user presses the Enter key. The example then queues another five threads and releases them all using an created with the flag.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/EventResetMode/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/VB/source.vb" id="Snippet1":::
@@ -167,7 +166,6 @@ The class allows threads to communicate
The example starts five threads and allows them to block on an created with the flag, then releases one thread each time the user presses the Enter key. The example then queues another five threads and releases them all using an created with the flag.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/EventResetMode/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/VB/source.vb" id="Snippet1":::
@@ -462,7 +460,6 @@ There was some other error. The `HResult` property may provide more information.
After the permissions are changed, the event is opened with the rights required to wait on it and signal it. If you run the compiled example from a third command window, the example runs using the new permissions.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/EventWaitHandle/.ctor/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/VB/source.vb" id="Snippet1":::
@@ -571,7 +568,6 @@ There was some other error. The `HResult` property may provide more information.
After the permissions have been read, using the method, and changed, the event is opened with the rights required to wait on it and signal it. If you run the compiled example from a third command window, the example runs using the new permissions.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/EventWaitHandle/.ctor/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/VB/source.vb" id="Snippet1":::
@@ -750,7 +746,6 @@ There was some other error. The `HResult` property may provide more information.
After the permissions are changed, the event is opened with the rights required to wait on it and signal it. If you run the compiled example from a third command window, the example runs using the new permissions.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/EventWaitHandle/.ctor/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/VB/source.vb" id="Snippet1":::
@@ -931,7 +926,6 @@ There was some other error. The `HResult` property may provide more information.
The example starts five threads and allows them to block on an created with the flag, then releases one thread each time the user presses the Enter key. The example then queues another five threads and releases them all using an created with the