diff --git a/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp b/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp deleted file mode 100644 index 2da48b17c60..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Policy; - -//for evidence Object -int main() -{ - - //Create evidence for new appdomain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - //Create the new application domain. - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence ); - - //Display the current relative search path. - Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath ); - - //Append the relative path. - String^ Newpath = "www.code.microsoft.com"; - domain->AppendPrivatePath( Newpath ); - - //Display the new relative search path. - Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath ); - - //Clear the private search path. - domain->ClearPrivatePath(); - - //Display the new relative search path. - Console::WriteLine( "Relative search path is now: {0}", domain->RelativeSearchPath ); - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp b/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp deleted file mode 100644 index 54f58550e69..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; -int main() -{ - - // Create a new application domain. - AppDomain^ domain = System::AppDomain::CreateDomain( "MyDomain" ); - - // Create a new AppDomain PolicyLevel. - PolicyLevel^ polLevel = PolicyLevel::CreateAppDomainLevel(); - - // Create a new, empty permission set. - PermissionSet^ permSet = gcnew PermissionSet( PermissionState::None ); - - // Add permission to execute code to the permission set. - permSet->AddPermission( gcnew SecurityPermission( SecurityPermissionFlag::Execution ) ); - - // Give the policy level's root code group a new policy statement based - // on the new permission set. - polLevel->RootCodeGroup->PolicyStatement = gcnew PolicyStatement( permSet ); - - // Give the new policy level to the application domain. - domain->SetAppDomainPolicy( polLevel ); - - // Try to execute the assembly. - try - { - - // This will throw a PolicyException if the executable tries to - // access any resources like file I/O or tries to create a window. - domain->ExecuteAssembly( "Assemblies\\MyWindowsExe.exe" ); - } - catch ( PolicyException^ e ) - { - Console::WriteLine( "PolicyException: {0}", e->Message ); - } - - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp b/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp deleted file mode 100644 index 228dd62f2ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Policy; - -//for evidence Object* -int main() -{ - AppDomainSetup^ setup = gcnew AppDomainSetup; - - // Shadow copying will not work unless the application has a name. - setup->ApplicationName = "MyApplication"; - - //Create evidence for the new application domain from evidence of - // current application domain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create a new application domain. - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, setup ); - - // MyAssembly.dll is located in the Assemblies subdirectory. - domain->AppendPrivatePath( "Assemblies" ); - - // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - // MoreAssemblies subdirectory. - domain->AppendPrivatePath( "MoreAssemblies" ); - - // Display the relative search path. - Console::WriteLine( "RelativeSearchPath: {0}", domain->RelativeSearchPath ); - - // Because Load returns an Assembly Object*, the assemblies must be - // loaded into the current domain as well. This will fail unless the - // current domain also has these directories in its search path. - AppDomain::CurrentDomain->AppendPrivatePath( "Assemblies" ); - AppDomain::CurrentDomain->AppendPrivatePath( "MoreAssemblies" ); - - // Save shadow copies to C:\Cache - domain->SetCachePath( "C:\\Cache" ); - - // Shadow copy only the assemblies in the Assemblies directory. - domain->SetShadowCopyPath( String::Concat( domain->BaseDirectory, "Assemblies" ) ); - - // Turn shadow copying on. - domain->SetShadowCopyFiles(); - - // This will be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly1 text name, Version, Culture, PublicKeyToken" ); - - // This will not be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly2 text name, Version, Culture, PublicKeyToken" ); - - // When the shadow copy path is cleared, the CLR will make shadow copies - // of all private assemblies. - domain->ClearShadowCopyPath(); - - // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly3 text name, Version, Culture, PublicKeyToken" ); - - // Unload the domain. - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp b/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp deleted file mode 100644 index fb78282dd30..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Policy; - -//for evidence object -int main() -{ - AppDomainSetup^ setup = gcnew AppDomainSetup; - - // Shadow copying will not work unless the application has a name. - setup->ApplicationName = "MyApplication"; - - //Create evidence for the new application domain from evidence of - // current application domain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create a new application domain. - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, setup ); - - // MyAssembly.dll is located in the Assemblies subdirectory. - domain->AppendPrivatePath( "Assemblies" ); - - // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - // MoreAssemblies subdirectory. - domain->AppendPrivatePath( "MoreAssemblies" ); - - // Display the relative search path. - Console::WriteLine( "RelativeSearchPath: {0}", domain->RelativeSearchPath ); - - // Because Load returns an Assembly object, the assemblies must be - // loaded into the current domain as well. This will fail unless the - // current domain also has these directories in its search path. - AppDomain::CurrentDomain->AppendPrivatePath( "Assemblies" ); - AppDomain::CurrentDomain->AppendPrivatePath( "MoreAssemblies" ); - - // Save shadow copies to C:\Cache - domain->SetCachePath( "C:\\Cache" ); - - // Shadow copy only the assemblies in the Assemblies directory. - domain->SetShadowCopyPath( String::Concat( domain->BaseDirectory, "Assemblies" ) ); - - // Turn shadow copying on. - domain->SetShadowCopyFiles(); - Console::WriteLine( "ShadowCopyFiles turned on: {0}", domain->ShadowCopyFiles ); - - // This will be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly1 text name, Version, Culture, PublicKeyToken" ); - - // This will not be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly2 text name, Version, Culture, PublicKeyToken" ); - - // When the shadow copy path is cleared, the CLR will make shadow copies - // of all private assemblies. - domain->ClearShadowCopyPath(); - - // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly3 text name, Version, Culture, PublicKeyToken" ); - - // Unload the domain. - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp index 5293d6d567a..80022c42339 100644 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp @@ -10,7 +10,7 @@ static void CreateQueue(String^ queuePath, bool transactional) if (!MessageQueue::Exists(queuePath)) { MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); + queue->Close(); } else { @@ -127,7 +127,7 @@ void PeekByCorrelationIdStringTimespan() // Designate a queue to receive the acknowledgement message for this // message. - msg->AdministrationQueue = + msg->AdministrationQueue = gcnew MessageQueue(".\\exampleAdminQueue"); // Set the message to generate an acknowledgement message upon its @@ -144,7 +144,7 @@ void PeekByCorrelationIdStringTimespan() msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); // Connect to the admin queue. - MessageQueue^ adminQueue = + MessageQueue^ adminQueue = gcnew MessageQueue(".\\exampleAdminQueue"); // Set the admin queue's MessageReadPropertyFilter property to ensure @@ -287,7 +287,7 @@ void ReceiveByCorrelationIdStringTimespan() // Designate a queue to receive the acknowledgement message for this // message. - msg->AdministrationQueue = + msg->AdministrationQueue = gcnew MessageQueue(".\\exampleAdminQueue"); // Set the message to generate an acknowledgement message upon its @@ -304,7 +304,7 @@ void ReceiveByCorrelationIdStringTimespan() msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); // Connect to the admin queue. - MessageQueue^ adminQueue = + MessageQueue^ adminQueue = gcnew MessageQueue(".\\exampleAdminQueue"); // Set the admin queue's MessageReadPropertyFilter property to ensure @@ -348,7 +348,7 @@ void ReceiveByCorrelationIdStringTransactionType() msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = + MessageQueue^ transQueue = gcnew MessageQueue(".\\exampleTransQueue"); // Create a new message in response to the original message. @@ -404,7 +404,7 @@ void ReceiveByCorrelationIdStringTimespanTransactionType() msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = + MessageQueue^ transQueue = gcnew MessageQueue(".\\exampleTransQueue"); // Create a new message in response to the original message. @@ -457,7 +457,7 @@ void ReceiveByCorrelationIdStringTimespanTransaction() msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = + MessageQueue^ transQueue = gcnew MessageQueue(".\\exampleTransQueue"); // Create a new message in response to the original message. @@ -510,7 +510,7 @@ void ReceiveByCorrelationIdStringTimespanTransaction() Console::WriteLine("Message.Label: {0}", responseMsg->Label); Console::WriteLine("Message.CorrelationId: {0}", responseMsg->CorrelationId); - + // } @@ -534,7 +534,7 @@ void ReceiveByCorrelationIdStringTransaction() msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = + MessageQueue^ transQueue = gcnew MessageQueue(".\\exampleTransQueue"); // Create a new message in response to the original message. @@ -582,7 +582,7 @@ void ReceiveByCorrelationIdStringTransaction() // Dispose of the transaction object. delete transaction; transQueue->Close(); - queue->Close(); + queue->Close(); } // Display the response message's property values. @@ -822,32 +822,6 @@ void GetAllMessages() // } -void GetEnumerator() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Get an IEnumerator object. - System::Collections::IEnumerator^ enumerator = - queue->GetMessageEnumerator2(); - - // Use the IEnumerator object to loop through the messages. - while(enumerator->MoveNext()) - { - // Get a message from the enumerator. - Message^ msg = (Message^)enumerator->Current; - - // Display the label of the message. - Console::WriteLine(msg->Label); - } - - queue->Close(); - - // -} - void SetPermissionsStringAccessRights() { // @@ -1098,4 +1072,4 @@ void main() // Write the exception information to the console. Console::WriteLine(ex->Message); } -} \ No newline at end of file +} diff --git a/snippets/csharp/System.Diagnostics/EventLog/CreateEventSource/Project.csproj b/snippets/csharp/System.Diagnostics/EventLog/CreateEventSource/Project.csproj deleted file mode 100644 index eadd8ce3c9c..00000000000 --- a/snippets/csharp/System.Diagnostics/EventLog/CreateEventSource/Project.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Exe - net6.0 - - - - - - - diff --git a/snippets/csharp/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.cs b/snippets/csharp/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.cs deleted file mode 100644 index e3fc3a8126f..00000000000 --- a/snippets/csharp/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -using System; -using System.Diagnostics; -using Microsoft.VisualBasic; - -class PerfCounterCatCreateMod -{ - - // - public static void Main(string[] args) - { - string categoryName = ""; - string counterName = ""; - string categoryHelp = ""; - string counterHelp = ""; - PerformanceCounterCategory pcc; - - // Copy the supplied arguments into the local variables. - try - { - categoryName = args[0]; - counterName = args[1]; - categoryHelp = args[2]; - counterHelp = args[3]; - } - catch(Exception ex) - { - // Ignore the exception from non-supplied arguments. - } - - Console.WriteLine("Category name: \"{0}\"", categoryName); - Console.WriteLine("Category help: \"{0}\"", categoryHelp); - Console.WriteLine("Counter name: \"{0}\"", counterName); - Console.WriteLine("Counter help: \"{0}\"", counterHelp); - - // Use the Create overload that creates a single counter. - try - { - pcc = PerformanceCounterCategory.Create(categoryName, categoryHelp, counterName, counterHelp); - Console.WriteLine("Category \"{0}\" created.", pcc.CategoryName); - } - catch(Exception ex) - { - Console.WriteLine("Unable to create the above category and counter:" + "\n" + ex.Message); - } - } - // -} -// diff --git a/snippets/csharp/System.Diagnostics/Process/WorkingSet/Project.csproj b/snippets/csharp/System.Diagnostics/Process/WorkingSet/Project.csproj deleted file mode 100644 index c02dc5044e7..00000000000 --- a/snippets/csharp/System.Diagnostics/Process/WorkingSet/Project.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Library - net6.0 - - - \ No newline at end of file diff --git a/snippets/csharp/System.Diagnostics/Process/WorkingSet/process_sample.cs b/snippets/csharp/System.Diagnostics/Process/WorkingSet/process_sample.cs deleted file mode 100644 index 27dc13b9963..00000000000 --- a/snippets/csharp/System.Diagnostics/Process/WorkingSet/process_sample.cs +++ /dev/null @@ -1,67 +0,0 @@ -// System.Diagnostics.Process.WorkingSet -// System.Diagnostics.Process.BasePriority -// System.Diagnostics.Process.UserProcessorTime -// System.Diagnostics.Process.PrivilegedProcessorTime -// System.Diagnostics.Process.TotalProcessorTime -// System.Diagnostics.Process.ToString -// System.Diagnostics.Process.Responding -// System.Diagnostics.Process.PriorityClass -// System.Diagnostics.Process.ExitCode - -// The following example starts an instance of Notepad. The example -// then retrieves and displays various properties of the associated -// process. The example detects when the process exits, and displays the process's exit code. - -// -using System; -using System.Diagnostics; -using System.Threading; - -namespace ProcessSample -{ - class MyProcessClass - { - public static void Main() - { - try - { - using (Process myProcess = Process.Start("NotePad.exe")) - { - while (!myProcess.HasExited) - { - Console.WriteLine(); - - Console.WriteLine($"Physical memory usage : {myProcess.WorkingSet}"); - Console.WriteLine($"Base priority : {myProcess.BasePriority}"); - Console.WriteLine($"Priority class : {myProcess.PriorityClass}"); - Console.WriteLine($"User processor time : {myProcess.UserProcessorTime}"); - Console.WriteLine($"Privileged processor time : {myProcess.PrivilegedProcessorTime}"); - Console.WriteLine($"Total processor time : {myProcess.TotalProcessorTime}"); - Console.WriteLine($"Process's Name : {myProcess}"); - Console.WriteLine("-------------------------------------"); - - if (myProcess.Responding) - { - Console.WriteLine("Status: Responding to user interface"); - myProcess.Refresh(); - } - else - { - Console.WriteLine("Status: Not Responding"); - } - - Thread.Sleep(1000); - } - - Console.WriteLine(); - Console.WriteLine($"Process exit code: {myProcess.ExitCode}"); - } - } - catch (Exception e) - { - Console.WriteLine($"The following exception was raised: {e.Message}"); - } - } - } -} -// diff --git a/snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs b/snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs index 1071f2b426a..193e211821c 100644 --- a/snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs +++ b/snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs @@ -85,7 +85,6 @@ public bool NewPrefs get { return myNewPrefs; } } - // private bool GetPrefsForUser() { try @@ -140,7 +139,6 @@ private bool GetPrefsForUser() return true; } } - // // public bool GetIsoStoreInfo() { @@ -266,7 +264,7 @@ public void DeleteDirectories() IsolatedStorageScope.Domain, typeof(System.Security.Policy.Url), typeof(System.Security.Policy.Url)); - // + // String[] dirNames = isoFile.GetDirectoryNames("*"); String[] fileNames = isoFile.GetFileNames("Archive\\*"); @@ -297,7 +295,7 @@ public void DeleteDirectories() { Console.WriteLine(e.ToString()); } - // + // } // // @@ -386,7 +384,7 @@ public double SetNewPrefsForUser() // isoStream.Position = 0; // Position to overwrite the old data. // - // + StreamWriter writer = new StreamWriter(isoStream); // Update the data based on the new inputs. writer.WriteLine(this.NewsUrl); @@ -396,7 +394,7 @@ public double SetNewPrefsForUser() double d = isoFile.CurrentSize / isoFile.MaximumSize; Console.WriteLine("CurrentSize = " + isoFile.CurrentSize.ToString()); Console.WriteLine("MaximumSize = " + isoFile.MaximumSize.ToString()); - // + // StreamWriter.Close implicitly closes isoStream. writer.Close(); isoFile.Close(); diff --git a/snippets/csharp/System.Messaging/MessageEnumerator/Overview/Project.csproj b/snippets/csharp/System.Messaging/MessageEnumerator/Overview/Project.csproj deleted file mode 100644 index c2a4520dc50..00000000000 --- a/snippets/csharp/System.Messaging/MessageEnumerator/Overview/Project.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Library - net48 - - - - - - - diff --git a/snippets/csharp/System.Messaging/MessageQueue/GetAllMessages/class1.cs b/snippets/csharp/System.Messaging/MessageQueue/GetAllMessages/class1.cs index e59a7854edf..578876bedef 100644 --- a/snippets/csharp/System.Messaging/MessageQueue/GetAllMessages/class1.cs +++ b/snippets/csharp/System.Messaging/MessageQueue/GetAllMessages/class1.cs @@ -89,9 +89,6 @@ public static void Main() // Demonstrate GetAllMessages. example.GetAllMessages(); - // Demonstrate GetEnumerator. - example.GetEnumerator(); - // Demonstrate SetPermissions. example.SetPermissions_StringAccessrights(); @@ -113,7 +110,7 @@ public static void Main() // Demonstrate Purge. example.Purge(); } - catch(System.Exception e) + catch (Exception e) { // Write the exception information to the console. Console.WriteLine(e); @@ -123,7 +120,7 @@ public static void Main() // Creates a new queue. public static void CreateQueue(string queuePath, bool transactional) { - if(!MessageQueue.Exists(queuePath)) + if (!MessageQueue.Exists(queuePath)) { MessageQueue.Create(queuePath, transactional); } @@ -206,7 +203,7 @@ public void Send_ObjectStringTransaction() // Commit the transaction. transaction.Commit(); } - catch(System.Exception e) + catch (System.Exception e) { // Cancel the transaction. transaction.Abort(); @@ -569,7 +566,7 @@ public void ReceiveByCorrelationId_StringTimespanTransaction() // Commit the transaction. transaction.Commit(); } - catch(System.Exception e) + catch (System.Exception e) { // Cancel the transaction. transaction.Abort(); @@ -645,7 +642,7 @@ public void ReceiveByCorrelationId_StringTransaction() // Commit the transaction. transaction.Commit(); } - catch(System.Exception e) + catch (System.Exception e) { // Cancel the transaction. transaction.Abort(); @@ -752,7 +749,7 @@ public void ReceiveById_StringTransaction() // Commit the transaction. transaction.Commit(); } - catch(System.Exception e) + catch (System.Exception e) { // Cancel the transaction. transaction.Abort(); @@ -801,7 +798,7 @@ public void ReceiveById_StringTimespanTransaction() // Commit the transaction. transaction.Commit(); } - catch(System.Exception e) + catch (System.Exception e) { // Cancel the transaction. transaction.Abort(); @@ -875,7 +872,7 @@ public void GetAllMessages() Message[] msgs = queue.GetAllMessages(); // Loop through the messages. - foreach(Message msg in msgs) + foreach (Message msg in msgs) { // Display the label of each message. Console.WriteLine(msg.Label); @@ -884,29 +881,6 @@ public void GetAllMessages() // } - public void GetEnumerator() - { - // - - // Connect to a queue on the local computer. - MessageQueue queue = new MessageQueue(".\\exampleQueue"); - - // Get an IEnumerator object. - System.Collections.IEnumerator enumerator = queue.GetEnumerator(); - - // Use the IEnumerator object to loop through the messages. - while(enumerator.MoveNext()) - { - // Get a message from the enumerator. - Message msg = (Message)enumerator.Current; - - // Display the label of the message. - Console.WriteLine(msg.Label); - } - - // - } - public void SetPermissions_StringAccessrights() { // diff --git a/snippets/csharp/System.Net/Dns/BeginResolve/Project.csproj b/snippets/csharp/System.Net/Dns/BeginResolve/Project.csproj deleted file mode 100644 index c02dc5044e7..00000000000 --- a/snippets/csharp/System.Net/Dns/BeginResolve/Project.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Library - net6.0 - - - \ No newline at end of file diff --git a/snippets/csharp/System.Net/Dns/BeginResolve/dns_begin_endresolve.cs b/snippets/csharp/System.Net/Dns/BeginResolve/dns_begin_endresolve.cs deleted file mode 100644 index b5194395cce..00000000000 --- a/snippets/csharp/System.Net/Dns/BeginResolve/dns_begin_endresolve.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - This program demonstrates 'BeginResolve' and 'EndResolve' methods of Dns class. - It obtains the 'IPHostEntry' object by calling 'BeginResolve' and 'EndResolve' method - of 'Dns' class by passing a URL, a callback function and an instance of 'RequestState' - class.Then prints host name, IP address list and aliases. -*/ - -using System; -using System.Net; -using System.Threading; - -// -// -class DnsBeginGetHostByName -{ - public static System.Threading.ManualResetEvent allDone = null; - - class RequestState - { - public IPHostEntry host; - public RequestState() - { - host = null; - } - } - - public static void Main() - { - allDone = new ManualResetEvent(false); - // Create an instance of the RequestState class. - RequestState myRequestState = new RequestState(); - - // Begin an asynchronous request for information like host name, IP addresses, or - // aliases for specified the specified URI. - IAsyncResult asyncResult = Dns.BeginResolve("www.contoso.com", new AsyncCallback(RespCallback), myRequestState ); - - // Wait until asynchronous call completes. - allDone.WaitOne(); - Console.WriteLine("Host name : " + myRequestState.host.HostName); - Console.WriteLine("\nIP address list : "); - for(int index=0; index < myRequestState.host.AddressList.Length; index++) - { - Console.WriteLine(myRequestState.host.AddressList[index]); - } - Console.WriteLine("\nAliases : "); - for(int index=0; index < myRequestState.host.Aliases.Length; index++) - { - Console.WriteLine(myRequestState.host.Aliases[index]); - } - } - - private static void RespCallback(IAsyncResult ar) - { - try - { - // Convert the IAsyncResult object to a RequestState object. - RequestState tempRequestState = (RequestState)ar.AsyncState; - // End the asynchronous request. - tempRequestState.host = Dns.EndResolve(ar); - allDone.Set(); - } - catch(ArgumentNullException e) - { - Console.WriteLine("ArgumentNullException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(Exception e) - { - Console.WriteLine("Exception caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - } -} -// -// diff --git a/snippets/csharp/System.Net/Dns/GetHostByAddress/Project.csproj b/snippets/csharp/System.Net/Dns/GetHostByAddress/Project.csproj deleted file mode 100644 index c02dc5044e7..00000000000 --- a/snippets/csharp/System.Net/Dns/GetHostByAddress/Project.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Library - net6.0 - - - \ No newline at end of file diff --git a/snippets/csharp/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.cs b/snippets/csharp/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.cs deleted file mode 100644 index 0f4a6ee9027..00000000000 --- a/snippets/csharp/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - This program demonstrates 'GetHostByAddress(IPAddress)' method of 'Dns' class. - It takes an IP address string from commandline or uses default value and creates - an instance of IPAddress for the specified IP address string. Obtains the IPHostEntry - object by calling 'GetHostByAddress' method of 'Dns' class and prints host name, - IP address list and aliases. -*/ - -using System; -using System.Net; -using System.Net.Sockets; - -class DnsHostByAddress -{ - public static void Main() - { - String IpAddressString = ""; - DnsHostByAddress myDnsHostByAddress = new DnsHostByAddress(); - Console.Write("Type an IP address (press Enter for default, default is '207.46.131.199'): "); - IpAddressString = Console.ReadLine(); - if(IpAddressString.Length > 0) - myDnsHostByAddress.DisplayHostAddress(IpAddressString); - else - myDnsHostByAddress.DisplayHostAddress("207.46.131.199"); - } - public void DisplayHostAddress(String IpAddressString) - { - // Call 'GetHostByAddress(IPAddress)' method giving an 'IPAddress' object as argument. - // Obtain an 'IPHostEntry' instance, containing address information of the specified host. -// - try - { - IPAddress hostIPAddress = IPAddress.Parse(IpAddressString); - IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress); - // Get the IP address list that resolves to the host names contained in - // the Alias property. - IPAddress[] address = hostInfo.AddressList; - // Get the alias names of the addresses in the IP address list. - String[] alias = hostInfo.Aliases; - - Console.WriteLine("Host name : " + hostInfo.HostName); - Console.WriteLine("\nAliases :"); - for(int index=0; index < alias.Length; index++) { - Console.WriteLine(alias[index]); - } - Console.WriteLine("\nIP address list : "); - for(int index=0; index < address.Length; index++) { - Console.WriteLine(address[index]); - } - } - catch(SocketException e) - { - Console.WriteLine("SocketException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(FormatException e) - { - Console.WriteLine("FormatException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(ArgumentNullException e) - { - Console.WriteLine("ArgumentNullException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(Exception e) - { - Console.WriteLine("Exception caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } -// - } -} \ No newline at end of file diff --git a/snippets/csharp/System.Net/Dns/GetHostByName/Project.csproj b/snippets/csharp/System.Net/Dns/GetHostByName/Project.csproj deleted file mode 100644 index c02dc5044e7..00000000000 --- a/snippets/csharp/System.Net/Dns/GetHostByName/Project.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Library - net6.0 - - - \ No newline at end of file diff --git a/snippets/csharp/System.Net/Dns/GetHostByName/dns_gethostbyname.cs b/snippets/csharp/System.Net/Dns/GetHostByName/dns_gethostbyname.cs deleted file mode 100644 index d9ec8c3f493..00000000000 --- a/snippets/csharp/System.Net/Dns/GetHostByName/dns_gethostbyname.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* - This program demonstrates 'GetHostByName' method of 'Dns' class. - It takes a URL string from commandline or uses default value, and obtains - the 'IPHostEntry' object by calling 'GetHostByName' method of 'Dns' class.Then - prints host name,IP address list and aliases. -*/ - -using System; -using System.Net; -using System.Net.Sockets; - -class DnsHostByName -{ - public static void Main() - - { - String hostName = ""; - DnsHostByName myDnsHostByName = new DnsHostByName(); - Console.Write("Type a URL (press Enter for default, default is 'www.microsoft.net') : "); - hostName = Console.ReadLine(); - if(hostName.Length > 0) - myDnsHostByName.DisplayHostName(hostName); - else - myDnsHostByName.DisplayHostName("www.microsoft.net"); - } - - public void DisplayHostName(String hostName) - { - // Call the GetHostByName method passing a DNS style host name(for example, - // "www.contoso.com") as an argument. - // Obtain the IPHostEntry instance, that contains information of the specified host. -// - try - { - IPHostEntry hostInfo = Dns.GetHostByName(hostName); - // Get the IP address list that resolves to the host names contained in the - // Alias property. - IPAddress[] address = hostInfo.AddressList; - // Get the alias names of the addresses in the IP address list. - String[] alias = hostInfo.Aliases; - - Console.WriteLine("Host name : " + hostInfo.HostName); - Console.WriteLine("\nAliases : "); - for(int index=0; index < alias.Length; index++) { - Console.WriteLine(alias[index]); - } - Console.WriteLine("\nIP address list : "); - for(int index=0; index < address.Length; index++) { - Console.WriteLine(address[index]); - } - } - catch(SocketException e) - { - Console.WriteLine("SocketException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(ArgumentNullException e) - { - Console.WriteLine("ArgumentNullException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(Exception e) - { - Console.WriteLine("Exception caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } -// - } -} \ No newline at end of file diff --git a/snippets/csharp/System.Net/Dns/Resolve/Project.csproj b/snippets/csharp/System.Net/Dns/Resolve/Project.csproj deleted file mode 100644 index c02dc5044e7..00000000000 --- a/snippets/csharp/System.Net/Dns/Resolve/Project.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Library - net6.0 - - - \ No newline at end of file diff --git a/snippets/csharp/System.Net/Dns/Resolve/dns_resolve.cs b/snippets/csharp/System.Net/Dns/Resolve/dns_resolve.cs deleted file mode 100644 index b9409312729..00000000000 --- a/snippets/csharp/System.Net/Dns/Resolve/dns_resolve.cs +++ /dev/null @@ -1,75 +0,0 @@ -/* - This program demonstrates 'Resolve' method of 'Dns' class. - It takes a URL or IP address string from commandline or uses default value and obtains the 'IPHostEntry' - object by calling 'Resolve' method of 'Dns' class. Then prints host name, IP address list and aliases. -*/ - -using System; -using System.Net; -using System.Net.Sockets; - -class DnsResolve -{ - public static void Main() - { - String hostString = ""; - DnsResolve myDnsResolve = new DnsResolve(); - Console.Write("Type a URL or IP address (press Enter for default, default is '207.46.131.199') : "); - hostString = Console.ReadLine(); - if(hostString.Length > 0) - myDnsResolve.DisplayHostAddress(hostString); - else - myDnsResolve.DisplayHostAddress("207.46.131.199"); - } - - public void DisplayHostAddress(String hostString) - { - // Call the Resolve method passing a DNS style host name or an IP address in dotted-quad notation - // (for example, "www.contoso.com" or "207.46.131.199") to obtain an IPHostEntry instance that contains - // address information for the specified host. -// - try { - IPHostEntry hostInfo = Dns.Resolve(hostString); - // Get the IP address list that resolves to the host names contained in the - // Alias property. - IPAddress[] address = hostInfo.AddressList; - // Get the alias names of the addresses in the IP address list. - String[] alias = hostInfo.Aliases; - - Console.WriteLine("Host name : " + hostInfo.HostName); - Console.WriteLine("\nAliases : "); - for(int index=0; index < alias.Length; index++) { - Console.WriteLine(alias[index]); - } - Console.WriteLine("\nIP Address list :"); - for(int index=0; index < address.Length; index++) { - Console.WriteLine(address[index]); - } - } - catch(SocketException e) - { - Console.WriteLine("SocketException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(ArgumentNullException e) - { - Console.WriteLine("ArgumentNullException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(NullReferenceException e) - { - Console.WriteLine("NullReferenceException caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } - catch(Exception e) - { - Console.WriteLine("Exception caught!!!"); - Console.WriteLine("Source : " + e.Source); - Console.WriteLine("Message : " + e.Message); - } -// - } -} \ No newline at end of file diff --git a/snippets/csharp/System.Net/ServicePointManager/CertificatePolicy/source.cs b/snippets/csharp/System.Net/ServicePointManager/CertificatePolicy/source.cs deleted file mode 100644 index 6a01619cbcb..00000000000 --- a/snippets/csharp/System.Net/ServicePointManager/CertificatePolicy/source.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Net; -using System.IO; -using System.Windows.Forms; -using System.Web; -using System.Web.Services; - -public class Form1: Form -{ - public void Method(Uri myUri) - { -// - ServicePointManager.CertificatePolicy = new MyCertificatePolicy(); - - // Create the request and receive the response - try - { - WebRequest myRequest = WebRequest.Create(myUri); - WebResponse myResponse = myRequest.GetResponse(); - ProcessResponse(myResponse); - myResponse.Close(); - } - // Catch any exceptions - catch (WebException e) - { - if (e.Status == WebExceptionStatus.TrustFailure) - { - // Code for handling security certificate problems goes here. - } - // Other exception handling goes here - } -// - } - - // Method added so sample will compile - public void ProcessResponse(WebResponse resp) - {} -} - -// Class added so sample will compile -public class MyCertificatePolicy : ICertificatePolicy -{ - public bool CheckValidationResult(System.Net.ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Net.WebRequest request, int certificateProblem) - { - return true; - } -} diff --git a/snippets/csharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.cs b/snippets/csharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.cs deleted file mode 100644 index 9ec7088f591..00000000000 --- a/snippets/csharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -using System; -using System.Reflection; -using System.Security.Policy; - -class ADAppendPrivatePath -{ - public static void Main() - { - //Create evidence for new appdomain. - Evidence adevidence = AppDomain.CurrentDomain.Evidence; - - //Create the new application domain. - AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence); - - //Display the current relative search path. - Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath); - - //Append the relative path. - String Newpath = "www.code.microsoft.com"; - domain.AppendPrivatePath(Newpath); - - //Display the new relative search path. - Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath); - - //Clear the private search path. - domain.ClearPrivatePath(); - - //Display the new relative search path. - Console.WriteLine("Relative search path is now: " + domain.RelativeSearchPath); - - AppDomain.Unload(domain); - } -} -// diff --git a/snippets/csharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.cs b/snippets/csharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.cs deleted file mode 100644 index 0740358aca2..00000000000 --- a/snippets/csharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -using System; -using System.Threading; -using System.Security; -using System.Security.Policy; -using System.Security.Permissions; - -namespace AppDomainSnippets -{ - class ADSetAppDomainPolicy - { - static void Main(string[] args) - { - // Create a new application domain. - AppDomain domain = System.AppDomain.CreateDomain("MyDomain"); - - // Create a new AppDomain PolicyLevel. - PolicyLevel polLevel = PolicyLevel.CreateAppDomainLevel(); - // Create a new, empty permission set. - PermissionSet permSet = new PermissionSet(PermissionState.None); - // Add permission to execute code to the permission set. - permSet.AddPermission - (new SecurityPermission(SecurityPermissionFlag.Execution)); - // Give the policy level's root code group a new policy statement based - // on the new permission set. - polLevel.RootCodeGroup.PolicyStatement = new PolicyStatement(permSet); - // Give the new policy level to the application domain. - domain.SetAppDomainPolicy(polLevel); - - // Try to execute the assembly. - try - { - // This will throw a PolicyException if the executable tries to - // access any resources like file I/O or tries to create a window. - domain.ExecuteAssembly("Assemblies\\MyWindowsExe.exe"); - } - catch(PolicyException e) - { - Console.WriteLine("PolicyException: {0}", e.Message); - } - - AppDomain.Unload(domain); - } - } -} -// \ No newline at end of file diff --git a/snippets/csharp/System/AppDomain/SetShadowCopyFiles/adproperties.cs b/snippets/csharp/System/AppDomain/SetShadowCopyFiles/adproperties.cs deleted file mode 100644 index 587f9302d9e..00000000000 --- a/snippets/csharp/System/AppDomain/SetShadowCopyFiles/adproperties.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -using System; -using System.Security.Policy; -namespace AppDomainSnippets -{ - class ADProperties - { - static void Main(string[] args) - { - - AppDomainSetup setup = new AppDomainSetup(); - // Shadow copying will not work unless the application has a name. - setup.ApplicationName = "MyApplication"; - - //Create evidence for the new application domain from evidence of - // current application domain. - Evidence adevidence = AppDomain.CurrentDomain.Evidence; - - // Create a new application domain. - AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, setup); - - // MyAssembly.dll is located in the Assemblies subdirectory. - domain.AppendPrivatePath("Assemblies"); - // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - // MoreAssemblies subdirectory. - domain.AppendPrivatePath("MoreAssemblies"); - // Display the relative search path. - Console.WriteLine("RelativeSearchPath: " + domain.RelativeSearchPath); - // Because Load returns an Assembly object, the assemblies must be - // loaded into the current domain as well. This will fail unless the - // current domain also has these directories in its search path. - AppDomain.CurrentDomain.AppendPrivatePath("Assemblies"); - AppDomain.CurrentDomain.AppendPrivatePath("MoreAssemblies"); - - // Save shadow copies to C:\Cache - domain.SetCachePath("C:\\Cache"); - // Shadow copy only the assemblies in the Assemblies directory. - domain.SetShadowCopyPath(domain.BaseDirectory + "Assemblies"); - // Turn shadow copying on. - domain.SetShadowCopyFiles(); - Console.WriteLine("ShadowCopyFiles turned on: " + domain.ShadowCopyFiles); - - // This will be copied. - // You must supply a valid fully qualified assembly name here. - domain.Load("Assembly1 text name, Version, Culture, PublicKeyToken"); - // This will not be copied. - // You must supply a valid fully qualified assembly name here. - domain.Load("Assembly2 text name, Version, Culture, PublicKeyToken"); - - // When the shadow copy path is cleared, the CLR will make shadow copies - // of all private assemblies. - domain.ClearShadowCopyPath(); - // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - // You must supply a valid fully qualified assembly name here. - domain.Load("Assembly3 text name, Version, Culture, PublicKeyToken"); - - // Unload the domain. - AppDomain.Unload(domain); - } - } -} -// \ No newline at end of file diff --git a/snippets/csharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.cs b/snippets/csharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.cs deleted file mode 100644 index a701215ac44..00000000000 --- a/snippets/csharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -using System; -using System.Security.Policy; -namespace AppDomainSnippets -{ - class ADShadowCopy - { - static void Main(string[] args) - { - - AppDomainSetup setup = new AppDomainSetup(); - // Shadow copying will not work unless the application has a name. - setup.ApplicationName = "MyApplication"; - - //Create evidence for the new application domain from evidence of - // current application domain. - Evidence adevidence = AppDomain.CurrentDomain.Evidence; - - // Create a new application domain. - AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, setup); - - // MyAssembly.dll is located in the Assemblies subdirectory. - domain.AppendPrivatePath("Assemblies"); - // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - // MoreAssemblies subdirectory. - domain.AppendPrivatePath("MoreAssemblies"); - // Display the relative search path. - Console.WriteLine("RelativeSearchPath: " + domain.RelativeSearchPath); - // Because Load returns an Assembly object, the assemblies must be - // loaded into the current domain as well. This will fail unless the - // current domain also has these directories in its search path. - AppDomain.CurrentDomain.AppendPrivatePath("Assemblies"); - AppDomain.CurrentDomain.AppendPrivatePath("MoreAssemblies"); - - // Save shadow copies to C:\Cache - domain.SetCachePath("C:\\Cache"); - // Shadow copy only the assemblies in the Assemblies directory. - domain.SetShadowCopyPath(domain.BaseDirectory + "Assemblies"); - // Turn shadow copying on. - domain.SetShadowCopyFiles(); - - // This will be copied. - // You must supply a valid fully qualified assembly name here. - domain.Load("Assembly1 text name, Version, Culture, PublicKeyToken"); - // This will not be copied. - // You must supply a valid fully qualified assembly name here. - domain.Load("Assembly2 text name, Version, Culture, PublicKeyToken"); - - // When the shadow copy path is cleared, the CLR will make shadow copies - // of all private assemblies. - domain.ClearShadowCopyPath(); - // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - // You must supply a valid fully qualified assembly name here. - domain.Load("Assembly3 text name, Version, Culture, PublicKeyToken"); - - // Unload the domain. - AppDomain.Unload(domain); - } - } -} -// \ No newline at end of file diff --git a/snippets/csharp/System/Uri/.ctor/source1.cs b/snippets/csharp/System/Uri/.ctor/source1.cs deleted file mode 100644 index eedb6bf21c2..00000000000 --- a/snippets/csharp/System/Uri/.ctor/source1.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Data; -using System.Security.Principal; -using System.Windows.Forms; - -public class Form1: Form -{ - protected void Method() - { -// -Uri myUri = new Uri("http://www.contoso.com/Hello%20World.htm", true); - -// - } -} diff --git a/snippets/csharp/System/Uri/.ctor/source3.cs b/snippets/csharp/System/Uri/.ctor/source3.cs deleted file mode 100644 index 70469a35491..00000000000 --- a/snippets/csharp/System/Uri/.ctor/source3.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -public class Test -{ - public static void Main() - { -// - Uri baseUri = new Uri("http://www.contoso.com"); - Uri myUri = new Uri(baseUri, "Hello%20World.htm",false); - -// - } -} diff --git a/snippets/fsharp/System.Diagnostics/Process/WorkingSet/fs.fsproj b/snippets/fsharp/System.Diagnostics/Process/WorkingSet/fs.fsproj deleted file mode 100644 index 5382e3af1c6..00000000000 --- a/snippets/fsharp/System.Diagnostics/Process/WorkingSet/fs.fsproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - net8.0 - - - - - - \ No newline at end of file diff --git a/snippets/fsharp/System.Diagnostics/Process/WorkingSet/process_sample.fs b/snippets/fsharp/System.Diagnostics/Process/WorkingSet/process_sample.fs deleted file mode 100644 index 9a0241c4ee4..00000000000 --- a/snippets/fsharp/System.Diagnostics/Process/WorkingSet/process_sample.fs +++ /dev/null @@ -1,46 +0,0 @@ -// System.Diagnostics.Process.WorkingSet -// System.Diagnostics.Process.BasePriority -// System.Diagnostics.Process.UserProcessorTime -// System.Diagnostics.Process.PrivilegedProcessorTime -// System.Diagnostics.Process.TotalProcessorTime -// System.Diagnostics.Process.ToString -// System.Diagnostics.Process.Responding -// System.Diagnostics.Process.PriorityClass -// System.Diagnostics.Process.ExitCode - -// The following example starts an instance of Notepad. The example -// then retrieves and displays various properties of the associated -// process. The example detects when the process exits, and displays the process's exit code. - -// -open System.Diagnostics -open System.Threading - -try - use myProcess = Process.Start "NotePad.exe" - - while not myProcess.HasExited do - printfn "" - - printfn $"Physical memory usage : {myProcess.WorkingSet64}" - printfn $"Base priority : {myProcess.BasePriority}" - printfn $"Priority class : {myProcess.PriorityClass}" - printfn $"User processor time : {myProcess.UserProcessorTime}" - printfn $"Privileged processor time : {myProcess.PrivilegedProcessorTime}" - printfn $"Total processor time : {myProcess.TotalProcessorTime}" - printfn $"Process's Name : {myProcess}" - printfn "-------------------------------------" - - if myProcess.Responding then - printfn "Status: Responding to user interface" - myProcess.Refresh() - else - printfn "Status: Not Responding" - - Thread.Sleep 1000 - - printfn "" - printfn $"Process exit code: {myProcess.ExitCode}" -with e -> - printfn $"The following exception was raised: {e.Message}" -// diff --git a/snippets/fsharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.fs b/snippets/fsharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.fs deleted file mode 100644 index d78b8fd27e3..00000000000 --- a/snippets/fsharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.fs +++ /dev/null @@ -1,27 +0,0 @@ -// -open System - -//Create evidence for new appdomain. -let adevidence = AppDomain.CurrentDomain.Evidence - -//Create the new application domain. -let domain = AppDomain.CreateDomain("MyDomain", adevidence) - -//Display the current relative search path. -printfn $"Relative search path is: {domain.RelativeSearchPath}" - -//Append the relative path. -let Newpath = "www.code.microsoft.com" -domain.AppendPrivatePath Newpath - -//Display the new relative search path. -printfn $"Relative search path is: {domain.RelativeSearchPath}" - -//Clear the private search path. -domain.ClearPrivatePath() - -//Display the new relative search path. -printfn $"Relative search path is now: {domain.RelativeSearchPath}" - -AppDomain.Unload domain -// \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/ClearPrivatePath/fs.fsproj b/snippets/fsharp/System/AppDomain/ClearPrivatePath/fs.fsproj deleted file mode 100644 index 79b3de7856f..00000000000 --- a/snippets/fsharp/System/AppDomain/ClearPrivatePath/fs.fsproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - net48 - - - - - - \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/DynamicDirectory/fs.fsproj b/snippets/fsharp/System/AppDomain/DynamicDirectory/fs.fsproj deleted file mode 100644 index fe75df72fdf..00000000000 --- a/snippets/fsharp/System/AppDomain/DynamicDirectory/fs.fsproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - net48 - - - - - - \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/ExecuteAssembly/fs.fsproj b/snippets/fsharp/System/AppDomain/ExecuteAssembly/fs.fsproj deleted file mode 100644 index 14662c657ea..00000000000 --- a/snippets/fsharp/System/AppDomain/ExecuteAssembly/fs.fsproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - net6.0 - - - - - - \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.fs b/snippets/fsharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.fs deleted file mode 100644 index 7cb9b02ae51..00000000000 --- a/snippets/fsharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.fs +++ /dev/null @@ -1,32 +0,0 @@ -// -open System -open System.Security -open System.Security.Policy -open System.Security.Permissions - -// Create a new application domain. -let domain = AppDomain.CreateDomain "MyDomain" - -// Create a new AppDomain PolicyLevel. -let polLevel = PolicyLevel.CreateAppDomainLevel() -// Create a new, empty permission set. -let permSet = PermissionSet PermissionState.None -// Add permission to execute code to the permission set. -permSet.AddPermission(SecurityPermission SecurityPermissionFlag.Execution) |> ignore -// Give the policy level's root code group a new policy statement based -// on the new permission set. -polLevel.RootCodeGroup.PolicyStatement <- PolicyStatement permSet -// Give the new policy level to the application domain. -domain.SetAppDomainPolicy polLevel - -// Try to execute the assembly. -try - // This will throw a PolicyException if the executable tries to - // access any resources like file I/O or tries to create a window. - domain.ExecuteAssembly "Assemblies\\MyWindowsExe.exe" - |> ignore -with :? PolicyException as e -> - printfn $"PolicyException: {e.Message}" - -AppDomain.Unload domain -// \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/SetAppDomainPolicy/fs.fsproj b/snippets/fsharp/System/AppDomain/SetAppDomainPolicy/fs.fsproj deleted file mode 100644 index be4144a975d..00000000000 --- a/snippets/fsharp/System/AppDomain/SetAppDomainPolicy/fs.fsproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - net48 - - - - - - \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/SetShadowCopyFiles/adproperties.fs b/snippets/fsharp/System/AppDomain/SetShadowCopyFiles/adproperties.fs deleted file mode 100644 index ad81562cb3c..00000000000 --- a/snippets/fsharp/System/AppDomain/SetShadowCopyFiles/adproperties.fs +++ /dev/null @@ -1,52 +0,0 @@ -// -open System - -let setup = AppDomainSetup() -// Shadow copying will not work unless the application has a name. -setup.ApplicationName = "MyApplication" - -//Create evidence for the new application domain from evidence of -// current application domain. -let adevidence = AppDomain.CurrentDomain.Evidence - -// Create a new application domain. -let domain = AppDomain.CreateDomain("MyDomain", adevidence, setup) - -// MyAssembly.dll is located in the Assemblies subdirectory. -domain.AppendPrivatePath "Assemblies" -// MyOtherAssembly.dll and MyThirdAssembly.dll are located in the -// MoreAssemblies subdirectory. -domain.AppendPrivatePath "MoreAssemblies" -// Display the relative search path. -printfn $"RelativeSearchPath: {domain.RelativeSearchPath}" -// Because Load returns an Assembly object, the assemblies must be -// loaded into the current domain as well. This will fail unless the -// current domain also has these directories in its search path. -AppDomain.CurrentDomain.AppendPrivatePath "Assemblies" -AppDomain.CurrentDomain.AppendPrivatePath "MoreAssemblies" - -// Save shadow copies to C:\Cache -domain.SetCachePath "C:\\Cache" -// Shadow copy only the assemblies in the Assemblies directory. -domain.SetShadowCopyPath(domain.BaseDirectory + "Assemblies") -// Turn shadow copying on. -domain.SetShadowCopyFiles() -printfn $"ShadowCopyFiles turned on: {domain.ShadowCopyFiles}" - -// This will be copied. -// You must supply a valid fully qualified assembly name here. -domain.Load "Assembly1 text name, Version, Culture, PublicKeyToken" |> ignore -// This will not be copied. -// You must supply a valid fully qualified assembly name here. -domain.Load "Assembly2 text name, Version, Culture, PublicKeyToken" |> ignore - -// When the shadow copy path is cleared, the CLR will make shadow copies -// of all private assemblies. -domain.ClearShadowCopyPath() -// MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. -// You must supply a valid fully qualified assembly name here. -domain.Load "Assembly3 text name, Version, Culture, PublicKeyToken" |> ignore - -// Unload the domain. -AppDomain.Unload domain -// \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/SetShadowCopyFiles/fs.fsproj b/snippets/fsharp/System/AppDomain/SetShadowCopyFiles/fs.fsproj deleted file mode 100644 index b7c1617d0d9..00000000000 --- a/snippets/fsharp/System/AppDomain/SetShadowCopyFiles/fs.fsproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - net48 - - - - - - \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.fs b/snippets/fsharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.fs deleted file mode 100644 index 5f5fecc2e0e..00000000000 --- a/snippets/fsharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.fs +++ /dev/null @@ -1,51 +0,0 @@ -// -open System - -let setup = AppDomainSetup() -// Shadow copying will not work unless the application has a name. -setup.ApplicationName <- "MyApplication" - -//Create evidence for the new application domain from evidence of -// current application domain. -let adevidence = AppDomain.CurrentDomain.Evidence - -// Create a new application domain. -let domain = AppDomain.CreateDomain("MyDomain", adevidence, setup) - -// MyAssembly.dll is located in the Assemblies subdirectory. -domain.AppendPrivatePath "Assemblies" -// MyOtherAssembly.dll and MyThirdAssembly.dll are located in the -// MoreAssemblies subdirectory. -domain.AppendPrivatePath "MoreAssemblies" -// Display the relative search path. -printfn $"RelativeSearchPath: {domain.RelativeSearchPath}" -// Because Load returns an Assembly object, the assemblies must be -// loaded into the current domain as well. This will fail unless the -// current domain also has these directories in its search path. -AppDomain.CurrentDomain.AppendPrivatePath "Assemblies" -AppDomain.CurrentDomain.AppendPrivatePath "MoreAssemblies" - -// Save shadow copies to C:\Cache -domain.SetCachePath "C:\\Cache" -// Shadow copy only the assemblies in the Assemblies directory. -domain.SetShadowCopyPath(domain.BaseDirectory + "Assemblies") -// Turn shadow copying on. -domain.SetShadowCopyFiles() - -// This will be copied. -// You must supply a valid fully qualified assembly name here. -domain.Load "Assembly1 text name, Version, Culture, PublicKeyToken" |> ignore -// This will not be copied. -// You must supply a valid fully qualified assembly name here. -domain.Load "Assembly2 text name, Version, Culture, PublicKeyToken" |> ignore - -// When the shadow copy path is cleared, the CLR will make shadow copies -// of all private assemblies. -domain.ClearShadowCopyPath() -// MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. -// You must supply a valid fully qualified assembly name here. -domain.Load "Assembly3 text name, Version, Culture, PublicKeyToken" |> ignore - -// Unload the domain. -AppDomain.Unload domain -// \ No newline at end of file diff --git a/snippets/fsharp/System/AppDomain/SetShadowCopyPath/fs.fsproj b/snippets/fsharp/System/AppDomain/SetShadowCopyPath/fs.fsproj deleted file mode 100644 index bffd01edfce..00000000000 --- a/snippets/fsharp/System/AppDomain/SetShadowCopyPath/fs.fsproj +++ /dev/null @@ -1,10 +0,0 @@ - - - Exe - net48 - - - - - - \ No newline at end of file diff --git a/snippets/fsharp/System/Uri/.ctor/source1.fs b/snippets/fsharp/System/Uri/.ctor/source1.fs deleted file mode 100644 index 5d0e0806417..00000000000 --- a/snippets/fsharp/System/Uri/.ctor/source1.fs +++ /dev/null @@ -1,7 +0,0 @@ -module source1 - -open System - -// -let myUri = Uri("http://www.contoso.com/Hello%20World.htm", true) -// \ No newline at end of file diff --git a/snippets/fsharp/System/Uri/.ctor/source3.fs b/snippets/fsharp/System/Uri/.ctor/source3.fs deleted file mode 100644 index a0f0cf66cff..00000000000 --- a/snippets/fsharp/System/Uri/.ctor/source3.fs +++ /dev/null @@ -1,8 +0,0 @@ -module source3 - -open System - -// -let baseUri = Uri "http://www.contoso.com" -let myUri = Uri(baseUri, "Hello%20World.htm", false) -// \ No newline at end of file diff --git a/snippets/visualbasic/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.vb b/snippets/visualbasic/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.vb deleted file mode 100644 index b2c3ce807eb..00000000000 --- a/snippets/visualbasic/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.vb +++ /dev/null @@ -1,43 +0,0 @@ -' -Imports System.Diagnostics - -Module PerfCounterCatCreateMod - - ' - Sub Main(ByVal args() As String) - Dim categoryName As String = "" - Dim counterName As String = "" - Dim categoryHelp As String = "" - Dim counterHelp As String = "" - Dim pcc As PerformanceCounterCategory - - ' Copy the supplied arguments into the local variables. - Try - categoryName = args(0) - counterName = args(1) - categoryHelp = args(2) - counterHelp = args(3) - Catch ex As Exception - ' Ignore the exception from non-supplied arguments. - End Try - - Console.WriteLine("Category name: ""{0}""", categoryName) - Console.WriteLine("Category help: ""{0}""", categoryHelp) - Console.WriteLine("Counter name: ""{0}""", counterName) - Console.WriteLine("Counter help: ""{0}""", counterHelp) - - ' Use the Create overload that creates a single counter. - Try - pcc = PerformanceCounterCategory.Create( _ - categoryName, categoryHelp, counterName, counterHelp) - Console.WriteLine("Category ""{0}"" created.", pcc.CategoryName) - - Catch ex As Exception - Console.WriteLine( _ - "Unable to create the above category and counter:" & _ - vbCrLf & ex.Message) - End Try - End Sub - ' -End Module -' diff --git a/snippets/visualbasic/System.Diagnostics/Process/WorkingSet/process_sample.vb b/snippets/visualbasic/System.Diagnostics/Process/WorkingSet/process_sample.vb deleted file mode 100644 index 91cde698284..00000000000 --- a/snippets/visualbasic/System.Diagnostics/Process/WorkingSet/process_sample.vb +++ /dev/null @@ -1,60 +0,0 @@ -' System.Diagnostics.Process.WorkingSet -' System.Diagnostics.Process.BasePriority -' System.Diagnostics.Process.UserProcessorTime -' System.Diagnostics.Process.PrivilegedProcessorTime -' System.Diagnostics.Process.TotalProcessorTime -' System.Diagnostics.Process.ToString -' System.Diagnostics.Process.Responding -' System.Diagnostics.Process.PriorityClass -' System.Diagnostics.Process.ExitCode - -' The following example starts an instance of Notepad. The example -' then retrieves and displays various properties of the associated -' process. The example detects when the process exits, and displays the process's exit code. - -' -Imports System.Diagnostics -Imports System.Threading - -Namespace Process_Sample - Class MyProcessClass - - Public Shared Sub Main() - Try - - Using myProcess = Process.Start("NotePad.exe") - - While Not myProcess.HasExited - - Console.WriteLine() - - Console.WriteLine($"Process's physical memory usage : {myProcess.WorkingSet}") - Console.WriteLine($"Base priority of the associated process : {myProcess.BasePriority}") - Console.WriteLine($"Priority class of the associated process : {myProcess.PriorityClass}") - Console.WriteLine($"User processor time : {myProcess.UserProcessorTime}") - Console.WriteLine($"Privileged processor time : {myProcess.PrivilegedProcessorTime}") - Console.WriteLine($"Total processor time : {myProcess.TotalProcessorTime}") - Console.WriteLine($"Process's name : {myProcess}") - Console.WriteLine("-------------------------------------") - - If myProcess.Responding Then - Console.WriteLine("Status: Responding to user interface") - myProcess.Refresh() - Else - Console.WriteLine("Status: Not Responding") - End If - Thread.Sleep(1000) - End While - - Console.WriteLine() - Console.WriteLine($"Process exit code: {myProcess.ExitCode}") - End Using - - Catch e As Exception - Console.WriteLine($"The following exception was raised: {e.Message}") - End Try - End Sub - End Class -End Namespace 'Process_Sample - -' diff --git a/snippets/visualbasic/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.vb b/snippets/visualbasic/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.vb index e3ba4b05bc8..9d88db5103a 100644 --- a/snippets/visualbasic/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.vb +++ b/snippets/visualbasic/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.vb @@ -1,4 +1,4 @@ -' +' 'This sample demonstrates methods of classes found in the System.IO IsolatedStorage namespace. Imports System.IO Imports System.IO.IsolatedStorage @@ -94,7 +94,6 @@ Namespace ISOCS End Get End Property - ' Private Function GetPrefsForUser() As Boolean Try ' @@ -133,8 +132,7 @@ Namespace ISOCS End Try End Function 'GetPrefsForUser - ' - ' + ' Public Function GetIsoStoreInfo() As Boolean Try 'Get a User store with type evidence for the current Domain and the Assembly. @@ -175,7 +173,7 @@ Namespace ISOCS ' Public Function SetPrefsForUser() As Double Try - ' + ' Dim isoFile As IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForDomain() @@ -205,9 +203,9 @@ Namespace ISOCS ' - ' + ' Public Sub DeleteFiles() - ' + ' Try Dim isoFile As IsolatedStorageFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User Or _ IsolatedStorageScope.Assembly Or IsolatedStorageScope.Domain, _ @@ -233,9 +231,9 @@ Namespace ISOCS End Sub ' - ' - ' This method deletes directories in the specified Isolated Storage, after first - ' deleting the files they contain. In this example, the Archive directory is deleted. + ' + ' This method deletes directories in the specified Isolated Storage, after first + ' deleting the files they contain. In this example, the Archive directory is deleted. ' There should be no other directories in this Isolated Storage. Public Sub DeleteDirectories() Try @@ -267,7 +265,7 @@ Namespace ISOCS End Sub ' - ' + ' Public Function SetNewPrefsForUser() As Double Try Dim inputChar As Byte @@ -275,7 +273,7 @@ Namespace ISOCS IsolatedStorageScope.Assembly Or IsolatedStorageScope.Domain, _ GetType(System.Security.Policy.Url), GetType(System.Security.Policy.Url)) - ' If this is not a new user, archive the old preferences and + ' If this is not a new user, archive the old preferences and ' overwrite them using the new preferences. If Not Me.myNewPrefs Then If isoFile.GetDirectoryNames("Archive").Length = 0 Then @@ -320,7 +318,7 @@ Namespace ISOCS ' End If - ' After you have read and written to the streams, close them. + ' After you have read and written to the streams, close them. target.Close() source.Close() End If @@ -332,7 +330,7 @@ Namespace ISOCS ' isoStream.SetLength(0) 'Position to overwrite the old data. ' - ' + Dim writer As New StreamWriter(isoStream) ' Update the data based on the new inputs. writer.WriteLine(Me.NewsUrl) @@ -342,7 +340,7 @@ Namespace ISOCS Dim d As Double = Convert.ToDouble(isoFile.CurrentSize) / Convert.ToDouble(isoFile.MaximumSize) Console.WriteLine(("CurrentSize = " & isoFile.CurrentSize.ToString())) Console.WriteLine(("MaximumSize = " & isoFile.MaximumSize.ToString())) - ' + ' StreamWriter.Close implicitly closes isoStream. writer.Close() isoFile.Close() @@ -355,4 +353,4 @@ Namespace ISOCS End Function 'SetNewPrefsForUser End Class End Namespace 'ISOCS -' \ No newline at end of file +' diff --git a/snippets/visualbasic/System.Net/Dns/BeginResolve/dns_begin_endresolve.vb b/snippets/visualbasic/System.Net/Dns/BeginResolve/dns_begin_endresolve.vb deleted file mode 100644 index 4e71447fd71..00000000000 --- a/snippets/visualbasic/System.Net/Dns/BeginResolve/dns_begin_endresolve.vb +++ /dev/null @@ -1,75 +0,0 @@ - ' -' This program demonstrates 'BeginResolve' and 'EndResolve' methods of Dns class. -' It obtains the 'IPHostEntry' object by calling 'BeginResolve' and 'EndResolve' method -' of 'Dns' class by passing a URL, a callback function and an instance of 'RequestState' -' class.Then prints host name, IP address list and aliases. -' - -Imports System.Net - -' -' -Class DnsBeginGetHostByName - - Class RequestState - Public host As IPHostEntry - - Public Sub New() - host = Nothing - End Sub - End Class - - - Public Shared Sub Main() - Try - ' Create an instance of the RequestState class. - Dim myRequestState As New RequestState() - - ' Begin an asynchronous request for information such as the host name, IP addresses, - ' or aliases for the specified URI. - Dim asyncResult As IAsyncResult = CType(Dns.BeginResolve("www.contoso.com", AddressOf RespCallback, myRequestState),IAsyncResult) - - ' Wait until asynchronous call completes. - While asyncResult.IsCompleted <> True - End While - - Console.WriteLine(("Host name : " + myRequestState.host.HostName)) - Console.WriteLine(ControlChars.Cr + "IP address list : ") - Dim index As Integer - For index = 0 To myRequestState.host.AddressList.Length - 1 - Console.WriteLine(myRequestState.host.AddressList(index)) - Next index - Console.WriteLine(ControlChars.Cr + "Aliases : ") - - For index = 0 To myRequestState.host.Aliases.Length - 1 - Console.WriteLine(myRequestState.host.Aliases(index)) - Next index - catch e as Exception - Console.WriteLine("Exception caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - End Try - End Sub - - - Private Shared Sub RespCallback(ar As IAsyncResult) - Try - ' Convert the IAsyncResult object to a RequestState object. - Dim tempRequestState As RequestState = CType(ar.AsyncState, RequestState) - - ' End the asynchronous request. - tempRequestState.host = Dns.EndResolve(ar) - Catch e As ArgumentNullException - Console.WriteLine("ArgumentNullException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - Catch e As Exception - Console.WriteLine("Exception caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - End Try - End Sub -' -' - -End Class diff --git a/snippets/visualbasic/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.vb b/snippets/visualbasic/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.vb deleted file mode 100644 index 3fbf2b6b727..00000000000 --- a/snippets/visualbasic/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.vb +++ /dev/null @@ -1,74 +0,0 @@ - ' -' This program demonstrates 'GetHostByAddress(IPAddress)' method of 'Dns' class. -' It takes an IP address string from commandline or uses default value and creates -' an instance of IPAddress for the specified IP address string. Obtains the IPHostEntry -' object by calling 'GetHostByAddress' method of 'Dns' class and prints host name, -' IP address list and aliases. -' - -Imports System.Net -Imports System.Net.Sockets - -Class DnsHostByAddress - - Public Shared Sub Main() - Dim IpAddressString As [String] = "" - Dim myDnsHostByAddress As New DnsHostByAddress() - Console.Write("Type an IP address (press Enter for default, default is '207.46.131.199'): ") - IpAddressString = Console.ReadLine() - If IpAddressString.Length > 0 Then - myDnsHostByAddress.DisplayHostAddress(IpAddressString) - Else - myDnsHostByAddress.DisplayHostAddress("207.46.131.199") - End If - End Sub -' - Public Sub DisplayHostAddress(IpAddressString As [String]) - Try - Dim hostIPAddress As IPAddress = IPAddress.Parse(IpAddressString) - - ' Call the GetHostByAddress(IPAddress) method, passing an IPAddress object as an argument - ' to obtain an IPHostEntry instance, containing address information for the specified host. - - Dim hostInfo As IPHostEntry = Dns.GetHostByAddress(hostIPAddress) - ' Get the IP address list that resolves to the host names contained in - ' the Alias property. - Dim address As IPAddress() = hostInfo.AddressList - ' Get the alias names of the above addresses in the IP address list. - Dim [alias] As [String]() = hostInfo.Aliases - - Console.WriteLine(("Host name : " + hostInfo.HostName)) - Console.WriteLine(ControlChars.Cr + "Aliases :") - Dim index As Integer - For index = 0 To [alias].Length - 1 - Console.WriteLine([alias](index)) - Next index - Console.WriteLine(ControlChars.Cr + "IP address list : ") - - For index = 0 To address.Length - 1 - Console.WriteLine(address(index)) - Next index - - Catch e As SocketException - Console.WriteLine("SocketException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - - Catch e As FormatException - Console.WriteLine("FormatException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - - Catch e As ArgumentNullException - Console.WriteLine("ArgumentNullException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - - Catch e As Exception - Console.WriteLine("Exception caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - End Try - End Sub -' -End Class \ No newline at end of file diff --git a/snippets/visualbasic/System.Net/Dns/GetHostByName/dns_gethostbyname.vb b/snippets/visualbasic/System.Net/Dns/GetHostByName/dns_gethostbyname.vb deleted file mode 100644 index 3fa5d774aed..00000000000 --- a/snippets/visualbasic/System.Net/Dns/GetHostByName/dns_gethostbyname.vb +++ /dev/null @@ -1,66 +0,0 @@ - ' -' This program demonstrates 'GetHostByName' method of 'Dns' class. -' It takes a URL string from commandline or uses default value, and obtains -' the 'IPHostEntry' object by calling 'GetHostByName' method of 'Dns' class.Then -' prints host name,IP address list and aliases. -' - -Imports System.Net -Imports System.Net.Sockets - -Class DnsHostByName - - Public Shared Sub Main() - - Dim hostName As [String] = "" - Dim myDnsHostByName As New DnsHostByName() - Console.Write("Type a URL (press Enter for default, default is 'www.microsoft.net') : ") - hostName = Console.ReadLine() - If hostName.Length > 0 Then - myDnsHostByName.DisplayHostName(hostName) - Else - myDnsHostByName.DisplayHostName("www.microsoft.net") - End If - End Sub - -' - Public Sub DisplayHostName(hostName As [String]) - Try - ' Call the GetHostByName method, passing a DNS style host name(for example, - ' "www.contoso.com") as an argument to obtain an IPHostEntry instance, that - ' contains information for the specified host. - - Dim hostInfo As IPHostEntry = Dns.GetHostByName(hostName) - ' Get the IP address list that resolves to the host names contained in - ' the Alias property. - Dim address As IPAddress() = hostInfo.AddressList - ' Get the alias names of the addresses in the IP address list. - Dim [alias] As [String]() = hostInfo.Aliases - - Console.WriteLine(("Host name : " + hostInfo.HostName)) - Console.WriteLine(ControlChars.Cr + "Aliases : ") - Dim index As Integer - For index = 0 To [alias].Length - 1 - Console.WriteLine([alias](index)) - Next index - Console.WriteLine(ControlChars.Cr + "IP address list : ") - - For index = 0 To address.Length - 1 - Console.WriteLine(address(index)) - Next index - Catch e As SocketException - Console.WriteLine("SocketException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - Catch e As ArgumentNullException - Console.WriteLine("ArgumentNullException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - Catch e As Exception - Console.WriteLine("Exception caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - End Try -' - End Sub -End Class \ No newline at end of file diff --git a/snippets/visualbasic/System.Net/Dns/Resolve/dns_resolve.vb b/snippets/visualbasic/System.Net/Dns/Resolve/dns_resolve.vb deleted file mode 100644 index 70889a023c3..00000000000 --- a/snippets/visualbasic/System.Net/Dns/Resolve/dns_resolve.vb +++ /dev/null @@ -1,69 +0,0 @@ - ' -' This program demonstrates 'Resolve' method of 'Dns' class. -' It takes a URL or IP address string from commandline or uses default value and obtains the 'IPHostEntry' -' object by calling 'Resolve' method of 'Dns' class. Then prints host name, IP address list and aliases. -' - -Imports System.Net -Imports System.Net.Sockets - -Class DnsResolve - - Public Shared Sub Main() - Dim hostString As [String] = "" - Dim myDnsResolve As New DnsResolve() - Console.Write("Type a URL or IP address (press Enter for default, default is '207.46.131.199') : ") - hostString = Console.ReadLine() - If hostString.Length > 0 Then - myDnsResolve.DisplayHostAddress(hostString) - Else - myDnsResolve.DisplayHostAddress("207.46.131.199") - End If - End Sub - - - Public Sub DisplayHostAddress(ByVal hostString As [String]) - ' - Try - ' Call the Resolve method passing a DNS style host name or an IP address in - ' dotted-quad notation (for example, "www.contoso.com" or "207.46.131.199") to - ' obtain an IPHostEntry instance that contains address information for the - ' specified host. - Dim hostInfo As IPHostEntry = Dns.Resolve(hostString) - ' Get the IP address list that resolves to the host names contained in the Alias - ' property. - Dim address As IPAddress() = hostInfo.AddressList - ' Get the alias names of the addresses in the IP address list. - Dim [alias] As [String]() = hostInfo.Aliases - - Console.WriteLine(("Host name : " + hostInfo.HostName)) - Console.WriteLine(ControlChars.Cr + "Aliases : ") - Dim index As Integer - For index = 0 To [alias].Length - 1 - Console.WriteLine([alias](index)) - Next index - Console.WriteLine(ControlChars.Cr + "IP Address list :") - - For index = 0 To address.Length - 1 - Console.WriteLine(address(index)) - Next index - Catch e As SocketException - Console.WriteLine("SocketException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - Catch e As ArgumentNullException - Console.WriteLine("ArgumentNullException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - Catch e As NullReferenceException - Console.WriteLine("NullReferenceException caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - Catch e As Exception - Console.WriteLine("Exception caught!!!") - Console.WriteLine(("Source : " + e.Source)) - Console.WriteLine(("Message : " + e.Message)) - End Try - ' - End Sub -End Class \ No newline at end of file diff --git a/snippets/visualbasic/System.Net/ServicePointManager/CertificatePolicy/source.vb b/snippets/visualbasic/System.Net/ServicePointManager/CertificatePolicy/source.vb deleted file mode 100644 index d20f7e3eb24..00000000000 --- a/snippets/visualbasic/System.Net/ServicePointManager/CertificatePolicy/source.vb +++ /dev/null @@ -1,52 +0,0 @@ -Imports System.Net -Imports System.Web -Imports System.Web.Services -Imports System.Security.Cryptography.X509Certificates - -Public Class Sample - Private myUri As Uri - - Public Sub Method() - -' - ServicePointManager.CertificatePolicy = New MyCertificatePolicy() - - ' Create the request and receive the response - Try - Dim myRequest As WebRequest = WebRequest.Create(myUri) - Dim myResponse As WebResponse = myRequest.GetResponse() - - ProcessResponse(myResponse) - - myResponse.Close() - - ' Catch any exceptions - Catch e As WebException - If e.Status = WebExceptionStatus.TrustFailure Then - ' Code for handling security certificate problems goes here. - End If - ' Other exception handling goes here - End Try - -' - End Sub - - ' Method added so sample will compile - Public Sub ProcessResponse(resp As WebResponse) - End Sub - -End Class - -' Class added so sample will compile -Public Class MyCertificatePolicy - Implements ICertificatePolicy - - Public Function CheckValidationResult(srvPoint As System.Net.ServicePoint, _ - certificate As System.Security.Cryptography.X509Certificates.X509Certificate, _ - request As System.Net.WebRequest, _ - certificateProblem As Integer) As Boolean _ - Implements ICertificatePolicy.CheckValidationResult - - Return True - End Function -End Class \ No newline at end of file diff --git a/snippets/visualbasic/System/AppDomain/ClearPrivatePath/adclearprivatepath.vb b/snippets/visualbasic/System/AppDomain/ClearPrivatePath/adclearprivatepath.vb deleted file mode 100644 index f73710ddf28..00000000000 --- a/snippets/visualbasic/System/AppDomain/ClearPrivatePath/adclearprivatepath.vb +++ /dev/null @@ -1,36 +0,0 @@ - ' -Imports System.Reflection -Imports System.Security.Policy - -Class ADAppendPrivatePath - - Public Shared Sub Main() - 'Create evidence for new appdomain. - Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence - - 'Create the new application domain. - Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence) - - 'Display the current relative search path. - Console.WriteLine("Relative search path is: " & domain.RelativeSearchPath) - - 'Append the relative path. - Dim Newpath As [String] = "www.code.microsoft.com" - domain.AppendPrivatePath(Newpath) - - 'Display the new relative search path. - Console.WriteLine("Relative search path is: " & domain.RelativeSearchPath) - - 'Clear the private search path. - domain.ClearPrivatePath() - - 'Display the new relative search path. - Console.WriteLine("Relative search path is now: " & domain.RelativeSearchPath) - - - AppDomain.Unload(domain) - End Sub -End Class -' - - diff --git a/snippets/visualbasic/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.vb b/snippets/visualbasic/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.vb deleted file mode 100644 index 2732529f51f..00000000000 --- a/snippets/visualbasic/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.vb +++ /dev/null @@ -1,39 +0,0 @@ -' -Imports System.Threading -Imports System.Security -Imports System.Security.Policy -Imports System.Security.Permissions - - - -Class ADSetAppDomainPolicy - - Overloads Shared Sub Main(args() As String) - ' Create a new application domain. - Dim domain As AppDomain = System.AppDomain.CreateDomain("MyDomain") - - ' Create a new AppDomain PolicyLevel. - Dim polLevel As PolicyLevel = PolicyLevel.CreateAppDomainLevel() - ' Create a new, empty permission set. - Dim permSet As New PermissionSet(PermissionState.None) - ' Add permission to execute code to the permission set. - permSet.AddPermission(New SecurityPermission(SecurityPermissionFlag.Execution)) - ' Give the policy level's root code group a new policy statement based - ' on the new permission set. - polLevel.RootCodeGroup.PolicyStatement = New PolicyStatement(permSet) - ' Give the new policy level to the application domain. - domain.SetAppDomainPolicy(polLevel) - - ' Try to execute the assembly. - Try - ' This will throw a PolicyException if the executable tries to - ' access any resources like file I/Q or window creation. - domain.ExecuteAssembly("Assemblies\MyWindowsExe.exe") - Catch e As PolicyException - Console.WriteLine("PolicyException: {0}", e.Message) - End Try - - AppDomain.Unload(domain) - End Sub -End Class -' \ No newline at end of file diff --git a/snippets/visualbasic/System/AppDomain/SetShadowCopyFiles/adproperties.vb b/snippets/visualbasic/System/AppDomain/SetShadowCopyFiles/adproperties.vb deleted file mode 100644 index 35011f2ee3b..00000000000 --- a/snippets/visualbasic/System/AppDomain/SetShadowCopyFiles/adproperties.vb +++ /dev/null @@ -1,59 +0,0 @@ - ' -Imports System.Security.Policy - 'for evidence object - -Class ADProperties - - Shared Sub Main(args() As String) - - Dim setup As New AppDomainSetup() - ' Shadow copying will not work unless the application has a name. - setup.ApplicationName = "MyApplication" - - 'Create evidence for the new application domain from evidence of - ' current application domain. - Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence - - ' Create a new application domain. - Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence, setup) - - ' MyAssembly.dll is located in the Assemblies subdirectory. - domain.AppendPrivatePath("Assemblies") - ' MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - ' MoreAssemblies subdirectory. - domain.AppendPrivatePath("MoreAssemblies") - ' Display the relative search path. - Console.WriteLine("RelativeSearchPath: " & domain.RelativeSearchPath) - ' Because Load returns an Assembly object, the assemblies must be - ' loaded into the current domain as well. This will fail unless the - ' current domain also has these directories in its search path. - AppDomain.CurrentDomain.AppendPrivatePath("Assemblies") - AppDomain.CurrentDomain.AppendPrivatePath("MoreAssemblies") - - ' Save shadow copies to C:\Cache - domain.SetCachePath("C:\Cache") - ' Shadow copy only the assemblies in the Assemblies directory. - domain.SetShadowCopyPath(domain.BaseDirectory + "Assemblies") - ' Turn shadow copying on. - domain.SetShadowCopyFiles() - Console.WriteLine("ShadowCopyFiles turned on: " & domain.ShadowCopyFiles) - - ' This will be copied. - ' You must supply a valid fully qualified assembly name here. - domain.Load("Assembly1 text name, Version, Culture, PublicKeyToken") - ' This will not be copied. - ' You must supply a valid fully qualified assembly name here. - domain.Load("Assembly2 text name, Version, Culture, PublicKeyToken") - - ' When the shadow copy path is cleared, the CLR will make shadow copies - ' of all private assemblies. - domain.ClearShadowCopyPath() - ' MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - ' You must supply a valid fully qualified assembly name here. - domain.Load("Assembly3 text name, Version, Culture, PublicKeyToken") - - ' Unload the domain. - AppDomain.Unload(domain) - End Sub -End Class -' \ No newline at end of file diff --git a/snippets/visualbasic/System/AppDomain/SetShadowCopyPath/adshadowcopy.vb b/snippets/visualbasic/System/AppDomain/SetShadowCopyPath/adshadowcopy.vb deleted file mode 100644 index 75fc2106644..00000000000 --- a/snippets/visualbasic/System/AppDomain/SetShadowCopyPath/adshadowcopy.vb +++ /dev/null @@ -1,63 +0,0 @@ -' -Imports System.Security.Policy - 'for evidence object - -Class ADShadowCopy - - 'Entry point which delegates to C-style main Private Function - ' Public Overloads Shared Sub Main() - ' Main(System.Environment.GetCommandLineArgs()) - ' End Sub - - Public Overloads Shared Sub Main(args() As String) - - Dim setup As New AppDomainSetup() - ' Shadow copying will not work unless the application has a name. - setup.ApplicationName = "MyApplication" - - 'Create evidence for the new application domain from evidence of - ' current application domain. - Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence - - ' Create a new application domain. - Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence, setup) - - ' MyAssembly.dll is located in the Assemblies subdirectory. - domain.AppendPrivatePath("Assemblies") - ' MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - ' MoreAssemblies subdirectory. - domain.AppendPrivatePath("MoreAssemblies") - ' Display the relative search path. - Console.WriteLine(("RelativeSearchPath: " + domain.RelativeSearchPath)) - ' Because Load returns an Assembly object, the assemblies must be - ' loaded into the current domain as well. This will fail unless the - ' current domain also has these directories in its search path. - AppDomain.CurrentDomain.AppendPrivatePath("Assemblies") - AppDomain.CurrentDomain.AppendPrivatePath("MoreAssemblies") - - ' Save shadow copies to C:\Cache - domain.SetCachePath("C:\Cache") - ' Shadow copy only the assemblies in the Assemblies directory. - domain.SetShadowCopyPath((domain.BaseDirectory + "Assemblies")) - ' Turn shadow copying on. - domain.SetShadowCopyFiles() - - ' This will be copied. - ' You must supply a valid fully qualified assembly name here. - domain.Load("Assembly1 text name, Version, Culture, PublicKeyToken") - ' This will not be copied. - ' You must supply a valid fully qualified assembly name here. - domain.Load("Assembly2 text name, Version, Culture, PublicKeyToken") - - ' When the shadow copy path is cleared, the CLR will make shadow copies - ' of all private assemblies. - domain.ClearShadowCopyPath() - ' MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - ' You must supply a valid fully qualified assembly name here. - domain.Load("Assembly3 text name, Version, Culture, PublicKeyToken") - - ' Unload the domain. - AppDomain.Unload(domain) - End Sub -End Class -' \ No newline at end of file diff --git a/snippets/visualbasic/System/Uri/.ctor/source1.vb b/snippets/visualbasic/System/Uri/.ctor/source1.vb deleted file mode 100644 index 56dc162f2ee..00000000000 --- a/snippets/visualbasic/System/Uri/.ctor/source1.vb +++ /dev/null @@ -1,14 +0,0 @@ -Imports System.Data -Imports System.Security.Principal -Imports System.Windows.Forms - -Public Class Form1 - Inherits Form - - Protected Sub Method() -' - Dim myUri As New Uri("http://www.contoso.com/Hello%20World.htm", True) - -' - End Sub -End Class diff --git a/snippets/visualbasic/System/Uri/.ctor/source3.vb b/snippets/visualbasic/System/Uri/.ctor/source3.vb deleted file mode 100644 index aa14b6f192a..00000000000 --- a/snippets/visualbasic/System/Uri/.ctor/source3.vb +++ /dev/null @@ -1,15 +0,0 @@ -Imports System.Data -Imports System.Security.Principal -Imports System.Windows.Forms - -Public Class Form1 - Inherits Form - - Protected Sub Method() -' - Dim baseUri As New Uri("http://www.contoso.com") - Dim myUri As New Uri(baseUri, "Hello%20World.htm", False) - -' - End Sub -End Class diff --git a/xml/Microsoft.VisualBasic/FileSystem.xml b/xml/Microsoft.VisualBasic/FileSystem.xml index 9d0a58a41be..7ed82b30cd6 100644 --- a/xml/Microsoft.VisualBasic/FileSystem.xml +++ b/xml/Microsoft.VisualBasic/FileSystem.xml @@ -3716,62 +3716,7 @@ Required. Valid variable name that contains data written to disk. Optional. Record number ( mode files) or byte number ( mode files) at which writing starts. Writes data from a variable to a disk file. The feature gives you better productivity and performance in file I/O operations than . For more information, see . - - [!NOTE] - > String fields that have more bytes than specified by the `VBFixedString` attribute are truncated when written to disk, - -## Binary Mode - For files opened in `Binary` mode, most of the `Random` mode rules apply, with some exceptions. The following rules for files opened in `Binary` mode differ from the rules for `Random` mode: - -- The `RecordLength` clause in the `FileOpen` function has no effect. `FilePut` writes all variables to disk contiguously, that is, without padding between records. - -- For any array other than an array in a structure, `FilePut` writes only the data. No descriptor is written. - -- `FilePut` writes variable-length strings that are not elements of structures without the two-byte length descriptor. The number of bytes written equals the number of characters in the string. For example, the following statements write 11 bytes to file number 1: - - :::code language="vb" source="~/snippets/visualbasic/Microsoft.VisualBasic/Conversion/ErrorToString/Class1.vb" id="Snippet44"::: - -- Writing to a file by using the `FilePut` function requires `Write` access from the enumeration. - - - -## Examples - This example uses the `FilePut` function to write data to a file. Five records of the structure `Person` are written to the file. - - :::code language="vb" source="~/snippets/visualbasic/Microsoft.VisualBasic/Conversion/ErrorToString/Class1.vb" id="Snippet42"::: - - ]]> - + To be added. < 1 and not equal to -1. File mode is invalid. diff --git a/xml/System.Collections/Hashtable.xml b/xml/System.Collections/Hashtable.xml index 15d46c3b78a..9dc0ccd07aa 100644 --- a/xml/System.Collections/Hashtable.xml +++ b/xml/System.Collections/Hashtable.xml @@ -775,14 +775,6 @@ Each element is a key/value pair stored in a constructors and demonstrates the differences in the behavior of the hash tables, even if each one contains the same elements. - - :::code language="csharp" source="~/snippets/csharp/System.Collections/Hashtable/.ctor/hashtable_ctor.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Collections/Hashtable/.ctor/hashtable_ctor.vb" id="Snippet1"::: - ]]> @@ -1148,14 +1140,6 @@ Each element is a key/value pair stored in a constructors and demonstrates the differences in the behavior of the hash tables, even if each one contains the same elements. - - :::code language="csharp" source="~/snippets/csharp/System.Collections/Hashtable/.ctor/hashtable_ctordictionary.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Collections/Hashtable/.ctor/hashtable_ctordictionary.vb" id="Snippet1"::: - ]]> @@ -1356,14 +1340,6 @@ Each element is a key/value pair stored in a constructors and demonstrates the differences in the behavior of the hash tables, even if each one contains the same elements. - - :::code language="csharp" source="~/snippets/csharp/System.Collections/Hashtable/.ctor/hashtable_ctorint.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Collections/Hashtable/.ctor/hashtable_ctorint.vb" id="Snippet1"::: - ]]> @@ -1567,14 +1543,6 @@ Each element is a key/value pair stored in a constructors and demonstrates the differences in the behavior of the hash tables, even if each one contains the same elements. - - :::code language="csharp" source="~/snippets/csharp/System.Collections/Hashtable/.ctor/hashtable_ctordictionaryfloat.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Collections/Hashtable/.ctor/hashtable_ctordictionaryfloat.vb" id="Snippet1"::: - ]]> @@ -1674,14 +1642,6 @@ Each element is a key/value pair stored in a constructors and demonstrates the differences in the behavior of the hash tables, even if each one contains the same elements. - - :::code language="csharp" source="~/snippets/csharp/System.Collections/Hashtable/.ctor/hashtable_ctorintfloat.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Collections/Hashtable/.ctor/hashtable_ctorintfloat.vb" id="Snippet1"::: - ]]> diff --git a/xml/System.Data.SqlClient/SqlParameterCollection.xml b/xml/System.Data.SqlClient/SqlParameterCollection.xml index 84083890d70..a2765c24850 100644 --- a/xml/System.Data.SqlClient/SqlParameterCollection.xml +++ b/xml/System.Data.SqlClient/SqlParameterCollection.xml @@ -326,22 +326,14 @@ This member is an explicit interface member implementation. It can be used only Adds the specified object to the . A new object. - Use caution when you are using this overload of the method to specify integer parameter values. Because this overload takes a of type , you must convert the integral value to an type when the value is zero, as the following C# example demonstrates. + Use caution when you use this overload of the method to specify integer parameter values. Because this overload takes a of type , you must convert the integral value to an type when the value is zero, as the following C# example demonstrates. ```csharp parameters.Add("@pname", Convert.ToInt32(0)); ``` - If you do not perform this conversion, the compiler assumes that you are trying to call the (, ) overload. - - - + If you do not perform this conversion, the compiler assumes that you're trying to call the (, ) overload. + To be added. The specified in the parameter is already added to this or another . The parameter is null. ADO.NET Overview diff --git a/xml/System.Diagnostics/EventLog.xml b/xml/System.Diagnostics/EventLog.xml index 1a92adcda2c..37db1323e98 100644 --- a/xml/System.Diagnostics/EventLog.xml +++ b/xml/System.Diagnostics/EventLog.xml @@ -1050,15 +1050,7 @@ SVC_UPDATE.EXE To change the configuration details of an existing source, you must delete the source and then create it with the new configuration. If other applications or components use the existing source, create a new source with the updated configuration rather than deleting the existing source. > [!NOTE] -> If a source has already been mapped to a log and you remap it to a new log, you must restart the computer for the changes to take effect. - - - -## Examples - The following example creates the source `MySource` on the computer `MyServer`, and writes an entry to the event log `MyNewLog`. - - :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/EventLog/CreateEventSource/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Diagnostics/EventLog/CreateEventSource/source.vb" id="Snippet1"::: +> If a source has already been mapped to a log and you remap it to a new log, you must restart the computer for the changes to take effect. ]]> diff --git a/xml/System.Diagnostics/PerformanceCounterCategory.xml b/xml/System.Diagnostics/PerformanceCounterCategory.xml index 181a6ecf29f..56f5360c770 100644 --- a/xml/System.Diagnostics/PerformanceCounterCategory.xml +++ b/xml/System.Diagnostics/PerformanceCounterCategory.xml @@ -703,12 +703,6 @@ > > In Windows Vista and later, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator. -## Examples - The following code example determines whether a object named "orders" exists. If not, it creates the object by using a object that contains two performance counters. - - :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterCategory/Create/ccd.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Diagnostics/PerformanceCounterCategory/Create/ccd.vb" id="Snippet1"::: - ]]> A counter name that is specified within the collection is or an empty string (""). @@ -889,14 +883,6 @@ > > In Windows Vista and later, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator. - - -## Examples - The following code example creates a and single with help text for each, using the method. - - :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/System.Diagnostics/PerformanceCounterCategory/.ctor/perfcountercatcreate.vb" id="Snippet2"::: - ]]> diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index cb09edee062..6ba6865bb43 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -7183,15 +7183,6 @@ No process is associated with this o The working set includes both shared and private data. The shared data includes the pages that contain all the instructions that the process executes, including the process modules and the system libraries. - - -## Examples - The following example starts an instance of Notepad. The example then retrieves and displays various properties of the associated process. The example detects when the process exits, and displays the process' exit code. - - :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/Process/WorkingSet/process_sample.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System.Diagnostics/Process/WorkingSet/process_sample.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Diagnostics/Process/WorkingSet/process_sample.vb" id="Snippet1"::: - ]]> diff --git a/xml/System.IO.IsolatedStorage/IsolatedStorageFile.xml b/xml/System.IO.IsolatedStorage/IsolatedStorageFile.xml index 8000585f844..c2f5139919c 100644 --- a/xml/System.IO.IsolatedStorage/IsolatedStorageFile.xml +++ b/xml/System.IO.IsolatedStorage/IsolatedStorageFile.xml @@ -586,14 +586,6 @@ The [How to: Anticipate Out-of-Space Conditions with Isolated Storage](/dotnet/standard/io/how-to-anticipate-out-of-space-conditions-with-isolated-storage) example demonstrates the use of the property. - - -## Examples - The following code example demonstrates the property. For the complete context of this example, see the overview. - - :::code language="csharp" source="~/snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs" id="Snippet5"::: - :::code language="vb" source="~/snippets/visualbasic/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.vb" id="Snippet5"::: - ]]> The property is unavailable. The current store has a roaming scope or is not open. @@ -2759,14 +2751,6 @@ The [How to: Anticipate Out-of-Space Conditions with Isolated Storage](/dotnet/standard/io/how-to-anticipate-out-of-space-conditions-with-isolated-storage) example demonstrates the use of the property. - - -## Examples - The following code example demonstrates the property. For the complete context of this example, see the overview. - - :::code language="csharp" source="~/snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs" id="Snippet5"::: - :::code language="vb" source="~/snippets/visualbasic/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.vb" id="Snippet5"::: - ]]> The property is unavailable. cannot be determined without evidence from the assembly's creation. The evidence could not be determined when the object was created. diff --git a/xml/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml b/xml/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml index 30f8b96ae0f..7609f9e7f8b 100644 --- a/xml/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml +++ b/xml/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml @@ -1512,14 +1512,6 @@ Dim source As New IsolatedStorageFileStream(UserName,FileMode.Open,isoFile) ## Remarks For more information, see . - - -## Examples - The following code example demonstrates the property. - - :::code language="csharp" source="~/snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs" id="Snippet4"::: - :::code language="vb" source="~/snippets/visualbasic/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.vb" id="Snippet4"::: - ]]> The property always generates this exception. diff --git a/xml/System.IO/Path.xml b/xml/System.IO/Path.xml index 0e0b3d5f5da..81666951ded 100644 --- a/xml/System.IO/Path.xml +++ b/xml/System.IO/Path.xml @@ -2406,12 +2406,6 @@ The array returned from this method is not guaranteed to contain the complete se > [!CAUTION] > Do not use if you think your code might execute in the same application domain as untrusted code. is an array, so its elements can be overwritten. If untrusted code overwrites elements of , it might cause your code to malfunction in ways that could be exploited. -## Examples - The following example demonstrates the use of the `InvalidPathChars` property. - - :::code language="csharp" source="~/snippets/csharp/System.IO/Path/ChangeExtension/pathmembers.cs" id="Snippet13"::: - :::code language="vb" source="~/snippets/visualbasic/System.IO/Path/ChangeExtension/pathmembers.vb" id="Snippet13"::: - ]]> File and Stream I/O diff --git a/xml/System.Messaging/MessageQueue.xml b/xml/System.Messaging/MessageQueue.xml index 9bc06a61f4a..da574cf5e95 100644 --- a/xml/System.Messaging/MessageQueue.xml +++ b/xml/System.Messaging/MessageQueue.xml @@ -2273,8 +2273,6 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. |Remote computer|Yes| |Remote computer and direct format name|Yes| - - ## Examples The following code example gets and sets the value of a message queue's property. @@ -2334,8 +2332,6 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. |Remote computer|No| |Remote computer and direct format name|No| - - ## Examples The following code example gets and sets the value of a message queue's property. @@ -2393,8 +2389,6 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. |Remote computer|No| |Remote computer and direct format name|Yes| - - ## Examples The following code example creates an event handler named `MyPeekCompleted`, attaches it to the event handler delegate, and calls to initiate an asynchronous peek operation on the queue that is located at the path ".\myQueue". When a event is raised, the example peeks the message and writes its body to the screen. The example then calls again to initiate a new asynchronous peek operation. @@ -2456,8 +2450,6 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. |Remote computer|No| |Remote computer and direct format name|Yes| - - ## Examples The following code example chains asynchronous requests. It assumes there is a queue on the local computer called "myQueue". The `Main` function begins the asynchronous operation that is handled by the `MyReceiveCompleted` routine. `MyReceiveCompleted` processes the current message and begins a new asynchronous receive operation. @@ -2512,9 +2504,9 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. The syntax for the `path` parameter depends on the type of queue, as shown in the following table. -|Queue type|Syntax| -|----------------|------------| -|Public queue|`MachineName`\\`QueueName`| +| Queue type | Syntax | +|--------------|----------------------------| +| Public queue | `MachineName`\\`QueueName` | cannot be called to verify the existence of a remote private queue. @@ -2522,20 +2514,18 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. Alternatively, you can use the to describe the queue path. -|Reference|Syntax| -|---------------|------------| -|Label|Label:[ `label` ]| +| Reference | Syntax | +|-----------|-------------------| +| Label | Label:[ `label` ] | The following table shows whether this method is available in various Workgroup modes. -|Workgroup mode|Available| -|--------------------|---------------| -|Local computer|Yes| -|Local computer and direct format name|No| -|Remote computer|No| -|Remote computer and direct format name|No| - - +| Workgroup mode | Available | +|----------------------------------------|-----------| +| Local computer | Yes | +| Local computer and direct format name | No | +| Remote computer | No | +| Remote computer and direct format name | No | ## Examples The following code example verifies whether a Message Queuing queue exists, and then deletes it. @@ -2603,8 +2593,6 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. |Remote computer|Yes| |Remote computer and direct format name|Yes| - - ## Examples The following code example displays the value of a message queue's property. @@ -2678,12 +2666,12 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. The following table shows whether this property is available in various Workgroup modes. -|Workgroup mode|Available| -|--------------------|---------------| -|Local computer|Yes| -|Local computer and direct format name|Yes| -|Remote computer|No| -|Remote computer and direct format name|Yes| +| Workgroup mode | Available | +|----------------------------------------|-----------| +| Local computer | Yes | +| Local computer and direct format name | Yes | +| Remote computer | No | +| Remote computer and direct format name | Yes | ## Examples The following code example demonstrates formatting a message body using . @@ -2738,14 +2726,12 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. The following table shows whether this method is available in various Workgroup modes. -|Workgroup mode|Available| -|--------------------|---------------| -|Local computer|Yes| -|Local computer and direct format name|Yes| -|Remote computer|No| -|Remote computer and direct format name|Yes| - - +| Workgroup mode | Available | +|----------------------------------------|-----------| +| Local computer | Yes | +| Local computer and direct format name | Yes | +| Remote computer | No | +| Remote computer and direct format name | Yes | ## Examples The following code example demonstrates the use of . @@ -2796,20 +2782,12 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. ## Remarks The following table shows whether this method is available in various Workgroup modes. -|Workgroup mode|Available| -|--------------------|---------------| -|Local computer|Yes| -|Local computer and direct format name|Yes| -|Remote computer|No| -|Remote computer and direct format name|Yes| - - - -## Examples - The following code example demonstrates the use of . - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp" id="Snippet22"::: - :::code language="csharp" source="~/snippets/csharp/System.Messaging/MessageQueue/GetAllMessages/class1.cs" id="Snippet22"::: +| Workgroup mode | Available | +|----------------------------------------|-----------| +| Local computer | Yes | +| Local computer and direct format name | Yes | +| Remote computer | No | +| Remote computer and direct format name | Yes | ]]> @@ -2852,14 +2830,12 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. The following table shows whether this method is available in various Workgroup modes. -|Workgroup mode|Available| -|--------------------|---------------| -|Local computer|No| -|Local computer and direct format name|No| -|Remote computer|No| -|Remote computer and direct format name|No| - - +| Workgroup mode | Available | +|----------------------------------------|-----------| +| Local computer | No | +| Local computer and direct format name | No | +| Remote computer | No | +| Remote computer and direct format name | No | ## Examples The following code example calls . @@ -2918,21 +2894,12 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. The following table shows whether this method is available in various Workgroup modes. -|Workgroup mode|Available| -|--------------------|---------------| -|Local computer|Yes| -|Local computer and direct format name|Yes| -|Remote computer|Yes| -|Remote computer and direct format name|Yes| - - - -## Examples - The following code example gets a dynamic list of messages in a queue and counts all messages with the property set to . - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System.Messaging/MessageEnumerator/Overview/mqgetmessageenumerator.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Messaging/MessageEnumerator/Overview/mqgetmessageenumerator.vb" id="Snippet1"::: +| Workgroup mode | Available | +|----------------------------------------|-----------| +| Local computer | Yes | +| Local computer and direct format name | Yes | +| Remote computer | Yes | +| Remote computer and direct format name | Yes | ]]> @@ -2975,12 +2942,12 @@ myMessageQueue.Send("Text 2."); //Resources are re-acquired. The following table shows whether this method is available in various Workgroup modes. -|Workgroup mode|Available| -|--------------------|---------------| -|Local computer|Yes| -|Local computer and direct format name|Yes| -|Remote computer|Yes| -|Remote computer and direct format name|Yes| +| Workgroup mode | Available | +|----------------------------------------|-----------| +| Local computer | Yes | +| Local computer and direct format name | Yes | +| Remote computer | Yes | +| Remote computer and direct format name | Yes | ]]> diff --git a/xml/System.Net/Dns.xml b/xml/System.Net/Dns.xml index ef43835050c..9a0c651620d 100644 --- a/xml/System.Net/Dns.xml +++ b/xml/System.Net/Dns.xml @@ -536,15 +536,7 @@ For more information about using the asynchronous programming model, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously). > [!NOTE] -> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in the .NET Framework](/dotnet/framework/network-programming/network-tracing). - - - -## Examples - The following example uses to resolve a DNS host name to an . - - :::code language="csharp" source="~/snippets/csharp/System.Net/Dns/BeginResolve/dns_begin_endresolve.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Net/Dns/BeginResolve/dns_begin_endresolve.vb" id="Snippet1"::: +> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ]]> @@ -813,15 +805,7 @@ To perform this operation synchronously, use the method. > [!NOTE] -> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in the .NET Framework](/dotnet/framework/network-programming/network-tracing). - - - -## Examples - The following example ends an asynchronous request for DNS host information. - - :::code language="csharp" source="~/snippets/csharp/System.Net/Dns/BeginResolve/dns_begin_endresolve.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Net/Dns/BeginResolve/dns_begin_endresolve.vb" id="Snippet1"::: +> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ]]> @@ -1142,15 +1126,7 @@ ## Remarks > [!NOTE] -> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in the .NET Framework](/dotnet/framework/network-programming/network-tracing). - - - -## Examples - The following example creates a from an . - - :::code language="csharp" source="~/snippets/csharp/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Net/Dns/GetHostByAddress/dns_gethostbyaddress_ipaddress.vb" id="Snippet1"::: +> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ]]> @@ -1299,15 +1275,7 @@ If the property is set to `true`, the property of the instance returned is not populated by this method and will always be empty. > [!NOTE] -> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in the .NET Framework](/dotnet/framework/network-programming/network-tracing). - - - -## Examples - The following example uses the method to get the DNS information for the specified DNS host name. - - :::code language="csharp" source="~/snippets/csharp/System.Net/Dns/GetHostByName/dns_gethostbyname.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Net/Dns/GetHostByName/dns_gethostbyname.vb" id="Snippet1"::: +> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ]]> @@ -1877,15 +1845,7 @@ If the property is set to `true`, the property of the instance returned is not populated by this method and will always be empty. > [!NOTE] -> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in the .NET Framework](/dotnet/framework/network-programming/network-tracing). - - - -## Examples - The following example uses the method to resolve an IP address to an instance. - - :::code language="csharp" source="~/snippets/csharp/System.Net/Dns/Resolve/dns_resolve.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Net/Dns/Resolve/dns_resolve.vb" id="Snippet1"::: +> This member emits trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ]]> diff --git a/xml/System.Net/ServicePointManager.xml b/xml/System.Net/ServicePointManager.xml index 3451f99a22c..b1d2c3571df 100644 --- a/xml/System.Net/ServicePointManager.xml +++ b/xml/System.Net/ServicePointManager.xml @@ -132,13 +132,6 @@ The default certificate policy allows valid certificates and valid certificates that have expired. - -## Examples - The following code example shows how to catch a certificate policy exception for a custom certificate policy. It assumes that the certificate policy object has been defined, that the Uniform Resource Identifier (URI) for the Web resource is contained in the variable `myUri`, and that there is a method named `ProcessResponse` that performs the work of the application. - - :::code language="csharp" source="~/snippets/csharp/System.Net/ServicePointManager/CertificatePolicy/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System.Net/ServicePointManager/CertificatePolicy/source.vb" id="Snippet1"::: - ]]> diff --git a/xml/System/AppDomain.xml b/xml/System/AppDomain.xml index 389b562c875..666077d4772 100644 --- a/xml/System/AppDomain.xml +++ b/xml/System/AppDomain.xml @@ -704,28 +704,7 @@ Application domains, which are represented by objects, h Resets the path that specifies the location of private assemblies to the empty string (""). - - . - - - -## Examples - The following code example demonstrates how to use the method to remove all entries from the list of private paths to search when assemblies are loaded. - - This method is now obsolete, and should not be used for new development. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/ClearPrivatePath/adclearprivatepath.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/ClearPrivatePath/adclearprivatepath.vb" id="Snippet1"::: - - ]]> - + To be added. The operation is attempted on an unloaded application domain. @@ -2256,29 +2235,7 @@ This method overload uses the information from the Information used to authorize creation of . Creates a new instance of the specified type. Parameters specify the name of the type, and how it is found and created. An instance of the object specified by . - - and . - - See for the format of `assemblyName`. See the property for the format of `typeName`. - -> [!NOTE] -> If you make an early-bound call to a method `M` of an object of type `T1` that was returned by , and that method makes an early-bound call to a method of an object of type `T2` in an assembly `C` other than the current assembly or the assembly containing `T1`, assembly `C` is loaded into the current application domain. This loading occurs even if the early-bound call to `T1.M()` was made in the body of a , or in other dynamically generated code. If the current domain is the default domain, assembly `C` cannot be unloaded until the process ends. If the current domain later attempts to load assembly `C`, the load might fail. - - - -## Examples - The following sample demonstrates the use of the `ignoreCase` parameter. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/CreateInstanceAndUnwrap/ignorecase.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/CreateInstanceAndUnwrap/ignorecase.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/CreateInstanceAndUnwrap/ignorecase.vb" id="Snippet1"::: - - ]]> - + To be added. or is . No matching constructor was found. @@ -3465,35 +3422,7 @@ This method overload uses the information from the The evidence supplied for the dynamic assembly. The evidence is used unaltered as the final set of evidence used for policy resolution. Defines a dynamic assembly using the specified name, access mode, and evidence. A dynamic assembly with the specified name and features. - - . The runtime will map the through the security policy to determine the granted permissions. Partially trusted callers must supply a null `evidence`. If `evidence` is `null`, the runtime copies the permission sets, that is, the current grant and deny sets, from the caller's to the dynamic being defined and marks policy as resolved. - - If the dynamic is saved to disk, subsequent loads will get grants based on policies associated with the location where the was saved. - - This method should only be used to define a dynamic assembly in the current application domain. For more information, see the method overload. - -> [!NOTE] -> During the development of code that emits dynamic assemblies, it is recommended that you use an overload of the method that specifies evidence and permissions, supply the evidence you want the dynamic assembly to have, and include in `refusedPermissions`. Including in the `refusedPermissions` parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes to be thrown when used with code that demands full trust. - - - -## Examples - The following sample demonstrates the method and the event. - - First, the code example tries to create an instance of `MyDynamicType` by calling the method with an invalid assembly name, and catches the resulting exception. - - The code example then adds an event handler for the event, and again tries to create an instance of`MyDynamicType`. During the call to , the event is raised for the invalid assembly. The event handler creates a dynamic assembly that contains a type named `MyDynamicType`, gives the type a parameterless constructor, and returns the new dynamic assembly. The call to then finishes successfully, and the constructor for `MyDynamicType` displays a message at the console. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . The property of is . @@ -3699,33 +3628,7 @@ This method overload uses the information from the The evidence supplied for the dynamic assembly. The evidence is used unaltered as the final set of evidence used for policy resolution. Defines a dynamic assembly using the specified name, access mode, storage directory, and evidence. A dynamic assembly with the specified name and features. - - . The runtime will map the through the security policy to determine the granted permissions. Partially trusted callers must supply a null `evidence`. If `evidence` is `null`, the runtime copies the permission sets, that is, the current grant and deny sets, from the caller's to the dynamic being defined and marks policy as resolved. - - If the dynamic is saved to disk, subsequent loads will get grants based on policies associated with the location where the was saved. - - This method should only be used to define a dynamic assembly in the current application domain. For more information, see the method overload. - -> [!NOTE] -> During the development of code that emits dynamic assemblies, it is recommended that you use an overload of the method that specifies evidence and permissions, supply the evidence you want the dynamic assembly to have, and include in `refusedPermissions`. Including in the `refusedPermissions` parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes to be thrown when used with code that demands full trust. - - - -## Examples - The following sample demonstrates the method and event. - - For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . The property of is . @@ -3790,31 +3693,7 @@ This method overload uses the information from the The refused permissions request. Defines a dynamic assembly using the specified name, access mode, and permission requests. A dynamic assembly with the specified name and features. - - method that specifies evidence as well as requested permissions, and supply an object. - -> [!NOTE] -> During the development of code that emits dynamic assemblies, it is recommended that you use an overload of the method that specifies evidence and permissions, supply the evidence you want the dynamic assembly to have, and include in `refusedPermissions`. Including in the `refusedPermissions` parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes to be thrown when used with code that demands full trust. - - This method should only be used to define a dynamic assembly in the current application domain. For more information, see the method overload . - - - -## Examples - The following sample demonstrates the method and event. - - For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . The property of is . @@ -3948,35 +3827,7 @@ This method overload uses the information from the The refused permissions request. Defines a dynamic assembly using the specified name, access mode, evidence, and permission requests. A dynamic assembly with the specified name and features. - - [!NOTE] -> During the development of code that emits dynamic assemblies, it is recommended that you include in `refusedPermissions`. Including in the `refusedPermissions` parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes to be thrown when used with code that demands full trust. - - Only fully trusted callers can supply their `evidence` when defining a dynamic . The runtime will map the through the security policy to determine the granted permissions. Partially trusted callers must supply a null `evidence`. If `evidence` is `null`, the runtime copies the permission sets, that is, the current grant and deny sets, from the caller's to the dynamic being defined and marks policy as resolved. - - If the dynamic is saved to disk, subsequent loads will get grants based on policies associated with the location where the was saved. - - This method should only be used to define a dynamic assembly in the current application domain. For more information, see the method overload. - - - -## Examples - The following sample demonstrates the method and event. - - For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . The property of is . @@ -4043,31 +3894,7 @@ This method overload uses the information from the The refused permissions request. Defines a dynamic assembly using the specified name, access mode, storage directory, and permission requests. A dynamic assembly with the specified name and features. - - method that specifies evidence as well as requested permissions, and supply an object. - -> [!NOTE] -> During the development of code that emits dynamic assemblies, it is recommended that you use an overload of the method that specifies evidence and permissions, supply the evidence you want the dynamic assembly to have, and include in `refusedPermissions`. Including in the `refusedPermissions` parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes to be thrown when used with code that demands full trust. - - This method should only be used to define a dynamic assembly in the current application domain. For more information, see the method overload. - - - -## Examples - The following sample demonstrates the method and event. - - For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . The property of is . @@ -4136,35 +3963,7 @@ This method overload uses the information from the The refused permissions request. Defines a dynamic assembly using the specified name, access mode, storage directory, evidence, and permission requests. A dynamic assembly with the specified name and features. - - [!NOTE] -> During the development of code that emits dynamic assemblies, it is recommended that you include in `refusedPermissions`. Including in the `refusedPermissions` parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes to be thrown when used with code that demands full trust. - - Only fully trusted callers can supply their `evidence` when defining a dynamic . The runtime will map the through the security policy to determine the granted permissions. Partially trusted callers must supply a null `evidence`. If `evidence` is `null`, the runtime copies the permission sets, that is, the current grant and deny sets, from the caller's to the dynamic being defined and marks policy as resolved. - - If the dynamic is saved to disk, subsequent loads will get grants based on policies associated with the location where the was saved. - - This method should only be used to define a dynamic assembly in the current application domain. For more information, see the method overload. - - - -## Examples - The following sample demonstrates the method and event. - - For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . The property of is . @@ -4236,35 +4035,7 @@ This method overload uses the information from the to synchronize the creation of modules, types, and members in the dynamic assembly; otherwise, . Defines a dynamic assembly using the specified name, access mode, storage directory, evidence, permission requests, and synchronization option. A dynamic assembly with the specified name and features. - - [!NOTE] -> During the development of code that emits dynamic assemblies, it is recommended that you include in `refusedPermissions`. Including in the `refusedPermissions` parameter ensures that the MSIL is verified. A limitation of this technique is that it also causes to be thrown when used with code that demands full trust. - - Only fully trusted callers can supply their evidence when defining a dynamic . The runtime will map the through the security policy to determine the granted permissions. Partially trusted callers must supply `null` for the `evidence` parameter. If `evidence` is `null`, the runtime copies the permission sets, that is, the current grant and deny sets, from the caller's to the dynamic being defined and marks policy as resolved. - - If the dynamic is saved to disk, subsequent loads will get grants based on policies associated with the location where the was saved. - - If `isSynchronized` is `true`, the following methods of the resulting will be synchronized: , , , , , and . If two of these methods are called on different threads, one will block until the other completes. - - - -## Examples - The following sample demonstrates the method and event. - - For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DefineDynamicAssembly/definedynamicassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . The property of is . @@ -4846,28 +4617,7 @@ This method overload uses the information from the Evidence for loading the assembly. Executes the assembly contained in the specified file, using the specified evidence. The value returned by the entry point of the assembly. - - method does not create a new process or application domain, and it does not execute the entry point method on a new thread. - - This method loads assemblies using the method. You can also execute assemblies using the method, which loads assemblies using the method. - - - -## Examples - The following sample demonstrates using one of the overloads of on two different domains. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/ExecuteAssembly/executeassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/ExecuteAssembly/executeassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/ExecuteAssembly/executeassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . @@ -5027,28 +4777,7 @@ This method overload uses the information from the The arguments to the entry point of the assembly. Executes the assembly contained in the specified file, using the specified evidence and arguments. The value returned by the entry point of the assembly. - - method. You can also execute assemblies using the method, which loads assemblies using the method. - - - -## Examples - The following sample demonstrates using one of the overloads of on two different domains. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/ExecuteAssembly/executeassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/ExecuteAssembly/executeassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/ExecuteAssembly/executeassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . @@ -5134,31 +4863,7 @@ This method overload uses the information from the Represents the hash algorithm used by the assembly manifest. Executes the assembly contained in the specified file, using the specified arguments, hash value, and hash algorithm. The value that is returned by the entry point of the assembly. - - method. You can also execute assemblies using the method, which loads assemblies using the method. - - - -## Examples - The following sample demonstrates using one of the overloads of on two different domains. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/ExecuteAssembly/executeassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/ExecuteAssembly/executeassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/ExecuteAssembly/executeassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . @@ -5222,28 +4927,7 @@ This method overload uses the information from the Represents the hash algorithm used by the assembly manifest. Executes the assembly contained in the specified file, using the specified evidence, arguments, hash value, and hash algorithm. The value returned by the entry point of the assembly. - - method. You can also execute assemblies using the method, which loads assemblies using the method. - - - -## Examples - The following sample demonstrates using one of the overloads of on two different domains. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/ExecuteAssembly/executeassembly.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/ExecuteAssembly/executeassembly.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/ExecuteAssembly/executeassembly.vb" id="Snippet1"::: - - ]]> - + To be added. is . @@ -7189,16 +6873,6 @@ The friendly name of the default application domain is the file name of the proc Beginning with the .NET Framework 4, the trust level of an assembly that is loaded by using this method is the same as the trust level of the application domain. -## Examples - The following sample demonstrates the use of loading a raw assembly. - - For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see [Assembly Names](/dotnet/standard/assembly/names). - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/Load/loadraw.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/Load/loadraw.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/Load/loadraw.vb" id="Snippet1"::: - ]]> @@ -7981,16 +7655,6 @@ The friendly name of the default application domain is the file name of the proc ## Remarks Call this method before an assembly is loaded into the in order for the security policy to have effect. - - -## Examples - The following example demonstrates how to use the method to set the security policy level of an application domain. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/SetAppDomainPolicy/adsetappdomainpolicy.vb" id="Snippet1"::: - ]]> @@ -8313,16 +7977,6 @@ The friendly name of the default application domain is the file name of the proc ## Remarks This method sets the property of the internal associated with this instance. - - -## Examples - This method is now obsolete, and should not be used for new development. The following example shows how to use the non-obsolete alternative, the property. For an explanation of this example, see the property or the property. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/DynamicDirectory/addynamicbase.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/DynamicDirectory/addynamicbase.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/DynamicDirectory/addynamicbase.vb" id="Snippet1"::: - ]]> The operation is attempted on an unloaded application domain. @@ -8471,16 +8125,6 @@ The friendly name of the default application domain is the file name of the proc ## Remarks For more information on shadow copying, see [Shadow Copying Assemblies](/dotnet/framework/app-domains/shadow-copy-assemblies). - - -## Examples - This method is now obsolete, and should not be used for new development. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/SetShadowCopyFiles/adproperties.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/SetShadowCopyFiles/adproperties.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/SetShadowCopyFiles/adproperties.vb" id="Snippet1"::: - ]]> The operation is attempted on an unloaded application domain. @@ -8568,16 +8212,6 @@ The friendly name of the default application domain is the file name of the proc For more information on shadow copying, see [Shadow Copying Assemblies](/dotnet/framework/app-domains/shadow-copy-assemblies). - - -## Examples - This method is now obsolete, and should not be used for new development. - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp" id="Snippet1"::: - :::code language="csharp" source="~/snippets/csharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.cs" id="Snippet1"::: - :::code language="fsharp" source="~/snippets/fsharp/System/AppDomain/SetShadowCopyPath/adshadowcopy.fs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/System/AppDomain/SetShadowCopyPath/adshadowcopy.vb" id="Snippet1"::: - ]]> The operation is attempted on an unloaded application domain. @@ -9263,7 +8897,7 @@ The following example demonstrates the , the target domain is marked for unloading. The dedicated thread attempts to unload the domain, and all threads in the domain are aborted. If a thread does not abort, for example because it is executing unmanaged code, or because it is executing a `finally` block, then after a period of time, a is thrown in the thread that originally called . If the thread that could not be aborted eventually ends, the target domain is not unloaded. Thus, in .NET Framework version 2.0 and later, `domain` is not guaranteed to unload, because it might not be possible to terminate executing threads. +There's a thread dedicated to unloading application domains. This improves reliability, especially when .NET Framework is hosted. When a thread calls , the target domain is marked for unloading. The dedicated thread attempts to unload the domain, and all threads in the domain are aborted. If a thread does not abort, for example because it is executing unmanaged code, or because it is executing a `finally` block, then after a period of time, a is thrown in the thread that originally called . If the thread that could not be aborted eventually ends, the target domain is not unloaded. Thus, `domain` is not guaranteed to unload, because it might not be possible to terminate executing threads. > [!NOTE] > In some cases, calling causes an immediate , for example if it is called in a finalizer. diff --git a/xml/System/String.xml b/xml/System/String.xml index 6664a5bf748..dd701a5aa50 100644 --- a/xml/System/String.xml +++ b/xml/System/String.xml @@ -4071,9 +4071,9 @@ The following example determines whether the string "fox" is a substring of a fa The `Copy` method returns a object that has the same value as the original string but represents a different object reference. It differs from an assignment operation, which assigns an existing string reference to an additional object variable. > [!IMPORTANT] -> Starting with .NET Core 3.0, this method is obsolete. However, we do not recommend its use in any .NET implementation. In particular, because of changes in string interning in .NET Core 3.0, in some cases the `Copy` method will not create a new string but will simply return a reference to an existing interned string. +> Starting with .NET Core 3.0, this method is obsolete. However, we do not recommend its use in any .NET implementation. In particular, because of changes in string interning in .NET Core 3.0, in some cases the `Copy` method doesn't create a new string but simply returns a reference to an existing interned string. -Depending on Why you want to call the `Copy` method, there are a number of alternatives: +Depending on *why* you want to call the `Copy` method, there are a number of alternatives: - If you want a different string instance to use in an operation that modifies the string, use the original string instance. Because strings are immutable, the string operation creates a new string instance, and the original string remains unaffected. In this case, you should not assign the new string reference to the original string variable. The following example provides an illustration. diff --git a/xml/System/Uri.xml b/xml/System/Uri.xml index 63aeb0e702e..65308fee545 100644 --- a/xml/System/Uri.xml +++ b/xml/System/Uri.xml @@ -429,14 +429,6 @@ If `dontEscape` is set to `false`, the constructor escapes any reserved characte This constructor does not ensure that the refers to an accessible resource. -## Examples - -The following example creates a instance for the URI `http://www.contoso.com/Hello%20World.htm`. Because the contained URI is completely escaped and is in canonical form, the `dontEscape` parameter can be set to `true`. - -:::code language="csharp" source="~/snippets/csharp/System/Uri/.ctor/source1.cs" id="Snippet1"::: -:::code language="fsharp" source="~/snippets/fsharp/System/Uri/.ctor/source1.fs" id="Snippet1"::: -:::code language="vb" source="~/snippets/visualbasic/System/Uri/.ctor/source1.vb" id="Snippet1"::: - ]]> @@ -951,14 +943,6 @@ The URI formed by combining and @@ -3722,13 +3706,6 @@ The following examples show a URI and the results of calling instances. The difference in the path information is written to the console. - - :::code language="csharp" source="~/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs" interactive="try-dotnet-method" id="Snippet3"::: - :::code language="fsharp" source="~/snippets/fsharp/System/Uri/CheckSchemeName/uriexamples.fs" id="Snippet3"::: - :::code language="vb" source="~/snippets/visualbasic/System/Uri/CheckSchemeName/uriexamples.vb" id="Snippet3"::: - ]]>