diff --git a/snippets/common/VS_Snippets_WebNet/Classic RequiredFieldValidator Example/Common/source.xml b/snippets/common/VS_Snippets_WebNet/Classic RequiredFieldValidator Example/Common/source.xml index 8b22af276da..211f403b997 100644 --- a/snippets/common/VS_Snippets_WebNet/Classic RequiredFieldValidator Example/Common/source.xml +++ b/snippets/common/VS_Snippets_WebNet/Classic RequiredFieldValidator Example/Common/source.xml @@ -6,7 +6,7 @@ void ValidateBtn_Click(Object sender, EventArgs e) { - if (Page.IsValid == true) { + if (Page.IsValid) { lblOutput.Text = "Required field is filled!"; } else { diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp index 0254a08a055..c0c1952f583 100644 --- a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp +++ b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp @@ -21,7 +21,7 @@ void main() threadId, nullptr, nullptr); // Poll while simulating work. - while(result->IsCompleted == false) + while(!result->IsCompleted) { Thread::Sleep(250); Console::Write("."); diff --git a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp b/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp index 516bbc78007..cc253499947 100644 --- a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp +++ b/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp @@ -16,7 +16,7 @@ static void Show( bool parseResult, String^ typeName, String^ parseValue ) String^ msgFailure = L"** Parse for {0} failed. Invalid input."; // - if ( parseResult == true ) + if ( parseResult ) Console::WriteLine( msgSuccess, typeName, parseValue ); else Console::WriteLine( msgFailure, typeName ); diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp index 3c0fc9ea0b5..23e5a5ec992 100644 --- a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp +++ b/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp @@ -8,7 +8,7 @@ int main() int x = 0; // - if ( (args->Length == 2) && (Int32::TryParse( args[ 1 ], x ) == true) && ((x >= 1) && (x <= 9)) ) + if ( (args->Length == 2) && (Int32::TryParse( args[ 1 ], x )) && ((x >= 1) && (x <= 9)) ) { for ( int i = 1; i <= x; i++ ) { diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp index 88be8906dc1..bf60e0028a7 100644 --- a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp +++ b/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp @@ -21,7 +21,7 @@ int main() { Console::WriteLine( m1, ((Console::CursorVisible == true) ? (String^)"VISIBLE" : "HIDDEN") ); s = Console::ReadLine(); - if ( String::IsNullOrEmpty( s ) == false ) + if ( !String::IsNullOrEmpty( s ) ) if ( s[ 0 ] == '+' ) Console::CursorVisible = true; else diff --git a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp b/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp index dfa09934fe2..8b8f1a06db8 100644 --- a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp +++ b/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp @@ -11,7 +11,7 @@ int main() // Your code could perform some useful task in the following loop. However, // for the sake of this example we'll merely pause for a quarter second. - while ( Console::KeyAvailable == false ) + while ( !Console::KeyAvailable ) Thread::Sleep( 250 ); cki = Console::ReadKey( true ); Console::WriteLine( "You pressed the '{0}' key.", cki.Key ); diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp index c4f43347958..ab6a5a558b4 100644 --- a/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp +++ b/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp @@ -9,7 +9,7 @@ int main() DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); // Create the directory only if it does not already exist. - if ( di->Exists == false ) + if ( !di->Exists ) di->Create(); diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp index c41ffca6df1..9a8cc79ec77 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp @@ -17,7 +17,7 @@ ref class MyFinalizeObject ~MyFinalizeObject() { - if ( hasFinalized == false ) + if ( !hasFinalized ) { Console::WriteLine( "First finalization" ); diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp index d4a9479288f..6f999eb0477 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp @@ -8,7 +8,7 @@ void main() unsigned int numbers = 0; Random^ rnd = gcnew Random(); - if (! UInt32::TryParse(line, numbers)) + if (!UInt32::TryParse(line, numbers)) numbers = 10; for (unsigned int ctr = 1; ctr <= numbers; ctr++) diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp index 118c51f44c6..1acc61d5d34 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp @@ -21,7 +21,7 @@ ref class CustomerFormatter : IFormatProvider, ICustomFormatter Object^ arg, IFormatProvider^ formatProvider) { - if (! this->Equals(formatProvider)) + if (!this->Equals(formatProvider)) { return nullptr; } diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp index 71878c05754..64c01acb0e7 100644 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp @@ -5,7 +5,7 @@ ref class FileUtilities public: static String^ AppendDirectorySeparator(String^ dir) { - if (! dir->Trim()->EndsWith(System::IO::Path::DirectorySeparatorChar.ToString())) + if (!dir->Trim()->EndsWith(System::IO::Path::DirectorySeparatorChar.ToString())) return dir->Trim() + System::IO::Path::DirectorySeparatorChar; else return dir; diff --git a/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp index ceda86a5cac..7064ebe4ae4 100644 --- a/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp @@ -166,7 +166,7 @@ public ref class MyTcpClientExample tcpClient->NoDelay = true; // Determines if the delay is enabled by using the NoDelay property. - if ( tcpClient->NoDelay == true ) + if ( tcpClient->NoDelay) Console::WriteLine( "The delay was set successfully to {0}", tcpClient->NoDelay ); diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp index c9c3ac9fdb2..c21d85aea5b 100644 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp @@ -41,7 +41,7 @@ int main() // // // Check whether the given XmlTextReader is readable. - if ( DiscoveryDocument::CanRead( myXmlTextReader ) == true ) + if ( DiscoveryDocument::CanRead( myXmlTextReader ) ) // Read the given XmlTextReader. myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp index 0fd88a3bd0e..b231f74defd 100644 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp @@ -48,7 +48,7 @@ int main() // DiscoveryExceptionDictionary^ myExceptionDictionary = myDiscoveryClientProtocol2->Errors; - if ( myExceptionDictionary->Contains( myUrlKey ) == true ) + if ( myExceptionDictionary->Contains( myUrlKey )) { Console::WriteLine( "'myExceptionDictionary' contains a discovery exception for the key '{0}'", myUrlKey ); } @@ -57,7 +57,7 @@ int main() Console::WriteLine( "'myExceptionDictionary' does not contain a discovery exception for the key '{0}'", myUrlKey ); } // - if ( myExceptionDictionary->Contains( myUrlKey ) == true ) + if ( myExceptionDictionary->Contains( myUrlKey ) ) { Console::WriteLine( "System generated exceptions." ); diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp index d41b2001023..75dcc210381 100644 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp @@ -38,7 +38,7 @@ int main() Console::WriteLine( "The number of elements in the collection after adding two elements to the collection: {0}", myDiscoveryReferenceCollection->Count ); // Call the Contains method. - if ( myDiscoveryReferenceCollection->Contains( myDiscoveryDocReference1 ) != true ) + if ( !myDiscoveryReferenceCollection->Contains( myDiscoveryDocReference1 ) ) { throw gcnew Exception( "Element not found in collection." ); } diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp index f89d4890e0e..76ced6cc1ed 100644 --- a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp @@ -115,7 +115,7 @@ ref class MyCustomChannel: public IChannelReceiver // Start listening to the port. virtual void StartListening( Object^ data ) { - if ( myListening == false ) + if ( !myListening ) { myTcpListener->Start(); myListening = true; @@ -128,7 +128,7 @@ ref class MyCustomChannel: public IChannelReceiver // Stop listening to the port. virtual void StopListening( Object^ data ) { - if ( myListening == true ) + if ( myListening ) { myTcpListener->Stop(); myListening = false; diff --git a/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp b/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp index d472ebf0ea7..d02ef6fb793 100644 --- a/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp @@ -107,7 +107,7 @@ ref class MyNewQueue // This exception would be thrown if there is no (further) acknowledgment message // with the specified correlation Id. Only output a message if there are no messages; // not if the loop has found at least one. - if ( found == false ) + if ( !found ) { Console::WriteLine( e->Message ); } diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp index 4908e655b4a..9ef51936eb2 100644 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp @@ -23,7 +23,7 @@ ref class MyNewQueue MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); // Send a message to the queue. - if ( myQueue->Transactional == true ) + if ( myQueue->Transactional) { // Create a transaction. MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp index 885fce58c6c..1e1f1b67acc 100644 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp @@ -23,7 +23,7 @@ ref class MyNewQueue MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); // Send a message to the queue. - if ( myQueue->Transactional == true ) + if ( myQueue->Transactional ) { // Create a transaction. MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp index 79d277ad91e..ec84a775eb9 100644 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp @@ -23,7 +23,7 @@ ref class MyNewQueue MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); // Send a message to the queue. - if ( myQueue->Transactional == true ) + if ( myQueue->Transactional ) { // Create a transaction. MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp index 512936db003..2398aece90c 100644 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp @@ -16,7 +16,7 @@ ref class MyNewQueue MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); // Send a message to the queue. - if ( myQueue->Transactional == true ) + if ( myQueue->Transactional ) { // Create a transaction. diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp index 43ec554b178..848433c877c 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp @@ -20,7 +20,7 @@ public ref class SelectedHostsCredentialPolicy: public ICredentialPolicy virtual bool ShouldSendCredential( Uri^ challengeUri, WebRequest^ request, NetworkCredential^ /*credential*/, IAuthenticationModule^ /*authModule*/ ) { Console::WriteLine( L"Checking custom credential policy." ); - if ( request->RequestUri->Host->Equals( L"www.contoso.com" ) || challengeUri->IsLoopback == true ) + if ( request->RequestUri->Host->Equals( L"www.contoso.com" ) || challengeUri->IsLoopback ) return true; return false; @@ -41,7 +41,7 @@ public ref class HttpsBasicCredentialPolicy: public IntranetZoneCredentialPolicy { Console::WriteLine( L"Checking custom credential policy for HTTPS and basic." ); bool answer = IntranetZoneCredentialPolicy::ShouldSendCredential( challengeUri, request, credential, authModule ); - if ( answer == true ) + if ( answer ) { Console::WriteLine( L"Sending credential for intranet resource." ); return answer; diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp index 779372bd986..1e751d2630a 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp @@ -458,7 +458,7 @@ public ref class FtpRequestTest // Example: ftp://contoso.com/someFile.txt. // // The command parameter identifies the command to send to the server. - if ( serverUri->ToLower()->StartsWith( Uri::UriSchemeFtp ) == false ) + if ( !serverUri->ToLower()->StartsWith( Uri::UriSchemeFtp ) ) { return false; } diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp index 7e698f37f1f..2a2ee1dc16b 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp @@ -823,7 +823,7 @@ void DisplayIPv4NetworkInterfaces() NetworkInterface ^ adapter = safe_cast(myEnum23->Current); // Only display informatin for interfaces that support IPv4. - if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) == false ) + if ( !adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) { continue; } @@ -875,7 +875,7 @@ void DisplayIPv6NetworkInterfaces() NetworkInterface ^ adapter = safe_cast(myEnum24->Current); // Only display informatin for interfaces that support IPv6. - if ( adapter->Supports( NetworkInterfaceComponent::IPv6 ) == false ) + if ( !adapter->Supports( NetworkInterfaceComponent::IPv6 ) ) { continue; } diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp index ed527a1ab65..7dc16c6e6be 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp @@ -16,7 +16,7 @@ void SampleTryCreate() // Parse the string and create a new Uri instance, if possible. Uri^ result; - if ( Uri::TryCreate( addressString, UriKind::RelativeOrAbsolute, result ) == true ) + if ( Uri::TryCreate( addressString, UriKind::RelativeOrAbsolute, result ) ) { // The call was successful. Write the URI address to the console. Console::Write( result ); diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp index 8a4cf1ac0b0..f7f450b51de 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp @@ -112,7 +112,7 @@ namespace Example // char testChar = 'e'; - if ( Uri::IsHexDigit( testChar ) == true ) + if ( Uri::IsHexDigit( testChar ) ) { Console::WriteLine( "'{0}' is the hexadecimal representation of {1}", testChar, Uri::FromHex( testChar ) ); @@ -236,7 +236,7 @@ namespace Example #if OLDMETHOD Uri^ result; - if ( Uri::TryParse( uriString, false, false, result ) == true ) + if ( Uri::TryParse( uriString, false, false, result ) ) { Console::WriteLine( "{0} is a valid Uri", result ); } diff --git a/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp index 6c1f42c7eb5..af770e04406 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp @@ -76,7 +76,7 @@ int main(array^ args) String^ answer = Console::ReadLine(); // If the user canceled the send, and mail hasn't been // sent yet,then cancel the pending operation. - if (answer->ToLower()->StartsWith("c") && mailSent == false) + if (answer->ToLower()->StartsWith("c") && !mailSent) { client->SendAsyncCancel(); } diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp index ef570eabf07..a1c1e3ff508 100644 --- a/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp @@ -302,7 +302,7 @@ public ref class SslTcpClient // while waiting for the asynchronous calls to complete. System::Threading::Thread::Sleep( 100 ); } - while ( complete != true && Console::KeyAvailable == false ); + while ( !complete && !Console::KeyAvailable ); if ( Console::KeyAvailable ) { diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp index 1a8d04b1690..6dc493cb959 100644 --- a/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp @@ -51,7 +51,7 @@ int main() // // - if ( myOperationCollection->Contains( myOperation ) == true ) + if ( myOperationCollection->Contains( myOperation )) { Console::WriteLine( "The index of the added 'myOperation' operation is : {0}", myOperationCollection->IndexOf( myOperation ) ); } diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp index d2a453944ff..051aa44c1c0 100644 --- a/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp @@ -93,7 +93,7 @@ int main() // // - if ( myOperationMessageCollection->Contains( myOperationMessage ) == true ) + if ( myOperationMessageCollection->Contains( myOperationMessage )) { int myIndex = myOperationMessageCollection->IndexOf( myOperationMessage ); Console::WriteLine( " The index of the Add operation message in the collection is : {0}", myIndex ); diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp index 2c6dda9ea2a..847ace50a90 100644 --- a/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp @@ -345,7 +345,7 @@ void RunUdpTests() Thread^ myThread1 = gcnew Thread( myThreadDelegate ); myThread1->Start(); - while ( myThread1->IsAlive == true ) + while ( myThread1->IsAlive ) { NeedForDelegates::SendTo1(); } @@ -354,7 +354,7 @@ void RunUdpTests() Console::WriteLine( "UDP test2" ); Thread^ myThread2 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom2 ) ); myThread2->Start(); - while ( myThread2->IsAlive == true ) + while ( myThread2->IsAlive ) { NeedForDelegates::SendTo2(); } @@ -363,7 +363,7 @@ void RunUdpTests() Console::WriteLine( "UDP test3" ); Thread^ myThread3 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom3 ) ); myThread3->Start(); - while ( myThread3->IsAlive == true ) + while ( myThread3->IsAlive ) { NeedForDelegates::SendTo3(); } @@ -372,7 +372,7 @@ void RunUdpTests() Console::WriteLine( "UDP test4" ); Thread^ myThread4 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom4 ) ); myThread4->Start(); - while ( myThread4->IsAlive == true ) + while ( myThread4->IsAlive ) { NeedForDelegates::SendTo4(); } diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp index 8cd7216c8d8..1adf2104e7e 100644 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp @@ -143,7 +143,7 @@ int main() } String^ proxy = args[ 1 ]; - if ( (rex->Match(proxy))->Success != true ) + if ( (!rex->Match(proxy))->Success) { Console::WriteLine( "Input string format not allowed." ); return -1; diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp index 75524420dc3..71b43149394 100644 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp @@ -181,7 +181,7 @@ int main(array^ args) } String^ proxy = args[1]; - if ((expression->Match(proxy))->Success != true) + if (!(expression->Match(proxy))->Success) { Console::WriteLine("Input string format not allowed."); return 0; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp index bf0a5213f5d..4af06166f99 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp @@ -26,7 +26,7 @@ public ref class Form1: public Form // Prints the type of each attribute in the collection. Object^ myAttribute; System::Text::StringBuilder^ text = gcnew System::Text::StringBuilder; - while ( ie->MoveNext() == true ) + while ( ie->MoveNext() ) { myAttribute = ie->Current; text->Append( myAttribute ); diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp index d7fe355fbbb..ccce5e98d91 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp @@ -97,7 +97,7 @@ public ref class Form1: public System::Windows::Forms::Form { if ( !textBox1->Text->Equals( "" ) ) { - if ( checkedListBox1->CheckedItems->Contains( textBox1->Text ) == false ) + if ( !checkedListBox1->CheckedItems->Contains( textBox1->Text ) ) checkedListBox1->Items->Add( textBox1->Text, CheckState::Checked ); textBox1->Text = ""; } @@ -154,7 +154,7 @@ public ref class Form1: public System::Windows::Forms::Form IEnumerator^ myEnumerator; myEnumerator = checkedListBox1->CheckedIndices->GetEnumerator(); int y; - while ( myEnumerator->MoveNext() != false ) + while ( myEnumerator->MoveNext() ) { y = safe_cast(myEnumerator->Current); checkedListBox1->SetItemChecked( y, false ); diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp index bda542d2c97..73599048694 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp @@ -25,7 +25,7 @@ public ref class Form1: public Form // Prints the name of each event in the collection. Object^ myEvent; - while ( ie->MoveNext() == true ) + while ( ie->MoveNext() ) { myEvent = ie->Current; textBox1->Text = String::Concat( textBox1->Text, myEvent, "\n" ); diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp index e56ea58f4e4..fdd6cb481c6 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp @@ -137,7 +137,7 @@ namespace myImageRotator private: void button1_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) { - if(imageList1->Images->Empty != true) + if(!imageList1->Images->Empty) { if(imageList1->Images->Count-1 > currentImage) { diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp index 637e3771a7b..b8f96a7d3a5 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp @@ -21,7 +21,7 @@ public ref class Form1: public Form { // Determine if menuItem2 is a parent menu. - if ( menuItem2->IsParent == true ) + if ( menuItem2->IsParent) { // Loop through all the submenus. diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp index 0d82eff0c21..3e53b5db8c4 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp @@ -22,11 +22,11 @@ public ref class Form1: public Form public: void myPrint() { - if ( useMyPrintController == true ) + if ( useMyPrintController) { myPrintDocument->PrintController = gcnew myControllerImplementation; - if ( wantsStatusDialog == true ) + if ( wantsStatusDialog) { myPrintDocument->PrintController = gcnew PrintControllerWithStatusDialog( diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp index a23af6a4698..10a99bf32bb 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp @@ -27,7 +27,7 @@ public ref class Form1: public Form // Prints the name of each property in the collection. Object^ myProperty; - while ( ie->MoveNext() == true ) + while ( ie->MoveNext() ) { myProperty = ie->Current; textBox1->Text = textBox1->Text + myProperty + "\n"; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp index 527da0905fc..c57eacb6a04 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp @@ -115,7 +115,7 @@ namespace CSExample { System::Drawing::Font^ currentFont = richTextBox1->SelectionFont; System::Drawing::FontStyle newFontStyle; - if ( richTextBox1->SelectionFont->Bold == true ) + if (richTextBox1->SelectionFont->Bold) { newFontStyle = FontStyle::Regular; } diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp index 693eb9b8722..b5ccb472733 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp @@ -38,7 +38,7 @@ public ref class Form1: public Form void Menu_Paste( System::Object^ sender, System::EventArgs^ e ) { // Determine if there is any text in the Clipboard to paste into the text box. - if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text ) == true ) + if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) { // Determine if any text is selected in the text box. if ( textBox1->SelectionLength > 0 ) @@ -60,7 +60,7 @@ public ref class Form1: public Form void Menu_Undo( System::Object^ sender, System::EventArgs^ e ) { // Determine if last operation can be undone in text box. - if ( textBox1->CanUndo == true ) + if ( textBox1->CanUndo) { // Undo the last operation. textBox1->Undo(); diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp index 7b9b2ef5ad3..6316bd30260 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp @@ -22,7 +22,7 @@ public ref class Form1: public Form { Int64 val; // Check the flag to prevent code re-entry. - if ( flag == false ) + if ( !flag ) { // Set the flag to True to prevent re-entry of the code below. flag = true; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp index cd571e3f3ea..98dfc092c04 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp @@ -36,7 +36,7 @@ public ref class Form1: public Form void Menu_Paste( System::Object^ sender, System::EventArgs^ e ) { // Determine if there is any text in the Clipboard to paste into the text box. - if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text ) == true ) + if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) { // Determine if any text is selected in the text box. if ( textBox1->SelectionLength > 0 ) @@ -57,7 +57,7 @@ public ref class Form1: public Form void Menu_Undo( System::Object^ sender, System::EventArgs^ e ) { // Determine if last operation can be undone in text box. - if ( textBox1->CanUndo == true ) + if ( textBox1->CanUndo) { // Undo the last operation. textBox1->Undo(); diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp index 20ee25b1870..b8c76b655e0 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp @@ -38,7 +38,7 @@ public ref class Form1: public Form void Menu_Paste( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) { // Determine if there is any text in the Clipboard to paste into the text box. - if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text ) == true ) + if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) { // Determine if any text is selected in the text box. if ( textBox1->SelectionLength > 0 ) @@ -59,7 +59,7 @@ public ref class Form1: public Form void Menu_Undo( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) { // Determine if last operation can be undone in text box. - if ( textBox1->CanUndo == true ) + if ( textBox1->CanUndo) { // Undo the last operation. textBox1->Undo(); diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp index b068ec23fd7..0f1f797d060 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp @@ -49,7 +49,7 @@ public ref class Class1 myTimer->Start(); // Runs the timer, and raises the event. - while ( exitFlag == false ) + while ( !exitFlag ) { // Processes all the events in the queue. diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp index e149dc7bc97..c0d2df832d8 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp @@ -115,7 +115,7 @@ public ref class Form1: public System::Windows::Forms::Form void textBox1_KeyPress( Object^ /*sender*/, System::Windows::Forms::KeyPressEventArgs^ e ) { // Check for the flag being set in the KeyDown event. - if ( nonNumberEntered == true ) + if ( nonNumberEntered) { // Stop the character from being entered into the control since it is non-numerical. e->Handled = true; } diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp index a0414d5e9ae..0a744e45790 100644 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp @@ -196,7 +196,7 @@ namespace SampleDataGridTableStyle { myDataGridTableStyle1 = gcnew DataGridTableStyle; mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting ); - if ( myDataGridTableStyle1->AllowSorting == true ) + if ( myDataGridTableStyle1->AllowSorting) { btnApplyStyles->Text = "Remove Sorting"; } @@ -217,7 +217,7 @@ namespace SampleDataGridTableStyle void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { - if ( myDataGridTableStyle1->AllowSorting == true ) + if ( myDataGridTableStyle1->AllowSorting) { // Remove sorting. myDataGridTableStyle1->AllowSorting = false; diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp index a75fecbfe5c..c677cd04ee9 100644 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp @@ -202,7 +202,7 @@ namespace SampleDataGridTableStyle { myDataGridTableStyle1 = gcnew DataGridTableStyle; myHeaderLabel->Text = String::Concat( "Header Status : ", myDataGridTableStyle1->ColumnHeadersVisible ); - if ( myDataGridTableStyle1->ColumnHeadersVisible == true ) + if (myDataGridTableStyle1->ColumnHeadersVisible) { btnheader->Text = "Remove Header"; } @@ -263,7 +263,7 @@ namespace SampleDataGridTableStyle void btnheader_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { - if ( myDataGridTableStyle1->ColumnHeadersVisible == true ) + if (myDataGridTableStyle1->ColumnHeadersVisible) { myDataGridTableStyle1->ColumnHeadersVisible = false; btnheader->Text = "Add Header"; diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp index 97729dfa60d..5726cddc1ae 100644 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp @@ -164,7 +164,7 @@ public ref class MyDataGrid: public Form private: void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { - if ( myDataGrid->AllowNavigation == true ) + if ( myDataGrid->AllowNavigation ) myDataGrid->AllowNavigation = false; else myDataGrid->AllowNavigation = true; diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp index 00cdb4f9266..6c49a0581e4 100644 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp @@ -169,7 +169,7 @@ public ref class MyDataGrid: public Form // Set the 'CaptionVisible' property on click of a button. void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { - if ( myDataGrid->CaptionVisible == true ) + if (myDataGrid->CaptionVisible) myDataGrid->CaptionVisible = false; else myDataGrid->CaptionVisible = true; diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp index 4cf2a59c55f..d9bfd97285c 100644 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp @@ -174,7 +174,7 @@ public ref class MyForm: public Form // Set the 'ParentRowsVisible' property on click of a button. void ToggleVisible_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) { - if ( myDataGrid->ParentRowsVisible == true ) + if (myDataGrid->ParentRowsVisible) myDataGrid->ParentRowsVisible = false; else myDataGrid->ParentRowsVisible = true; diff --git a/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp index c7c5d0265a8..c14974a24ed 100644 --- a/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp @@ -83,7 +83,7 @@ namespace DlgOpenFileReadOnly_CS { // If ReadOnlyChecked is true, uses the OpenFile method to // open the file with read/only access. - if ( dlgOpenFile->ReadOnlyChecked == true ) + if ( dlgOpenFile->ReadOnlyChecked ) { return dynamic_cast(dlgOpenFile->OpenFile()); } diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp index 3a57be14948..ed746f91afa 100644 --- a/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp @@ -101,7 +101,7 @@ namespace FormModalEx myForm->Show(); // Determine if the form is modal. - if ( myForm->Modal == false ) + if ( !myForm->Modal ) { // Change borderstyle and make it not a top level window. myForm->FormBorderStyle = ::FormBorderStyle::FixedToolWindow; diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp index 33879cbe214..b7d3456a1d0 100644 --- a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp @@ -148,7 +148,7 @@ public ref class Form1: public System::Windows::Forms::Form private: void PopupMyMenu( Object^ /*sender*/, System::EventArgs^ /*e*/ ) { - if ( textBox1->Enabled == false || textBox1->Focused == false || textBox1->SelectedText->Length == 0 ) + if ( !textBox1->Enabled || !textBox1->Focused || textBox1->SelectedText->Length == 0 ) { menuCut->Enabled = false; menuCopy->Enabled = false; diff --git a/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp b/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp index 5774ba827d9..40ce708e483 100644 --- a/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp @@ -277,7 +277,7 @@ public ref class Form1: public System::Windows::Forms::Form private: void checkBox1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) { - if ( checkBox1->Checked == true ) + if ( checkBox1->Checked) monthCalendar1->ShowToday = true; else monthCalendar1->ShowToday = false; @@ -288,7 +288,7 @@ public ref class Form1: public System::Windows::Forms::Form private: void checkBox2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) { - if ( checkBox2->Checked == true ) + if ( checkBox2->Checked) monthCalendar1->ShowTodayCircle = true; else monthCalendar1->ShowTodayCircle = false; @@ -391,7 +391,7 @@ public ref class Form1: public System::Windows::Forms::Form { StreamWriter^ myOutputStream = File::CreateText( "myDates.txt" ); IEnumerator^ myDates = listBox1->Items->GetEnumerator(); - while ( myDates->MoveNext() == true ) + while ( myDates->MoveNext() ) { myOutputStream->WriteLine( myDates->Current ); } diff --git a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp index 20d16f1d3fd..2eb8b3629e8 100644 --- a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp @@ -157,7 +157,7 @@ public ref class MyDataGridClass_FlatMode_ReadOnly: public Form void myDataGrid_FlatModeChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) { String^ strMessage = "false"; - if ( myDataGrid->FlatMode == true ) + if ( myDataGrid->FlatMode) strMessage = "true"; MessageBox::Show( "Flat mode changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); @@ -166,7 +166,7 @@ public ref class MyDataGridClass_FlatMode_ReadOnly: public Form // Toggle the 'FlatMode'. void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { - if ( myDataGrid->FlatMode == true ) + if ( myDataGrid->FlatMode) myDataGrid->FlatMode = false; else myDataGrid->FlatMode = true; @@ -185,7 +185,7 @@ public ref class MyDataGridClass_FlatMode_ReadOnly: public Form void myDataGrid_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) { String^ strMessage = "false"; - if ( myDataGrid->ReadOnly == true ) + if ( myDataGrid->ReadOnly) strMessage = "true"; MessageBox::Show( "Read only changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); @@ -194,7 +194,7 @@ public ref class MyDataGridClass_FlatMode_ReadOnly: public Form // Toggle the 'ReadOnly' property. void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { - if ( myDataGrid->ReadOnly == true ) + if ( myDataGrid->ReadOnly) myDataGrid->ReadOnly = false; else myDataGrid->ReadOnly = true; diff --git a/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp index 4af0f4bc225..b7cf840a387 100644 --- a/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp @@ -75,7 +75,7 @@ public ref class Form1: public System::Windows::Forms::Form for ( int x = 1; x <= filenames->Length; x++ ) { // Copy the file and increment the ProgressBar if successful. - if ( CopyFile( filenames[ x - 1 ] ) == true ) + if ( CopyFile( filenames[ x - 1 ] )) { // Perform the increment on the ProgressBar. pBar1->PerformStep(); diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp index c67fbfda69b..52a2cac1209 100644 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp @@ -105,7 +105,7 @@ public ref class Form1: public System::Windows::Forms::Form void RedoAllButDeletes() { // Determines if a Redo operation can be performed. - if ( richTextBox1->CanRedo == true ) + if ( richTextBox1->CanRedo ) { // Determines if the redo operation deletes text. if ( !richTextBox1->RedoActionName->Equals( "Delete" ) ) diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp index 69a7397dd5b..022de159c08 100644 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp @@ -480,7 +480,7 @@ public ref class Form1: public System::Windows::Forms::Form GraphicsPath^ myPath = gcnew GraphicsPath; myPath->AddLine( 20, 20, 100, 20 ); PointF lastPoint = myPath->GetLastPoint(); - if ( lastPoint.IsEmpty == false ) + if ( !lastPoint.IsEmpty ) { String^ lastPointXString = lastPoint.X.ToString(); String^ lastPointYString = lastPoint.Y.ToString(); diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp index f35c6df0167..56d2b0ad062 100644 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp @@ -51,7 +51,7 @@ public ref class SortByLengthListBox: public ListBox counter -= 1; } } - while ( (swapped == true) ); + while ( swapped ); } } }; diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp index 5be651a12c2..500deda2bdf 100644 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp @@ -87,7 +87,7 @@ public ref class Form1: public System::Windows::Forms::Form void Player_LoadCompleted( Object^ /*sender*/, System::ComponentModel::AsyncCompletedEventArgs^ /*e*/ ) { - if (this->Player->IsLoadCompleted == true) + if (this->Player->IsLoadCompleted) { this->Player->PlaySync(); } diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp index 9d3a1bb3916..48b77946c90 100644 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp @@ -143,7 +143,7 @@ namespace TrackBarRendererSample { return; } - if (thumbClicked == true) + if (thumbClicked) { if (e->Location.X > trackRectangle.X && e->Location.X < (trackRectangle.X + @@ -167,7 +167,7 @@ namespace TrackBarRendererSample return; } // The user is moving the thumb. - if (thumbClicked == true) + if (thumbClicked) { // Track movements to the next tick to the right, if // the cursor has moved halfway to the next tick. diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp index bf7cbb571b4..08971375d11 100644 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp @@ -30,7 +30,7 @@ public ref class Form1: public Form // Checks the tabControl1 controls collection for tabPage3. // Adds tabPage3 to tabControl1 if it is not in the collection. - if ( tabControl1->TabPages->Contains( tabPage3 ) == false ) + if ( !tabControl1->TabPages->Contains( tabPage3 ) ) this->tabControl1->TabPages->Add( tabPage3 ); this->tabControl1->Location = Point(25,25); diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp index d3aa1154e37..84935312288 100644 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp @@ -18,7 +18,7 @@ public ref class Form1: public Form Label^ label1 = gcnew Label; // Determines if the tabControl1 controls collection is read-only. - if ( tabControl1->TabPages->IsReadOnly == true ) + if (tabControl1->TabPages->IsReadOnly) label1->Text = "The tabControl1 controls collection is read-only."; else label1->Text = "The tabControl1 controls collection is not read-only."; diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp index c338294ee7d..d4df63dad0d 100644 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp @@ -113,7 +113,7 @@ public ref class myTreeNodeCollectionForm: public Form while ( myEnum->MoveNext() ) { TreeNode^ myTreeNode = safe_cast(myEnum->Current); - if ( myTreeNode->IsSelected == true ) + if ( myTreeNode->IsSelected) { // Remove the selected node from the 'myTreeViewBase' TreeView. diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp index 310e114a0a0..0cdb9542ff0 100644 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp @@ -132,7 +132,7 @@ public ref class MyTreeNode_FirstNode: public Form // Begin repainting the TreeView. myTreeView->EndUpdate(); - if ( myTreeView->Nodes[ 0 ]->IsExpanded == false ) + if ( !myTreeView->Nodes[ 0 ]->IsExpanded ) myTreeView->Nodes[ 0 ]->Expand(); } @@ -196,7 +196,7 @@ public ref class MyTreeNode_FirstNode: public Form { // If the check box is checked, expand all the tree nodes. - if ( myCheckBox->Checked == true ) + if ( myCheckBox->Checked ) { myTreeView->ExpandAll(); } @@ -239,7 +239,7 @@ public ref class MyTreeNode_FirstNode: public Form myTreeView->SelectedNode = mySelectedNode; myTreeView->LabelEdit = true; mySelectedNode->BeginEdit(); - if ( mySelectedNode->IsEditing == true ) + if ( mySelectedNode->IsEditing ) MessageBox::Show( String::Concat( "The name of node being edited: ", mySelectedNode->Text ) ); mySelectedNode->BeginEdit(); } diff --git a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp index 93100c5d8dd..9b45b0f17f2 100644 --- a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp +++ b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp @@ -34,7 +34,7 @@ namespace SDKSample { PngBitmapDecoder^ pngDecoder = gcnew PngBitmapDecoder(pngStream, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); BitmapFrame^ pngFrame = pngDecoder->Frames[0]; InPlaceBitmapMetadataWriter^ pngInplace = pngFrame->CreateInPlaceBitmapMetadataWriter(); - if (pngInplace->TrySave() == true) + if (pngInplace->TrySave()) { pngInplace->SetQuery("/Text/Description", "Have a nice day."); } diff --git a/snippets/csharp/Microsoft.Win32/FileDialog/DefaultExt/Window1.xaml.cs b/snippets/csharp/Microsoft.Win32/FileDialog/DefaultExt/Window1.xaml.cs index 74183a5e3cc..cc327d7366e 100644 --- a/snippets/csharp/Microsoft.Win32/FileDialog/DefaultExt/Window1.xaml.cs +++ b/snippets/csharp/Microsoft.Win32/FileDialog/DefaultExt/Window1.xaml.cs @@ -1,14 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace CSharp { @@ -74,7 +66,7 @@ void openFileDialog_Click(object sender, RoutedEventArgs e) Nullable result = dlg.ShowDialog(); // Process open file dialog box results - if (result == true) + if (result.Value) { // Open document string filename = dlg.FileName; @@ -95,7 +87,7 @@ void saveFileDialog_Click(object sender, RoutedEventArgs e) Nullable result = dlg.ShowDialog(); // Process save file dialog box results - if (result == true) + if (result.Value) { // Save document string filename = dlg.FileName; @@ -115,11 +107,11 @@ void printDialog_Click(object sender, RoutedEventArgs e) Nullable result = dlg.ShowDialog(); // Process save file dialog box results - if (result == true) + if (result.Value) { // Print document } // } } -} \ No newline at end of file +} diff --git a/snippets/csharp/Microsoft.Win32/IntranetZoneCredentialPolicy/Overview/websample.cs b/snippets/csharp/Microsoft.Win32/IntranetZoneCredentialPolicy/Overview/websample.cs index f3f75b910ba..beb614e1820 100644 --- a/snippets/csharp/Microsoft.Win32/IntranetZoneCredentialPolicy/Overview/websample.cs +++ b/snippets/csharp/Microsoft.Win32/IntranetZoneCredentialPolicy/Overview/websample.cs @@ -22,7 +22,7 @@ public virtual bool ShouldSendCredential(Uri challengeUri, { Console.WriteLine("Checking custom credential policy."); if (request.RequestUri.Host == "www.contoso.com" || - challengeUri.IsLoopback == true) + challengeUri.IsLoopback) return true; return false; @@ -49,7 +49,7 @@ public override bool ShouldSendCredential(Uri challengeUri, Console.WriteLine("Checking custom credential policy for HTTPS and basic."); bool answer = base.ShouldSendCredential(challengeUri, request, credential, authModule); - if (answer == true) + if (answer ) { Console.WriteLine("Sending credential for intranet resource."); return answer; diff --git a/snippets/csharp/System.ComponentModel.Design/DesignerTransaction/Overview/source.cs b/snippets/csharp/System.ComponentModel.Design/DesignerTransaction/Overview/source.cs index 88b69062bf4..4182dbf52e2 100644 --- a/snippets/csharp/System.ComponentModel.Design/DesignerTransaction/Overview/source.cs +++ b/snippets/csharp/System.ComponentModel.Design/DesignerTransaction/Overview/source.cs @@ -108,7 +108,7 @@ public override void Initialize(System.ComponentModel.IComponent component) private void LinkDTNotifications(object sender, EventArgs e) { - if(notification_mode == false) + if(!notification_mode) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); if(host != null) diff --git a/snippets/csharp/System.ComponentModel/AttributeCollection/GetEnumerator/source.cs b/snippets/csharp/System.ComponentModel/AttributeCollection/GetEnumerator/source.cs index a58fad76ec0..11ebb10cd88 100644 --- a/snippets/csharp/System.ComponentModel/AttributeCollection/GetEnumerator/source.cs +++ b/snippets/csharp/System.ComponentModel/AttributeCollection/GetEnumerator/source.cs @@ -17,7 +17,7 @@ private void MyEnumerator() { // Prints the type of each attribute in the collection. Object myAttribute; - while(ie.MoveNext()==true) { + while(ie.MoveNext()) { myAttribute = ie.Current; textBox1.Text += myAttribute.ToString(); textBox1.Text += '\n'; diff --git a/snippets/csharp/System.ComponentModel/BackgroundWorker/Overview/form1.cs b/snippets/csharp/System.ComponentModel/BackgroundWorker/Overview/form1.cs index 34b6579078b..45a6dedd591 100644 --- a/snippets/csharp/System.ComponentModel/BackgroundWorker/Overview/form1.cs +++ b/snippets/csharp/System.ComponentModel/BackgroundWorker/Overview/form1.cs @@ -16,7 +16,7 @@ public Form1() private void startAsyncButton_Click(object sender, EventArgs e) { - if (backgroundWorker1.IsBusy != true) + if (!backgroundWorker1.IsBusy) { // Start the asynchronous operation. backgroundWorker1.RunWorkerAsync(); @@ -25,7 +25,7 @@ private void startAsyncButton_Click(object sender, EventArgs e) private void cancelAsyncButton_Click(object sender, EventArgs e) { - if (backgroundWorker1.WorkerSupportsCancellation == true) + if (backgroundWorker1.WorkerSupportsCancellation) { // Cancel the asynchronous operation. backgroundWorker1.CancelAsync(); @@ -39,7 +39,7 @@ private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) for (int i = 1; i <= 10; i++) { - if (worker.CancellationPending == true) + if (worker.CancellationPending) { e.Cancel = true; break; @@ -62,7 +62,7 @@ private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEve // This event handler deals with the results of the background operation. private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - if (e.Cancelled == true) + if (e.Cancelled) { resultLabel.Text = "Canceled!"; } diff --git a/snippets/csharp/System.ComponentModel/BindingListT/FindCore/Form1.cs b/snippets/csharp/System.ComponentModel/BindingListT/FindCore/Form1.cs index 761b8193859..81b4b1d6062 100644 --- a/snippets/csharp/System.ComponentModel/BindingListT/FindCore/Form1.cs +++ b/snippets/csharp/System.ComponentModel/BindingListT/FindCore/Form1.cs @@ -64,7 +64,7 @@ void Form1_Load(object sender, EventArgs e) // private void button1_Click(object sender, EventArgs e) { - if (binding1.SupportsSearching != true) + if (!binding1.SupportsSearching) { MessageBox.Show("Cannot search the list."); } diff --git a/snippets/csharp/System.ComponentModel/EventDescriptorCollection/GetEnumerator/source.cs b/snippets/csharp/System.ComponentModel/EventDescriptorCollection/GetEnumerator/source.cs index d21ec18315c..3c34871ebf5 100644 --- a/snippets/csharp/System.ComponentModel/EventDescriptorCollection/GetEnumerator/source.cs +++ b/snippets/csharp/System.ComponentModel/EventDescriptorCollection/GetEnumerator/source.cs @@ -17,7 +17,7 @@ private void MyEnumerator() { // Prints the name of each event in the collection. Object myEvent; - while(ie.MoveNext() == true) { + while(ie.MoveNext()) { myEvent = ie.Current; textBox1.Text += myEvent.ToString() + '\n'; } diff --git a/snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/GetEnumerator/source.cs b/snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/GetEnumerator/source.cs index c7e7a928d78..1cd439ec29f 100644 --- a/snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/GetEnumerator/source.cs +++ b/snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/GetEnumerator/source.cs @@ -18,7 +18,7 @@ private void MyEnumerator() { // Prints the name of each property in the collection. Object myProperty; - while(ie.MoveNext()==true) { + while(ie.MoveNext()) { myProperty = ie.Current; textBox1.Text += myProperty.ToString() + '\n'; } diff --git a/snippets/csharp/System.Configuration.Install/InstallContext/Overview/installcontext_installcontext.cs b/snippets/csharp/System.Configuration.Install/InstallContext/Overview/installcontext_installcontext.cs index c7a73c1ec1c..35e5f071b56 100644 --- a/snippets/csharp/System.Configuration.Install/InstallContext/Overview/installcontext_installcontext.cs +++ b/snippets/csharp/System.Configuration.Install/InstallContext/Overview/installcontext_installcontext.cs @@ -47,7 +47,7 @@ public override void Install( IDictionary mySavedState ) // // // Check whether the "LogtoConsole" parameter has been set. - if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true ) + if ( myInstallContext.IsParameterTrue( "LogtoConsole" )) { // Display the message to the console and add it to the logfile. myInstallContext.LogMessage( "The 'Install' method has been called" ); @@ -69,7 +69,7 @@ public override void Uninstall( IDictionary mySavedState ) public override void Rollback( IDictionary mySavedState ) { base.Rollback( mySavedState ); - if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true ) + if ( myInstallContext.IsParameterTrue( "LogtoConsole" )) { myInstallContext.LogMessage( "The 'Rollback' method has been called" ); } @@ -80,7 +80,7 @@ public override void Rollback( IDictionary mySavedState ) public override void Commit( IDictionary mySavedState ) { base.Commit( mySavedState ); - if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true ) + if ( myInstallContext.IsParameterTrue( "LogtoConsole" )) { myInstallContext.LogMessage( "The 'Commit' method has been called" ); } diff --git a/snippets/csharp/System.Data.EntityClient/EntityConnection/ConnectionString/Program.cs b/snippets/csharp/System.Data.EntityClient/EntityConnection/ConnectionString/Program.cs index 18b39536573..ad9c59c09c9 100644 --- a/snippets/csharp/System.Data.EntityClient/EntityConnection/ConnectionString/Program.cs +++ b/snippets/csharp/System.Data.EntityClient/EntityConnection/ConnectionString/Program.cs @@ -740,7 +740,7 @@ static void StructuralTypeVisitRecord(IExtendedDataRecord record) // If the field is flagged as DbNull, the shape of the value is undetermined. // An attempt to get such a value may trigger an exception. - if (record.IsDBNull(fieldIndex) == false) + if (!record.IsDBNull(fieldIndex)) { BuiltInTypeKind fieldTypeKind = record.DataRecordInfo.FieldMetadata[fieldIndex]. FieldType.TypeUsage.EdmType.BuiltInTypeKind; @@ -805,7 +805,7 @@ static void RefTypeVisitRecord(IExtendedDataRecord record) // If the field is flagged as DbNull, the shape of the value is undetermined. // An attempt to get such a value may trigger an exception. - if (record.IsDBNull(fieldIndex) == false) + if (!record.IsDBNull(fieldIndex)) { BuiltInTypeKind fieldTypeKind = record.DataRecordInfo.FieldMetadata[fieldIndex]. FieldType.TypeUsage.EdmType.BuiltInTypeKind; diff --git a/snippets/csharp/System.Data.Linq.Mapping/AssociationAttribute/Overview/northwind.cs b/snippets/csharp/System.Data.Linq.Mapping/AssociationAttribute/Overview/northwind.cs index 8e7305d58e5..57e40711006 100644 --- a/snippets/csharp/System.Data.Linq.Mapping/AssociationAttribute/Overview/northwind.cs +++ b/snippets/csharp/System.Data.Linq.Mapping/AssociationAttribute/Overview/northwind.cs @@ -508,7 +508,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -543,7 +543,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1541,7 +1541,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1756,7 +1756,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1790,7 +1790,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1996,7 +1996,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2030,7 +2030,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2478,7 +2478,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2513,7 +2513,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2547,7 +2547,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2903,7 +2903,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2937,7 +2937,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3730,7 +3730,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq.Mapping/ColumnAttribute/AutoSync/northwind.cs b/snippets/csharp/System.Data.Linq.Mapping/ColumnAttribute/AutoSync/northwind.cs index 16328097639..14c2544a58e 100644 --- a/snippets/csharp/System.Data.Linq.Mapping/ColumnAttribute/AutoSync/northwind.cs +++ b/snippets/csharp/System.Data.Linq.Mapping/ColumnAttribute/AutoSync/northwind.cs @@ -506,7 +506,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -540,7 +540,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1576,7 +1576,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1791,7 +1791,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1825,7 +1825,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2031,7 +2031,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2065,7 +2065,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2513,7 +2513,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2547,7 +2547,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2581,7 +2581,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2943,7 +2943,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2977,7 +2977,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3770,7 +3770,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq.Mapping/UpdateCheck/Overview/northwind.cs b/snippets/csharp/System.Data.Linq.Mapping/UpdateCheck/Overview/northwind.cs index 1809d690a08..00d6f18f673 100644 --- a/snippets/csharp/System.Data.Linq.Mapping/UpdateCheck/Overview/northwind.cs +++ b/snippets/csharp/System.Data.Linq.Mapping/UpdateCheck/Overview/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3723,7 +3723,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/ChangeConflictCollection/Overview/northwind.cs b/snippets/csharp/System.Data.Linq/ChangeConflictCollection/Overview/northwind.cs index 13bd829fd38..1c51514232d 100644 --- a/snippets/csharp/System.Data.Linq/ChangeConflictCollection/Overview/northwind.cs +++ b/snippets/csharp/System.Data.Linq/ChangeConflictCollection/Overview/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/ConflictMode/Overview/northwind.cs b/snippets/csharp/System.Data.Linq/ConflictMode/Overview/northwind.cs index 13bd829fd38..1c51514232d 100644 --- a/snippets/csharp/System.Data.Linq/ConflictMode/Overview/northwind.cs +++ b/snippets/csharp/System.Data.Linq/ConflictMode/Overview/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/DataContext/CreateDatabase/northwind.cs b/snippets/csharp/System.Data.Linq/DataContext/CreateDatabase/northwind.cs index ac4a6ea8edb..b80e4cdd862 100644 --- a/snippets/csharp/System.Data.Linq/DataContext/CreateDatabase/northwind.cs +++ b/snippets/csharp/System.Data.Linq/DataContext/CreateDatabase/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/DataContext/ExecuteCommand/northwind.cs b/snippets/csharp/System.Data.Linq/DataContext/ExecuteCommand/northwind.cs index 200e69a56d8..23d8eced6a4 100644 --- a/snippets/csharp/System.Data.Linq/DataContext/ExecuteCommand/northwind.cs +++ b/snippets/csharp/System.Data.Linq/DataContext/ExecuteCommand/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2475,7 +2475,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2509,7 +2509,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2543,7 +2543,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2899,7 +2899,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2933,7 +2933,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3726,7 +3726,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/DataContext/GetChangeSet/northwind.cs b/snippets/csharp/System.Data.Linq/DataContext/GetChangeSet/northwind.cs index ac4a6ea8edb..b80e4cdd862 100644 --- a/snippets/csharp/System.Data.Linq/DataContext/GetChangeSet/northwind.cs +++ b/snippets/csharp/System.Data.Linq/DataContext/GetChangeSet/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/DataLoadOptions/AssociateWith/northwind.cs b/snippets/csharp/System.Data.Linq/DataLoadOptions/AssociateWith/northwind.cs index 13bd829fd38..1c51514232d 100644 --- a/snippets/csharp/System.Data.Linq/DataLoadOptions/AssociateWith/northwind.cs +++ b/snippets/csharp/System.Data.Linq/DataLoadOptions/AssociateWith/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/IMultipleResults/Overview/northwind-sprox.cs b/snippets/csharp/System.Data.Linq/IMultipleResults/Overview/northwind-sprox.cs index 2342f488137..6e275426ed3 100644 --- a/snippets/csharp/System.Data.Linq/IMultipleResults/Overview/northwind-sprox.cs +++ b/snippets/csharp/System.Data.Linq/IMultipleResults/Overview/northwind-sprox.cs @@ -562,7 +562,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -596,7 +596,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1594,7 +1594,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1809,7 +1809,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1843,7 +1843,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2049,7 +2049,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2083,7 +2083,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2528,7 +2528,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2562,7 +2562,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2596,7 +2596,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2952,7 +2952,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2986,7 +2986,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3779,7 +3779,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/MemberChangeConflict/Overview/northwind.cs b/snippets/csharp/System.Data.Linq/MemberChangeConflict/Overview/northwind.cs index 13bd829fd38..1c51514232d 100644 --- a/snippets/csharp/System.Data.Linq/MemberChangeConflict/Overview/northwind.cs +++ b/snippets/csharp/System.Data.Linq/MemberChangeConflict/Overview/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/MemberChangeConflict/Resolve/northwind.cs b/snippets/csharp/System.Data.Linq/MemberChangeConflict/Resolve/northwind.cs index 4e4fee87733..7f0a2d7175d 100644 --- a/snippets/csharp/System.Data.Linq/MemberChangeConflict/Resolve/northwind.cs +++ b/snippets/csharp/System.Data.Linq/MemberChangeConflict/Resolve/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3723,7 +3723,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/TableTEntity/Attach/northwind.cs b/snippets/csharp/System.Data.Linq/TableTEntity/Attach/northwind.cs index 1a7cfe67b61..9a282cbb453 100644 --- a/snippets/csharp/System.Data.Linq/TableTEntity/Attach/northwind.cs +++ b/snippets/csharp/System.Data.Linq/TableTEntity/Attach/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Linq/TableTEntity/DeleteOnSubmit/northwind.cs b/snippets/csharp/System.Data.Linq/TableTEntity/DeleteOnSubmit/northwind.cs index ac4a6ea8edb..b80e4cdd862 100644 --- a/snippets/csharp/System.Data.Linq/TableTEntity/DeleteOnSubmit/northwind.cs +++ b/snippets/csharp/System.Data.Linq/TableTEntity/DeleteOnSubmit/northwind.cs @@ -505,7 +505,7 @@ public CustomerDemographic CustomerDemographic { CustomerDemographic previousValue = this._CustomerDemographic.Entity; if (((previousValue != value) - || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) + || (!this._CustomerDemographic.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -539,7 +539,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1537,7 +1537,7 @@ public Employee ReportsToEmployee { Employee previousValue = this._ReportsToEmployee.Entity; if (((previousValue != value) - || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) + || (!this._ReportsToEmployee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1752,7 +1752,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1786,7 +1786,7 @@ public Territory Territory { Territory previousValue = this._Territory.Entity; if (((previousValue != value) - || (this._Territory.HasLoadedOrAssignedValue == false))) + || (!this._Territory.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -1992,7 +1992,7 @@ public Order Order { Order previousValue = this._Order.Entity; if (((previousValue != value) - || (this._Order.HasLoadedOrAssignedValue == false))) + || (!this._Order.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2026,7 +2026,7 @@ public Product Product { Product previousValue = this._Product.Entity; if (((previousValue != value) - || (this._Product.HasLoadedOrAssignedValue == false))) + || (!this._Product.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2471,7 +2471,7 @@ public Customer Customer { Customer previousValue = this._Customer.Entity; if (((previousValue != value) - || (this._Customer.HasLoadedOrAssignedValue == false))) + || (!this._Customer.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2505,7 +2505,7 @@ public Employee Employee { Employee previousValue = this._Employee.Entity; if (((previousValue != value) - || (this._Employee.HasLoadedOrAssignedValue == false))) + || (!this._Employee.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2539,7 +2539,7 @@ public Shipper Shipper { Shipper previousValue = this._Shipper.Entity; if (((previousValue != value) - || (this._Shipper.HasLoadedOrAssignedValue == false))) + || (!this._Shipper.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2895,7 +2895,7 @@ public Category Category { Category previousValue = this._Category.Entity; if (((previousValue != value) - || (this._Category.HasLoadedOrAssignedValue == false))) + || (!this._Category.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -2929,7 +2929,7 @@ public Supplier Supplier { Supplier previousValue = this._Supplier.Entity; if (((previousValue != value) - || (this._Supplier.HasLoadedOrAssignedValue == false))) + || (!this._Supplier.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) @@ -3722,7 +3722,7 @@ public Region Region { Region previousValue = this._Region.Entity; if (((previousValue != value) - || (this._Region.HasLoadedOrAssignedValue == false))) + || (!this._Region.HasLoadedOrAssignedValue ))) { this.SendPropertyChanging(); if ((previousValue != null)) diff --git a/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/clientcredentialslogin.xaml.cs b/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/clientcredentialslogin.xaml.cs index 022c5a3f359..0a0377a1ff7 100644 --- a/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/clientcredentialslogin.xaml.cs +++ b/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/clientcredentialslogin.xaml.cs @@ -27,7 +27,7 @@ private void CancelButton_Click(object sender, RoutedEventArgs e) private void LoginWindow_Closing(object sender, CancelEventArgs e) { - if (this.DialogResult == true && + if (this.DialogResult && (this.userNameBox.Text == string.Empty || this.passwordBox.SecurePassword.Length == 0)) { e.Cancel = true; diff --git a/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/source.cs b/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/source.cs index dd4e10ffa56..b7d22e2ebc9 100644 --- a/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/source.cs +++ b/snippets/csharp/System.Data.Services.Client/DataServiceCollectionT/Overview/source.cs @@ -1806,7 +1806,7 @@ private static void OnSendingRequest(object sender, SendingRequestEventArgs e) // // checking for relationships that return a null reference. // // // var query = from p in context.Products - // where (p.Discontinued == false && p.ProductID > 77) + // where (!p.Discontinued && p.ProductID > 77) // select new Product // { // ProductID = p.ProductID, diff --git a/snippets/csharp/System.Data/EntityKey/Overview/Source.cs b/snippets/csharp/System.Data/EntityKey/Overview/Source.cs index 7db5e68bb64..0d1bd6e7354 100644 --- a/snippets/csharp/System.Data/EntityKey/Overview/Source.cs +++ b/snippets/csharp/System.Data/EntityKey/Overview/Source.cs @@ -1499,7 +1499,7 @@ static public void EntityCollectionCountContainsAddRemove_IRelatedEnd_Add() Console.WriteLine("EntityCollection count after one entity has been removed: {0}", entityCollection.Count); - if (contains == false) + if (!contains) Console.WriteLine("The removed entity is not in in the collection any more."); //Use IRelatedEnd to add the entity back. diff --git a/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddressasync.cs b/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddressasync.cs index cb84550152f..1bdabf61441 100644 --- a/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddressasync.cs +++ b/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddressasync.cs @@ -23,7 +23,7 @@ static void ResolveAddressAsync() resolver.ResolveAddressCompleted += new EventHandler(resolver_ResolveAddressCompleted); - if (watcher.Position.Location.IsUnknown == false) + if (!watcher.Position.Location.IsUnknown) { resolver.ResolveAddressAsync(watcher.Position.Location); } diff --git a/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddresssync.cs b/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddresssync.cs index 30a5f621359..3a6673c8ebd 100644 --- a/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddresssync.cs +++ b/snippets/csharp/System.Device.Location/CivicAddress/Overview/resolvecivicaddresssync.cs @@ -18,7 +18,7 @@ static void ResolveAddressSync() CivicAddressResolver resolver = new CivicAddressResolver(); - if (watcher.Position.Location.IsUnknown == false) + if (!watcher.Position.Location.IsUnknown) { CivicAddress address = resolver.ResolveAddress(watcher.Position.Location); diff --git a/snippets/csharp/System.Device.Location/GeoCoordinate/Course/courseandspeed.cs b/snippets/csharp/System.Device.Location/GeoCoordinate/Course/courseandspeed.cs index 580600bdef5..a047fae6a50 100644 --- a/snippets/csharp/System.Device.Location/GeoCoordinate/Course/courseandspeed.cs +++ b/snippets/csharp/System.Device.Location/GeoCoordinate/Course/courseandspeed.cs @@ -18,7 +18,7 @@ static void GetLocationCourseAndSpeed() watcher.TryStart(true, TimeSpan.FromMilliseconds(1000)); - if (watcher.Position.Location.IsUnknown != true) + if (!watcher.Position.Location.IsUnknown) { GeoCoordinate coord = watcher.Position.Location; diff --git a/snippets/csharp/System.Device.Location/GeoCoordinate/IsUnknown/getlocationdatasynchandleunknown.cs b/snippets/csharp/System.Device.Location/GeoCoordinate/IsUnknown/getlocationdatasynchandleunknown.cs index 3bdf207dbae..2d6c7c65de2 100644 --- a/snippets/csharp/System.Device.Location/GeoCoordinate/IsUnknown/getlocationdatasynchandleunknown.cs +++ b/snippets/csharp/System.Device.Location/GeoCoordinate/IsUnknown/getlocationdatasynchandleunknown.cs @@ -17,7 +17,7 @@ static void GetLocationPropertyHandleUnknown() GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(); watcher.TryStart(false, TimeSpan.FromMilliseconds(1000)); - if (watcher.Position.Location.IsUnknown != true) + if (!watcher.Position.Location.IsUnknown) { GeoCoordinate coord = watcher.Position.Location; diff --git a/snippets/csharp/System.Device.Location/GeoCoordinateWatcher/Overview/getlocationdatasync.cs b/snippets/csharp/System.Device.Location/GeoCoordinateWatcher/Overview/getlocationdatasync.cs index 7664e43c8b4..b7bf7bbf7c3 100644 --- a/snippets/csharp/System.Device.Location/GeoCoordinateWatcher/Overview/getlocationdatasync.cs +++ b/snippets/csharp/System.Device.Location/GeoCoordinateWatcher/Overview/getlocationdatasync.cs @@ -21,7 +21,7 @@ static void GetLocationProperty() GeoCoordinate coord = watcher.Position.Location; - if (coord.IsUnknown != true) + if (!coord.IsUnknown) { Console.WriteLine("Lat: {0}, Long: {1}", coord.Latitude, diff --git a/snippets/csharp/System.Drawing.Drawing2D/GraphicsPath/AddArc/form1.cs b/snippets/csharp/System.Drawing.Drawing2D/GraphicsPath/AddArc/form1.cs index b01066404fe..2f4febd3a10 100644 --- a/snippets/csharp/System.Drawing.Drawing2D/GraphicsPath/AddArc/form1.cs +++ b/snippets/csharp/System.Drawing.Drawing2D/GraphicsPath/AddArc/form1.cs @@ -543,7 +543,7 @@ private void GetLastPointExample(PaintEventArgs e) GraphicsPath myPath = new GraphicsPath(); myPath.AddLine(20, 20, 100, 20); PointF lastPoint = myPath.GetLastPoint(); - if(lastPoint.IsEmpty == false) + if(!lastPoint.IsEmpty) { string lastPointXString = lastPoint.X.ToString(); string lastPointYString = lastPoint.Y.ToString(); diff --git a/snippets/csharp/System.Drawing.Printing/PrintDocument/PrintController/source.cs b/snippets/csharp/System.Drawing.Printing/PrintDocument/PrintController/source.cs index 4e64164fa97..d009108c168 100644 --- a/snippets/csharp/System.Drawing.Printing/PrintDocument/PrintController/source.cs +++ b/snippets/csharp/System.Drawing.Printing/PrintDocument/PrintController/source.cs @@ -13,11 +13,11 @@ public class Form1: Form // public void myPrint() { - if (useMyPrintController == true) + if (useMyPrintController) { myPrintDocument.PrintController = new myControllerImplementation(); - if (wantsStatusDialog == true) + if (wantsStatusDialog) { myPrintDocument.PrintController = new PrintControllerWithStatusDialog diff --git a/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex1.cs b/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex1.cs index 8399f06cfff..014de4f4052 100644 --- a/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex1.cs +++ b/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex1.cs @@ -14,7 +14,7 @@ public static void Main() foreach (var fmt in culture.DateTimeFormat.GetAllDateTimePatterns()) { total += 1; - if (! DateTime.TryParse(date1.ToString(fmt), out date2)) { + if (!DateTime.TryParse(date1.ToString(fmt), out date2)) { noRoundTrip++; Console.WriteLine("Unable to parse {0:" + fmt + "} (format '{1}')", date1, fmt); diff --git a/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex2.cs b/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex2.cs index 6b2aca2aeec..931a1098e7a 100644 --- a/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex2.cs +++ b/snippets/csharp/System.Globalization/DateTimeFormatInfo/GetAllDateTimePatterns/getalldatetimepatternsex2.cs @@ -19,7 +19,7 @@ public static void Main() noRoundTrip = 0; foreach (var pattern in culture.DateTimeFormat.GetAllDateTimePatterns(fmt)) { total++; - if (! DateTime.TryParse(date1.ToString(pattern), out date2)) { + if (!DateTime.TryParse(date1.ToString(pattern), out date2)) { noRoundTrip++; Console.WriteLine("Unable to parse {0:" + pattern + "} (format '{1}')", date1, pattern); diff --git a/snippets/csharp/System.Globalization/SortVersion/Overview/example1.cs b/snippets/csharp/System.Globalization/SortVersion/Overview/example1.cs index e0c8b19849d..c273161e23d 100644 --- a/snippets/csharp/System.Globalization/SortVersion/Overview/example1.cs +++ b/snippets/csharp/System.Globalization/SortVersion/Overview/example1.cs @@ -35,7 +35,7 @@ public static void Main() SortVersion ver = null; // If the data has not been saved, create it. - if (! File.Exists(FILENAME)) { + if (!File.Exists(FILENAME)) { regions = GenerateData(); ver = CultureInfo.CurrentCulture.CompareInfo.Version; reindex = true; diff --git a/snippets/csharp/System.Globalization/TextInfo/Clone/ro.cs b/snippets/csharp/System.Globalization/TextInfo/Clone/ro.cs index d5657012924..e5509602279 100644 --- a/snippets/csharp/System.Globalization/TextInfo/Clone/ro.cs +++ b/snippets/csharp/System.Globalization/TextInfo/Clone/ro.cs @@ -45,7 +45,7 @@ public static void Main() // the set operation fails, but that programming technique is inefficient. Console.WriteLine("3c) Try to set the read-only clone's LineSeparator " + "property."); - if (ti3.IsReadOnly == true) + if (ti3.IsReadOnly) { Console.WriteLine("3d) The set operation is invalid."); } diff --git a/snippets/csharp/System.IO.Packaging/CertificateEmbeddingOption/Overview/PackageDigitalSignature.cs b/snippets/csharp/System.IO.Packaging/CertificateEmbeddingOption/Overview/PackageDigitalSignature.cs index fa037b9db5a..1e13e83f19f 100644 --- a/snippets/csharp/System.IO.Packaging/CertificateEmbeddingOption/Overview/PackageDigitalSignature.cs +++ b/snippets/csharp/System.IO.Packaging/CertificateEmbeddingOption/Overview/PackageDigitalSignature.cs @@ -184,7 +184,7 @@ private static void ExtractPackageParts(string packageFilename) }// end:if (ValidateSignature(package)) // Display error message if signature validation fails. - else // if (ValidateSignatures(package) == false) + else // if (!ValidateSignatures(package)) { string msg = "Digital signatures in '" + packageFilename + "\n' failed validation. Unpacking canceled."; diff --git a/snippets/csharp/System.IO.Packaging/EncryptedPackageEnvelope/Close/Window1.xaml.cs b/snippets/csharp/System.IO.Packaging/EncryptedPackageEnvelope/Close/Window1.xaml.cs index 8c8cb806dd9..a777e6437b7 100644 --- a/snippets/csharp/System.IO.Packaging/EncryptedPackageEnvelope/Close/Window1.xaml.cs +++ b/snippets/csharp/System.IO.Packaging/EncryptedPackageEnvelope/Close/Window1.xaml.cs @@ -8,12 +8,10 @@ using System.Security.RightsManagement; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Xps.Packaging; -using System.Xml; using WinForms = Microsoft.Win32; namespace SdkSample @@ -44,7 +42,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) { string msg = "The currently open document needs to be closed before\n" + - "opening a new document. Ok to close '"+_xpsDocumentName+"'?"; + "opening a new document. Ok to close '" + _xpsDocumentName + "'?"; MessageBoxResult result = MessageBox.Show(msg, "Close Current Document?", MessageBoxButton.OKCancel, MessageBoxImage.Question); @@ -68,7 +66,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() == true) + if (dialog.ShowDialog().Value) OpenDocument(dialog.FileName); }// end:OnOpen() @@ -86,7 +84,7 @@ public bool OpenDocument(string filename) _xpsDocumentPath = filename; // Extract the document filename without the path. - _xpsDocumentName = filename.Remove(0, filename.LastIndexOf('\\')+1); + _xpsDocumentName = filename.Remove(0, filename.LastIndexOf('\\') + 1); _packageUri = new Uri(filename, UriKind.Absolute); try @@ -129,8 +127,8 @@ public bool OpenDocument(string filename) docViewer.Document = fds; // Enable document menu controls. - menuFileClose.IsEnabled = true; - menuFilePrint.IsEnabled = true; + menuFileClose.IsEnabled = true; + menuFilePrint.IsEnabled = true; menuFileRights.IsEnabled = true; menuViewIncreaseZoom.IsEnabled = true; menuViewDecreaseZoom.IsEnabled = true; @@ -185,7 +183,7 @@ private Package GetPackage(string filename) { Stream inputPackageStream = webResponse.GetResponseStream(); if (inputPackageStream != null) - { + { // Retrieve the Package from that stream. inputPackage = Package.Open(inputPackageStream); } @@ -318,7 +316,7 @@ private void OnRights(object sender, EventArgs e) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() == true) + if (dialog.ShowDialog().Value) OpenXrML(dialog.FileName); }// end:OnRights() @@ -350,7 +348,7 @@ public bool OpenXrML(string filename) WriteStatus("Opened '" + _xrmlFilename + "'"); WritePrompt("Click 'File | Publish...' to publish the document " + - "package with the permissions specified in '"+ _xrmlFilename+ "'."); + "package with the permissions specified in '" + _xrmlFilename + "'."); rightsBlockTitle.Text = "Rights - " + _xrmlFilename; return true; }// end:OpenXrML() @@ -385,23 +383,26 @@ private void OnPublish(object sender, EventArgs e) { // Create a "File Save" dialog positioned to the // "Content\" folder to write the encrypted package to. - WinForms.SaveFileDialog dialog = new WinForms.SaveFileDialog(); - dialog.InitialDirectory = GetContentFolder(); - dialog.Title = "Publish Rights Managed Package As"; - dialog.Filter = "Rights Managed XPS package (*-RM.xps)|*-RM.xps"; + WinForms.SaveFileDialog dialog = new() + { + InitialDirectory = GetContentFolder(), + Title = "Publish Rights Managed Package As", + Filter = "Rights Managed XPS package (*-RM.xps)|*-RM.xps", - // Create a new package filename by prefixing - // the document filename extension with "rm". - dialog.FileName = _xpsDocumentPath.Insert( - _xpsDocumentPath.LastIndexOf('.'), "-RM" ); + // Create a new package filename by prefixing + // the document filename extension with "rm". + FileName = _xpsDocumentPath.Insert( + _xpsDocumentPath.LastIndexOf('.'), "-RM") + }; // Show the "Save As" dialog. If the user clicks "Cancel", return. - if (dialog.ShowDialog() != true) return; + if (!dialog.ShowDialog().Value) + return; // Extract the filename without path. _rmxpsPackagePath = dialog.FileName; _rmxpsPackageName = _rmxpsPackagePath.Remove( - 0, _rmxpsPackagePath.LastIndexOf('\\')+1 ); + 0, _rmxpsPackagePath.LastIndexOf('\\') + 1); WriteStatus("Publishing '" + _rmxpsPackageName + "'."); PublishRMPackage(_xpsDocumentPath, _xrmlFilepath, dialog.FileName); @@ -425,12 +426,12 @@ public bool PublishRMPackage( string xrmlString; // Extract individual filenames without the path. - string packageFilename = packageFile.Remove( 0, - packageFile.LastIndexOf('\\')+1 ); - string xrmlFilename = xrmlFile.Remove( 0, - xrmlFile.LastIndexOf('\\')+1 ); - string encryptedFilename = encryptedFile.Remove( 0, - encryptedFile.LastIndexOf('\\')+1 ); + string packageFilename = packageFile.Remove(0, + packageFile.LastIndexOf('\\') + 1); + string xrmlFilename = xrmlFile.Remove(0, + xrmlFile.LastIndexOf('\\') + 1); + string encryptedFilename = encryptedFile.Remove(0, + encryptedFile.LastIndexOf('\\') + 1); try { @@ -443,7 +444,7 @@ public bool PublishRMPackage( } catch (Exception ex) { - MessageBox.Show("ERROR: '"+xrmlFilename+"' open failed.\n"+ + MessageBox.Show("ERROR: '" + xrmlFilename + "' open failed.\n" + "Exception: " + ex.Message, "XrML File Error", MessageBoxButton.OK, MessageBoxImage.Error); return false; @@ -511,7 +512,7 @@ public bool PublishRMPackage( "XrML UnsignedPublishLicense owner name: " + author.Name, "Incorrect Authentication Name", MessageBoxButton.OK, MessageBoxImage.Error); - return false; + return false; } // @@ -585,9 +586,11 @@ static internal string GetDefaultWindowsUserName() string[] splitUserName = wi.Name.Split('\\'); System.DirectoryServices.DirectorySearcher src = - new System.DirectoryServices.DirectorySearcher(); - src.SearchRoot = new System.DirectoryServices.DirectoryEntry( - "LDAP://" + splitUserName[0]); + new System.DirectoryServices.DirectorySearcher + { + SearchRoot = new System.DirectoryServices.DirectoryEntry( + "LDAP://" + splitUserName[0]) + }; src.PropertiesToLoad.Add("mail"); @@ -676,7 +679,7 @@ private void OnPrint(object target, ExecutedRoutedEventArgs args) /// Prints the DocumentViewer's content and annotations. public void PrintDocument() { - if (docViewer == null) return; + if (docViewer == null) return; docViewer.Print(); }// end:PrintDocument() @@ -686,7 +689,7 @@ public void PrintDocument() public DocumentViewer DocViewer { get - { return docViewer; } // "docViewer" declared in Window1.xaml + { return docViewer; } // "docViewer" declared in Window1.xaml } #endregion Utilities @@ -694,12 +697,12 @@ public DocumentViewer DocViewer private string _xrmlFilepath = null; // xrml path and filename. private string _xrmlFilename = null; // xrml filename without path. private string _xrmlString = null; // xrml string. - private string _xpsDocumentPath=null; // XPS doc path and filename. - private string _xpsDocumentName=null; // XPS doc filename without path. - private string _rmxpsPackagePath=null; // RM package path and filename. - private string _rmxpsPackageName=null; // RM package name without path. - private Uri _packageUri; // XPS document path and filename URI. - private Package _xpsPackage = null; // XPS document package. + private string _xpsDocumentPath = null; // XPS doc path and filename. + private string _xpsDocumentName = null; // XPS doc filename without path. + private string _rmxpsPackagePath = null; // RM package path and filename. + private string _rmxpsPackageName = null; // RM package name without path. + private Uri _packageUri; // XPS document path and filename URI. + private Package _xpsPackage = null; // XPS document package. private XpsDocument _xpsDocument; // XPS document within the package. private static SecureEnvironment _secureEnv = null; private static String _currentUserId = GetDefaultWindowsUserName(); diff --git a/snippets/csharp/System.IO.Packaging/PackageStore/AddPackage/Window1.xaml.cs b/snippets/csharp/System.IO.Packaging/PackageStore/AddPackage/Window1.xaml.cs index a90f1982ae3..bb809b0ed42 100644 --- a/snippets/csharp/System.IO.Packaging/PackageStore/AddPackage/Window1.xaml.cs +++ b/snippets/csharp/System.IO.Packaging/PackageStore/AddPackage/Window1.xaml.cs @@ -7,15 +7,12 @@ using System.IO.Packaging; using System.Net; using System.Security.RightsManagement; -using System.Text; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Xps.Packaging; -using System.Xml; using WinForms = Microsoft.Win32; namespace SdkSample @@ -44,14 +41,16 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) { // Create a "File Open" dialog positioned to the // "Content\" folder containing the sample fixed document. - WinForms.OpenFileDialog dialog = new WinForms.OpenFileDialog(); - dialog.InitialDirectory = GetContentFolder(); - dialog.CheckFileExists = true; - dialog.Filter = "XPS Document files (*.xps)|*.xps"; + WinForms.OpenFileDialog dialog = new WinForms.OpenFileDialog + { + InitialDirectory = GetContentFolder(), + CheckFileExists = true, + Filter = "XPS Document files (*.xps)|*.xps" + }; // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() == true) + if (dialog.ShowDialog().Value) { CloseDocument(); // Close current document if open. _xpsFile = dialog.FileName; // Save the path and file name. @@ -282,7 +281,7 @@ public bool OpenEncryptedDocument(string xpsFile) // // - if (rmi.CryptoProvider.CanDecrypt == true) + if (rmi.CryptoProvider.CanDecrypt) ShowStatus(" Decryption granted."); else ShowStatus(" CANNOT DECRYPT!"); diff --git a/snippets/csharp/System.IO/DirectoryInfo/CreateSubdirectory/directoryinfocreatesub.cs b/snippets/csharp/System.IO/DirectoryInfo/CreateSubdirectory/directoryinfocreatesub.cs index 7d6e7bab787..45017313422 100644 --- a/snippets/csharp/System.IO/DirectoryInfo/CreateSubdirectory/directoryinfocreatesub.cs +++ b/snippets/csharp/System.IO/DirectoryInfo/CreateSubdirectory/directoryinfocreatesub.cs @@ -10,7 +10,7 @@ public static void Main() DirectoryInfo di = new DirectoryInfo("TempDir"); // Create the directory only if it does not already exist. - if (di.Exists == false) + if (!di.Exists) di.Create(); // Create a subdirectory in the directory just created. diff --git a/snippets/csharp/System.IO/DirectoryInfo/Delete/directoryinfodelete.cs b/snippets/csharp/System.IO/DirectoryInfo/Delete/directoryinfodelete.cs index 655fb3ec078..2496254f044 100644 --- a/snippets/csharp/System.IO/DirectoryInfo/Delete/directoryinfodelete.cs +++ b/snippets/csharp/System.IO/DirectoryInfo/Delete/directoryinfodelete.cs @@ -11,7 +11,7 @@ public static void Main() DirectoryInfo di = new DirectoryInfo("TempDir"); // Create the directory only if it does not already exist. - if (di.Exists == false) + if (!di.Exists) di.Create(); // Create a subdirectory in the directory just created. diff --git a/snippets/csharp/System.IO/DirectoryInfo/MoveTo/directoryinfomoveto.cs b/snippets/csharp/System.IO/DirectoryInfo/MoveTo/directoryinfomoveto.cs index a6f64abf1ec..6cd2b1d600b 100644 --- a/snippets/csharp/System.IO/DirectoryInfo/MoveTo/directoryinfomoveto.cs +++ b/snippets/csharp/System.IO/DirectoryInfo/MoveTo/directoryinfomoveto.cs @@ -11,14 +11,14 @@ public static void Main() DirectoryInfo di = new DirectoryInfo("TempDir"); // Create the directory only if it does not already exist. - if (di.Exists == false) + if (!di.Exists) di.Create(); // Create a subdirectory in the directory just created. DirectoryInfo dis = di.CreateSubdirectory("SubDir"); // Move the main directory. Note that the contents move with the directory. - if (Directory.Exists("NewTempDir") == false) + if (!Directory.Exists("NewTempDir")) di.MoveTo("NewTempDir"); try diff --git a/snippets/csharp/System.IO/DirectoryInfo/Overview/copydir.cs b/snippets/csharp/System.IO/DirectoryInfo/Overview/copydir.cs index 308ff4df69a..9949d94d0c3 100644 --- a/snippets/csharp/System.IO/DirectoryInfo/Overview/copydir.cs +++ b/snippets/csharp/System.IO/DirectoryInfo/Overview/copydir.cs @@ -12,7 +12,7 @@ public static void CopyAll(DirectoryInfo source, DirectoryInfo target) } // Check if the target directory exists, if not, create it. - if (Directory.Exists(target.FullName) == false) + if (!Directory.Exists(target.FullName)) { Directory.CreateDirectory(target.FullName); } diff --git a/snippets/csharp/System.IO/DirectoryInfo/Parent/directoryinfoparent.cs b/snippets/csharp/System.IO/DirectoryInfo/Parent/directoryinfoparent.cs index 50ba9f76295..604340a1189 100644 --- a/snippets/csharp/System.IO/DirectoryInfo/Parent/directoryinfoparent.cs +++ b/snippets/csharp/System.IO/DirectoryInfo/Parent/directoryinfoparent.cs @@ -11,7 +11,7 @@ public static void Main() DirectoryInfo di = new DirectoryInfo("TempDir"); // Create the directory only if it does not already exist. - if (di.Exists == false) + if (!di.Exists) di.Create(); // Create a subdirectory in the directory just created. diff --git a/snippets/csharp/System.IO/DirectoryInfo/Root/directoryinforoot.cs b/snippets/csharp/System.IO/DirectoryInfo/Root/directoryinforoot.cs index bbafc6e5ff3..42f049a6a7f 100644 --- a/snippets/csharp/System.IO/DirectoryInfo/Root/directoryinforoot.cs +++ b/snippets/csharp/System.IO/DirectoryInfo/Root/directoryinforoot.cs @@ -11,7 +11,7 @@ public static void Main() DirectoryInfo di = new DirectoryInfo("TempDir"); // Create the directory only if it does not already exist. - if (di.Exists == false) + if (!di.Exists) di.Create(); // Create a subdirectory in the directory just created. diff --git a/snippets/csharp/System.IO/DriveInfo/Overview/DriveInfo.cs b/snippets/csharp/System.IO/DriveInfo/Overview/DriveInfo.cs index 51d5b9c6226..6d1cf5fd55b 100644 --- a/snippets/csharp/System.IO/DriveInfo/Overview/DriveInfo.cs +++ b/snippets/csharp/System.IO/DriveInfo/Overview/DriveInfo.cs @@ -12,7 +12,7 @@ public static void Main() { Console.WriteLine("Drive {0}", d.Name); Console.WriteLine(" Drive type: {0}", d.DriveType); - if (d.IsReady == true) + if (d.IsReady) { Console.WriteLine(" Volume label: {0}", d.VolumeLabel); Console.WriteLine(" File system: {0}", d.DriveFormat); diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1-vsdoc.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1-vsdoc.js index 8bc55c944ba..e38c9cb31d2 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1-vsdoc.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1-vsdoc.js @@ -573,12 +573,12 @@ jQuery.extend({ /// // A third-party is pushing the ready event forwards - if ( wait === true ) { + if ( wait) { jQuery.readyWait--; } // Make sure that the DOM is not already loaded - if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { + if ( !jQuery.readyWait || (!wait && !jQuery.isReady) ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); @@ -588,7 +588,7 @@ jQuery.extend({ jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { + if ( !wait && --jQuery.readyWait > 0 ) { return; } @@ -844,13 +844,13 @@ jQuery.extend({ if ( args ) { if ( isObj ) { for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { + if ( !callback.apply( object[ name ], args ) ) { break; } } } else { for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { + if ( !callback.apply( object[ i++ ], args ) ) { break; } } @@ -860,7 +860,7 @@ jQuery.extend({ } else { if ( isObj ) { for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + if ( !callback.call( object[ name ], name, object[ name ] ) ) { break; } } @@ -2269,7 +2269,7 @@ jQuery.event = { elem = window; } - if ( handler === false ) { + if (!handler) { handler = returnFalse; } else if ( !handler ) { // Fixes bug #7229. Fix recommended by jdalton @@ -2372,7 +2372,7 @@ jQuery.event = { // Check for a special event handler // Only use addEventListener/attachEvent if the special // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + if ( !special.setup || !special.setup.call( elem, data, namespaces, eventHandle ) ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); @@ -2416,7 +2416,7 @@ jQuery.event = { return; } - if ( handler === false ) { + if (!handler) { handler = returnFalse; } @@ -2514,7 +2514,7 @@ jQuery.event = { // remove generic event handler if no more handlers exist if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + if ( !special.teardown || !special.teardown.call( elem, namespaces ) ) { jQuery.removeEvent( elem, type, elemData.handle ); } @@ -2614,7 +2614,7 @@ jQuery.event = { // Trigger an inline bound script try { if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { + if ( elem[ "on" + type ] && !elem[ "on" + type ].apply( elem, data ) ) { event.result = false; event.preventDefault(); } @@ -2633,7 +2633,7 @@ jQuery.event = { isClick = jQuery.nodeName( target, "a" ) && targetType === "click", special = jQuery.event.special[ targetType ] || {}; - if ( (!special._default || special._default.call( elem, event ) === false) && + if ( (!special._default || !special._default.call( elem, event )) && !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { try { @@ -2713,7 +2713,7 @@ jQuery.event = { if ( ret !== undefined ) { event.result = ret; - if ( ret === false ) { + if (!ret) { event.preventDefault(); event.stopPropagation(); } @@ -3168,7 +3168,7 @@ if ( document.addEventListener ) { // return this; // } -// if ( jQuery.isFunction( data ) || data === false ) { +// if ( jQuery.isFunction( data ) || !data ) { // fn = data; // data = undefined; // } @@ -3591,10 +3591,10 @@ function liveHandler( event ) { ret = match.handleObj.origHandler.apply( match.elem, arguments ); - if ( ret === false || event.isPropagationStopped() ) { + if ( !ret || event.isPropagationStopped() ) { maxLevel = match.level; - if ( ret === false ) { + if (!ret) { stop = false; } if ( event.isImmediatePropagationStopped() ) { @@ -4047,7 +4047,7 @@ var Sizzle = function( selector, context, results, seed ) { } else if ( context && context.nodeType === 1 ) { for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + if ( checkSet[i] && (checkSet[i] || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { results.push( set[i] ); } } @@ -4169,7 +4169,7 @@ Sizzle.filter = function( expr, set, inplace, not ) { if ( !match ) { anyFound = found = true; - } else if ( match === true ) { + } else if ( match) { continue; } } @@ -6030,7 +6030,7 @@ jQuery.fn.extend({ }); // Copy the events from the original to the clone - if ( events === true ) { + if ( events) { cloneCopyEvent( this, ret ); cloneCopyEvent( this.find("*"), ret.find("*") ); } @@ -7591,7 +7591,7 @@ jQuery.extend({ ifModifiedKey = s.url; // Add anti-cache in url if needed - if (s.cache === false) { + if (!s.cache) { var ts = jQuery.now(), // try replacing _= if it is there @@ -7603,7 +7603,7 @@ jQuery.extend({ } // Set the correct header, if data is being sent - if (s.data && s.hasContent && s.contentType !== false || options.contentType) { + if (s.data && s.hasContent && s.contentType || options.contentType) { requestHeaders["Content-Type"] = s.contentType; } @@ -7629,7 +7629,7 @@ jQuery.extend({ } // Allow custom headers/mimetypes and early abort - if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) { + if (s.beforeSend && (!s.beforeSend.call(callbackContext, jqXHR, s) || state === 2)) { // Abort if not done already jqXHR.abort(); return false; @@ -8321,7 +8321,7 @@ jQuery.extend({ // Queueing opt.old = opt.complete; opt.complete = function() { - if ( opt.queue !== false ) { + if ( opt.queue ) { jQuery(this).dequeue(); } if ( jQuery.isFunction( opt.old ) ) { @@ -8473,7 +8473,7 @@ jQuery.fx.prototype = { this.options.curAnim[ this.prop ] = true; for ( var i in this.options.curAnim ) { - if ( this.options.curAnim[i] !== true ) { + if ( !this.options.curAnim[i] ) { done = false; } } diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1.js index ddc55e2d76e..1f463a5b97a 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-1.5.1.js @@ -400,12 +400,12 @@ jQuery.extend({ // Handle when the DOM is ready ready: function( wait ) { // A third-party is pushing the ready event forwards - if ( wait === true ) { + if ( wait ) { jQuery.readyWait--; } // Make sure that the DOM is not already loaded - if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { + if ( !jQuery.readyWait || (!wait && !jQuery.isReady) ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); @@ -415,7 +415,7 @@ jQuery.extend({ jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { + if ( !wait && --jQuery.readyWait > 0 ) { return; } @@ -617,13 +617,13 @@ jQuery.extend({ if ( args ) { if ( isObj ) { for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { + if (!callback.apply( object[ name ], args )) { break; } } } else { for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { + if (!callback.apply( object[ i++ ], args )) { break; } } @@ -633,7 +633,7 @@ jQuery.extend({ } else { if ( isObj ) { for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + if (!callback.call( object[ name ], name, object[ name ] )) { break; } } @@ -2161,7 +2161,7 @@ jQuery.event = { } catch ( e ) {} - if ( handler === false ) { + if (!handler) { handler = returnFalse; } else if ( !handler ) { // Fixes bug #7229. Fix recommended by jdalton @@ -2248,7 +2248,7 @@ jQuery.event = { // Check for a special event handler // Only use addEventListener/attachEvent if the special // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + if ( !special.setup || !special.setup.call( elem, data, namespaces, eventHandle ) ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); @@ -2287,7 +2287,7 @@ jQuery.event = { return; } - if ( handler === false ) { + if (!handler) { handler = returnFalse; } @@ -2379,7 +2379,7 @@ jQuery.event = { // remove generic event handler if no more handlers exist if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + if ( !special.teardown || !special.teardown.call( elem, namespaces ) ) { jQuery.removeEvent( elem, type, elemData.handle ); } @@ -2476,7 +2476,7 @@ jQuery.event = { // Trigger an inline bound script try { if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { + if ( elem[ "on" + type ] && !elem[ "on" + type ].apply( elem, data ) ) { event.result = false; event.preventDefault(); } @@ -2495,7 +2495,7 @@ jQuery.event = { isClick = jQuery.nodeName( target, "a" ) && targetType === "click", special = jQuery.event.special[ targetType ] || {}; - if ( (!special._default || special._default.call( elem, event ) === false) && + if ( (!special._default || !special._default.call( elem, event )) && !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { try { @@ -2566,7 +2566,7 @@ jQuery.event = { if ( ret !== undefined ) { event.result = ret; - if ( ret === false ) { + if (!ret) { event.preventDefault(); event.stopPropagation(); } @@ -3022,7 +3022,7 @@ jQuery.each(["bind", "one"], function( i, name ) { return this; } - if ( jQuery.isFunction( data ) || data === false ) { + if ( jQuery.isFunction( data ) || !data ) { fn = data; data = undefined; } @@ -3256,10 +3256,10 @@ function liveHandler( event ) { ret = match.handleObj.origHandler.apply( match.elem, arguments ); - if ( ret === false || event.isPropagationStopped() ) { + if ( !ret || event.isPropagationStopped() ) { maxLevel = match.level; - if ( ret === false ) { + if (!ret) { stop = false; } if ( event.isImmediatePropagationStopped() ) { @@ -3450,7 +3450,7 @@ var Sizzle = function( selector, context, results, seed ) { } else if ( context && context.nodeType === 1 ) { for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + if ( checkSet[i] && (checkSet[i] || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { results.push( set[i] ); } } @@ -3568,7 +3568,7 @@ Sizzle.filter = function( expr, set, inplace, not ) { if ( !match ) { anyFound = found = true; - } else if ( match === true ) { + } else if ( match ) { continue; } } @@ -6702,7 +6702,7 @@ jQuery.extend({ ifModifiedKey = s.url; // Add anti-cache in url if needed - if ( s.cache === false ) { + if (!s.cache) { var ts = jQuery.now(), // try replacing _= if it is there @@ -6714,7 +6714,7 @@ jQuery.extend({ } // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + if ( s.data && s.hasContent && s.contentType || options.contentType ) { requestHeaders[ "Content-Type" ] = s.contentType; } @@ -6740,7 +6740,7 @@ jQuery.extend({ } // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + if ( s.beforeSend && ( !s.beforeSend.call( callbackContext, jqXHR, s ) || state === 2 ) ) { // Abort if not done already jqXHR.abort(); return false; @@ -7005,9 +7005,9 @@ function ajaxConvert( s, response ) { conv2 = converters[ tmp[1] + " " + current ]; if ( conv2 ) { conv1 = converters[ conv1 ]; - if ( conv1 === true ) { + if ( conv1 ) { conv = conv2; - } else if ( conv2 === true ) { + } else if ( conv2 ) { conv = conv1; } break; @@ -7020,7 +7020,7 @@ function ajaxConvert( s, response ) { jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); } // If found converter is not an equivalence - if ( conv !== true ) { + if ( !conv ) { // Convert with 1 or 2 converters accordingly response = conv ? conv( response ) : conv2( conv1(response) ); } @@ -7051,7 +7051,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { if ( s.dataTypes[ 0 ] === "jsonp" || originalSettings.jsonpCallback || originalSettings.jsonp != null || - s.jsonp !== false && ( jsre.test( s.url ) || + s.jsonp && ( jsre.test( s.url ) || dataIsString && jsre.test( s.data ) ) ) { var responseContainer, @@ -7070,7 +7070,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { } }; - if ( s.jsonp !== false ) { + if ( s.jsonp ) { url = url.replace( jsre, replace ); if ( s.url === url ) { if ( dataIsString ) { @@ -7709,7 +7709,7 @@ jQuery.extend({ // Queueing opt.old = opt.complete; opt.complete = function() { - if ( opt.queue !== false ) { + if ( opt.queue ) { jQuery(this).dequeue(); } if ( jQuery.isFunction( opt.old ) ) { @@ -7827,7 +7827,7 @@ jQuery.fx.prototype = { this.options.curAnim[ this.prop ] = true; for ( var i in this.options.curAnim ) { - if ( this.options.curAnim[i] !== true ) { + if ( !this.options.curAnim[i] ) { done = false; } } diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-ui-1.8.11.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-ui-1.8.11.js index 79285779228..ef4f02fb00a 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-ui-1.8.11.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery-ui-1.8.11.js @@ -1142,7 +1142,7 @@ $.widget("ui.draggable", $.ui.mouse, { this._setContainment(); //Trigger event + callbacks - if(this._trigger("start", event) === false) { + if(!this._trigger("start", event)) { this._clear(); return false; } @@ -1168,7 +1168,7 @@ $.widget("ui.draggable", $.ui.mouse, { //Call plugins and callbacks and use the resulting position if something is returned if (!noPropagation) { var ui = this._uiHash(); - if(this._trigger('drag', event, ui) === false) { + if(!this._trigger('drag', event, ui)) { this._mouseUp({}); return false; } @@ -1199,15 +1199,15 @@ $.widget("ui.draggable", $.ui.mouse, { if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original") return false; - if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { + if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { var self = this; $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { - if(self._trigger("stop", event) !== false) { + if(self._trigger("stop", event)) { self._clear(); } }); } else { - if(this._trigger("stop", event) !== false) { + if(this._trigger("stop", event)) { this._clear(); } } @@ -1692,7 +1692,7 @@ $.ui.plugin.add("draggable", "scroll", { } - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + if(scrolled && $.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(i, event); } @@ -3459,7 +3459,7 @@ $.widget("ui.sortable", $.ui.mouse, { } - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + if(scrolled && $.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, event); } @@ -4231,7 +4231,7 @@ $.widget("ui.sortable", $.ui.mouse, { }, _trigger: function() { - if ($.Widget.prototype._trigger.apply(this, arguments) === false) { + if (!$.Widget.prototype._trigger.apply(this, arguments)) { this.cancel(); } }, @@ -5168,7 +5168,7 @@ $.widget( "ui.autocomplete", { } clearTimeout( this.closing ); - if ( this._trigger( "search", event ) === false ) { + if (!this._trigger( "search", event )) { return; } @@ -6506,7 +6506,7 @@ $.widget("ui.dialog", { } // currently non-resizable, becoming resizable - if (!isResizable && value !== false) { + if (!isResizable && value) { self._makeResizable(value); } break; @@ -6814,7 +6814,7 @@ $.widget( "ui.slider", $.ui.mouse, { this.range = $([]); if ( o.range ) { - if ( o.range === true ) { + if ( o.range ) { this.range = $( "
" ); if ( !o.values ) { o.values = [ this._valueMin(), this._valueMin() ]; @@ -6913,7 +6913,7 @@ $.widget( "ui.slider", $.ui.mouse, { self._keySliding = true; $( this ).addClass( "ui-state-active" ); allowed = self._start( event, index ); - if ( allowed === false ) { + if (!allowed) { return; } } @@ -7036,13 +7036,13 @@ $.widget( "ui.slider", $.ui.mouse, { // workaround for bug #3736 (if both handles of a range are at 0, // the first is always used as the one with least distance, // and moving it is obviously prevented by preventing negative ranges) - if( o.range === true && this.values(1) === o.min ) { + if( o.range && this.values(1) === o.min ) { index += 1; closestHandle = $( this.handles[index] ); } allowed = this._start( event, index ); - if ( allowed === false ) { + if (!allowed) { return false; } this._mouseSliding = true; @@ -7154,7 +7154,7 @@ $.widget( "ui.slider", $.ui.mouse, { if ( this.options.values && this.options.values.length ) { otherVal = this.values( index ? 0 : 1 ); - if ( ( this.options.values.length === 2 && this.options.range === true ) && + if ( ( this.options.values.length === 2 && this.options.range ) && ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) ) { newVal = otherVal; @@ -7170,7 +7170,7 @@ $.widget( "ui.slider", $.ui.mouse, { values: newValues } ); otherVal = this.values( index ? 0 : 1 ); - if ( allowed !== false ) { + if ( allowed ) { this.values( index, newVal, true ); } } @@ -7181,7 +7181,7 @@ $.widget( "ui.slider", $.ui.mouse, { handle: this.handles[ index ], value: newVal } ); - if ( allowed !== false ) { + if ( allowed ) { this.value( newVal ); } } @@ -7384,7 +7384,7 @@ $.widget( "ui.slider", $.ui.mouse, { valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100; _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); - if ( self.options.range === true ) { + if ( self.options.range ) { if ( self.orientation === "horizontal" ) { if ( i === 0 ) { self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); @@ -7692,7 +7692,7 @@ $.widget( "ui.tabs", { } // reset cache if switching from cached to not cached - if ( o.cache === false ) { + if (!o.cache) { this.anchors.removeData( "cache.tabs" ); } diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.unobtrusive-ajax.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.unobtrusive-ajax.js index 95cdfd3313e..9377b339b82 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.unobtrusive-ajax.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.unobtrusive-ajax.js @@ -82,7 +82,7 @@ var result; asyncOnBeforeSend(xhr, method); result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments); - if (result !== false) { + if (result ) { loading.show(duration); } return result; diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate-vsdoc.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate-vsdoc.js index 30774ac11f6..a9d9544f1ae 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate-vsdoc.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate-vsdoc.js @@ -931,7 +931,7 @@ $.extend($.validator, { // handle dependency check $.each(rules, function(prop, val) { // ignore rule when param is explicitly false, eg. required:false - if (val === false) { + if (!val) { delete rules[prop]; return; } diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate.js index 4ba1ad970cd..adc1a3c709a 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/jquery.validate.js @@ -812,7 +812,7 @@ $.extend($.validator, { // handle dependency check $.each(rules, function(prop, val) { // ignore rule when param is explicitly false, eg. required:false - if (val === false) { + if (!val) { delete rules[prop]; return; } diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftajax.debug.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftajax.debug.js index 548facdfcc1..7dd98e7a406 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftajax.debug.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftajax.debug.js @@ -2430,7 +2430,7 @@ Date._parse = function Date$_parse(value, cultureInfo, args) { if (date) return date; } } - if (! custom) { + if (!custom) { formats = cultureInfo._getDateTimeFormats(); for (i = 0, l = formats.length; i < l; i++) { date = Date._parseExact(value, formats[i], cultureInfo); @@ -3141,7 +3141,7 @@ Sys.CultureInfo = function Sys$CultureInfo(name, numberFormat, dateTimeFormat) { this.dateTimeFormat = dateTimeFormat; } function Sys$CultureInfo$_getDateTimeFormats() { - if (! this._dateTimeFormats) { + if (!this._dateTimeFormats) { var dtf = this.dateTimeFormat; this._dateTimeFormats = [ dtf.MonthDayPattern, @@ -4543,7 +4543,7 @@ Sys.UI.DomElement.setVisibilityMode = function Sys$UI$DomElement$setVisibilityMo Sys.UI.DomElement._ensureOldDisplayMode(element); if (element._visibilityMode !== value) { element._visibilityMode = value; - if (Sys.UI.DomElement.getVisible(element) === false) { + if (!Sys.UI.DomElement.getVisible(element)) { if (element._visibilityMode === Sys.UI.VisibilityMode.hide) { element.style.display = element._oldDisplayMode; } @@ -6784,7 +6784,7 @@ Sys.Net.WebServiceProxy.invoke = function Sys$Net$WebServiceProxy$invoke(service {name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional: true} ]); if (e) throw e; - var schemeHost = (enableJsonp !== false) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null, + var schemeHost = (enableJsonp) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null, tempCallback, jsonp = schemeHost && (schemeHost.length === 3) && ((schemeHost[1] !== location.protocol) || (schemeHost[2] !== location.host)); useGet = jsonp || useGet; diff --git a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftmvcajax.debug.js b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftmvcajax.debug.js index eb68ba7e7e2..ff8fb47d616 100644 --- a/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftmvcajax.debug.js +++ b/snippets/csharp/System.IdentityModel.Tokens/IssuerNameRegistry/Overview/scripts/microsoftmvcajax.debug.js @@ -309,7 +309,7 @@ Sys.Mvc.MvcHelpers._onComplete = function Sys_Mvc_MvcHelpers$_onComplete(request /// /// ajaxContext.set_response(request.get_executor()); - if (ajaxOptions.onComplete && ajaxOptions.onComplete(ajaxContext) === false) { + if (ajaxOptions.onComplete && !ajaxOptions.onComplete(ajaxContext)) { return; } var statusCode = ajaxContext.get_response().get_statusCode(); diff --git a/snippets/csharp/System.Linq/Enumerable/AggregateTSource/enumerable.cs b/snippets/csharp/System.Linq/Enumerable/AggregateTSource/enumerable.cs index 5b7949c4f0c..c55f5ec6902 100644 --- a/snippets/csharp/System.Linq/Enumerable/AggregateTSource/enumerable.cs +++ b/snippets/csharp/System.Linq/Enumerable/AggregateTSource/enumerable.cs @@ -243,7 +243,7 @@ public static void AnyEx3() // Determine whether any pets over age 1 are also unvaccinated. bool unvaccinated = - pets.Any(p => p.Age > 1 && p.Vaccinated == false); + pets.Any(p => p.Age > 1 && !p.Vaccinated); Console.WriteLine( "There {0} unvaccinated animals over age one.", @@ -538,7 +538,7 @@ public static void CountEx2() try { - int numberUnvaccinated = pets.Count(p => p.Vaccinated == false); + int numberUnvaccinated = pets.Count(p => !p.Vaccinated); Console.WriteLine("There are {0} unvaccinated animals.", numberUnvaccinated); } catch (OverflowException) diff --git a/snippets/csharp/System.Linq/Queryable/AggregateTSource/queryable.cs b/snippets/csharp/System.Linq/Queryable/AggregateTSource/queryable.cs index 9cdf0985ad1..38bf04ebeb5 100644 --- a/snippets/csharp/System.Linq/Queryable/AggregateTSource/queryable.cs +++ b/snippets/csharp/System.Linq/Queryable/AggregateTSource/queryable.cs @@ -251,7 +251,7 @@ public static void AnyEx3() // Determine whether any pets over age 1 are also unvaccinated. bool unvaccinated = - pets.AsQueryable().Any(p => p.Age > 1 && p.Vaccinated == false); + pets.AsQueryable().Any(p => p.Age > 1 && !p.Vaccinated); Console.WriteLine( "There {0} unvaccinated animals over age one.", @@ -558,7 +558,7 @@ public static void CountEx2() // Count the number of unvaccinated pets in the array. int numberUnvaccinated = - pets.AsQueryable().Count(p => p.Vaccinated == false); + pets.AsQueryable().Count(p => !p.Vaccinated); Console.WriteLine( "There are {0} unvaccinated animals.", diff --git a/snippets/csharp/System.Messaging/AcknowledgeTypes/Overview/message_acknowledgment.cs b/snippets/csharp/System.Messaging/AcknowledgeTypes/Overview/message_acknowledgment.cs index 7c9d1c2ec29..609e37fce19 100644 --- a/snippets/csharp/System.Messaging/AcknowledgeTypes/Overview/message_acknowledgment.cs +++ b/snippets/csharp/System.Messaging/AcknowledgeTypes/Overview/message_acknowledgment.cs @@ -168,7 +168,7 @@ public void ReceiveAcknowledgment(string messageId, string queuePath) // This exception would be thrown if there is no (further) acknowledgment message // with the specified correlation Id. Only output a message if there are no messages; // not if the loop has found at least one. - if(found == false) + if (!found) { Console.WriteLine(e.Message); } diff --git a/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_timeouttransaction.cs b/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_timeouttransaction.cs index 7838de036ae..fc5ce6ba256 100644 --- a/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_timeouttransaction.cs +++ b/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_timeouttransaction.cs @@ -44,7 +44,7 @@ public void SendMessageTransactional() MessageQueue(".\\myTransactionalQueue"); // Send a message to the queue. - if (myQueue.Transactional == true) + if (myQueue.Transactional) { // Create a transaction. MessageQueueTransaction myTransaction = new diff --git a/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_transaction.cs b/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_transaction.cs index 9468987b6a5..36f8caf15e8 100644 --- a/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_transaction.cs +++ b/snippets/csharp/System.Messaging/MessageQueue/Receive/mqreceive_transaction.cs @@ -44,7 +44,7 @@ public void SendMessageTransactional() MessageQueue(".\\myTransactionalQueue"); // Send a message to the queue. - if (myQueue.Transactional == true) + if (myQueue.Transactional) { // Create a transaction. MessageQueueTransaction myTransaction = new diff --git a/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_generic.cs b/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_generic.cs index a064ca52ce2..6b72a1d7c0e 100644 --- a/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_generic.cs +++ b/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_generic.cs @@ -39,7 +39,7 @@ public void SendMessage() MessageQueue myQueue = new MessageQueue(".\\myQueue"); // Send a message to the queue. - if (myQueue.Transactional == true) + if (myQueue.Transactional) { // Create a transaction. MessageQueueTransaction myTransaction = new diff --git a/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_objtransaction.cs b/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_objtransaction.cs index a63ec6e244c..4955d9ba422 100644 --- a/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_objtransaction.cs +++ b/snippets/csharp/System.Messaging/MessageQueue/Send/mqsend_objtransaction.cs @@ -44,7 +44,7 @@ public void SendMessageTransactional() MessageQueue(".\\myTransactionalQueue"); // Send a message to the queue. - if (myQueue.Transactional == true) + if (myQueue.Transactional) { // Create a transaction. MessageQueueTransaction myTransaction = new diff --git a/snippets/csharp/System.Net.Mail/MailAddress/.ctor/mailasync.cs b/snippets/csharp/System.Net.Mail/MailAddress/.ctor/mailasync.cs index 62b6d019edb..53e65b21358 100644 --- a/snippets/csharp/System.Net.Mail/MailAddress/.ctor/mailasync.cs +++ b/snippets/csharp/System.Net.Mail/MailAddress/.ctor/mailasync.cs @@ -68,7 +68,7 @@ public static void Main(string[] args) string answer = Console.ReadLine(); // If the user canceled the send, and mail hasn't been sent yet, // then cancel the pending operation. - if (answer.StartsWith("c") && mailSent == false) + if (answer.StartsWith("c") && !mailSent) { client.SendAsyncCancel(); } diff --git a/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs b/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs index 7164a5747f7..9c6b672328b 100644 --- a/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs +++ b/snippets/csharp/System.Net.NetworkInformation/DuplicateAddressDetectionState/Overview/networkexamples.cs @@ -785,7 +785,7 @@ public static void DisplayIPv4NetworkInterfaces() foreach (NetworkInterface adapter in nics) { // Only display informatin for interfaces that support IPv4. - if (adapter.Supports(NetworkInterfaceComponent.IPv4) == false) + if (!adapter.Supports(NetworkInterfaceComponent.IPv4)) { continue; } @@ -831,7 +831,7 @@ public static void DisplayIPv6NetworkInterfaces() foreach (NetworkInterface adapter in nics) { // Only display informatin for interfaces that support IPv6. - if (adapter.Supports(NetworkInterfaceComponent.IPv6) == false) + if (!adapter.Supports(NetworkInterfaceComponent.IPv6)) { continue; } diff --git a/snippets/csharp/System.Net.Security/LocalCertificateSelectionCallback/Overview/clientasync.cs b/snippets/csharp/System.Net.Security/LocalCertificateSelectionCallback/Overview/clientasync.cs index 6097cb58534..91f0cda9d04 100644 --- a/snippets/csharp/System.Net.Security/LocalCertificateSelectionCallback/Overview/clientasync.cs +++ b/snippets/csharp/System.Net.Security/LocalCertificateSelectionCallback/Overview/clientasync.cs @@ -227,7 +227,7 @@ public static int Main(string[] args) // Real world applications would do work here // while waiting for the asynchronous calls to complete. System.Threading.Thread.Sleep(100); - } while (complete != true && Console.KeyAvailable == false); + } while (!complete && !Console.KeyAvailable); if (Console.KeyAvailable) { diff --git a/snippets/csharp/System.Net.Sockets/Socket/Receive/source.cs b/snippets/csharp/System.Net.Sockets/Socket/Receive/source.cs index cb8f02e5df8..1ba30a018b7 100644 --- a/snippets/csharp/System.Net.Sockets/Socket/Receive/source.cs +++ b/snippets/csharp/System.Net.Sockets/Socket/Receive/source.cs @@ -323,7 +323,7 @@ public static void RunUdpTests() Thread myThread1 = new Thread(myThreadDelegate); myThread1.Start(); - while (myThread1.IsAlive == true) + while (myThread1.IsAlive) { SendTo1(); } @@ -332,7 +332,7 @@ public static void RunUdpTests() Console.WriteLine("UDP test2"); Thread myThread2 = new Thread(new ThreadStart(Sync_Send_Receive.ReceiveFrom2)); myThread2.Start(); - while (myThread2.IsAlive == true) + while (myThread2.IsAlive) { SendTo2(); } @@ -341,7 +341,7 @@ public static void RunUdpTests() Console.WriteLine("UDP test3"); Thread myThread3 = new Thread(new ThreadStart(Sync_Send_Receive.ReceiveFrom3)); myThread3.Start(); - while (myThread3.IsAlive == true) + while (myThread3.IsAlive) { SendTo3(); } @@ -350,7 +350,7 @@ public static void RunUdpTests() Console.WriteLine("UDP test4"); Thread myThread4 = new Thread(new ThreadStart(Sync_Send_Receive.ReceiveFrom4)); myThread4.Start(); - while (myThread4.IsAlive == true) + while (myThread4.IsAlive) { SendTo4(); } diff --git a/snippets/csharp/System.Net.Sockets/TcpClient/.ctor/source.cs b/snippets/csharp/System.Net.Sockets/TcpClient/.ctor/source.cs index 1b64cbbcdef..cce6840706c 100644 --- a/snippets/csharp/System.Net.Sockets/TcpClient/.ctor/source.cs +++ b/snippets/csharp/System.Net.Sockets/TcpClient/.ctor/source.cs @@ -141,7 +141,7 @@ public static void MyTcpClientPropertySetter () tcpClient.NoDelay = true; // Determines if the delay is enabled by using the NoDelay property. - if (tcpClient.NoDelay == true) + if (tcpClient.NoDelay) Console.WriteLine ("The delay was set successfully to " + tcpClient.NoDelay.ToString ()); // diff --git a/snippets/csharp/System.Net/FileWebRequest/GetResponse/getresponse.cs b/snippets/csharp/System.Net/FileWebRequest/GetResponse/getresponse.cs index 106810a7394..56cf0b76393 100644 --- a/snippets/csharp/System.Net/FileWebRequest/GetResponse/getresponse.cs +++ b/snippets/csharp/System.Net/FileWebRequest/GetResponse/getresponse.cs @@ -107,7 +107,7 @@ static void Main(string[] args) } else { - if (makeFileRequest(args[0])== true) + if (makeFileRequest(args[0])) readFile(); } } diff --git a/snippets/csharp/System.Net/FtpStatusCode/Overview/ftptests.cs b/snippets/csharp/System.Net/FtpStatusCode/Overview/ftptests.cs index 0b02c53705d..2d9b8c9bcde 100644 --- a/snippets/csharp/System.Net/FtpStatusCode/Overview/ftptests.cs +++ b/snippets/csharp/System.Net/FtpStatusCode/Overview/ftptests.cs @@ -448,7 +448,7 @@ public static bool SendCommandToServer(string serverUri, string command) // // The command parameter identifies the command to send to the server. - if (serverUri.ToLower().StartsWith(Uri.UriSchemeFtp) == false) + if (!serverUri.ToLower().StartsWith(Uri.UriSchemeFtp)) { return false; } diff --git a/snippets/csharp/System.Net/HttpWebRequest/ServicePoint/servicepoint.cs b/snippets/csharp/System.Net/HttpWebRequest/ServicePoint/servicepoint.cs index a1ac83e7143..ae4bdc04961 100644 --- a/snippets/csharp/System.Net/HttpWebRequest/ServicePoint/servicepoint.cs +++ b/snippets/csharp/System.Net/HttpWebRequest/ServicePoint/servicepoint.cs @@ -141,7 +141,7 @@ public static void Main(string[] args) } string proxy = args[0]; - if ((rex.Match(proxy)).Success != true) + if (!(rex.Match(proxy)).Success) { Console.WriteLine("Input string format not allowed."); return; diff --git a/snippets/csharp/System.Net/ServicePointManager/DnsRefreshTimeout/servicepoint.cs b/snippets/csharp/System.Net/ServicePointManager/DnsRefreshTimeout/servicepoint.cs index b35d8eb3e62..0b999c8e5c6 100644 --- a/snippets/csharp/System.Net/ServicePointManager/DnsRefreshTimeout/servicepoint.cs +++ b/snippets/csharp/System.Net/ServicePointManager/DnsRefreshTimeout/servicepoint.cs @@ -127,7 +127,7 @@ public static void Main (string[] args) } string proxy = args[0]; - if ((rex.Match (proxy)).Success != true) + if (!(rex.Match (proxy)).Success) { Console.WriteLine ("Input string format not allowed."); return; diff --git a/snippets/csharp/System.Numerics/BigInteger/Overview/Mutability_Examples.cs b/snippets/csharp/System.Numerics/BigInteger/Overview/Mutability_Examples.cs index e75a056f20a..e2f59bd6737 100644 --- a/snippets/csharp/System.Numerics/BigInteger/Overview/Mutability_Examples.cs +++ b/snippets/csharp/System.Numerics/BigInteger/Overview/Mutability_Examples.cs @@ -31,7 +31,7 @@ private static void PerformBigIntegerOperation() for (int ctr = 0; ctr <= repetitions; ctr++) { // Perform some operation. If it fails, exit the loop. - if (! SomeOperationSucceeds()) break; + if (!SomeOperationSucceeds()) break; // The following code executes if the operation succeeds. number++; } @@ -53,7 +53,7 @@ private static void PerformWithIntermediary() for (int ctr = 0; ctr <= repetitions; ctr++) { // Perform some operation. If it fails, exit the loop. - if (! SomeOperationSucceeds()) break; + if (!SomeOperationSucceeds()) break; // The following code executes if the operation succeeds. actualRepetitions++; } diff --git a/snippets/csharp/System.Numerics/BigInteger/TryParse/System.Numeric.BigInteger.TryParse.cs b/snippets/csharp/System.Numerics/BigInteger/TryParse/System.Numeric.BigInteger.TryParse.cs index ad0b384121a..0bfa8ff8d35 100644 --- a/snippets/csharp/System.Numerics/BigInteger/TryParse/System.Numeric.BigInteger.TryParse.cs +++ b/snippets/csharp/System.Numerics/BigInteger/TryParse/System.Numeric.BigInteger.TryParse.cs @@ -37,10 +37,10 @@ private void TryParse1() } else { - if (! succeeded1) + if (!succeeded1) Console.WriteLine("Unable to initialize the first BigInteger value."); - if (! succeeded2) + if (!succeeded2) Console.WriteLine("Unable to initialize the second BigInteger value."); } // The example displays the following output: diff --git a/snippets/csharp/System.Printing/LocalPrintServer/Overview/Window1.xaml.cs b/snippets/csharp/System.Printing/LocalPrintServer/Overview/Window1.xaml.cs index f064bc293bc..d6819b5c7eb 100644 --- a/snippets/csharp/System.Printing/LocalPrintServer/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Printing/LocalPrintServer/Overview/Window1.xaml.cs @@ -72,7 +72,7 @@ private void WindowLoaded(object sender, RoutedEventArgs e) public String ContentDir { get - { return _contentDir; } + { return _contentDir; } } #region Button Event Handlers @@ -133,33 +133,33 @@ private void ButtonHelperPrint(bool async) switch (currentMode) { case eGuiMode.SingleVisual: - { - printHelper.PrintSingleVisual(printQueue, async); - break; - } + { + printHelper.PrintSingleVisual(printQueue, async); + break; + } case eGuiMode.MultipleVisuals: - { - printHelper.PrintMultipleVisuals(printQueue, async); - break; - } + { + printHelper.PrintMultipleVisuals(printQueue, async); + break; + } case eGuiMode.SingleFlowDocument: - { - printHelper.PrintSingleFlowContentDocument( - printQueue, async); - break; - } + { + printHelper.PrintSingleFlowContentDocument( + printQueue, async); + break; + } case eGuiMode.SingleFixedDocument: - { - printHelper.PrintSingleFixedContentDocument( - printQueue, async); - break; - } + { + printHelper.PrintSingleFixedContentDocument( + printQueue, async); + break; + } case eGuiMode.MultipleFixedDocuments: - { - printHelper.PrintMultipleFixedContentDocuments( - printQueue, async); - break; - } + { + printHelper.PrintMultipleFixedContentDocuments( + printQueue, async); + break; + } }// end:switch (currentMode) }// end:ButtonHelperSave() @@ -180,8 +180,8 @@ private void OnBtnCancelClick(object sender, RoutedEventArgs e) /// /// /// Progress information about the asynchronous save. - private void AsyncPrintEvent( - object printHelper, AsyncPrintEventArgs asyncInformation) + private void AsyncPrintEvent( + object printHelper, AsyncPrintEventArgs asyncInformation) { if (asyncInformation.Completed) { @@ -217,7 +217,7 @@ private string GetContainerPathFromDialog() saveFileDialog.Filter = "XPS document files (*.xps)|*.xps"; saveFileDialog.FilterIndex = 1; - if (saveFileDialog.ShowDialog() == true) + if (saveFileDialog.ShowDialog().Value) { // The user specified a valid path and filename. return saveFileDialog.FileName; } diff --git a/snippets/csharp/System.Printing/LocalPrintServer/Overview/XpsPrintHelper.cs b/snippets/csharp/System.Printing/LocalPrintServer/Overview/XpsPrintHelper.cs index cff3a324f3e..70155896cb8 100644 --- a/snippets/csharp/System.Printing/LocalPrintServer/Overview/XpsPrintHelper.cs +++ b/snippets/csharp/System.Printing/LocalPrintServer/Overview/XpsPrintHelper.cs @@ -3,17 +3,13 @@ using System; using System.Collections.Generic; -using System.IO; -using System.IO.Packaging; using System.Printing; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Documents.Serialization; using System.Windows.Media; using System.Windows.Xps; -using System.Windows.Xps.Packaging; using System.Windows.Xps.Serialization; -using SDKSample; namespace SDKSampleHelper { @@ -75,7 +71,7 @@ public PrintDialog GetPrintDialog() // Show the printer dialog. If the return is "true", // the user made a valid selection and clicked "Ok". - if (dlg.ShowDialog() == true) + if (dlg.ShowDialog().Value) printDialog = dlg; // return the dialog the user selections. return printDialog; @@ -196,7 +192,7 @@ public void PrintSingleFixedContentDocument(PrintQueue pq, bool async) PrintSingleFixedContentDocument(xdwPrint, fd); }// end:PrintSingleFixedContentDocument() - // + // // ---------------- PrintMultipleFixedContentDocuments ---------------- /// @@ -228,7 +224,7 @@ public void PrintMultipleFixedContentDocuments(PrintQueue pq, bool async) PrintMultipleFixedContentDocuments(xdwPrint, fds); }// end:PrintMultipleFixedContentDocuments() - // + // // -------------------- PrintDocumentViewerContent -------------------- /// @@ -516,7 +512,7 @@ private void AsyncPrintingProgress( } }// end:AsyncPrintingProgress() - // + // // ----- MultipleFixedContentDocuments_WritingPrintTicketRequired ----- /// @@ -578,7 +574,7 @@ private void MultipleFixedContentDocuments_WritingPrintTicketRequired( // to FixedPage as well. }// end:MultipleFixedContentDocuments_WritingPrintTicketRequired() - // + // // -------------- CreateFixedDocumentSequencePrintTicket -------------- /// @@ -633,7 +629,7 @@ private PrintTicket CreateFixedDocumentPrintTicket(bool isLandscaped) #region Helper Methods - // + // // -------------------- GetPrintXpsDocumentWriter() ------------------- /// /// Returns an XpsDocumentWriter for the default print queue. @@ -651,7 +647,7 @@ private XpsDocumentWriter GetPrintXpsDocumentWriter() XpsDocumentWriter xpsdw = PrintQueue.CreateXpsDocumentWriter(pq); return xpsdw; }// end:GetPrintXpsDocumentWriter() - // + // // --------------- GetPrintXpsDocumentWriter(PrintQueue) -------------- /// @@ -703,12 +699,12 @@ private Visual PerformTransform(Visual v, PrintQueue pq) #endregion // Helper Methods #region Private Data - private int _batchProgress = 0; - private int _firstDocumentPrintTicket = 0; - private String _contentDir = null; - private WPFContent _wpfContent = null; - private VisualsToXpsDocument _activeVtoXPSD = null; - private XpsDocumentWriter _xpsdwActive = null; + private int _batchProgress = 0; + private int _firstDocumentPrintTicket = 0; + private String _contentDir = null; + private WPFContent _wpfContent = null; + private VisualsToXpsDocument _activeVtoXPSD = null; + private XpsDocumentWriter _xpsdwActive = null; #endregion // Private Data }// end:class XpsPrintHelper diff --git a/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/AddDeclarativeSecurity/constructorbuilder_attributes_4.cs b/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/AddDeclarativeSecurity/constructorbuilder_attributes_4.cs index b993445c8cd..235593640b4 100644 --- a/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/AddDeclarativeSecurity/constructorbuilder_attributes_4.cs +++ b/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/AddDeclarativeSecurity/constructorbuilder_attributes_4.cs @@ -60,7 +60,7 @@ internal MyConstructorBuilder() MethodAttributes myMethodAttributes = myConstructor.Attributes; Type myAttributeType = typeof(MethodAttributes); int myAttribValue = (int) myMethodAttributes; - if(! myAttributeType.IsEnum) + if (!myAttributeType.IsEnum) { Console.WriteLine("This is not an Enum"); } diff --git a/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetImplementationFlags/constructorbuilder_setimplementationflags.cs b/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetImplementationFlags/constructorbuilder_setimplementationflags.cs index cdf850e8799..39651db3e8f 100644 --- a/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetImplementationFlags/constructorbuilder_setimplementationflags.cs +++ b/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetImplementationFlags/constructorbuilder_setimplementationflags.cs @@ -50,7 +50,7 @@ internal MyConstructorBuilder() MethodImplAttributes myMethodAttributes = myConstructor.GetMethodImplementationFlags(); Type myAttributeType = typeof(MethodImplAttributes); int myAttribValue = (int) myMethodAttributes; - if(! myAttributeType.IsEnum) + if (!myAttributeType.IsEnum) { Console.WriteLine("This is not an Enum"); } diff --git a/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance1.cs b/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance1.cs index 6f1d3ae62c2..9d62b7edbdc 100644 --- a/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance1.cs +++ b/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance1.cs @@ -34,7 +34,7 @@ public static void Main() { Assembly assem = typeof(Person).Assembly; Person p = (Person) assem.CreateInstance("Contoso.Libraries.Person"); - if (! (p == null)) { + if (!(p == null)) { p.Name = "John"; Console.WriteLine("Instantiated a {0} object whose value is '{1}'", p.GetType().Name, p); diff --git a/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance2.cs b/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance2.cs index 4b315d61c27..5a64b3d52ab 100644 --- a/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance2.cs +++ b/snippets/csharp/System.Reflection/Assembly/CreateInstance/createinstance2.cs @@ -35,7 +35,7 @@ public static void Main() String fullName = "contoso.libraries.person"; Assembly assem = typeof(Person).Assembly; Person p = (Person) assem.CreateInstance(fullName); - if (! (p == null)) { + if (!(p == null)) { p.Name = "John"; Console.WriteLine("Instantiated a {0} object whose value is '{1}'", p.GetType().Name, p); @@ -45,7 +45,7 @@ public static void Main() "with Assembly.CreateInstance(String)"); // Try case-insensitive type name comparison. p = (Person) assem.CreateInstance(fullName, true); - if (! (p == null)) { + if (!(p == null)) { p.Name = "John"; Console.WriteLine("Instantiated a {0} object whose value is '{1}'", p.GetType().Name, p); diff --git a/snippets/csharp/System.Reflection/MemberInfo/GetCustomAttributes/GetCustomAttributes1.cs b/snippets/csharp/System.Reflection/MemberInfo/GetCustomAttributes/GetCustomAttributes1.cs index 16a609ac7b5..043a288bc86 100644 --- a/snippets/csharp/System.Reflection/MemberInfo/GetCustomAttributes/GetCustomAttributes1.cs +++ b/snippets/csharp/System.Reflection/MemberInfo/GetCustomAttributes/GetCustomAttributes1.cs @@ -38,7 +38,7 @@ public static void Main() Console.Write("ThreadStatic"); hasAttribute = true; } - if (! hasAttribute) + if (!hasAttribute) Console.Write("No attributes"); Console.WriteLine(); diff --git a/snippets/csharp/System.Resources/MissingManifestResourceException/Overview/resourcenames.cs b/snippets/csharp/System.Resources/MissingManifestResourceException/Overview/resourcenames.cs index 56327b4f829..653688612f3 100644 --- a/snippets/csharp/System.Resources/MissingManifestResourceException/Overview/resourcenames.cs +++ b/snippets/csharp/System.Resources/MissingManifestResourceException/Overview/resourcenames.cs @@ -15,7 +15,7 @@ public static void Main() string filename = Environment.GetCommandLineArgs()[1].Trim(); // Check whether the file exists. - if (! File.Exists(filename)) { + if (!File.Exists(filename)) { Console.WriteLine("{0} does not exist.", filename); return; } diff --git a/snippets/csharp/System.Resources/ResourceManager/Overview/example3.cs b/snippets/csharp/System.Resources/ResourceManager/Overview/example3.cs index 1828619dcb1..546ace48d36 100644 --- a/snippets/csharp/System.Resources/ResourceManager/Overview/example3.cs +++ b/snippets/csharp/System.Resources/ResourceManager/Overview/example3.cs @@ -19,7 +19,7 @@ public static void Main() Console.WriteLine("\n{0}!", greeting); Console.Write(rm.GetString("Prompt", CultureInfo.CurrentCulture)); string name = Console.ReadLine(); - if (! String.IsNullOrEmpty(name)) + if (!String.IsNullOrEmpty(name)) Console.WriteLine("{0}, {1}!", greeting, name); } Console.WriteLine(); diff --git a/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/assembly1.cs b/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/assembly1.cs index 351313e1e09..629e4d6c457 100644 --- a/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/assembly1.cs +++ b/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/assembly1.cs @@ -27,7 +27,7 @@ public class FileUtilities { internal static string AppendDirectorySeparator(string dir) { - if (! dir.Trim().EndsWith(Path.DirectorySeparatorChar.ToString())) + if (!dir.Trim().EndsWith(Path.DirectorySeparatorChar.ToString())) return dir.Trim() + Path.DirectorySeparatorChar; else return dir; diff --git a/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/friend1.cs b/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/friend1.cs index 38cdb1b2282..cce729d89c8 100644 --- a/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/friend1.cs +++ b/snippets/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/friend1.cs @@ -30,7 +30,7 @@ public class FileUtilities { internal static string AppendDirectorySeparator(string dir) { - if (! dir.Trim().EndsWith(Path.DirectorySeparatorChar.ToString())) + if (!dir.Trim().EndsWith(Path.DirectorySeparatorChar.ToString())) return dir.Trim() + Path.DirectorySeparatorChar; else return dir; diff --git a/snippets/csharp/System.Runtime.Remoting.Channels/IChannelReceiver/Overview/ichannelreceiver_channeldata_server.cs b/snippets/csharp/System.Runtime.Remoting.Channels/IChannelReceiver/Overview/ichannelreceiver_channeldata_server.cs index 7e7d5433229..52f15dcd99c 100644 --- a/snippets/csharp/System.Runtime.Remoting.Channels/IChannelReceiver/Overview/ichannelreceiver_channeldata_server.cs +++ b/snippets/csharp/System.Runtime.Remoting.Channels/IChannelReceiver/Overview/ichannelreceiver_channeldata_server.cs @@ -134,7 +134,7 @@ public string[] GetUrlsForUri(string objectURI) // Start listening to the port. public void StartListening(object data) { - if(myListening == false) + if (!myListening) { myTcpListener.Start(); myListening = true; @@ -147,7 +147,7 @@ public void StartListening(object data) // Stop listening to the port. public void StopListening(object data) { - if(myListening == true) + if (myListening) { myTcpListener.Stop(); myListening = false; diff --git a/snippets/csharp/System.Security.Claims/ClaimsAuthenticationManager/Overview/simpleclaimsauthenticatonmanager.cs b/snippets/csharp/System.Security.Claims/ClaimsAuthenticationManager/Overview/simpleclaimsauthenticatonmanager.cs index b2d4b0b3156..c3c776ce1a2 100644 --- a/snippets/csharp/System.Security.Claims/ClaimsAuthenticationManager/Overview/simpleclaimsauthenticatonmanager.cs +++ b/snippets/csharp/System.Security.Claims/ClaimsAuthenticationManager/Overview/simpleclaimsauthenticatonmanager.cs @@ -13,7 +13,7 @@ class SimpleClaimsAuthenticatonManager : ClaimsAuthenticationManager { public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal) { - if (incomingPrincipal != null && incomingPrincipal.Identity.IsAuthenticated == true) + if (incomingPrincipal != null && incomingPrincipal.Identity.IsAuthenticated) { ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim(ClaimTypes.Role, "User")); } diff --git a/snippets/csharp/System.Security.Cryptography/KeyedHashAlgorithm/Overview/program.cs b/snippets/csharp/System.Security.Cryptography/KeyedHashAlgorithm/Overview/program.cs index b4857bcd343..a6ea9abea2e 100644 --- a/snippets/csharp/System.Security.Cryptography/KeyedHashAlgorithm/Overview/program.cs +++ b/snippets/csharp/System.Security.Cryptography/KeyedHashAlgorithm/Overview/program.cs @@ -118,7 +118,7 @@ public override void Initialize() } protected override void HashCore(byte[] rgb, int ib, int cb) { - if (bHashing == false) + if (!bHashing) { hash1.TransformBlock(rgbInner, 0, 64, rgbInner, 0); bHashing = true; @@ -128,7 +128,7 @@ protected override void HashCore(byte[] rgb, int ib, int cb) protected override byte[] HashFinal() { - if (bHashing == false) + if (!bHashing) { hash1.TransformBlock(rgbInner, 0, 64, rgbInner, 0); bHashing = true; diff --git a/snippets/csharp/System.Security.Cryptography/ToBase64Transform/Overview/members.cs b/snippets/csharp/System.Security.Cryptography/ToBase64Transform/Overview/members.cs index 975f5a7fbad..ff23fe7398a 100644 --- a/snippets/csharp/System.Security.Cryptography/ToBase64Transform/Overview/members.cs +++ b/snippets/csharp/System.Security.Cryptography/ToBase64Transform/Overview/members.cs @@ -99,7 +99,7 @@ private static void EncodeFromFile(string sourceFile, string targetFile) // Determine if the current transform can be reused. // - if (! base64Transform.CanReuseTransform) + if (!base64Transform.CanReuseTransform) // { // Free up any used resources. diff --git a/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BlockSize/Window1.xaml.cs b/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BlockSize/Window1.xaml.cs index a039fc2496b..7afe891e30f 100644 --- a/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BlockSize/Window1.xaml.cs +++ b/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BlockSize/Window1.xaml.cs @@ -3,18 +3,11 @@ using System; using System.IO; -using System.IO.Packaging; -using System.Net; using System.Security.RightsManagement; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; -using System.Windows.Markup; using System.Windows.Media.Imaging; -using System.Windows.Xps.Packaging; -using System.Xml; using WinForms = Microsoft.Win32; namespace SdkSample @@ -45,7 +38,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) { string msg = "The currently open file needs to be closed before\n" + - "opening a one. Ok to close '"+_contentFilename+"'?"; + "opening a one. Ok to close '" + _contentFilename + "'?"; MessageBoxResult result = MessageBox.Show(msg, "Close Current File?", MessageBoxButton.OKCancel, MessageBoxImage.Question); @@ -70,7 +63,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() == true) + if (dialog.ShowDialog().Value) OpenContent(dialog.FileName); }// end:OnOpen() @@ -120,7 +113,7 @@ public bool OpenContent(string filename) } // Enable document menu controls. - menuFileClose.IsEnabled = true; + menuFileClose.IsEnabled = true; menuFileRights.IsEnabled = true; // Give the ImageViewer focus. @@ -210,7 +203,7 @@ private void OnRights(object sender, EventArgs e) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() == true) + if (dialog.ShowDialog().Value) OpenXrML(dialog.FileName); }// end:OnRights() @@ -240,7 +233,7 @@ public bool OpenXrML(string filename) WriteStatus("Opened '" + _xrmlFilename + "'"); WritePrompt("Click 'File | Publish...' to publish the document " + - "package with the permissions specified in '"+ _xrmlFilename+ "'."); + "package with the permissions specified in '" + _xrmlFilename + "'."); rightsBlockTitle.Text = "Rights - " + _xrmlFilename; return true; }// end:OpenXrML() @@ -277,15 +270,15 @@ private void OnPublish(object sender, EventArgs e) // "Content\" folder to write the encrypted content file to. WinForms.SaveFileDialog dialog = new WinForms.SaveFileDialog(); dialog.InitialDirectory = GetContentFolder(); - dialog.Title = "Publish Rights Managed Content As"; + dialog.Title = "Publish Rights Managed Content As"; dialog.Filter = "Rights Managed content (*.protected)|*.protected"; // Create a new content ".protected" file extension. dialog.FileName = _contentFilepath.Insert( - _contentFilepath.Length, ".protected" ); + _contentFilepath.Length, ".protected"); // Show the "Save As" dialog. If the user clicks "Cancel", return. - if (dialog.ShowDialog() != true) return; + if (!dialog.ShowDialog().Value) return; // Extract the filename without path. _rmContentFilepath = dialog.FileName; @@ -313,8 +306,8 @@ public bool PublishRMContent( string xrmlString; // Extract individual filenames without the path. - string contentFilename = FilenameOnly(contentFile); - string xrmlFilename = FilenameOnly(xrmlFile); + string contentFilename = FilenameOnly(contentFile); + string xrmlFilename = FilenameOnly(xrmlFile); string encryptedFilename = FilenameOnly(encryptedFile); try @@ -328,7 +321,7 @@ public bool PublishRMContent( } catch (Exception ex) { - MessageBox.Show("ERROR: '"+xrmlFilename+"' open failed.\n"+ + MessageBox.Show("ERROR: '" + xrmlFilename + "' open failed.\n" + "Exception: " + ex.Message, "XrML File Error", MessageBoxButton.OK, MessageBoxImage.Error); return false; @@ -394,7 +387,7 @@ public bool PublishRMContent( "XrML UnsignedPublishLicense owner name: " + author.Name, "Incorrect Authentication Name", MessageBoxButton.OK, MessageBoxImage.Error); - return false; + return false; } WriteStatus(" Signing the UnsignedPublishLicense\n" + @@ -435,7 +428,7 @@ public bool PublishRMContent( { WriteStatus(" Writing encrypted content."); using (Stream clearTextStream = - File.OpenRead(contentFile) ) + File.OpenRead(contentFile)) { using (Stream cryptoTextStream = File.OpenWrite(encryptedFile)) @@ -451,14 +444,14 @@ public bool PublishRMContent( new byte[cryptoProvider.BlockSize]; // Encrypt clearText to cryptoText block by block. - for(;;) + for (; ; ) { // Read clearText block. int readCount = ReliableRead( clearTextStream, - clearTextBlock, 0 , + clearTextBlock, 0, cryptoProvider.BlockSize); // readCount of zero is end of data. - if (readCount == 0) break; // for + if (readCount == 0) break; // for // Encrypt clearText to cryptoText. byte[] cryptoTextBlock = @@ -633,7 +626,7 @@ private static int ReliableRead( int bytesRead = stream.Read(buffer, offset + totalBytesRead, requiredCount - totalBytesRead); - if (bytesRead == 0) break; // while + if (bytesRead == 0) break; // while totalBytesRead += bytesRead; } return totalBytesRead; @@ -645,7 +638,7 @@ private static int ReliableRead( public Image ImageViewer { get - { return imageViewer; } // "imageViewer" declared in Window1.xaml + { return imageViewer; } // "imageViewer" declared in Window1.xaml } #endregion Utilities @@ -653,13 +646,13 @@ public Image ImageViewer private string _xrmlFilepath = null; // xrml path and filename. private string _xrmlFilename = null; // xrml filename without path. private string _xrmlString = null; // xrml string. - private string _contentFilepath=null; // content path and filename. - private string _contentFilename=null; // content filename without path. - private string _rmContentFilepath=null; // RM content path and filename. - private string _rmContentFilename=null; // RM content filename without path. + private string _contentFilepath = null; // content path and filename. + private string _contentFilename = null; // content filename without path. + private string _rmContentFilepath = null; // RM content path and filename. + private string _rmContentFilename = null; // RM content filename without path. private static SecureEnvironment _secureEnv = null; private static String _currentUserId = GetDefaultWindowsUserName(); #endregion private fields }// end:partial class Window1 -}// end:namespace SdkSample \ No newline at end of file +}// end:namespace SdkSample diff --git a/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BoundGrants/Window1.xaml.cs b/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BoundGrants/Window1.xaml.cs index 87345906eca..3de060cd7e6 100644 --- a/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BoundGrants/Window1.xaml.cs +++ b/snippets/csharp/System.Security.RightsManagement/CryptoProvider/BoundGrants/Window1.xaml.cs @@ -4,17 +4,12 @@ using System; using System.Collections.ObjectModel; using System.IO; -using System.Net; +using System.Security.Permissions; using System.Security.RightsManagement; -using System.Text; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; using System.Windows.Input; -using System.Windows.Markup; using System.Windows.Media.Imaging; -using System.Xml; -using System.Security.Permissions; using WinForms = Microsoft.Win32; namespace SdkSample @@ -51,7 +46,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) // Show the "File Open" dialog. If the user // clicks "Cancel", cancel the File|Open operation. - if (dialog.ShowDialog() != true) + if (!dialog.ShowDialog().Value) return; // clicks "OK", load and display the specified file. @@ -62,8 +57,8 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) // Check to see if the file name shows as "protected" or // "encrypted". If encrypted, use OpenEncryptedContent(). bool opened; - if ( _contentFile.ToLower().Contains("protected") - || _contentFile.ToLower().Contains("encrypted") ) + if (_contentFile.ToLower().Contains("protected") + || _contentFile.ToLower().Contains("encrypted")) opened = OpenEncryptedContent(_contentFile); // Otherwise open as unencrypted. @@ -72,7 +67,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) // If the file was successfully opened, show the file name, // enable File|Close, and give focus to the Image control. - if (opened == true) + if (opened) { this.Title = "RightsManagedContentViewer SDK Sample - " + Filename(_contentFile); @@ -92,7 +87,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) public bool OpenContent(string filename) { // If the file is not a supported image, do not try to display it. - if ( !filename.EndsWith(".png") + if (!filename.EndsWith(".png") && !filename.EndsWith(".jpg") && !filename.EndsWith(".jpeg")) { @@ -140,9 +135,9 @@ public bool OpenEncryptedContent(string encryptedFile) // Get the ID of the current user log-in. string currentUserId; try - { currentUserId = GetDefaultWindowsUserName(); } + { currentUserId = GetDefaultWindowsUserName(); } catch - { currentUserId = null; } + { currentUserId = null; } if (currentUserId == null) { MessageBox.Show("No valid user ID available", "Invalid User ID", @@ -178,7 +173,7 @@ public bool OpenEncryptedContent(string encryptedFile) _secureEnv = SecureEnvironment.Create( applicationManifest, new ContentUser(currentUserId, - _authentication) ); + _authentication)); } else // if user is not yet activated. { @@ -189,7 +184,7 @@ public bool OpenEncryptedContent(string encryptedFile) _secureEnv = SecureEnvironment.Create( applicationManifest, _authentication, - UserActivationMode.Permanent ); + UserActivationMode.Permanent); // If not using the current Windows user, use // UserActivationMode.Temporary to display the Windows @@ -223,7 +218,7 @@ public bool OpenEncryptedContent(string encryptedFile) if (encryptedFile.EndsWith(".protected")) { // Remove ".protected" from the file name. useLicenseFile = useLicenseFile.Remove( - useLicenseFile.Length - ".protected".Length ); + useLicenseFile.Length - ".protected".Length); } // Append ".UseLicense.xml" as the UseLicense file extension. useLicenseFile = useLicenseFile + ".UseLicense.xml"; @@ -264,13 +259,13 @@ public bool OpenEncryptedContent(string encryptedFile) rightsBlock.Text += " Until: " + grant.ValidUntil + "\n"; } - if (cryptoProvider.CanDecrypt == true) + if (cryptoProvider.CanDecrypt) ShowStatus(" Decryption granted."); else ShowStatus(" CANNOT DECRYPT!"); // - ShowStatus(" Decrypting '"+Filename(encryptedFile)+"'."); + ShowStatus(" Decrypting '" + Filename(encryptedFile) + "'."); // byte[] imageBuffer; using (Stream cipherTextStream = File.OpenRead(encryptedFile)) @@ -292,7 +287,7 @@ public bool OpenEncryptedContent(string encryptedFile) // decrypt cipherText to clearText block by block. int imageBufferIndex = 0; - for ( ; ; ) + for (; ; ) { // Read cipherText block. int readCount = ReliableRead( cipherTextStream, @@ -308,7 +303,7 @@ public bool OpenEncryptedContent(string encryptedFile) // Copy the clearTextBlock to the imageBuffer. int copySize = Math.Min(clearTextBlock.Length, - contentLength-imageBufferIndex); + contentLength - imageBufferIndex); Array.Copy(clearTextBlock, 0, imageBuffer, imageBufferIndex, copySize); imageBufferIndex += copySize; @@ -516,7 +511,7 @@ public void ShowPrompt(string prompt) /// Sets rights management for Windows authentication. private void OnWindowsAuthentication(object sender, EventArgs e) { - menuViewWindows.IsChecked = true; + menuViewWindows.IsChecked = true; menuViewPassport.IsChecked = false; _authentication = AuthenticationType.Windows; } @@ -526,7 +521,7 @@ private void OnWindowsAuthentication(object sender, EventArgs e) /// Sets rights management for Windows authentication. private void OnPassportAuthentication(object sender, EventArgs e) { - menuViewWindows.IsChecked = false; + menuViewWindows.IsChecked = false; menuViewPassport.IsChecked = true; _authentication = AuthenticationType.Passport; } @@ -574,11 +569,11 @@ public Image ImageViewer #endregion Utilities #region private fields - private string _contentFile=null; // content path and filename. + private string _contentFile = null; // content path and filename. private AuthenticationType _authentication = AuthenticationType.Windows; private static SecureEnvironment _secureEnv = null; private static String _currentUserId = GetDefaultWindowsUserName(); #endregion private fields }// end:partial class Window1 -}// end:namespace SdkSample \ No newline at end of file +}// end:namespace SdkSample diff --git a/snippets/csharp/System.Security.RightsManagement/UnsignedPublishLicense/.ctor/Window1.xaml.cs b/snippets/csharp/System.Security.RightsManagement/UnsignedPublishLicense/.ctor/Window1.xaml.cs index f6816c465ab..5f9b965d897 100644 --- a/snippets/csharp/System.Security.RightsManagement/UnsignedPublishLicense/.ctor/Window1.xaml.cs +++ b/snippets/csharp/System.Security.RightsManagement/UnsignedPublishLicense/.ctor/Window1.xaml.cs @@ -9,12 +9,10 @@ using System.Security.RightsManagement; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Xps.Packaging; -using System.Xml; using WinForms = Microsoft.Win32; namespace SdkSample @@ -45,7 +43,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) { string msg = "The currently open document needs to be closed before\n" + - "opening a new document. Ok to close '"+_xpsDocumentName+"'?"; + "opening a new document. Ok to close '" + _xpsDocumentName + "'?"; MessageBoxResult result = MessageBox.Show(msg, "Close Current Document?", MessageBoxButton.OKCancel, MessageBoxImage.Question); @@ -69,7 +67,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() == true) + if (dialog.ShowDialog().Value) OpenDocument(dialog.FileName); }// end:OnOpen() @@ -87,7 +85,7 @@ public bool OpenDocument(string filename) _xpsDocumentPath = filename; // Extract the document filename without the path. - _xpsDocumentName = filename.Remove(0, filename.LastIndexOf('\\')+1); + _xpsDocumentName = filename.Remove(0, filename.LastIndexOf('\\') + 1); _packageUri = new Uri(filename, UriKind.Absolute); try @@ -130,8 +128,8 @@ public bool OpenDocument(string filename) docViewer.Document = fds; // Enable document menu controls. - menuFileClose.IsEnabled = true; - menuFilePrint.IsEnabled = true; + menuFileClose.IsEnabled = true; + menuFilePrint.IsEnabled = true; menuFileRights.IsEnabled = true; menuViewIncreaseZoom.IsEnabled = true; menuViewDecreaseZoom.IsEnabled = true; @@ -186,7 +184,7 @@ private Package GetPackage(string filename) { Stream inputPackageStream = webResponse.GetResponseStream(); if (inputPackageStream != null) - { + { // Retrieve the Package from that stream. inputPackage = Package.Open(inputPackageStream); } @@ -317,7 +315,7 @@ private void OnRights(object sender, EventArgs e) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() == true) + if (dialog.ShowDialog().Value) OpenXrML(dialog.FileName); }// end:OnRights() @@ -349,7 +347,7 @@ public bool OpenXrML(string filename) WriteStatus("Opened '" + _xrmlFilename + "'"); WritePrompt("Click 'File | Publish...' to publish the document " + - "package with the permissions specified in '"+ _xrmlFilename+ "'."); + "package with the permissions specified in '" + _xrmlFilename + "'."); rightsBlockTitle.Text = "Rights - " + _xrmlFilename; return true; }// end:OpenXrML() @@ -386,21 +384,22 @@ private void OnPublish(object sender, EventArgs e) // "Content\" folder to write the encrypted package to. WinForms.SaveFileDialog dialog = new WinForms.SaveFileDialog(); dialog.InitialDirectory = GetContentFolder(); - dialog.Title = "Publish Rights Managed Package As"; + dialog.Title = "Publish Rights Managed Package As"; dialog.Filter = "Rights Managed XPS package (*-RM.xps)|*-RM.xps"; // Create a new package filename by prefixing // the document filename extension with "rm". dialog.FileName = _xpsDocumentPath.Insert( - _xpsDocumentPath.LastIndexOf('.'), "-RM" ); + _xpsDocumentPath.LastIndexOf('.'), "-RM"); // Show the "Save As" dialog. If the user clicks "Cancel", return. - if (dialog.ShowDialog() != true) return; + if (!dialog.ShowDialog().Value) + return; // Extract the filename without path. _rmxpsPackagePath = dialog.FileName; _rmxpsPackageName = _rmxpsPackagePath.Remove( - 0, _rmxpsPackagePath.LastIndexOf('\\')+1 ); + 0, _rmxpsPackagePath.LastIndexOf('\\') + 1); WriteStatus("Publishing '" + _rmxpsPackageName + "'."); PublishRMPackage(_xpsDocumentPath, _xrmlFilepath, dialog.FileName); @@ -424,12 +423,12 @@ public bool PublishRMPackage( string xrmlString; // Extract individual filenames without the path. - string packageFilename = packageFile.Remove( 0, - packageFile.LastIndexOf('\\')+1 ); - string xrmlFilename = xrmlFile.Remove( 0, - xrmlFile.LastIndexOf('\\')+1 ); - string encryptedFilename = encryptedFile.Remove( 0, - encryptedFile.LastIndexOf('\\')+1 ); + string packageFilename = packageFile.Remove(0, + packageFile.LastIndexOf('\\') + 1); + string xrmlFilename = xrmlFile.Remove(0, + xrmlFile.LastIndexOf('\\') + 1); + string encryptedFilename = encryptedFile.Remove(0, + encryptedFile.LastIndexOf('\\') + 1); try { @@ -441,7 +440,7 @@ public bool PublishRMPackage( } catch (Exception ex) { - MessageBox.Show("ERROR: '"+xrmlFilename+"' open failed.\n"+ + MessageBox.Show("ERROR: '" + xrmlFilename + "' open failed.\n" + "Exception: " + ex.Message, "XrML File Error", MessageBoxButton.OK, MessageBoxImage.Error); return false; @@ -474,7 +473,7 @@ public bool PublishRMPackage( // with appropriate ValidFrom and ValidUntil date/time values. foreach (ContentGrant grant in tmpGrants) { - unsignedLicense.Grants.Add( new ContentGrant( + unsignedLicense.Grants.Add(new ContentGrant( grant.User, grant.Right, DateTime.MinValue, // set ValidFrom as appropriate DateTime.MaxValue)); // set ValidUntil as appropriate @@ -532,7 +531,7 @@ public bool PublishRMPackage( "XrML UnsignedPublishLicense owner name: " + author.Name, "Incorrect Authentication Name", MessageBoxButton.OK, MessageBoxImage.Error); - return false; + return false; } WriteStatus(" Signing the UnsignedPublishLicense\n" + @@ -695,7 +694,7 @@ private void OnPrint(object target, ExecutedRoutedEventArgs args) /// Prints the DocumentViewer's content and annotations. public void PrintDocument() { - if (docViewer == null) return; + if (docViewer == null) return; docViewer.Print(); }// end:PrintDocument() @@ -705,7 +704,7 @@ public void PrintDocument() public DocumentViewer DocViewer { get - { return docViewer; } // "docViewer" declared in Window1.xaml + { return docViewer; } // "docViewer" declared in Window1.xaml } #endregion Utilities @@ -713,12 +712,12 @@ public DocumentViewer DocViewer private string _xrmlFilepath = null; // xrml path and filename. private string _xrmlFilename = null; // xrml filename without path. private string _xrmlString = null; // xrml string. - private string _xpsDocumentPath=null; // XPS doc path and filename. - private string _xpsDocumentName=null; // XPS doc filename without path. - private string _rmxpsPackagePath=null; // RM package path and filename. - private string _rmxpsPackageName=null; // RM package name without path. - private Uri _packageUri; // XPS document path and filename URI. - private Package _xpsPackage = null; // XPS document package. + private string _xpsDocumentPath = null; // XPS doc path and filename. + private string _xpsDocumentName = null; // XPS doc filename without path. + private string _rmxpsPackagePath = null; // RM package path and filename. + private string _rmxpsPackageName = null; // RM package name without path. + private Uri _packageUri; // XPS document path and filename URI. + private Package _xpsPackage = null; // XPS document package. private XpsDocument _xpsDocument; // XPS document within the package. private static SecureEnvironment _secureEnv = null; private static String _currentUserId = GetDefaultWindowsUserName(); diff --git a/snippets/csharp/System.Text.RegularExpressions/Regex/GroupNameFromNumber/groupnamefromnumberex.cs b/snippets/csharp/System.Text.RegularExpressions/Regex/GroupNameFromNumber/groupnamefromnumberex.cs index 521b5922095..72e8e6f88f4 100644 --- a/snippets/csharp/System.Text.RegularExpressions/Regex/GroupNameFromNumber/groupnamefromnumberex.cs +++ b/snippets/csharp/System.Text.RegularExpressions/Regex/GroupNameFromNumber/groupnamefromnumberex.cs @@ -17,7 +17,7 @@ public static void Main() // Get group names. do { string name = rgx.GroupNameFromNumber(ctr); - if (! String.IsNullOrEmpty(name)) + if (!String.IsNullOrEmpty(name)) { ctr++; names.Add(name); @@ -26,7 +26,7 @@ public static void Main() { exitFlag = true; } - } while (! exitFlag); + } while (!exitFlag); foreach (string cityLine in cityLines) { diff --git a/snippets/csharp/System.Text.RegularExpressions/RegexMatchTimeoutException/Overview/class1.cs b/snippets/csharp/System.Text.RegularExpressions/RegexMatchTimeoutException/Overview/class1.cs index 67bc97034aa..d1866e5ac79 100644 --- a/snippets/csharp/System.Text.RegularExpressions/RegexMatchTimeoutException/Overview/class1.cs +++ b/snippets/csharp/System.Text.RegularExpressions/RegexMatchTimeoutException/Overview/class1.cs @@ -41,7 +41,7 @@ private static bool ValidateInput(string input, TimeSpan timeout) timeout); // Write to event log named RegexTimeouts try { - if (! EventLog.SourceExists("RegexTimeouts")) + if (!EventLog.SourceExists("RegexTimeouts")) EventLog.CreateEventSource("RegexTimeouts", "RegexTimeouts"); EventLog log = new EventLog("RegexTimeouts"); diff --git a/snippets/csharp/System.Threading.Tasks/Parallel/ForEachTSource/foreach1.cs b/snippets/csharp/System.Threading.Tasks/Parallel/ForEachTSource/foreach1.cs index ba9954f6f16..b40de631b97 100644 --- a/snippets/csharp/System.Threading.Tasks/Parallel/ForEachTSource/foreach1.cs +++ b/snippets/csharp/System.Threading.Tasks/Parallel/ForEachTSource/foreach1.cs @@ -22,7 +22,7 @@ public static void Main() nVowels++; } } - if (! Char.IsWhiteSpace(uCh)) { + if (!Char.IsWhiteSpace(uCh)) { lock (obj) { nNonWhiteSpace++; } diff --git a/snippets/csharp/System.Threading.Tasks/Task/.ctor/run3.cs b/snippets/csharp/System.Threading.Tasks/Task/.ctor/run3.cs index 6498fd90d3c..dc4c1b71568 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/.ctor/run3.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/.ctor/run3.cs @@ -31,7 +31,7 @@ public static async Task Main() bool allExist = true; foreach (var title in titles) { string fn = title + ".txt"; - if (! File.Exists(fn)) { + if (!File.Exists(fn)) { allExist = false; Console.WriteLine("Cannot find '{0}'", fn); break; diff --git a/snippets/csharp/System.Threading.Tasks/Task/.ctor/run5.cs b/snippets/csharp/System.Threading.Tasks/Task/.ctor/run5.cs index 2b8b7f7f8ea..b1b63176634 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/.ctor/run5.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/.ctor/run5.cs @@ -23,14 +23,14 @@ public static void Main() int n2 = tasks[1].Result; int result = n1 + n2; bool validInput = false; - while (! validInput) { + while (!validInput) { ShowMessage(n1, n2); string userInput = Console.ReadLine(); // Process user input. if (userInput.Trim().ToUpper() == "X") return; int answer; validInput = Int32.TryParse(userInput, out answer); - if (! validInput) + if (!validInput) Console.WriteLine("Invalid input. Try again, but enter only numbers. "); else if (answer == result) Console.WriteLine("Correct!"); diff --git a/snippets/csharp/System.Threading.Tasks/Task/FromExceptionTResult/fromresult1.cs b/snippets/csharp/System.Threading.Tasks/Task/FromExceptionTResult/fromresult1.cs index 009bbb43d20..ff2a7378b78 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/FromExceptionTResult/fromresult1.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/FromExceptionTResult/fromresult1.cs @@ -36,7 +36,7 @@ public static void Main() private static Task GetFileLengthsAsync(string filePath) { - if (! Directory.Exists(filePath)) { + if (!Directory.Exists(filePath)) { return Task.FromException( new DirectoryNotFoundException("Invalid directory name.")); } diff --git a/snippets/csharp/System.Threading.Tasks/Task/Overview/Wait2.cs b/snippets/csharp/System.Threading.Tasks/Task/Overview/Wait2.cs index d827785334d..c8827c42e62 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/Overview/Wait2.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/Overview/Wait2.cs @@ -14,7 +14,7 @@ public static void Main() bool completed = taskA.IsCompleted; Console.WriteLine("Task A completed: {0}, Status: {1}", completed, taskA.Status); - if (! completed) + if (!completed) Console.WriteLine("Timed out before task A completed."); } catch (AggregateException) { diff --git a/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait5.cs b/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait5.cs index 58db86548dc..4444d962549 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait5.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait5.cs @@ -18,7 +18,7 @@ public static void Main() Console.WriteLine("Mean: {0:N2}", sum/n); Console.WriteLine("N: {0:N0}", n); } ); - if (! t.Wait(150)) + if (!t.Wait(150)) Console.WriteLine("The timeout interval elapsed."); } } diff --git a/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait6.cs b/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait6.cs index 4bb621efa0a..c49371c7e0b 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait6.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/Wait/Wait6.cs @@ -19,7 +19,7 @@ public static void Main() Console.WriteLine("N: {0:N0}", n); } ); TimeSpan ts = TimeSpan.FromMilliseconds(150); - if (! t.Wait(ts)) + if (!t.Wait(ts)) Console.WriteLine("The timeout interval elapsed."); } } diff --git a/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll3.cs b/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll3.cs index 94a27f86467..0c5366b01c0 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll3.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll3.cs @@ -22,7 +22,7 @@ public static async Task Main() tasks.Add(Task.Run( () => { var png = new Ping(); try { var reply = png.Send(url); - if (! (reply.Status == IPStatus.Success)) { + if (!(reply.Status == IPStatus.Success)) { Interlocked.Increment(ref failed); throw new TimeoutException("Unable to reach " + url + "."); } diff --git a/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll4.cs b/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll4.cs index bf3c15f50bc..1d744f297f2 100644 --- a/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll4.cs +++ b/snippets/csharp/System.Threading.Tasks/Task/WhenAll/WhenAll4.cs @@ -22,7 +22,7 @@ public static void Main() tasks.Add(Task.Run( () => { var png = new Ping(); try { var reply = png.Send(url); - if (! (reply.Status == IPStatus.Success)) { + if (!(reply.Status == IPStatus.Success)) { Interlocked.Increment(ref failed); throw new TimeoutException("Unable to reach " + url + "."); } diff --git a/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall1.cs b/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall1.cs index da7961ce0be..4a781d22657 100644 --- a/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall1.cs +++ b/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall1.cs @@ -19,7 +19,7 @@ public static void Main() // Determine the number of words in each file. foreach (var filename in filenames) - tasks.Add( Task.Factory.StartNew( fn => { if (! File.Exists(fn.ToString())) + tasks.Add( Task.Factory.StartNew( fn => { if (!File.Exists(fn.ToString())) throw new FileNotFoundException("{0} does not exist.", filename); StreamReader sr = new StreamReader(fn.ToString()); diff --git a/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall2.cs b/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall2.cs index 90a6c6d2e3d..55fa93c4c57 100644 --- a/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall2.cs +++ b/snippets/csharp/System.Threading.Tasks/TaskFactory/ContinueWhenAll/continuewhenall2.cs @@ -23,7 +23,7 @@ public static void Main() foreach (var filename in filenames) tasks.Add( Task.Factory.StartNew( fn => { token.ThrowIfCancellationRequested(); - if (! File.Exists(fn.ToString())) { + if (!File.Exists(fn.ToString())) { source.Cancel(); token.ThrowIfCancellationRequested(); } @@ -37,7 +37,7 @@ public static void Main() filename, token)); var finalTask = Task.Factory.ContinueWhenAll(tasks.ToArray(), wordCountTasks => { - if (! token.IsCancellationRequested) + if (!token.IsCancellationRequested) Console.WriteLine("\n{0,-25} {1,6} total words\n", String.Format("{0} files", wordCountTasks.Length), totalWords); diff --git a/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew1.cs b/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew1.cs index b142d8c8095..5b12dcbf4ab 100644 --- a/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew1.cs +++ b/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew1.cs @@ -31,7 +31,7 @@ private static string ShowHex(string value) { string hexString = null; // Handle only non-control characters. - if (! Char.IsControl(value, 0)) { + if (!Char.IsControl(value, 0)) { foreach (var ch in value) hexString += $"0x{(ushort)ch:X} "; } diff --git a/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew4.cs b/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew4.cs index b19638aa781..ad80d6ad414 100644 --- a/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew4.cs +++ b/snippets/csharp/System.Threading.Tasks/TaskFactory/StartNew/startnew4.cs @@ -25,7 +25,7 @@ public static void Main() for (int ctr = 0; ctr < order.Length; ctr++) { order[ctr] = rnd.NextDouble(); if (order[ctr] == 0) { - if (! wasZero) { + if (!wasZero) { wasZero = true; } else { diff --git a/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue1.cs b/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue1.cs index f37e21be885..c5e5c7acda9 100644 --- a/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue1.cs +++ b/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue1.cs @@ -23,7 +23,7 @@ public static void Main(string[] args) // False = prime. bool[] values = new bool[upperBound + 1]; for (int ctr = 2; ctr <= (int) Math.Sqrt(upperBound); ctr++) { - if (values[ctr] == false) { + if (!values[ctr] ) { for (int product = ctr * ctr; product <= upperBound; product = product + ctr) values[product] = true; @@ -39,7 +39,7 @@ public static void Main(string[] args) string output = String.Empty; for (int ctr = 1; ctr <= numbers.GetUpperBound(0); ctr++) - if (numbers[ctr] == false) + if (!numbers[ctr] ) primes.Add(ctr); // Create the output string. diff --git a/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue2.cs b/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue2.cs index 21df6a924b8..05c5accb44e 100644 --- a/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue2.cs +++ b/snippets/csharp/System.Threading.Tasks/TaskTResult/ContinueWith/continue2.cs @@ -14,7 +14,7 @@ public static void Main(string[] args) // False = prime. bool[] values = new bool[upperBound + 1]; for (int ctr = 2; ctr <= (int) Math.Sqrt(upperBound); ctr++) { - if (values[ctr] == false) { + if (!values[ctr]) { for (int product = ctr * ctr; product <= upperBound; product = product + ctr) values[product] = true; @@ -27,7 +27,7 @@ public static void Main(string[] args) string output = String.Empty; for (int ctr = 1; ctr <= numbers.GetUpperBound(0); ctr++) - if (numbers[ctr] == false) + if (!numbers[ctr]) primes.Add(ctr); // Create the output string. diff --git a/snippets/csharp/System.Threading/LockRecursionPolicy/Overview/ClassExample1.cs b/snippets/csharp/System.Threading/LockRecursionPolicy/Overview/ClassExample1.cs index 370cce1acfb..d79e0824711 100644 --- a/snippets/csharp/System.Threading/LockRecursionPolicy/Overview/ClassExample1.cs +++ b/snippets/csharp/System.Threading/LockRecursionPolicy/Overview/ClassExample1.cs @@ -166,7 +166,7 @@ public static void Main() do { String output = String.Empty; items = sc.Count; - if (! desc) { + if (!desc) { start = 1; step = 1; last = items; diff --git a/snippets/csharp/System.Threading/Monitor/Overview/badbox1.cs b/snippets/csharp/System.Threading/Monitor/Overview/badbox1.cs index 9cf4722b04c..ff8cf86bcdc 100644 --- a/snippets/csharp/System.Threading/Monitor/Overview/badbox1.cs +++ b/snippets/csharp/System.Threading/Monitor/Overview/badbox1.cs @@ -33,7 +33,7 @@ public static void Main() String msg = String.Empty; foreach (var ie in e.InnerExceptions) { Console.WriteLine("{0}", ie.GetType().Name); - if (! msg.Contains(ie.Message)) + if (!msg.Contains(ie.Message)) msg += ie.Message + Environment.NewLine; } Console.WriteLine("\nException Message(s):"); diff --git a/snippets/csharp/System.Threading/Monitor/Overview/badlock1.cs b/snippets/csharp/System.Threading/Monitor/Overview/badlock1.cs index 838977c2d08..95857871c37 100644 --- a/snippets/csharp/System.Threading/Monitor/Overview/badlock1.cs +++ b/snippets/csharp/System.Threading/Monitor/Overview/badlock1.cs @@ -32,7 +32,7 @@ public static void Main() String msg = String.Empty; foreach (var ie in e.InnerExceptions) { Console.WriteLine("{0}", ie.GetType().Name); - if (! msg.Contains(ie.Message)) + if (!msg.Contains(ie.Message)) msg += ie.Message + Environment.NewLine; } Console.WriteLine("\nException Message(s):"); diff --git a/snippets/csharp/System.Threading/ReaderWriterLockSlim/Overview/classexample1.cs b/snippets/csharp/System.Threading/ReaderWriterLockSlim/Overview/classexample1.cs index af42004eaaf..70e1db99325 100644 --- a/snippets/csharp/System.Threading/ReaderWriterLockSlim/Overview/classexample1.cs +++ b/snippets/csharp/System.Threading/ReaderWriterLockSlim/Overview/classexample1.cs @@ -166,7 +166,7 @@ public static void Main() do { String output = String.Empty; items = sc.Count; - if (! desc) { + if (!desc) { start = 1; step = 1; last = items; diff --git a/snippets/csharp/System.Web.Services.Description/OperationCollection/Overview/operationcollection_methods.cs b/snippets/csharp/System.Web.Services.Description/OperationCollection/Overview/operationcollection_methods.cs index 78f69c980d0..951df6ebe66 100644 --- a/snippets/csharp/System.Web.Services.Description/OperationCollection/Overview/operationcollection_methods.cs +++ b/snippets/csharp/System.Web.Services.Description/OperationCollection/Overview/operationcollection_methods.cs @@ -54,7 +54,7 @@ public static void Main() // // - if(myOperationCollection.Contains(myOperation) == true) + if (myOperationCollection.Contains(myOperation)) { Console.WriteLine("The index of the added 'myOperation' " + "operation is : " + diff --git a/snippets/csharp/System.Web.Services.Description/OperationMessageCollection/Overview/operationmessagecollection_sample.cs b/snippets/csharp/System.Web.Services.Description/OperationMessageCollection/Overview/operationmessagecollection_sample.cs index 5faabf855ff..c042511d34c 100644 --- a/snippets/csharp/System.Web.Services.Description/OperationMessageCollection/Overview/operationmessagecollection_sample.cs +++ b/snippets/csharp/System.Web.Services.Description/OperationMessageCollection/Overview/operationmessagecollection_sample.cs @@ -81,8 +81,7 @@ static void Main() // // - if(myOperationMessageCollection.Contains(myOperationMessage) - == true ) + if(myOperationMessageCollection.Contains(myOperationMessage)) { int myIndex = myOperationMessageCollection.IndexOf(myOperationMessage); diff --git a/snippets/csharp/System.Web.Services.Discovery/DiscoveryDocument/CanRead/discoverydocument_discoverydocument.cs b/snippets/csharp/System.Web.Services.Discovery/DiscoveryDocument/CanRead/discoverydocument_discoverydocument.cs index b917f1a44bb..ff17e279bd5 100644 --- a/snippets/csharp/System.Web.Services.Discovery/DiscoveryDocument/CanRead/discoverydocument_discoverydocument.cs +++ b/snippets/csharp/System.Web.Services.Discovery/DiscoveryDocument/CanRead/discoverydocument_discoverydocument.cs @@ -41,7 +41,7 @@ static void Main() // // // Check whether the given XmlTextReader is readable. - if( DiscoveryDocument.CanRead( myXmlTextReader ) == true ) + if ( DiscoveryDocument.CanRead( myXmlTextReader )) { // Read the given XmlTextReader. myDiscoveryDocument = DiscoveryDocument.Read( myXmlTextReader ); diff --git a/snippets/csharp/System.Web.Services.Discovery/DiscoveryExceptionDictionary/Overview/discoveryexceptiondictionary_property_method.cs b/snippets/csharp/System.Web.Services.Discovery/DiscoveryExceptionDictionary/Overview/discoveryexceptiondictionary_property_method.cs index 851e957ab0a..accac564dd3 100644 --- a/snippets/csharp/System.Web.Services.Discovery/DiscoveryExceptionDictionary/Overview/discoveryexceptiondictionary_property_method.cs +++ b/snippets/csharp/System.Web.Services.Discovery/DiscoveryExceptionDictionary/Overview/discoveryexceptiondictionary_property_method.cs @@ -51,7 +51,7 @@ static void Main() // DiscoveryExceptionDictionary myExceptionDictionary = myDiscoveryClientProtocol2.Errors; - if ( myExceptionDictionary.Contains(myUrlKey) == true ) + if ( myExceptionDictionary.Contains(myUrlKey)) { Console.WriteLine("'myExceptionDictionary' contains " + " a discovery exception for the key '" + myUrlKey + "'"); @@ -62,7 +62,7 @@ DiscoveryExceptionDictionary myExceptionDictionary " a discovery exception for the key '" + myUrlKey + "'"); } // - if (myExceptionDictionary.Contains(myUrlKey) == true ) + if (myExceptionDictionary.Contains(myUrlKey)) { Console.WriteLine("System generated exceptions."); diff --git a/snippets/csharp/System.Web.Services.Discovery/DiscoveryReferenceCollection/Overview/discoveryreferencecollection.cs b/snippets/csharp/System.Web.Services.Discovery/DiscoveryReferenceCollection/Overview/discoveryreferencecollection.cs index 157d180851a..414406d8d30 100644 --- a/snippets/csharp/System.Web.Services.Discovery/DiscoveryReferenceCollection/Overview/discoveryreferencecollection.cs +++ b/snippets/csharp/System.Web.Services.Discovery/DiscoveryReferenceCollection/Overview/discoveryreferencecollection.cs @@ -46,8 +46,7 @@ static void Main() + myDiscoveryReferenceCollection.Count.ToString()); // Call the Contains method. - if (myDiscoveryReferenceCollection.Contains(myDiscoveryDocReference1) - != true) + if (!myDiscoveryReferenceCollection.Contains(myDiscoveryDocReference1)) { throw new Exception("Element not found in collection."); } diff --git a/snippets/csharp/System.Windows.Annotations.Storage/AnnotationStore/DeleteAnnotation/ThumbViewer.cs b/snippets/csharp/System.Windows.Annotations.Storage/AnnotationStore/DeleteAnnotation/ThumbViewer.cs index 89604450657..7a60e37ce5f 100644 --- a/snippets/csharp/System.Windows.Annotations.Storage/AnnotationStore/DeleteAnnotation/ThumbViewer.cs +++ b/snippets/csharp/System.Windows.Annotations.Storage/AnnotationStore/DeleteAnnotation/ThumbViewer.cs @@ -185,7 +185,7 @@ public bool OpenDocument(string fileName) dialog.InitialDirectory = GetContentFolder(); dialog.Filter = this.OpenFileFilter; bool result = (bool)dialog.ShowDialog(null); - if (result == false) return false; + if (!result) return false; fileName = dialog.FileName; return OpenFile(fileName); @@ -500,7 +500,7 @@ public bool SaveDocumentAsFile(string fileName) bool result = (bool)dialog.ShowDialog(null); // If the user clicked "Cancel", cancel the saving the file. - if (result == false) return false; + if (!result) return false; fileName = dialog.FileName; } diff --git a/snippets/csharp/System.Windows.Annotations/AnnotationDocumentPaginator/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Annotations/AnnotationDocumentPaginator/Overview/Window1.xaml.cs index d0b0ed26f00..f54d5823bfc 100644 --- a/snippets/csharp/System.Windows.Annotations/AnnotationDocumentPaginator/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Annotations/AnnotationDocumentPaginator/Overview/Window1.xaml.cs @@ -326,7 +326,7 @@ public void PrintDocument() return; // DocumentViewer has not been initialized yet. // If Annotations are disabled, use normal DocuementViewer.Print() - if ((menuViewAnnotations.IsChecked==false) || (_annotHelper == null)) + if (!menuViewAnnotations.IsChecked || (_annotHelper == null)) { docViewer.Print(); } diff --git a/snippets/csharp/System.Windows.Annotations/AnnotationService/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Annotations/AnnotationService/Overview/Window1.xaml.cs index 5c1c8a1e235..985063006ee 100644 --- a/snippets/csharp/System.Windows.Annotations/AnnotationService/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Annotations/AnnotationService/Overview/Window1.xaml.cs @@ -232,7 +232,7 @@ private void StartAnnotations() _annotService = new AnnotationService(docViewer); // If the AnnotationService is currently enabled, disable it. - if (_annotService.IsEnabled == true) + if (_annotService.IsEnabled) _annotService.Disable(); // Open a stream to the file for storing annotations. @@ -349,7 +349,7 @@ public void PrintDocument() return; // DocumentViewer has not been initialized yet. // If Annotations are disabled, use normal DocuementViewer.Print() - if (menuViewAnnotations.IsChecked == false) + if (!menuViewAnnotations.IsChecked) { docViewer.Print(); } diff --git a/snippets/csharp/System.Windows.Automation.Provider/ISelectionItemProvider/AddToSelection/ListItemFragment.cs b/snippets/csharp/System.Windows.Automation.Provider/ISelectionItemProvider/AddToSelection/ListItemFragment.cs index c0202fb0e0e..195b11ddc64 100644 --- a/snippets/csharp/System.Windows.Automation.Provider/ISelectionItemProvider/AddToSelection/ListItemFragment.cs +++ b/snippets/csharp/System.Windows.Automation.Provider/ISelectionItemProvider/AddToSelection/ListItemFragment.cs @@ -93,7 +93,7 @@ public object GetPatternProvider(int patternId) /// The value of the property. public object GetPropertyValue(int propertyId) { - if (listItemControl.IsAlive == false) + if (!listItemControl.IsAlive) { throw new ElementNotAvailableException(); } @@ -240,7 +240,7 @@ public IRawElementProviderFragment Navigate(NavigateDirection direction) /// public void SetFocus() { - if (listItemControl.IsAlive == false) + if (!listItemControl.IsAlive) { throw new ElementNotAvailableException(); } diff --git a/snippets/csharp/System.Windows.Automation/MultipleViewPattern+MultipleViewPatternInformation/CurrentView/UIAMultipleViewPattern_snippets.cs b/snippets/csharp/System.Windows.Automation/MultipleViewPattern+MultipleViewPatternInformation/CurrentView/UIAMultipleViewPattern_snippets.cs index b1d9a324072..e9baa7e53e5 100644 --- a/snippets/csharp/System.Windows.Automation/MultipleViewPattern+MultipleViewPatternInformation/CurrentView/UIAMultipleViewPattern_snippets.cs +++ b/snippets/csharp/System.Windows.Automation/MultipleViewPattern+MultipleViewPatternInformation/CurrentView/UIAMultipleViewPattern_snippets.cs @@ -293,7 +293,7 @@ private string ViewName(AutomationElement multipleViewControl) private AutomationElement StartTargetApp(string target) { Process p = Process.Start(target); - if (p.WaitForInputIdle(50000) == false) + if (!p.WaitForInputIdle(50000)) { return null; } diff --git a/snippets/csharp/System.Windows.Automation/RangeValuePattern+RangeValuePatternInformation/IsReadOnly/UIARangeValuePattern_snippets.cs b/snippets/csharp/System.Windows.Automation/RangeValuePattern+RangeValuePatternInformation/IsReadOnly/UIARangeValuePattern_snippets.cs index d13c3245d39..c331e8fe697 100644 --- a/snippets/csharp/System.Windows.Automation/RangeValuePattern+RangeValuePatternInformation/IsReadOnly/UIARangeValuePattern_snippets.cs +++ b/snippets/csharp/System.Windows.Automation/RangeValuePattern+RangeValuePatternInformation/IsReadOnly/UIARangeValuePattern_snippets.cs @@ -57,7 +57,7 @@ public UIARangeValuePattern_snippets() private AutomationElement StartTargetApp(string target) { Process p = Process.Start(target); - if (p.WaitForInputIdle(50000) == false) + if (!p.WaitForInputIdle(50000)) { return null; } diff --git a/snippets/csharp/System.Windows.Automation/StructureChangedEventArgs/.ctor/ListItemFragment.cs b/snippets/csharp/System.Windows.Automation/StructureChangedEventArgs/.ctor/ListItemFragment.cs index bffa76ac9fa..ed1a736fc85 100644 --- a/snippets/csharp/System.Windows.Automation/StructureChangedEventArgs/.ctor/ListItemFragment.cs +++ b/snippets/csharp/System.Windows.Automation/StructureChangedEventArgs/.ctor/ListItemFragment.cs @@ -89,7 +89,7 @@ public object GetPatternProvider(int patternId) /// The value of the property. public object GetPropertyValue(int propId) { - if (ListItemControl.IsAlive == false) + if (!ListItemControl.IsAlive) { throw new ElementNotAvailableException(); } @@ -236,7 +236,7 @@ public IRawElementProviderFragment Navigate(NavigateDirection direction) /// public void SetFocus() { - if (ListItemControl.IsAlive == false) + if (!ListItemControl.IsAlive) { throw new ElementNotAvailableException(); } diff --git a/snippets/csharp/System.Windows.Controls/Button/IsCancel/Page1.xaml.cs b/snippets/csharp/System.Windows.Controls/Button/IsCancel/Page1.xaml.cs index 2b5dd847f83..17f5b9978e0 100644 --- a/snippets/csharp/System.Windows.Controls/Button/IsCancel/Page1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/Button/IsCancel/Page1.xaml.cs @@ -19,11 +19,11 @@ public partial class Page1 : StackPanel void OnClickDefault(object sender, RoutedEventArgs e) { // - if (btnDefault.IsDefault == true) + if (btnDefault.IsDefault) { btnDefault.Content = "This is the default button."; } - if (btnDefault.IsDefaulted == true) + if (btnDefault.IsDefaulted) { btnDefault.Content = "The button is defaulted."; } @@ -32,7 +32,7 @@ void OnClickDefault(object sender, RoutedEventArgs e) } void OnClickCancel(object sender, RoutedEventArgs e) { - if (btnCancel.IsCancel == true) + if (btnCancel.IsCancel) { btnCancel.Content = "This is the cancel button."; } diff --git a/snippets/csharp/System.Windows.Controls/ComboBox/DropDownClosed/Pane1.xaml.cs b/snippets/csharp/System.Windows.Controls/ComboBox/DropDownClosed/Pane1.xaml.cs index 9896de53bec..b87c18f57e4 100644 --- a/snippets/csharp/System.Windows.Controls/ComboBox/DropDownClosed/Pane1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/ComboBox/DropDownClosed/Pane1.xaml.cs @@ -23,20 +23,20 @@ public partial class Pane1 : Canvas void OnHover(object sender, RoutedEventArgs e) { // - if (cbi1.IsHighlighted == true) + if (cbi1.IsHighlighted) { cbi2.Content = "Item2"; cbi3.Content = "Item3"; cbi1.Content = "Highlighted Item"; } // - else if (cbi2.IsHighlighted == true) + else if (cbi2.IsHighlighted) { cbi1.Content = "Item1"; cbi3.Content = "Item3"; cbi2.Content = "Highlighted Item"; } - else if (cbi3.IsHighlighted == true) + else if (cbi3.IsHighlighted) { cbi1.Content = "Item1"; cbi2.Content = "Item2"; @@ -47,7 +47,7 @@ void OnHover(object sender, RoutedEventArgs e) // void OnDropDownOpened(object sender, EventArgs e) { - if (cb.IsDropDownOpen == true) + if (cb.IsDropDownOpen) { cb.Text = "Combo box opened"; } @@ -55,7 +55,7 @@ void OnDropDownOpened(object sender, EventArgs e) void OnDropDownClosed(object sender, EventArgs e) { - if (cb.IsDropDownOpen == false) + if (!cb.IsDropDownOpen) { cb.Text = "Combo box closed"; } diff --git a/snippets/csharp/System.Windows.Controls/ContentControl/Overview/Page1.xaml.cs b/snippets/csharp/System.Windows.Controls/ContentControl/Overview/Page1.xaml.cs index bf629b82834..86318cd2559 100644 --- a/snippets/csharp/System.Windows.Controls/ContentControl/Overview/Page1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/ContentControl/Overview/Page1.xaml.cs @@ -20,7 +20,7 @@ public partial class Page1 : Canvas // void OnClick(object sender, RoutedEventArgs e) { - if (contCtrl.HasContent == true) + if (contCtrl.HasContent) { MessageBox.Show("contCtrl has content"); } diff --git a/snippets/csharp/System.Windows.Controls/ContextMenu/Overview/Pane1.xaml.cs b/snippets/csharp/System.Windows.Controls/ContextMenu/Overview/Pane1.xaml.cs index 87015c57950..cc3787a7b32 100644 --- a/snippets/csharp/System.Windows.Controls/ContextMenu/Overview/Pane1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/ContextMenu/Overview/Pane1.xaml.cs @@ -34,7 +34,7 @@ void OnClosed(object sender, RoutedEventArgs e) void IsOpenSnippet() { // - if (cm.IsOpen == true) + if (cm.IsOpen) { cmButton.Content = "The ContextMenu opened and the IsOpen property is true."; } diff --git a/snippets/csharp/System.Windows.Controls/Control/BorderThickness/Pane1.xaml.cs b/snippets/csharp/System.Windows.Controls/Control/BorderThickness/Pane1.xaml.cs index 1506fc841eb..5f8f9e2a407 100644 --- a/snippets/csharp/System.Windows.Controls/Control/BorderThickness/Pane1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/Control/BorderThickness/Pane1.xaml.cs @@ -103,7 +103,7 @@ void ChangePadding(object sender, RoutedEventArgs e) // void IsTabStop(object sender, RoutedEventArgs e) { - if (btn13.IsTabStop == true) + if (btn13.IsTabStop) { btn13.Content = "Control is a tab stop."; } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/adventureworkslt2008dataset.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/adventureworkslt2008dataset.designer.cs index fe4bf61cad3..4ac06a5e1d9 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/adventureworkslt2008dataset.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/AutoGenerateColumns/adventureworkslt2008dataset.designer.cs @@ -43,7 +43,7 @@ public AdventureWorksLT2008DataSet() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected AdventureWorksLT2008DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if ((this.IsBinarySerialized(info, context))) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -189,7 +189,7 @@ internal void InitVars() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableCustomer = ((CustomerDataTable)(base.Tables["Customer"])); - if ((initTable == true)) { + if ((initTable)) { if ((this.tableCustomer != null)) { this.tableCustomer.InitVars(); } @@ -1026,7 +1026,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.CustomerDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if ((this.ClearBeforeFill)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -1155,7 +1155,7 @@ private int UpdateDeletedRows(AdventureWorksLT2008DataSet dataSet, global::Syste global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; - if ((allAddedRows.Contains(row) == false)) { + if (!allAddedRows.Contains(row)) { realUpdatedRows.Add(row); } } @@ -1171,7 +1171,7 @@ public virtual int UpdateAll(AdventureWorksLT2008DataSet dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } - if ((dataSet.HasChanges() == false)) { + if (!dataSet.HasChanges()) { return 0; } global::System.Data.IDbConnection workConnection = this.Connection; @@ -1339,15 +1339,15 @@ private bool IsChildAndParent(global::System.Data.DataRow child, global::System. global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((newParent == null)) { for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/adventureworkslt2008dataset.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/adventureworkslt2008dataset.designer.cs index 6250828cdcb..b2e2b1f748f 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Columns/adventureworkslt2008dataset.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Columns/adventureworkslt2008dataset.designer.cs @@ -43,7 +43,7 @@ public AdventureWorksLT2008DataSet() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected AdventureWorksLT2008DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if ((this.IsBinarySerialized(info, context))) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -189,7 +189,7 @@ internal void InitVars() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableCustomer = ((CustomerDataTable)(base.Tables["Customer"])); - if ((initTable == true)) { + if ((initTable)) { if ((this.tableCustomer != null)) { this.tableCustomer.InitVars(); } @@ -1026,7 +1026,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.CustomerDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if ((this.ClearBeforeFill)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -1155,7 +1155,7 @@ private int UpdateDeletedRows(AdventureWorksLT2008DataSet dataSet, global::Syste global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; - if ((allAddedRows.Contains(row) == false)) { + if (!(allAddedRows.Contains(row))) { realUpdatedRows.Add(row); } } @@ -1171,7 +1171,7 @@ public virtual int UpdateAll(AdventureWorksLT2008DataSet dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } - if ((dataSet.HasChanges() == false)) { + if (!(dataSet.HasChanges())) { return 0; } global::System.Data.IDbConnection workConnection = this.Connection; @@ -1339,15 +1339,15 @@ private bool IsChildAndParent(global::System.Data.DataRow child, global::System. global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((newParent == null)) { for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/adventureworkslt2008dataset.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/adventureworkslt2008dataset.designer.cs index d657b010630..9b2bc761831 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/adventureworkslt2008dataset.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/adventureworkslt2008dataset.designer.cs @@ -43,7 +43,7 @@ public AdventureWorksLT2008DataSet() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected AdventureWorksLT2008DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if (this.IsBinarySerialized(info, context)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -1272,7 +1272,7 @@ private int UpdateDeletedRows(AdventureWorksLT2008DataSet dataSet, global::Syste global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; - if ((allAddedRows.Contains(row) == false)) { + if (!allAddedRows.Contains(row)) { realUpdatedRows.Add(row); } } @@ -1288,11 +1288,11 @@ public virtual int UpdateAll(AdventureWorksLT2008DataSet dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } - if ((dataSet.HasChanges() == false)) { + if (!dataSet.HasChanges()) { return 0; } if (((this._salesOrderDetailTableAdapter != null) - && (this.MatchTableAdapterConnection(this._salesOrderDetailTableAdapter.Connection) == false))) { + && (!this.MatchTableAdapterConnection(this._salesOrderDetailTableAdapter.Connection)))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } @@ -1474,15 +1474,15 @@ private bool IsChildAndParent(global::System.Data.DataRow child, global::System. global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((newParent == null)) { for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/window1.xaml.cs b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/window1.xaml.cs index 8b92f23cb1b..4f7f3626a73 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/window1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/FrozenColumnCount/window1.xaml.cs @@ -50,7 +50,7 @@ private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { //Get the column header that started the command and move that column left to freeze it. System.Windows.Controls.Primitives.DataGridColumnHeader header = (System.Windows.Controls.Primitives.DataGridColumnHeader)e.OriginalSource; - if (header.Column.IsFrozen ==true) + if (header.Column.IsFrozen) { return; } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer.cs index 02071f38df0..ccb546b62ea 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer.cs @@ -52,7 +52,7 @@ public AdventureWorksLT2008DataSet() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] protected AdventureWorksLT2008DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if (this.IsBinarySerialized(info, context)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -231,25 +231,25 @@ internal void InitVars() { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal void InitVars(bool initTable) { this.tableAddress = ((AddressDataTable)(base.Tables["Address"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableAddress != null)) { this.tableAddress.InitVars(); } } this.tableCustomer = ((CustomerDataTable)(base.Tables["Customer"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableCustomer != null)) { this.tableCustomer.InitVars(); } } this.tableCustomerAddress = ((CustomerAddressDataTable)(base.Tables["CustomerAddress"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableCustomerAddress != null)) { this.tableCustomerAddress.InitVars(); } } this.tableProduct = ((ProductDataTable)(base.Tables["Product"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableProduct != null)) { this.tableProduct.InitVars(); } @@ -3067,7 +3067,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.AddressDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if (this.ClearBeforeFill) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -3634,7 +3634,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.CustomerDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if (this.ClearBeforeFill) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -4291,7 +4291,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.CustomerAddressDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if (this.ClearBeforeFill) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -4718,7 +4718,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.ProductDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if (this.ClearBeforeFill) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -4811,7 +4811,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[8].Value = ((string)(Original_Size)); } - if ((Original_Weight.HasValue == true)) { + if (Original_Weight.HasValue) { this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[10].Value = ((decimal)(Original_Weight.Value)); } @@ -4819,7 +4819,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[10].Value = global::System.DBNull.Value; } - if ((Original_ProductCategoryID.HasValue == true)) { + if (Original_ProductCategoryID.HasValue) { this.Adapter.DeleteCommand.Parameters[11].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[12].Value = ((int)(Original_ProductCategoryID.Value)); } @@ -4827,7 +4827,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[11].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[12].Value = global::System.DBNull.Value; } - if ((Original_ProductModelID.HasValue == true)) { + if (Original_ProductModelID.HasValue) { this.Adapter.DeleteCommand.Parameters[13].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[14].Value = ((int)(Original_ProductModelID.Value)); } @@ -4836,7 +4836,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[14].Value = global::System.DBNull.Value; } this.Adapter.DeleteCommand.Parameters[15].Value = ((System.DateTime)(Original_SellStartDate)); - if ((Original_SellEndDate.HasValue == true)) { + if (Original_SellEndDate.HasValue) { this.Adapter.DeleteCommand.Parameters[16].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[17].Value = ((System.DateTime)(Original_SellEndDate.Value)); } @@ -4844,7 +4844,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[16].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[17].Value = global::System.DBNull.Value; } - if ((Original_DiscontinuedDate.HasValue == true)) { + if (Original_DiscontinuedDate.HasValue) { this.Adapter.DeleteCommand.Parameters[18].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[19].Value = ((System.DateTime)(Original_DiscontinuedDate.Value)); } @@ -4924,32 +4924,32 @@ public virtual int Insert( else { this.Adapter.InsertCommand.Parameters[5].Value = ((string)(Size)); } - if ((Weight.HasValue == true)) { + if (Weight.HasValue) { this.Adapter.InsertCommand.Parameters[6].Value = ((decimal)(Weight.Value)); } else { this.Adapter.InsertCommand.Parameters[6].Value = global::System.DBNull.Value; } - if ((ProductCategoryID.HasValue == true)) { + if (ProductCategoryID.HasValue) { this.Adapter.InsertCommand.Parameters[7].Value = ((int)(ProductCategoryID.Value)); } else { this.Adapter.InsertCommand.Parameters[7].Value = global::System.DBNull.Value; } - if ((ProductModelID.HasValue == true)) { + if (ProductModelID.HasValue) { this.Adapter.InsertCommand.Parameters[8].Value = ((int)(ProductModelID.Value)); } else { this.Adapter.InsertCommand.Parameters[8].Value = global::System.DBNull.Value; } this.Adapter.InsertCommand.Parameters[9].Value = ((System.DateTime)(SellStartDate)); - if ((SellEndDate.HasValue == true)) { + if (SellEndDate.HasValue) { this.Adapter.InsertCommand.Parameters[10].Value = ((System.DateTime)(SellEndDate.Value)); } else { this.Adapter.InsertCommand.Parameters[10].Value = global::System.DBNull.Value; } - if ((DiscontinuedDate.HasValue == true)) { + if (DiscontinuedDate.HasValue) { this.Adapter.InsertCommand.Parameters[11].Value = ((System.DateTime)(DiscontinuedDate.Value)); } else { @@ -5048,32 +5048,32 @@ public virtual int Update( else { this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(Size)); } - if ((Weight.HasValue == true)) { + if (Weight.HasValue) { this.Adapter.UpdateCommand.Parameters[6].Value = ((decimal)(Weight.Value)); } else { this.Adapter.UpdateCommand.Parameters[6].Value = global::System.DBNull.Value; } - if ((ProductCategoryID.HasValue == true)) { + if (ProductCategoryID.HasValue) { this.Adapter.UpdateCommand.Parameters[7].Value = ((int)(ProductCategoryID.Value)); } else { this.Adapter.UpdateCommand.Parameters[7].Value = global::System.DBNull.Value; } - if ((ProductModelID.HasValue == true)) { + if (ProductModelID.HasValue) { this.Adapter.UpdateCommand.Parameters[8].Value = ((int)(ProductModelID.Value)); } else { this.Adapter.UpdateCommand.Parameters[8].Value = global::System.DBNull.Value; } this.Adapter.UpdateCommand.Parameters[9].Value = ((System.DateTime)(SellStartDate)); - if ((SellEndDate.HasValue == true)) { + if (SellEndDate.HasValue) { this.Adapter.UpdateCommand.Parameters[10].Value = ((System.DateTime)(SellEndDate.Value)); } else { this.Adapter.UpdateCommand.Parameters[10].Value = global::System.DBNull.Value; } - if ((DiscontinuedDate.HasValue == true)) { + if (DiscontinuedDate.HasValue) { this.Adapter.UpdateCommand.Parameters[11].Value = ((System.DateTime)(DiscontinuedDate.Value)); } else { @@ -5124,7 +5124,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[23].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[24].Value = ((string)(Original_Size)); } - if ((Original_Weight.HasValue == true)) { + if (Original_Weight.HasValue) { this.Adapter.UpdateCommand.Parameters[25].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[26].Value = ((decimal)(Original_Weight.Value)); } @@ -5132,7 +5132,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[25].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[26].Value = global::System.DBNull.Value; } - if ((Original_ProductCategoryID.HasValue == true)) { + if (Original_ProductCategoryID.HasValue) { this.Adapter.UpdateCommand.Parameters[27].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[28].Value = ((int)(Original_ProductCategoryID.Value)); } @@ -5140,7 +5140,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[27].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[28].Value = global::System.DBNull.Value; } - if ((Original_ProductModelID.HasValue == true)) { + if (Original_ProductModelID.HasValue) { this.Adapter.UpdateCommand.Parameters[29].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[30].Value = ((int)(Original_ProductModelID.Value)); } @@ -5149,7 +5149,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[30].Value = global::System.DBNull.Value; } this.Adapter.UpdateCommand.Parameters[31].Value = ((System.DateTime)(Original_SellStartDate)); - if ((Original_SellEndDate.HasValue == true)) { + if (Original_SellEndDate.HasValue) { this.Adapter.UpdateCommand.Parameters[32].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[33].Value = ((System.DateTime)(Original_SellEndDate.Value)); } @@ -5157,7 +5157,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[32].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[33].Value = global::System.DBNull.Value; } - if ((Original_DiscontinuedDate.HasValue == true)) { + if (Original_DiscontinuedDate.HasValue) { this.Adapter.UpdateCommand.Parameters[34].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[35].Value = ((System.DateTime)(Original_DiscontinuedDate.Value)); } @@ -5523,7 +5523,7 @@ private int UpdateDeletedRows(AdventureWorksLT2008DataSet dataSet, global::Syste global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; - if ((allAddedRows.Contains(row) == false)) { + if (!allAddedRows.Contains(row)) { realUpdatedRows.Add(row); } } @@ -5538,26 +5538,26 @@ public virtual int UpdateAll(AdventureWorksLT2008DataSet dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } - if ((dataSet.HasChanges() == false)) { + if (!dataSet.HasChanges()) { return 0; } if (((this._addressTableAdapter != null) - && (this.MatchTableAdapterConnection(this._addressTableAdapter.Connection) == false))) { + && (!this.MatchTableAdapterConnection(this._addressTableAdapter.Connection) ))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } if (((this._customerTableAdapter != null) - && (this.MatchTableAdapterConnection(this._customerTableAdapter.Connection) == false))) { + && (!this.MatchTableAdapterConnection(this._customerTableAdapter.Connection) ))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } if (((this._customerAddressTableAdapter != null) - && (this.MatchTableAdapterConnection(this._customerAddressTableAdapter.Connection) == false))) { + && (!this.MatchTableAdapterConnection(this._customerAddressTableAdapter.Connection) ))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } if (((this._productTableAdapter != null) - && (this.MatchTableAdapterConnection(this._productTableAdapter.Connection) == false))) { + && (!this.MatchTableAdapterConnection(this._productTableAdapter.Connection) ))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } @@ -5774,15 +5774,15 @@ private bool IsChildAndParent(global::System.Data.DataRow child, global::System. global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((newParent == null)) { for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer1.cs b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer1.cs index 301df5137ca..17afca8c79d 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer1.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/Overview/adventureworkslt2008dataset.designer1.cs @@ -43,7 +43,7 @@ public AdventureWorksLT2008DataSet() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected AdventureWorksLT2008DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if (this.IsBinarySerialized(info, context)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -189,7 +189,7 @@ internal void InitVars() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableCustomer = ((CustomerDataTable)(base.Tables["Customer"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableCustomer != null)) { this.tableCustomer.InitVars(); } @@ -1357,7 +1357,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.CustomerDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if (this.ClearBeforeFill) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -2000,7 +2000,7 @@ private int UpdateDeletedRows(AdventureWorksLT2008DataSet dataSet, global::Syste global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; - if ((allAddedRows.Contains(row) == false)) { + if (!allAddedRows.Contains(row)) { realUpdatedRows.Add(row); } } @@ -2016,11 +2016,11 @@ public virtual int UpdateAll(AdventureWorksLT2008DataSet dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } - if ((dataSet.HasChanges() == false)) { + if (!dataSet.HasChanges()) { return 0; } if (((this._customerTableAdapter != null) - && (this.MatchTableAdapterConnection(this._customerTableAdapter.Connection) == false))) { + && (!this.MatchTableAdapterConnection(this._customerTableAdapter.Connection)))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } @@ -2202,15 +2202,15 @@ private bool IsChildAndParent(global::System.Data.DataRow child, global::System. global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((newParent == null)) { for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/adventureworkslt2008dataset.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/adventureworkslt2008dataset.designer.cs index e9ddd53ad91..685b493cb3a 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/adventureworkslt2008dataset.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/RowHeaderStyle/adventureworkslt2008dataset.designer.cs @@ -43,7 +43,7 @@ public AdventureWorksLT2008DataSet() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected AdventureWorksLT2008DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if (this.IsBinarySerialized(info, context)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -189,7 +189,7 @@ internal void InitVars() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableCustomer = ((CustomerDataTable)(base.Tables["Customer"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableCustomer != null)) { this.tableCustomer.InitVars(); } @@ -849,7 +849,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet.CustomerDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if (this.ClearBeforeFill) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/adventureworkslt2008dataset.designer.cs b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/adventureworkslt2008dataset.designer.cs index 34431dab1fb..ce99ae8c10b 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/adventureworkslt2008dataset.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/adventureworkslt2008dataset.designer.cs @@ -43,7 +43,7 @@ public AdventureWorksLT2008DataSet() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected AdventureWorksLT2008DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if (this.IsBinarySerialized(info, context)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -189,7 +189,7 @@ internal void InitVars() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableCustomer = ((CustomerDataTable)(base.Tables["Customer"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableCustomer != null)) { this.tableCustomer.InitVars(); } @@ -1044,7 +1044,7 @@ private int UpdateDeletedRows(AdventureWorksLT2008DataSet dataSet, global::Syste global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; - if ((allAddedRows.Contains(row) == false)) { + if (!(allAddedRows.Contains(row))) { realUpdatedRows.Add(row); } } @@ -1060,7 +1060,7 @@ public virtual int UpdateAll(AdventureWorksLT2008DataSet dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } - if ((dataSet.HasChanges() == false)) { + if (!(dataSet.HasChanges())) { return 0; } global::System.Data.IDbConnection workConnection = this.Connection; @@ -1228,15 +1228,15 @@ private bool IsChildAndParent(global::System.Data.DataRow child, global::System. global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((newParent == null)) { for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } diff --git a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/window1.xaml.cs b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/window1.xaml.cs index 6c6ddf95abf..f059c4e6feb 100644 --- a/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/window1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/DataGrid/SelectedCellsChanged/window1.xaml.cs @@ -50,7 +50,7 @@ private void DG1_SelectionChanged(object sender, SelectionChangedEventArgs e) foreach (DataRowView row in selectedrows) { bool editable = row.DataView.AllowEdit; - if (editable == true) + if (editable) { //Copy a new value into the CompanyName, where clipboard contains a string AdventureWorksLT2008DataSet.CustomerRow cr = (AdventureWorksLT2008DataSet.CustomerRow)row.Row; diff --git a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/adventureworkslt2008dataset1.designer.cs b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/adventureworkslt2008dataset1.designer.cs index 325dd11a204..4914045f9dd 100644 --- a/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/adventureworkslt2008dataset1.designer.cs +++ b/snippets/csharp/System.Windows.Controls/DataGridCheckBoxColumn/Overview/adventureworkslt2008dataset1.designer.cs @@ -43,7 +43,7 @@ public AdventureWorksLT2008DataSet1() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected AdventureWorksLT2008DataSet1(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { - if ((this.IsBinarySerialized(info, context) == true)) { + if (this.IsBinarySerialized(info, context)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; @@ -189,7 +189,7 @@ internal void InitVars() { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableSalesOrderHeader = ((SalesOrderHeaderDataTable)(base.Tables["SalesOrderHeader"])); - if ((initTable == true)) { + if (initTable) { if ((this.tableSalesOrderHeader != null)) { this.tableSalesOrderHeader.InitVars(); } @@ -1624,7 +1624,7 @@ private void InitCommandCollection() { [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(AdventureWorksLT2008DataSet1.SalesOrderHeaderDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; - if ((this.ClearBeforeFill == true)) { + if (this.ClearBeforeFill) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); @@ -1701,7 +1701,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[1].Value = ((byte)(Original_RevisionNumber)); this.Adapter.DeleteCommand.Parameters[2].Value = ((System.DateTime)(Original_OrderDate)); this.Adapter.DeleteCommand.Parameters[3].Value = ((System.DateTime)(Original_DueDate)); - if ((Original_ShipDate.HasValue == true)) { + if (Original_ShipDate.HasValue) { this.Adapter.DeleteCommand.Parameters[4].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[5].Value = ((System.DateTime)(Original_ShipDate.Value)); } @@ -1734,7 +1734,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[12].Value = ((string)(Original_AccountNumber)); } this.Adapter.DeleteCommand.Parameters[13].Value = ((int)(Original_CustomerID)); - if ((Original_ShipToAddressID.HasValue == true)) { + if (Original_ShipToAddressID.HasValue) { this.Adapter.DeleteCommand.Parameters[14].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[15].Value = ((int)(Original_ShipToAddressID.Value)); } @@ -1742,7 +1742,7 @@ public virtual int Delete( this.Adapter.DeleteCommand.Parameters[14].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[15].Value = global::System.DBNull.Value; } - if ((Original_BillToAddressID.HasValue == true)) { + if (Original_BillToAddressID.HasValue) { this.Adapter.DeleteCommand.Parameters[16].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[17].Value = ((int)(Original_BillToAddressID.Value)); } @@ -1813,7 +1813,7 @@ public virtual int Insert( this.Adapter.InsertCommand.Parameters[0].Value = ((byte)(RevisionNumber)); this.Adapter.InsertCommand.Parameters[1].Value = ((System.DateTime)(OrderDate)); this.Adapter.InsertCommand.Parameters[2].Value = ((System.DateTime)(DueDate)); - if ((ShipDate.HasValue == true)) { + if (ShipDate.HasValue) { this.Adapter.InsertCommand.Parameters[3].Value = ((System.DateTime)(ShipDate.Value)); } else { @@ -1834,13 +1834,13 @@ public virtual int Insert( this.Adapter.InsertCommand.Parameters[7].Value = ((string)(AccountNumber)); } this.Adapter.InsertCommand.Parameters[8].Value = ((int)(CustomerID)); - if ((ShipToAddressID.HasValue == true)) { + if (ShipToAddressID.HasValue) { this.Adapter.InsertCommand.Parameters[9].Value = ((int)(ShipToAddressID.Value)); } else { this.Adapter.InsertCommand.Parameters[9].Value = global::System.DBNull.Value; } - if ((BillToAddressID.HasValue == true)) { + if (BillToAddressID.HasValue) { this.Adapter.InsertCommand.Parameters[10].Value = ((int)(BillToAddressID.Value)); } else { @@ -1934,7 +1934,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[0].Value = ((byte)(RevisionNumber)); this.Adapter.UpdateCommand.Parameters[1].Value = ((System.DateTime)(OrderDate)); this.Adapter.UpdateCommand.Parameters[2].Value = ((System.DateTime)(DueDate)); - if ((ShipDate.HasValue == true)) { + if (ShipDate.HasValue) { this.Adapter.UpdateCommand.Parameters[3].Value = ((System.DateTime)(ShipDate.Value)); } else { @@ -1955,13 +1955,13 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[7].Value = ((string)(AccountNumber)); } this.Adapter.UpdateCommand.Parameters[8].Value = ((int)(CustomerID)); - if ((ShipToAddressID.HasValue == true)) { + if (ShipToAddressID.HasValue) { this.Adapter.UpdateCommand.Parameters[9].Value = ((int)(ShipToAddressID.Value)); } else { this.Adapter.UpdateCommand.Parameters[9].Value = global::System.DBNull.Value; } - if ((BillToAddressID.HasValue == true)) { + if (BillToAddressID.HasValue) { this.Adapter.UpdateCommand.Parameters[10].Value = ((int)(BillToAddressID.Value)); } else { @@ -1994,7 +1994,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[20].Value = ((byte)(Original_RevisionNumber)); this.Adapter.UpdateCommand.Parameters[21].Value = ((System.DateTime)(Original_OrderDate)); this.Adapter.UpdateCommand.Parameters[22].Value = ((System.DateTime)(Original_DueDate)); - if ((Original_ShipDate.HasValue == true)) { + if (Original_ShipDate.HasValue) { this.Adapter.UpdateCommand.Parameters[23].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[24].Value = ((System.DateTime)(Original_ShipDate.Value)); } @@ -2027,7 +2027,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[31].Value = ((string)(Original_AccountNumber)); } this.Adapter.UpdateCommand.Parameters[32].Value = ((int)(Original_CustomerID)); - if ((Original_ShipToAddressID.HasValue == true)) { + if (Original_ShipToAddressID.HasValue) { this.Adapter.UpdateCommand.Parameters[33].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[34].Value = ((int)(Original_ShipToAddressID.Value)); } @@ -2035,7 +2035,7 @@ public virtual int Update( this.Adapter.UpdateCommand.Parameters[33].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[34].Value = global::System.DBNull.Value; } - if ((Original_BillToAddressID.HasValue == true)) { + if (Original_BillToAddressID.HasValue) { this.Adapter.UpdateCommand.Parameters[35].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[36].Value = ((int)(Original_BillToAddressID.Value)); } @@ -2287,7 +2287,7 @@ private int UpdateDeletedRows(AdventureWorksLT2008DataSet1 dataSet, global::Syst global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; - if ((allAddedRows.Contains(row) == false)) { + if (!allAddedRows.Contains(row)) { realUpdatedRows.Add(row); } } @@ -2303,11 +2303,11 @@ public virtual int UpdateAll(AdventureWorksLT2008DataSet1 dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } - if ((dataSet.HasChanges() == false)) { + if (!dataSet.HasChanges()) { return 0; } if (((this._salesOrderHeaderTableAdapter != null) - && (this.MatchTableAdapterConnection(this._salesOrderHeaderTableAdapter.Connection) == false))) { + && !this.MatchTableAdapterConnection(this._salesOrderHeaderTableAdapter.Connection))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } @@ -2489,15 +2489,15 @@ private bool IsChildAndParent(global::System.Data.DataRow child, global::System. global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); } if ((newParent == null)) { for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) - && ((object.ReferenceEquals(newParent, child) == false) - && (object.ReferenceEquals(newParent, parent) == false))); + && ((!object.ReferenceEquals(newParent, child) ) + && (!object.ReferenceEquals(newParent, parent) ))); ) { newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } diff --git a/snippets/csharp/System.Windows.Controls/GroupStyle/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Controls/GroupStyle/Overview/Window1.xaml.cs index edc41fb7f54..d05f70af9e3 100644 --- a/snippets/csharp/System.Windows.Controls/GroupStyle/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/GroupStyle/Overview/Window1.xaml.cs @@ -21,7 +21,7 @@ private void AddGrouping(object sender, RoutedEventArgs e) // myView = (CollectionView)CollectionViewSource.GetDefaultView(myItemsControl.ItemsSource); // - if (myView.CanGroup == true) + if (myView.CanGroup) { PropertyGroupDescription groupDescription = new PropertyGroupDescription("@Type"); diff --git a/snippets/csharp/System.Windows.Controls/HeaderedItemsControl/Overview/Page1.xaml.cs b/snippets/csharp/System.Windows.Controls/HeaderedItemsControl/Overview/Page1.xaml.cs index 42922caa6a6..d666017bdc2 100644 --- a/snippets/csharp/System.Windows.Controls/HeaderedItemsControl/Overview/Page1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/HeaderedItemsControl/Overview/Page1.xaml.cs @@ -44,7 +44,7 @@ public partial class Page1 : Canvas void OnClick(object sender, RoutedEventArgs e) { // - if (hitemsCtrl.HasHeader == true) + if (hitemsCtrl.HasHeader) { MessageBox.Show(hitemsCtrl.Header.ToString()); } diff --git a/snippets/csharp/System.Windows.Controls/ListBox/ScrollIntoView/Window1.xaml.cs b/snippets/csharp/System.Windows.Controls/ListBox/ScrollIntoView/Window1.xaml.cs index b001957b1c7..c41275dd97e 100644 --- a/snippets/csharp/System.Windows.Controls/ListBox/ScrollIntoView/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/ListBox/ScrollIntoView/Window1.xaml.cs @@ -76,7 +76,7 @@ private void OnUnselected(object sender, RoutedEventArgs e) // private void SelectedItem(object sender, RoutedEventArgs e) { - if (item1.IsSelected == true) + if (item1.IsSelected) { label2.Content = "IsSelected."; } diff --git a/snippets/csharp/System.Windows.Controls/MenuItem/Command/Pane11.xaml.cs b/snippets/csharp/System.Windows.Controls/MenuItem/Command/Pane11.xaml.cs index 008fa0519c4..a1d6ad40d10 100644 --- a/snippets/csharp/System.Windows.Controls/MenuItem/Command/Pane11.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/MenuItem/Command/Pane11.xaml.cs @@ -79,7 +79,7 @@ private void OnSubmenuClosed(object sender, RoutedEventArgs e) // private void Highlight(object sender, RoutedEventArgs e) { - if (item1.IsHighlighted == true) + if (item1.IsHighlighted) { hlbtn.Content = "Item is highlighted."; } diff --git a/snippets/csharp/System.Windows.Controls/MenuItem/IsPressed/Pane1.xaml.cs b/snippets/csharp/System.Windows.Controls/MenuItem/IsPressed/Pane1.xaml.cs index 41f124cafc5..268f1eb3c0d 100644 --- a/snippets/csharp/System.Windows.Controls/MenuItem/IsPressed/Pane1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/MenuItem/IsPressed/Pane1.xaml.cs @@ -58,7 +58,7 @@ void StatusClick(object sender, RoutedEventArgs e) // private void OnChecked(object sender, RoutedEventArgs e) { - if (mi1.IsChecked == true) + if (mi1.IsChecked) { textBlock1.Text = "Item is checked."; } @@ -68,7 +68,7 @@ private void OnChecked(object sender, RoutedEventArgs e) // private void OnUnchecked(object sender, RoutedEventArgs e) { - if (mi1.IsChecked == false) + if (!mi1.IsChecked) { textBlock1.Text = "Item is unchecked."; } diff --git a/snippets/csharp/System.Windows.Controls/PageRangeSelection/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Controls/PageRangeSelection/Overview/Window1.xaml.cs index 889225a4bbf..7399016a024 100644 --- a/snippets/csharp/System.Windows.Controls/PageRangeSelection/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/PageRangeSelection/Overview/Window1.xaml.cs @@ -1,39 +1,37 @@ using System; +using System.IO; +using System.Printing; using System.Windows; -using System.Windows.Media; using System.Windows.Controls; using System.Windows.Documents; -using System.Printing; -using System.Windows.Xps; using System.Windows.Xps.Packaging; -using System.IO; namespace PrintDialog_Sample { - /// - /// Interaction logic for Window1.xaml - /// + /// + /// Interaction logic for Window1.xaml + /// - public partial class Window1 : Window + public partial class Window1 : Window { - // + // private void InvokePrint(object sender, RoutedEventArgs e) - { - // Create the print dialog object and set options - PrintDialog pDialog = new PrintDialog(); - pDialog.PageRangeSelection = PageRangeSelection.AllPages; - pDialog.UserPageRangeEnabled = true; + { + // Create the print dialog object and set options + PrintDialog pDialog = new PrintDialog(); + pDialog.PageRangeSelection = PageRangeSelection.AllPages; + pDialog.UserPageRangeEnabled = true; - // Display the dialog. This returns true if the user presses the Print button. - Nullable print = pDialog.ShowDialog(); - if (print == true) - { - XpsDocument xpsDocument = new XpsDocument("C:\\FixedDocumentSequence.xps", FileAccess.ReadWrite); - FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence(); - pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "Test print job"); - } + // Display the dialog. This returns true if the user presses the Print button. + Nullable print = pDialog.ShowDialog(); + if (print.Value) + { + XpsDocument xpsDocument = new XpsDocument("C:\\FixedDocumentSequence.xps", FileAccess.ReadWrite); + FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence(); + pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "Test print job"); } - // + } + // // private void GetHeight(object sender, RoutedEventArgs e) { @@ -51,4 +49,4 @@ private void GetWidth(object sender, RoutedEventArgs e) } //
} -} \ No newline at end of file +} diff --git a/snippets/csharp/System.Windows.Controls/ScrollChangedEventArgs/ExtentHeight/Window1.xaml.cs b/snippets/csharp/System.Windows.Controls/ScrollChangedEventArgs/ExtentHeight/Window1.xaml.cs index c359d392b44..dfc8d20ade0 100644 --- a/snippets/csharp/System.Windows.Controls/ScrollChangedEventArgs/ExtentHeight/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Controls/ScrollChangedEventArgs/ExtentHeight/Window1.xaml.cs @@ -24,7 +24,7 @@ private void scrollTrue(object sender, RoutedEventArgs e) // private void sChanged(object sender, ScrollChangedEventArgs e) { - if (svrContent.CanContentScroll == true) + if (svrContent.CanContentScroll) { tBlock1.Foreground = System.Windows.Media.Brushes.Red; tBlock1.Text = "ScrollChangedEvent just Occurred"; diff --git a/snippets/csharp/System.Windows.Documents.DocumentStructures/FigureStructure/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Documents.DocumentStructures/FigureStructure/Overview/Window1.xaml.cs index 4322d1a0d4b..d8861401243 100644 --- a/snippets/csharp/System.Windows.Documents.DocumentStructures/FigureStructure/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Documents.DocumentStructures/FigureStructure/Overview/Window1.xaml.cs @@ -47,7 +47,7 @@ private void OnOpen(object target, ExecutedRoutedEventArgs args) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", load and display the specified XPS document. - if (dialog.ShowDialog() != true) return; + if (!dialog.ShowDialog()) return; // If the file is an XPS document, open it in the DocumentViewer. if (dialog.FileName.EndsWith(".xps")) @@ -183,7 +183,7 @@ private void OnAddStructure(object sender, EventArgs e) // Show the "File Open" dialog. If the user picks a file and // clicks "OK", set it as the XPS unstructured file. - if (openDialog.ShowDialog() != true) return; + if (!openDialog.ShowDialog()) return; string xpsUnstructuredFile = openDialog.FileName; -----*/ // For the sample, always use "Spec_withoutStructure.xps" @@ -204,7 +204,7 @@ private void OnAddStructure(object sender, EventArgs e) // Show the "File Save" dialog. If the user picks a file and // clicks "OK", set it as the target ouput XPS structured file. - if (saveDialog.ShowDialog() != true) return; + if (!saveDialog.ShowDialog()) return; string xpsTargetFile = saveDialog.FileName; // Add the document structure resource elements diff --git a/snippets/csharp/System.Windows.Documents/DocumentPaginator/PageSize/Window1.xaml.cs b/snippets/csharp/System.Windows.Documents/DocumentPaginator/PageSize/Window1.xaml.cs index bd644631982..ac3142d14fd 100644 --- a/snippets/csharp/System.Windows.Documents/DocumentPaginator/PageSize/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Documents/DocumentPaginator/PageSize/Window1.xaml.cs @@ -121,35 +121,35 @@ private void ButtonHelperSave(bool async) switch (currentMode) { case eGuiMode.SingleVisual: - { - saveHelper.SaveSingleVisual( - newContainerPath, async); - break; - } + { + saveHelper.SaveSingleVisual( + newContainerPath, async); + break; + } case eGuiMode.MultipleVisuals: - { - saveHelper.SaveMultipleVisuals( - newContainerPath, async); - break; - } + { + saveHelper.SaveMultipleVisuals( + newContainerPath, async); + break; + } case eGuiMode.SingleFlowDocument: - { - saveHelper.SaveSingleFlowContentDocument( - newContainerPath, async); - break; - } + { + saveHelper.SaveSingleFlowContentDocument( + newContainerPath, async); + break; + } case eGuiMode.SingleFixedDocument: - { - saveHelper.SaveSingleFixedContentDocument( - newContainerPath, async); - break; - } + { + saveHelper.SaveSingleFixedContentDocument( + newContainerPath, async); + break; + } case eGuiMode.MultipleFixedDocuments: - { - saveHelper.SaveMultipleFixedContentDocuments( - newContainerPath, async); - break; - } + { + saveHelper.SaveMultipleFixedContentDocuments( + newContainerPath, async); + break; + } }// end:switch (currentMode) }// end:ButtonHelperSave() @@ -201,13 +201,14 @@ private void AsyncSaveEvent( /// private string GetContainerPathFromDialog() { - SaveFileDialog saveFileDialog = new SaveFileDialog(); - - saveFileDialog.Filter = "XPS Document files (*.xps)|*.xps"; - saveFileDialog.FilterIndex = 1; - saveFileDialog.InitialDirectory = _contentDir; + SaveFileDialog saveFileDialog = new SaveFileDialog + { + Filter = "XPS Document files (*.xps)|*.xps", + FilterIndex = 1, + InitialDirectory = _contentDir + }; - if (saveFileDialog.ShowDialog() == true) + if (saveFileDialog.ShowDialog().Value) { // The user specified a valid path and filename. return saveFileDialog.FileName; } diff --git a/snippets/csharp/System.Windows.Forms/CheckedListBox/Overview/source.cs b/snippets/csharp/System.Windows.Forms/CheckedListBox/Overview/source.cs index 99f92a5dce2..66fbe306ab8 100644 --- a/snippets/csharp/System.Windows.Forms/CheckedListBox/Overview/source.cs +++ b/snippets/csharp/System.Windows.Forms/CheckedListBox/Overview/source.cs @@ -102,7 +102,7 @@ private void button1_Click(object sender, System.EventArgs e) { if(textBox1.Text != "") { - if(checkedListBox1.CheckedItems.Contains(textBox1.Text)== false) + if(!checkedListBox1.CheckedItems.Contains(textBox1.Text)) checkedListBox1.Items.Add(textBox1.Text,CheckState.Checked); textBox1.Text = ""; } @@ -156,7 +156,7 @@ private void button3_Click(object sender, System.EventArgs e) IEnumerator myEnumerator; myEnumerator = checkedListBox1.CheckedIndices.GetEnumerator(); int y; - while (myEnumerator.MoveNext() != false) + while (myEnumerator.MoveNext()) { y =(int) myEnumerator.Current; checkedListBox1.SetItemChecked(y, false); diff --git a/snippets/csharp/System.Windows.Forms/Control/KeyDown/form1.cs b/snippets/csharp/System.Windows.Forms/Control/KeyDown/form1.cs index 7551859f006..d30d6399e64 100644 --- a/snippets/csharp/System.Windows.Forms/Control/KeyDown/form1.cs +++ b/snippets/csharp/System.Windows.Forms/Control/KeyDown/form1.cs @@ -117,7 +117,7 @@ private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { // Check for the flag being set in the KeyDown event. - if (nonNumberEntered == true) + if (nonNumberEntered) { // Stop the character from being entered into the control since it is non-numerical. e.Handled = true; diff --git a/snippets/csharp/System.Windows.Forms/DataGrid/AllowNavigation/mydatagrid_allownavigationchanged.cs b/snippets/csharp/System.Windows.Forms/DataGrid/AllowNavigation/mydatagrid_allownavigationchanged.cs index cd0ea2296f8..93152a33ca0 100644 --- a/snippets/csharp/System.Windows.Forms/DataGrid/AllowNavigation/mydatagrid_allownavigationchanged.cs +++ b/snippets/csharp/System.Windows.Forms/DataGrid/AllowNavigation/mydatagrid_allownavigationchanged.cs @@ -161,7 +161,7 @@ private void CallAllowNavigationChanged() // Set the 'AllowNavigation' property on click of a button. private void myButton_Click(object sender, EventArgs e) { - if (myDataGrid.AllowNavigation == true) + if (myDataGrid.AllowNavigation) myDataGrid.AllowNavigation = false; else myDataGrid.AllowNavigation = true; diff --git a/snippets/csharp/System.Windows.Forms/DataGrid/CaptionVisibleChanged/mydatagrid_captionvisiblechanged.cs b/snippets/csharp/System.Windows.Forms/DataGrid/CaptionVisibleChanged/mydatagrid_captionvisiblechanged.cs index 0a45eace136..d8b2dafc73c 100644 --- a/snippets/csharp/System.Windows.Forms/DataGrid/CaptionVisibleChanged/mydatagrid_captionvisiblechanged.cs +++ b/snippets/csharp/System.Windows.Forms/DataGrid/CaptionVisibleChanged/mydatagrid_captionvisiblechanged.cs @@ -167,7 +167,7 @@ private void CallCaptionVisibleChanged() // Set the 'CaptionVisible' property on click of a button. private void myButton_Click(object sender, EventArgs e) { - if (myDataGrid.CaptionVisible == true) + if (myDataGrid.CaptionVisible) myDataGrid.CaptionVisible = false; else myDataGrid.CaptionVisible = true; diff --git a/snippets/csharp/System.Windows.Forms/DataGrid/FlatMode/mydatagridclass_flatmode_readonly.cs b/snippets/csharp/System.Windows.Forms/DataGrid/FlatMode/mydatagridclass_flatmode_readonly.cs index a6ece5aad8e..9b88fd33ecd 100644 --- a/snippets/csharp/System.Windows.Forms/DataGrid/FlatMode/mydatagridclass_flatmode_readonly.cs +++ b/snippets/csharp/System.Windows.Forms/DataGrid/FlatMode/mydatagridclass_flatmode_readonly.cs @@ -153,7 +153,7 @@ private void AttachFlatModeChanged() private void myDataGrid_FlatModeChanged(object sender, EventArgs e) { string strMessage = "false"; - if(myDataGrid.FlatMode == true) + if(myDataGrid.FlatMode) strMessage = "true"; MessageBox.Show("Flat mode changed to "+strMessage, @@ -163,7 +163,7 @@ private void myDataGrid_FlatModeChanged(object sender, EventArgs e) // Toggle the 'FlatMode'. private void button1_Click(object sender, EventArgs e) { - if(myDataGrid.FlatMode == true) + if (myDataGrid.FlatMode) myDataGrid.FlatMode = false; else myDataGrid.FlatMode = true; @@ -179,7 +179,7 @@ private void AttachReadOnlyChanged() private void myDataGrid_ReadOnlyChanged(object sender, EventArgs e) { string strMessage = "false"; - if(myDataGrid.ReadOnly == true) + if (myDataGrid.ReadOnly) strMessage = "true"; MessageBox.Show("Read only changed to "+strMessage, @@ -189,7 +189,7 @@ private void myDataGrid_ReadOnlyChanged(object sender, EventArgs e) // Toggle the 'ReadOnly' property. private void button2_Click(object sender, EventArgs e) { - if(myDataGrid.ReadOnly == true) + if (myDataGrid.ReadOnly) myDataGrid.ReadOnly = false; else myDataGrid.ReadOnly = true; diff --git a/snippets/csharp/System.Windows.Forms/DataGrid/ParentRowsLabelStyleChanged/datagrid_parentrowslabelstylechanged.cs b/snippets/csharp/System.Windows.Forms/DataGrid/ParentRowsLabelStyleChanged/datagrid_parentrowslabelstylechanged.cs index 7f9eac498aa..5b8c03fd17b 100644 --- a/snippets/csharp/System.Windows.Forms/DataGrid/ParentRowsLabelStyleChanged/datagrid_parentrowslabelstylechanged.cs +++ b/snippets/csharp/System.Windows.Forms/DataGrid/ParentRowsLabelStyleChanged/datagrid_parentrowslabelstylechanged.cs @@ -180,7 +180,7 @@ private void CallParentRowsVisibleChanged() // Set the 'ParentRowsVisible' property on click of a button. private void ToggleVisible_Clicked(object sender, EventArgs e) { - if (myDataGrid.ParentRowsVisible == true) + if (myDataGrid.ParentRowsVisible) myDataGrid.ParentRowsVisible = false; else myDataGrid.ParentRowsVisible = true; diff --git a/snippets/csharp/System.Windows.Forms/DataGridTableStyle/AllowSorting/datagridtablestyle_sample2.cs b/snippets/csharp/System.Windows.Forms/DataGridTableStyle/AllowSorting/datagridtablestyle_sample2.cs index 0774176d48e..fe21a8686d7 100644 --- a/snippets/csharp/System.Windows.Forms/DataGridTableStyle/AllowSorting/datagridtablestyle_sample2.cs +++ b/snippets/csharp/System.Windows.Forms/DataGridTableStyle/AllowSorting/datagridtablestyle_sample2.cs @@ -191,7 +191,7 @@ private void DataGridTableStyle_Sample_Load(object sender, mylabel.Text = "Sorting Status :" + myDataGridTableStyle1.AllowSorting.ToString(); - if(myDataGridTableStyle1.AllowSorting == true) + if (myDataGridTableStyle1.AllowSorting) { btnApplyStyles.Text = "Remove Sorting"; } @@ -212,7 +212,7 @@ private void AllowSortingChanged_Handler(object sender,EventArgs e) private void btnApplyStyles_Click(object sender, EventArgs e) { - if(myDataGridTableStyle1.AllowSorting == true) + if (myDataGridTableStyle1.AllowSorting) { // Remove sorting. myDataGridTableStyle1.AllowSorting = false; diff --git a/snippets/csharp/System.Windows.Forms/DataGridTableStyle/ColumnHeadersVisible/datagridtablestyle_sample3.cs b/snippets/csharp/System.Windows.Forms/DataGridTableStyle/ColumnHeadersVisible/datagridtablestyle_sample3.cs index f10df13e4e4..222862b8b86 100644 --- a/snippets/csharp/System.Windows.Forms/DataGridTableStyle/ColumnHeadersVisible/datagridtablestyle_sample3.cs +++ b/snippets/csharp/System.Windows.Forms/DataGridTableStyle/ColumnHeadersVisible/datagridtablestyle_sample3.cs @@ -197,7 +197,7 @@ private void DataGridTableStyle_Sample_Load(object sender, myDataGridTableStyle1 = new DataGridTableStyle(); myHeaderLabel.Text = "Header Status :" + myDataGridTableStyle1.ColumnHeadersVisible.ToString(); - if(myDataGridTableStyle1.ColumnHeadersVisible == true) + if (myDataGridTableStyle1.ColumnHeadersVisible) { btnheader.Text = "Remove Header"; } @@ -257,7 +257,7 @@ private void ColumnHeadersVisibleChanged_Handler(object sender, } private void btnheader_Click(object sender, EventArgs e) { - if(myDataGridTableStyle1.ColumnHeadersVisible == true) + if (myDataGridTableStyle1.ColumnHeadersVisible) { myDataGridTableStyle1.ColumnHeadersVisible = false; btnheader.Text = "Add Header"; diff --git a/snippets/csharp/System.Windows.Forms/DataGridView/CellValidated/form1.cs b/snippets/csharp/System.Windows.Forms/DataGridView/CellValidated/form1.cs index b67876e389a..30be2c936bb 100644 --- a/snippets/csharp/System.Windows.Forms/DataGridView/CellValidated/form1.cs +++ b/snippets/csharp/System.Windows.Forms/DataGridView/CellValidated/form1.cs @@ -231,7 +231,7 @@ private void UpdateLabelText() // If the cell contains a value that has not been commited, // use the modified value. - if (DataGridView1.IsCurrentCellDirty == true) + if (DataGridView1.IsCurrentCellDirty) { value = DataGridView1.SelectedCells[counter] diff --git a/snippets/csharp/System.Windows.Forms/DataGridView/Sort/form1.cs b/snippets/csharp/System.Windows.Forms/DataGridView/Sort/form1.cs index bc38af69c3a..1ccccedf2f4 100644 --- a/snippets/csharp/System.Windows.Forms/DataGridView/Sort/form1.cs +++ b/snippets/csharp/System.Windows.Forms/DataGridView/Sort/form1.cs @@ -84,11 +84,11 @@ private void PopulateDataGridView() // private void Button1_Click( object sender, EventArgs e ) { - if ( RadioButton1.Checked == true ) + if ( RadioButton1.Checked) { DataGridView1.Sort( new RowComparer( SortOrder.Ascending ) ); } - else if ( RadioButton2.Checked == true ) + else if ( RadioButton2.Checked) { DataGridView1.Sort( new RowComparer( SortOrder.Descending ) ); } diff --git a/snippets/csharp/System.Windows.Forms/Form/Modal/form1.cs b/snippets/csharp/System.Windows.Forms/Form/Modal/form1.cs index d35f1dd4c9c..97b7cf93e14 100644 --- a/snippets/csharp/System.Windows.Forms/Form/Modal/form1.cs +++ b/snippets/csharp/System.Windows.Forms/Form/Modal/form1.cs @@ -98,7 +98,7 @@ private void ShowMyNonModalForm() myForm.Show(); // Determine if the form is modal. - if(myForm.Modal == false) + if (!myForm.Modal) { // Change borderstyle and make it not a top level window. myForm.FormBorderStyle = FormBorderStyle.FixedToolWindow; diff --git a/snippets/csharp/System.Windows.Forms/ImageList+ImageCollection/Overview/source.cs b/snippets/csharp/System.Windows.Forms/ImageList+ImageCollection/Overview/source.cs index abc74bbe791..0c24622b59f 100644 --- a/snippets/csharp/System.Windows.Forms/ImageList+ImageCollection/Overview/source.cs +++ b/snippets/csharp/System.Windows.Forms/ImageList+ImageCollection/Overview/source.cs @@ -107,7 +107,7 @@ private void InitializeComponent() // Display the image. private void button1_Click (object sender, System.EventArgs e) { - if(imageList1.Images.Empty != true) + if(!imageList1.Images.Empty) { if(imageList1.Images.Count-1 > currentImage) { diff --git a/snippets/csharp/System.Windows.Forms/ListBox/GetSelected/form1.cs b/snippets/csharp/System.Windows.Forms/ListBox/GetSelected/form1.cs index cf74ca36cbf..be6086b37e4 100644 --- a/snippets/csharp/System.Windows.Forms/ListBox/GetSelected/form1.cs +++ b/snippets/csharp/System.Windows.Forms/ListBox/GetSelected/form1.cs @@ -138,7 +138,7 @@ private void InvertMySelection() for (int x = 0; x < listBox1.Items.Count; x++) { // Determine if the item is selected. - if(listBox1.GetSelected(x) == true) + if (listBox1.GetSelected(x)) // Deselect all items that are selected. listBox1.SetSelected(x,false); else diff --git a/snippets/csharp/System.Windows.Forms/ListBox/Sort/form1.cs b/snippets/csharp/System.Windows.Forms/ListBox/Sort/form1.cs index 6ddc953f2ef..9f509bd9cfd 100644 --- a/snippets/csharp/System.Windows.Forms/ListBox/Sort/form1.cs +++ b/snippets/csharp/System.Windows.Forms/ListBox/Sort/form1.cs @@ -93,7 +93,7 @@ protected override void Sort() counter -= 1; } } - while((swapped==true)); + while(swapped); } } } diff --git a/snippets/csharp/System.Windows.Forms/MenuItem/Enabled/form1.cs b/snippets/csharp/System.Windows.Forms/MenuItem/Enabled/form1.cs index 4251df19b9d..238bc0aee0c 100644 --- a/snippets/csharp/System.Windows.Forms/MenuItem/Enabled/form1.cs +++ b/snippets/csharp/System.Windows.Forms/MenuItem/Enabled/form1.cs @@ -145,7 +145,7 @@ static void Main() // private void PopupMyMenu(object sender, System.EventArgs e) { - if (textBox1.Enabled == false || textBox1.Focused == false || + if (!textBox1.Enabled || !textBox1.Focused || textBox1.SelectedText.Length == 0) { menuCut.Enabled = false; diff --git a/snippets/csharp/System.Windows.Forms/MenuItem/IsParent/source.cs b/snippets/csharp/System.Windows.Forms/MenuItem/IsParent/source.cs index ec8264caeb0..d51fd38d334 100644 --- a/snippets/csharp/System.Windows.Forms/MenuItem/IsParent/source.cs +++ b/snippets/csharp/System.Windows.Forms/MenuItem/IsParent/source.cs @@ -10,7 +10,7 @@ public class Form1: Form public void DisableMyChildMenus () { // Determine if menuItem2 is a parent menu. - if(menuItem2.IsParent == true) + if (menuItem2.IsParent) { // Loop through all the submenus. for(int i = 0; i < menuItem2.MenuItems.Count; i++) diff --git a/snippets/csharp/System.Windows.Forms/MonthCalendar/AddBoldedDate/mc.cs b/snippets/csharp/System.Windows.Forms/MonthCalendar/AddBoldedDate/mc.cs index 02e7cf6eb43..d7454a5f4b9 100644 --- a/snippets/csharp/System.Windows.Forms/MonthCalendar/AddBoldedDate/mc.cs +++ b/snippets/csharp/System.Windows.Forms/MonthCalendar/AddBoldedDate/mc.cs @@ -274,7 +274,7 @@ static void Main() // private void checkBox1_CheckedChanged(object sender, System.EventArgs e) { - if(checkBox1.Checked == true) + if (checkBox1.Checked) monthCalendar1.ShowToday = true; else monthCalendar1.ShowToday = false; @@ -284,7 +284,7 @@ private void checkBox1_CheckedChanged(object sender, System.EventArgs e) // private void checkBox2_CheckedChanged(object sender, System.EventArgs e) { - if(checkBox2.Checked == true) + if (checkBox2.Checked) monthCalendar1.ShowTodayCircle = true; else monthCalendar1.ShowTodayCircle = false; @@ -384,7 +384,7 @@ private void this_Closing (object Sender, CancelEventArgs c) { StreamWriter myOutputStream = File.CreateText("myDates.txt"); IEnumerator myDates = listBox1.Items.GetEnumerator(); - while(myDates.MoveNext() == true) + while(myDates.MoveNext()) { myOutputStream.WriteLine(myDates.Current.ToString()); diff --git a/snippets/csharp/System.Windows.Forms/OpenFileDialog/ReadOnlyChecked/form1.cs b/snippets/csharp/System.Windows.Forms/OpenFileDialog/ReadOnlyChecked/form1.cs index cf8034276e8..07af95c6afd 100644 --- a/snippets/csharp/System.Windows.Forms/OpenFileDialog/ReadOnlyChecked/form1.cs +++ b/snippets/csharp/System.Windows.Forms/OpenFileDialog/ReadOnlyChecked/form1.cs @@ -93,7 +93,7 @@ private FileStream OpenFile() string path = null; try { - if(dlgOpenFile.ReadOnlyChecked == true) + if (dlgOpenFile.ReadOnlyChecked) { return (FileStream)dlgOpenFile.OpenFile(); } diff --git a/snippets/csharp/System.Windows.Forms/PrintControllerWithStatusDialog/Overview/source.cs b/snippets/csharp/System.Windows.Forms/PrintControllerWithStatusDialog/Overview/source.cs index 48e723bc7da..b774e603408 100644 --- a/snippets/csharp/System.Windows.Forms/PrintControllerWithStatusDialog/Overview/source.cs +++ b/snippets/csharp/System.Windows.Forms/PrintControllerWithStatusDialog/Overview/source.cs @@ -13,9 +13,9 @@ public class Form1: Form // void myPrint() { - if (useMyPrintController==true) { + if (useMyPrintController) { myDocumentPrinter.PrintController = new myControllerImplementation(); - if (wantsStatusDialog==true) { + if (wantsStatusDialog) { myDocumentPrinter.PrintController = new PrintControllerWithStatusDialog(myDocumentPrinter.PrintController); } diff --git a/snippets/csharp/System.Windows.Forms/ProgressBar/Overview/form1.cs b/snippets/csharp/System.Windows.Forms/ProgressBar/Overview/form1.cs index 36a61249c7c..390e47bfa76 100644 --- a/snippets/csharp/System.Windows.Forms/ProgressBar/Overview/form1.cs +++ b/snippets/csharp/System.Windows.Forms/ProgressBar/Overview/form1.cs @@ -58,7 +58,7 @@ private void CopyWithProgress(string[] filenames) for (int x = 1; x <= filenames.Length; x++) { // Copy the file and increment the ProgressBar if successful. - if(CopyFile(filenames[x-1]) == true) + if (CopyFile(filenames[x-1])) { // Perform the increment on the ProgressBar. pBar1.PerformStep(); diff --git a/snippets/csharp/System.Windows.Forms/RichTextBox/CanRedo/form1.cs b/snippets/csharp/System.Windows.Forms/RichTextBox/CanRedo/form1.cs index 70df1e287ea..22caea5a711 100644 --- a/snippets/csharp/System.Windows.Forms/RichTextBox/CanRedo/form1.cs +++ b/snippets/csharp/System.Windows.Forms/RichTextBox/CanRedo/form1.cs @@ -109,7 +109,7 @@ private void button1_Click(object sender, System.EventArgs e) private void RedoAllButDeletes() { // Determines if a Redo operation can be performed. - if(richTextBox1.CanRedo == true) + if (richTextBox1.CanRedo) { // Determines if the redo operation deletes text. if (richTextBox1.RedoActionName != "Delete") diff --git a/snippets/csharp/System.Windows.Forms/RichTextBox/SelectionFont/source.cs b/snippets/csharp/System.Windows.Forms/RichTextBox/SelectionFont/source.cs index aad4bee6087..a65b608b378 100644 --- a/snippets/csharp/System.Windows.Forms/RichTextBox/SelectionFont/source.cs +++ b/snippets/csharp/System.Windows.Forms/RichTextBox/SelectionFont/source.cs @@ -109,7 +109,7 @@ private void ToggleBold() System.Drawing.Font currentFont = richTextBox1.SelectionFont; System.Drawing.FontStyle newFontStyle; - if (richTextBox1.SelectionFont.Bold == true) + if (richTextBox1.SelectionFont.Bold) { newFontStyle = FontStyle.Regular; } diff --git a/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/Contains/form1.cs b/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/Contains/form1.cs index a62aac1b003..72ddf85fe7f 100644 --- a/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/Contains/form1.cs +++ b/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/Contains/form1.cs @@ -23,7 +23,7 @@ public Form1() // Checks the tabControl1 controls collection for tabPage3. // Adds tabPage3 to tabControl1 if it is not in the collection. - if (tabControl1.TabPages.Contains(tabPage3) == false) + if (!tabControl1.TabPages.Contains(tabPage3)) this.tabControl1.TabPages.Add(tabPage3); this.tabControl1.Location = new Point(25, 25); diff --git a/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/IsReadOnly/form1.cs b/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/IsReadOnly/form1.cs index a8411741b3a..1e67f857841 100644 --- a/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/IsReadOnly/form1.cs +++ b/snippets/csharp/System.Windows.Forms/TabControl+TabPageCollection/IsReadOnly/form1.cs @@ -12,7 +12,7 @@ public Form1() Label label1 = new Label(); // Determines if the tabControl1 controls collection is read-only. - if (tabControl1.TabPages.IsReadOnly == true) + if (tabControl1.TabPages.IsReadOnly) label1.Text = "The tabControl1 controls collection is read-only."; else label1.Text = "The tabControl1 controls collection is not read-only."; diff --git a/snippets/csharp/System.Windows.Forms/TextBoxBase/CanUndo/source.cs b/snippets/csharp/System.Windows.Forms/TextBoxBase/CanUndo/source.cs index 23a2082d4b7..345e463c2b3 100644 --- a/snippets/csharp/System.Windows.Forms/TextBoxBase/CanUndo/source.cs +++ b/snippets/csharp/System.Windows.Forms/TextBoxBase/CanUndo/source.cs @@ -26,7 +26,7 @@ private void Menu_Cut(System.Object sender, System.EventArgs e) private void Menu_Paste(System.Object sender, System.EventArgs e) { // Determine if there is any text in the Clipboard to paste into the text box. - if(Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true) + if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) { // Determine if any text is selected in the text box. if(textBox1.SelectionLength > 0) @@ -44,7 +44,7 @@ private void Menu_Paste(System.Object sender, System.EventArgs e) private void Menu_Undo(System.Object sender, System.EventArgs e) { // Determine if last operation can be undone in text box. - if(textBox1.CanUndo == true) + if (textBox1.CanUndo) { // Undo the last operation. textBox1.Undo(); diff --git a/snippets/csharp/System.Windows.Forms/TextBoxBase/Clear/source.cs b/snippets/csharp/System.Windows.Forms/TextBoxBase/Clear/source.cs index c50248f01dd..0040bb09438 100644 --- a/snippets/csharp/System.Windows.Forms/TextBoxBase/Clear/source.cs +++ b/snippets/csharp/System.Windows.Forms/TextBoxBase/Clear/source.cs @@ -14,7 +14,7 @@ private void MyTextChangedHandler(System.Object sender, System.EventArgs e) { long val; // Check the flag to prevent code re-entry. - if(flag == false) + if (!flag) { // Set the flag to True to prevent re-entry of the code below. flag = true; diff --git a/snippets/csharp/System.Windows.Forms/TextBoxBase/ClearUndo/source.cs b/snippets/csharp/System.Windows.Forms/TextBoxBase/ClearUndo/source.cs index 23a2082d4b7..345e463c2b3 100644 --- a/snippets/csharp/System.Windows.Forms/TextBoxBase/ClearUndo/source.cs +++ b/snippets/csharp/System.Windows.Forms/TextBoxBase/ClearUndo/source.cs @@ -26,7 +26,7 @@ private void Menu_Cut(System.Object sender, System.EventArgs e) private void Menu_Paste(System.Object sender, System.EventArgs e) { // Determine if there is any text in the Clipboard to paste into the text box. - if(Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true) + if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) { // Determine if any text is selected in the text box. if(textBox1.SelectionLength > 0) @@ -44,7 +44,7 @@ private void Menu_Paste(System.Object sender, System.EventArgs e) private void Menu_Undo(System.Object sender, System.EventArgs e) { // Determine if last operation can be undone in text box. - if(textBox1.CanUndo == true) + if (textBox1.CanUndo) { // Undo the last operation. textBox1.Undo(); diff --git a/snippets/csharp/System.Windows.Forms/TextBoxBase/SelectedText/source.cs b/snippets/csharp/System.Windows.Forms/TextBoxBase/SelectedText/source.cs index dd66c7c3ad0..dfb946da290 100644 --- a/snippets/csharp/System.Windows.Forms/TextBoxBase/SelectedText/source.cs +++ b/snippets/csharp/System.Windows.Forms/TextBoxBase/SelectedText/source.cs @@ -44,7 +44,7 @@ private void Menu_Paste(System.Object sender, System.EventArgs e) private void Menu_Undo(System.Object sender, System.EventArgs e) { // Determine if last operation can be undone in text box. - if(textBox1.CanUndo == true) + if (textBox1.CanUndo) { // Undo the last operation. textBox1.Undo(); diff --git a/snippets/csharp/System.Windows.Forms/Timer/Overview/source.cs b/snippets/csharp/System.Windows.Forms/Timer/Overview/source.cs index df8b20a500a..cfeaaf2fb9f 100644 --- a/snippets/csharp/System.Windows.Forms/Timer/Overview/source.cs +++ b/snippets/csharp/System.Windows.Forms/Timer/Overview/source.cs @@ -35,7 +35,7 @@ process the timer event to the timer. */ myTimer.Start(); // Runs the timer, and raises the event. - while(exitFlag == false) { + while(!exitFlag) { // Processes all the events in the queue. Application.DoEvents(); } diff --git a/snippets/csharp/System.Windows.Forms/TrackBarRenderer/Overview/form1.cs b/snippets/csharp/System.Windows.Forms/TrackBarRenderer/Overview/form1.cs index 0de57f0ada5..ac0daf0e1cb 100644 --- a/snippets/csharp/System.Windows.Forms/TrackBarRenderer/Overview/form1.cs +++ b/snippets/csharp/System.Windows.Forms/TrackBarRenderer/Overview/form1.cs @@ -150,7 +150,7 @@ protected override void OnMouseUp(MouseEventArgs e) if (!TrackBarRenderer.IsSupported) return; - if (thumbClicked == true) + if (thumbClicked) { if (e.Location.X > trackRectangle.X && e.Location.X < (trackRectangle.X + @@ -172,7 +172,7 @@ protected override void OnMouseMove(MouseEventArgs e) return; // The user is moving the thumb. - if (thumbClicked == true) + if (thumbClicked) { // Track movements to the next tick to the right, if // the cursor has moved halfway to the next tick. diff --git a/snippets/csharp/System.Windows.Forms/TreeNode/ExpandAll/treenode_forecolor.cs b/snippets/csharp/System.Windows.Forms/TreeNode/ExpandAll/treenode_forecolor.cs index 4cf28bbf5c6..2a01e40f7e5 100644 --- a/snippets/csharp/System.Windows.Forms/TreeNode/ExpandAll/treenode_forecolor.cs +++ b/snippets/csharp/System.Windows.Forms/TreeNode/ExpandAll/treenode_forecolor.cs @@ -91,7 +91,7 @@ private void FillMyTreeView() Cursor.Current = Cursors.Default; // Begin repainting the TreeView. myTreeView.EndUpdate(); - if (myTreeView.Nodes[0].IsExpanded == false) + if (!myTreeView.Nodes[0].IsExpanded) myTreeView.Nodes[0].Expand(); } @@ -169,7 +169,7 @@ static void Main() private void myCheckBox_CheckedChanged(object sender, System.EventArgs e) { // If the check box is checked, expand all the tree nodes. - if (myCheckBox.Checked == true) + if (myCheckBox.Checked) { myTreeView.ExpandAll(); } @@ -215,7 +215,7 @@ private void MenuItem1_Click(object sender, System.EventArgs e) myTreeView.SelectedNode = mySelectedNode; myTreeView.LabelEdit = true; mySelectedNode.BeginEdit(); - if (mySelectedNode.IsEditing == true) + if (mySelectedNode.IsEditing) MessageBox.Show("The name of node being edited: "+ mySelectedNode.Text); mySelectedNode.BeginEdit(); diff --git a/snippets/csharp/System.Windows.Forms/TreeNodeCollection/AddRange/treenodecollection_clear.cs b/snippets/csharp/System.Windows.Forms/TreeNodeCollection/AddRange/treenodecollection_clear.cs index 151940a342f..06fa55a64fe 100644 --- a/snippets/csharp/System.Windows.Forms/TreeNodeCollection/AddRange/treenodecollection_clear.cs +++ b/snippets/csharp/System.Windows.Forms/TreeNodeCollection/AddRange/treenodecollection_clear.cs @@ -66,7 +66,7 @@ private void MyButtonAddClick(object sender, EventArgs e) TreeNodeCollection myTreeNodeCollection = myTreeViewBase.Nodes; foreach(TreeNode myTreeNode in myTreeNodeCollection) { - if (myTreeNode.IsSelected == true) + if (myTreeNode.IsSelected) { // Remove the selected node from the 'myTreeViewBase' TreeView. myTreeViewBase.Nodes.Remove(myTreeNode); diff --git a/snippets/csharp/System.Windows.Input/RoutedCommand/CanExecute/Window1.xaml.cs b/snippets/csharp/System.Windows.Input/RoutedCommand/CanExecute/Window1.xaml.cs index 599df605480..7368db086d6 100644 --- a/snippets/csharp/System.Windows.Input/RoutedCommand/CanExecute/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Input/RoutedCommand/CanExecute/Window1.xaml.cs @@ -102,7 +102,7 @@ private void IncreaseDecreaseCanExecute(object sender, CanExecuteRoutedEventArgs Slider target = e.Source as Slider; if (target != null) { - if (target.IsEnabled == true) + if (target.IsEnabled) { e.CanExecute = true; e.Handled = true; diff --git a/snippets/csharp/System.Windows.Input/Stylus/Overview/Window2.xaml.cs b/snippets/csharp/System.Windows.Input/Stylus/Overview/Window2.xaml.cs index 491c098be32..d192eb4d55c 100644 --- a/snippets/csharp/System.Windows.Input/Stylus/Overview/Window2.xaml.cs +++ b/snippets/csharp/System.Windows.Input/Stylus/Overview/Window2.xaml.cs @@ -199,7 +199,7 @@ void inkCanvas1_StylusDown(object sender, StylusDownEventArgs e) // void inkCanvas1_StylusInRange(object sender, StylusEventArgs e) { - if (e.StylusDevice.Inverted == true) + if (e.StylusDevice.Inverted) { inkCanvas1.EditingMode = InkCanvasEditingMode.EraseByStroke; inkCanvas1.Cursor = System.Windows.Input.Cursors.Hand; diff --git a/snippets/csharp/System.Windows.Markup/XamlReader/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Markup/XamlReader/Overview/Window1.xaml.cs index 92a4ca11bd3..da4b6ca63c9 100644 --- a/snippets/csharp/System.Windows.Markup/XamlReader/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Markup/XamlReader/Overview/Window1.xaml.cs @@ -109,7 +109,7 @@ public void ButtonRoundTripASyncStream() private void xReader_LoadCompleted(object sender, AsyncCompletedEventArgs e) { - if (e.Cancelled != true) + if (!e.Cancelled) { // Load new button } diff --git a/snippets/csharp/System.Windows.Media.Imaging/BitmapDecoder/CreateInPlaceBitmapMetadataWriter/BitmapMetadata.cs b/snippets/csharp/System.Windows.Media.Imaging/BitmapDecoder/CreateInPlaceBitmapMetadataWriter/BitmapMetadata.cs index cebd57c79dd..307b69cd95f 100644 --- a/snippets/csharp/System.Windows.Media.Imaging/BitmapDecoder/CreateInPlaceBitmapMetadataWriter/BitmapMetadata.cs +++ b/snippets/csharp/System.Windows.Media.Imaging/BitmapDecoder/CreateInPlaceBitmapMetadataWriter/BitmapMetadata.cs @@ -29,7 +29,7 @@ private void CreateAndShowMainWindow () PngBitmapDecoder pngDecoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); BitmapFrame pngFrame = pngDecoder.Frames[0]; InPlaceBitmapMetadataWriter pngInplace = pngFrame.CreateInPlaceBitmapMetadataWriter(); - if (pngInplace.TrySave() == true) + if (pngInplace.TrySave()) { pngInplace.SetQuery("/Text/Description", "Have a nice day."); } pngStream.Close(); // diff --git a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/MyLights.cs b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/MyLights.cs index f1438034703..438155ce852 100644 --- a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/MyLights.cs +++ b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/MyLights.cs @@ -51,12 +51,12 @@ public void ShowAmbientLight(bool show, Model3DGroup modelGroup) { string s = m.ToString(); } - if (show == true) + if (show) { modelGroup.Children.Add(_ambLight); } - if (show == false) + if (!show) { modelGroup.Children.Remove(_ambLight); } @@ -64,12 +64,12 @@ public void ShowAmbientLight(bool show, Model3DGroup modelGroup) public void ShowDirLight(int index, bool show, Model3DGroup modelGroup) { - if (show == true) + if (show) { modelGroup.Children.Add(_dirLight[index]); } - if (show == false) + if (!show) { modelGroup.Children.Remove(_dirLight[index]); } @@ -77,12 +77,12 @@ public void ShowDirLight(int index, bool show, Model3DGroup modelGroup) public void ShowPointLight(int indexer, bool show, Model3DGroup modelGroup) { - if (show == true) + if (show) { modelGroup.Children.Add(_ptLight); } - if (show == false) + if (!show) { modelGroup.Children.Remove(_ptLight); } diff --git a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/ViewportEventHandlers.cs b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/ViewportEventHandlers.cs index ba555d9a797..9dc5360b98b 100644 --- a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/ViewportEventHandlers.cs +++ b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/ViewportEventHandlers.cs @@ -177,7 +177,7 @@ private void KeyDownHandlerForPointLight(object sender, KeyEventArgs e) break; } - if (e.Handled == true) + if (e.Handled) { // Transform point light. myLights.TransformPointLight(pointLightVector, spaceLinesChangeVector); diff --git a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window1.xaml.cs index 2b1228babc7..77a411685f8 100644 --- a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window1.xaml.cs @@ -1,12 +1,7 @@ using System; using System.Windows; -using System.Collections; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Media3D; -using System.Windows.Shapes; namespace HitTest3D { @@ -162,12 +157,12 @@ public void UpdateTestPointInfo(Point3D testpoint3D, Vector3D testdirection) //Toggle between camera projections. public void ToggleCamera(object sender, EventArgs e) { - if ((bool)CameraCheck.IsChecked == true) + if ((bool)CameraCheck.IsChecked) { OrthographicCamera myOCamera = new OrthographicCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 3); myViewport.Camera = myOCamera; } - if ((bool)CameraCheck.IsChecked != true) + if (!(bool)CameraCheck.IsChecked) { PerspectiveCamera myPCamera = new PerspectiveCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 50); myViewport.Camera = myPCamera; @@ -178,14 +173,14 @@ public void ToggleCamera(object sender, EventArgs e) // public void AddAnimation(object sender, EventArgs e) { - if ((bool)CenterAnimCheck.IsChecked == true) + if ((bool)CenterAnimCheck.IsChecked) { //Shift point around which model rotates to (-0.5, -0.5, -0.5). myHorizontalRTransform.CenterX = -0.5; myHorizontalRTransform.CenterY = -0.5; myHorizontalRTransform.CenterZ = -0.5; } - if ((bool)CenterAnimCheck.IsChecked != true) + if (!(bool)CenterAnimCheck.IsChecked) { //Set point around which model rotates back to (0, 0, 0). myHorizontalRTransform.CenterX = 0; diff --git a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window11.xaml.cs b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window11.xaml.cs index f0fab7f73cf..355fe47330c 100644 --- a/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window11.xaml.cs +++ b/snippets/csharp/System.Windows.Media.Media3D/AmbientLight/Overview/Window11.xaml.cs @@ -18,10 +18,10 @@ private enum KeyMode { Camera, PointLight }; private KeyMode currKeyMode = KeyMode.Camera; MyLights myLights = new MyLights(); Model3D objModel = null; - Model3DGroup modelGroup = new Model3DGroup(); - ModelVisual3D modelsVisual = new ModelVisual3D(); + Model3DGroup modelGroup = new Model3DGroup(); + ModelVisual3D modelsVisual = new ModelVisual3D(); - public Window1() + public Window1() { InitializeComponent(); } @@ -34,7 +34,7 @@ private void OnWindowLoaded(object sender, EventArgs e) private void OnListBoxChanged(object sender, EventArgs e) { - double[] fieldOfView = new double[7] {50.0, 50.0, 2.0, 75.0, 75.0, 75.0, 20.0 }; + double[] fieldOfView = new double[7] { 50.0, 50.0, 2.0, 75.0, 75.0, 75.0, 20.0 }; if (myViewport3D == null) return; @@ -47,13 +47,13 @@ private void OnListBoxChanged(object sender, EventArgs e) // Add or remove an ambient light from the 3D viewport. private void OnAmbientLightChange(object sender, EventArgs e) { - if (checkBoxAmbientLight.IsChecked == true) + if (checkBoxAmbientLight.IsChecked.Value) { - myLights.ShowAmbientLight(true, modelGroup); + myLights.ShowAmbientLight(true, modelGroup); } else { - myLights.ShowAmbientLight(false, modelGroup); + myLights.ShowAmbientLight(false, modelGroup); } myViewport3D.Focus(); @@ -62,13 +62,13 @@ private void OnAmbientLightChange(object sender, EventArgs e) // Add or remove a directional light from the 3D viewport. private void OnDirectionalLightOneChange(object sender, EventArgs e) { - if (checkBoxDirLightOne.IsChecked == true) + if (checkBoxDirLightOne.IsChecked.Value) { - myLights.ShowDirLight(0, true, modelGroup); + myLights.ShowDirLight(0, true, modelGroup); } else { - myLights.ShowDirLight(0, false, modelGroup); + myLights.ShowDirLight(0, false, modelGroup); } myViewport3D.Focus(); @@ -77,13 +77,13 @@ private void OnDirectionalLightOneChange(object sender, EventArgs e) // Add or remove a directional light from the 3D viewport. private void OnDirectionalLightTwoChange(object sender, EventArgs e) { - if (checkBoxDirLightTwo.IsChecked == true) + if (checkBoxDirLightTwo.IsChecked.Value) { - myLights.ShowDirLight(1, true, modelGroup); + myLights.ShowDirLight(1, true, modelGroup); } else { - myLights.ShowDirLight(1, false, modelGroup); + myLights.ShowDirLight(1, false, modelGroup); } myViewport3D.Focus(); @@ -92,11 +92,11 @@ private void OnDirectionalLightTwoChange(object sender, EventArgs e) // Add or remove a point light from the 3D viewport. private void OnPointLight(object sender, EventArgs e) { - if (checkBoxPointLight.IsChecked == true) + if (checkBoxPointLight.IsChecked.Value) { currKeyMode = KeyMode.PointLight; rbPosition2.IsChecked = true; - myLights.ShowPointLight(1, true, modelGroup); + myLights.ShowPointLight(1, true, modelGroup); xyzPointLight.Foreground = System.Windows.Media.Brushes.Black; xyzPointLight.Content = "x: " + myLights.PointLightPosition.X + " y: " + myLights.PointLightPosition.Y + " z: " + myLights.PointLightPosition.Z; } @@ -104,7 +104,7 @@ private void OnPointLight(object sender, EventArgs e) { currKeyMode = KeyMode.Camera; rbPosition1.IsChecked = true; - myLights.ShowPointLight(1, false, modelGroup); + myLights.ShowPointLight(1, false, modelGroup); xyzPointLight.Foreground = System.Windows.Media.Brushes.LightGray; } @@ -182,13 +182,13 @@ private void OnRange(object sender, RoutedEventArgs e) private void LoadMesh(double fieldOfView) { if ((myViewport3D != null) && (modelGroup.Children.Count > 0)) - { - myViewport3D.Children.Remove(modelsVisual); - modelGroup.Children.Clear(); - } - + { + myViewport3D.Children.Remove(modelsVisual); + modelGroup.Children.Clear(); + } + ((PerspectiveCamera)myViewport3D.Camera).FieldOfView = fieldOfView; - + // Define the material for the model. SolidColorBrush brush = new SolidColorBrush(Colors.Cyan); DiffuseMaterial colorMaterial = new DiffuseMaterial(brush); @@ -198,37 +198,37 @@ private void LoadMesh(double fieldOfView) objModel = new GeometryModel3D(objMesh, colorMaterial); // Define the projection camera and add to the model. - SetProjectionCamera(myViewport3D, modelGroup); - - modelGroup.Children.Add(objModel); - - // Add ambient light to the model group. - if (checkBoxAmbientLight.IsChecked == true) - { - myLights.ShowAmbientLight(true, modelGroup); - } - - // Add directional lights to the model group. - if (checkBoxDirLightOne.IsChecked == true) - { - myLights.ShowDirLight(0, true, modelGroup); - } - if (checkBoxDirLightTwo.IsChecked == true) - { - myLights.ShowDirLight(1, true, modelGroup); - } - - // Add the model group data to the viewport. - modelsVisual.Content = modelGroup; - myViewport3D.Children.Add(modelsVisual); - - checkBoxPointLight.IsChecked = false; + SetProjectionCamera(myViewport3D, modelGroup); + + modelGroup.Children.Add(objModel); + + // Add ambient light to the model group. + if (checkBoxAmbientLight.IsChecked.Value) + { + myLights.ShowAmbientLight(true, modelGroup); + } + + // Add directional lights to the model group. + if (checkBoxDirLightOne.IsChecked.Value) + { + myLights.ShowDirLight(0, true, modelGroup); + } + if (checkBoxDirLightTwo.IsChecked.Value) + { + myLights.ShowDirLight(1, true, modelGroup); + } + + // Add the model group data to the viewport. + modelsVisual.Content = modelGroup; + myViewport3D.Children.Add(modelsVisual); + + checkBoxPointLight.IsChecked = false; xyzPointLight.Foreground = System.Windows.Media.Brushes.LightGray; currKeyMode = KeyMode.Camera; rbPosition1.IsChecked = true; } - public void SetProjectionCamera(Viewport3D myViewport3D, Model3DGroup modelGroup) + public void SetProjectionCamera(Viewport3D myViewport3D, Model3DGroup modelGroup) { const double CameraDistance = 80; // distance from camera to origin const double CameraLatitude = Math.PI / 2; // angle from +ve y axis to camera (i.e. latitude) @@ -241,8 +241,8 @@ public void SetProjectionCamera(Viewport3D myViewport3D, Model3DGroup modelGroup projCamera.Position = new Point3D(x, y, z); myViewport3D.Camera = projCamera; - TranslateTransform3D pan = new TranslateTransform3D(new Vector3D(0, 0, 0)); - modelGroup.Transform = pan; + TranslateTransform3D pan = new TranslateTransform3D(new Vector3D(0, 0, 0)); + modelGroup.Transform = pan; } } -} \ No newline at end of file +} diff --git a/snippets/csharp/System.Windows.Media.Media3D/MatrixCamera/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows.Media.Media3D/MatrixCamera/Overview/Window1.xaml.cs index 2720b7a931e..282f9c31393 100644 --- a/snippets/csharp/System.Windows.Media.Media3D/MatrixCamera/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Media.Media3D/MatrixCamera/Overview/Window1.xaml.cs @@ -252,13 +252,13 @@ private void UpdateTranslation(object sender, EventArgs e) Vector3D convertVector3D = new Vector3D(OffsetXValue, OffsetYValue, OffsetZValue); myTranslateTransform3D = new TranslateTransform3D(OffsetXValue, OffsetYValue, OffsetZValue); - if (addTranslationCheck.IsChecked == false) + if (!addTranslationCheck.IsChecked.Value) { myprocTransformGroup.Children.Clear(); myprocTransformGroup.Children.Add(myTranslateTransform3D); topModelVisual3D.Transform = myprocTransformGroup; } - if (addTranslationCheck.IsChecked == true) + if (addTranslationCheck.IsChecked.Value) { myprocTransformGroup.Children.Add(myTranslateTransform3D); topModelVisual3D.Transform = myprocTransformGroup; @@ -295,4 +295,4 @@ private void SetMatrixCamera(object sender, EventArgs e) } // } -} \ No newline at end of file +} diff --git a/snippets/csharp/System.Windows.Media/FormattedText/BuildGeometry/OutlineTextControl.cs b/snippets/csharp/System.Windows.Media/FormattedText/BuildGeometry/OutlineTextControl.cs index 9e07c599620..1a453ae68e4 100644 --- a/snippets/csharp/System.Windows.Media/FormattedText/BuildGeometry/OutlineTextControl.cs +++ b/snippets/csharp/System.Windows.Media/FormattedText/BuildGeometry/OutlineTextControl.cs @@ -43,7 +43,7 @@ protected override void OnRender(DrawingContext drawingContext) drawingContext.DrawGeometry(Fill, new System.Windows.Media.Pen(Stroke, StrokeThickness), _textGeometry); // Draw the text highlight based on the properties that are set. - if (Highlight == true) + if (Highlight) { drawingContext.DrawGeometry(null, new System.Windows.Media.Pen(Stroke, StrokeThickness), _textHighLightGeometry); } @@ -59,8 +59,8 @@ public void CreateText() System.Windows.FontStyle fontStyle = FontStyles.Normal; FontWeight fontWeight = FontWeights.Medium; - if (Bold == true) fontWeight = FontWeights.Bold; - if (Italic == true) fontStyle = FontStyles.Italic; + if (Bold) fontWeight = FontWeights.Bold; + if (Italic) fontStyle = FontStyles.Italic; // Create the formatted text based on the properties set. FormattedText formattedText = new FormattedText( @@ -80,7 +80,7 @@ public void CreateText() _textGeometry = formattedText.BuildGeometry(new System.Windows.Point(0, 0)); // Build the geometry object that represents the text highlight. - if (Highlight == true) + if (Highlight) { _textHighLightGeometry = formattedText.BuildHighlightGeometry(new System.Windows.Point(0, 0)); } diff --git a/snippets/csharp/System.Windows.Shell/TaskbarItemInfo/Overview/mainwindow.xaml.cs b/snippets/csharp/System.Windows.Shell/TaskbarItemInfo/Overview/mainwindow.xaml.cs index 03b9ca2aee4..0a956fc9f45 100644 --- a/snippets/csharp/System.Windows.Shell/TaskbarItemInfo/Overview/mainwindow.xaml.cs +++ b/snippets/csharp/System.Windows.Shell/TaskbarItemInfo/Overview/mainwindow.xaml.cs @@ -36,7 +36,7 @@ private void StartCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e) // private void StartCommand_Executed(object sender, ExecutedRoutedEventArgs e) { - if (this._backgroundWorker.IsBusy == false) + if (!this._backgroundWorker.IsBusy) { this._backgroundWorker.RunWorkerAsync(); // When the task is started, change the ProgressState and Overlay @@ -65,7 +65,7 @@ void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // When the task ends, change the ProgressState and Overlay // of the taskbar item to indicate a stopped task. - if (e.Cancelled == true) + if (e.Cancelled) { // The task was stopped by the user. Show the progress indicator // in the paused state. @@ -105,7 +105,7 @@ void bw_DoWork(object sender, DoWorkEventArgs e) { for (int i = 1; i <= 100; i++) { - if (_worker.CancellationPending == true) + if (_worker.CancellationPending) { e.Cancel = true; break; diff --git a/snippets/csharp/System.Windows.Threading/Dispatcher/CheckAccess/Window1.xaml.cs b/snippets/csharp/System.Windows.Threading/Dispatcher/CheckAccess/Window1.xaml.cs index 85ccdb735ca..3c65e541a82 100644 --- a/snippets/csharp/System.Windows.Threading/Dispatcher/CheckAccess/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Threading/Dispatcher/CheckAccess/Window1.xaml.cs @@ -1,18 +1,14 @@ using System; +using System.Threading; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Threading; using System.Windows.Threading; namespace SDKSamples { public partial class Window1 : Window - { - // Delegate used to push a worker itme onto the Dispatcher. + { + // Delegate used to push a worker item onto the Dispatcher. private delegate void UpdateUIDelegate(Button button); public Window1() @@ -25,7 +21,7 @@ public Window1() } // - // Uses the Dispatcher.CheckAccess method to determine if + // Uses the Dispatcher.CheckAccess method to determine if // the calling thread has access to the thread the UI object is on. private void TryToUpdateButtonCheckAccess(object uiObject) { @@ -51,7 +47,7 @@ private void TryToUpdateButtonCheckAccess(object uiObject) // // - // Uses the Dispatcher.VerifyAccess method to determine if + // Uses the Dispatcher.VerifyAccess method to determine if // the calling thread has access to the thread the UI object is on. private void TryToUpdateButtonVerifyAccess(object uiObject) { @@ -60,7 +56,7 @@ private void TryToUpdateButtonVerifyAccess(object uiObject) if (theButton != null) { try - { + { // Check if this thread has access to this object. theButton.Dispatcher.VerifyAccess(); @@ -72,8 +68,8 @@ private void TryToUpdateButtonVerifyAccess(object uiObject) catch (InvalidOperationException e) { // Exception Error Message. - MessageBox.Show("Exception ToString: \n\n" + e.ToString(), - "Execption Caught! Thrown During AccessVerify()."); + MessageBox.Show("Exception ToString: \n\n" + e.ToString(), + "Exception Caught! Thrown During AccessVerify()."); MessageBox.Show("Pushing job onto UI Thread Dispatcher"); @@ -88,7 +84,7 @@ private void TryToUpdateButtonVerifyAccess(object uiObject) private void threadStartingCheckAccess() { // Try to update a Button created on the UI thread. - TryToUpdateButtonCheckAccess(ButtonOnUIThread); + TryToUpdateButtonCheckAccess(ButtonOnUIThread); } private void threadStartingVerifyAccess() @@ -102,7 +98,7 @@ private void CreateThread(object sender, RoutedEventArgs e) ThreadStart threadStartingPoint; // Determine which ThreadStart to use. - if (rbCheckAccess.IsChecked == true) + if (rbCheckAccess.IsChecked.Value) { threadStartingPoint = new ThreadStart(threadStartingCheckAccess); } @@ -130,4 +126,4 @@ private void UpdateButtonUI(Button theButton) private int _uiThreadID; private int _backgroundThreadID; } -} \ No newline at end of file +} diff --git a/snippets/csharp/System.Windows.Threading/DispatcherObject/CheckAccess/Window1.xaml.cs b/snippets/csharp/System.Windows.Threading/DispatcherObject/CheckAccess/Window1.xaml.cs index 4dbe0ca673e..398bbaf545c 100644 --- a/snippets/csharp/System.Windows.Threading/DispatcherObject/CheckAccess/Window1.xaml.cs +++ b/snippets/csharp/System.Windows.Threading/DispatcherObject/CheckAccess/Window1.xaml.cs @@ -1,17 +1,13 @@ using System; +using System.Threading; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Threading; using System.Windows.Threading; namespace SDKSamples { public partial class Window1 : Window - { + { // Delegate used to place a work item onto the Dispatcher. private delegate void UpdateUIDelegate(Button button); @@ -20,7 +16,7 @@ public Window1() InitializeComponent(); // Get the id of the UI thread for display purposes. - _uiThreadID = this.Dispatcher.Thread.ManagedThreadId; + _uiThreadID = Dispatcher.Thread.ManagedThreadId; lblUIThreadID.Content = _uiThreadID; } @@ -34,7 +30,7 @@ private void TryToUpdateButtonCheckAccess(object uiObject) if (theButton != null) { // Checking if this thread has access to the object - if(theButton.CheckAccess()) + if (theButton.CheckAccess()) { // This thread has access so it can update the UI thread UpdateButtonUI(theButton); @@ -73,7 +69,7 @@ private void TryToUpdateButtonVerifyAccess(object uiObject) catch (InvalidOperationException e) { // Exception error meessage. - MessageBox.Show("Exception ToString: \n\n" + e.ToString(), + MessageBox.Show("Exception ToString: \n\n" + e.ToString(), "Execption Caught! Thrown During AccessVerify()."); MessageBox.Show("Pushing job onto UI Thread Dispatcher"); @@ -88,7 +84,7 @@ private void TryToUpdateButtonVerifyAccess(object uiObject) private void threadStartingCheckAccess() { // Try to update a Button created on the UI thread. - TryToUpdateButtonCheckAccess(ButtonOnUIThread); + TryToUpdateButtonCheckAccess(ButtonOnUIThread); } private void threadStartingVerifyAccess() @@ -102,7 +98,7 @@ private void CreateThread(object sender, RoutedEventArgs e) ThreadStart threadStartingPoint; // Determine which ThreadStart to use. - if (rbCheckAccess.IsChecked == true) + if (rbCheckAccess.IsChecked.Value) { threadStartingPoint = new ThreadStart(threadStartingCheckAccess); } @@ -130,4 +126,4 @@ private void UpdateButtonUI(Button theButton) private int _uiThreadID; private int _backgroundThreadID; } -} \ No newline at end of file +} diff --git a/snippets/csharp/System.Windows/Application/Properties/MainWindow.xaml.cs b/snippets/csharp/System.Windows/Application/Properties/MainWindow.xaml.cs index 2d28bf84f95..7dcd4202cb8 100644 --- a/snippets/csharp/System.Windows/Application/Properties/MainWindow.xaml.cs +++ b/snippets/csharp/System.Windows/Application/Properties/MainWindow.xaml.cs @@ -15,7 +15,7 @@ public MainWindow() void MainWindow_Loaded(object sender, EventArgs e) { // Check for safe mode - if ((bool)Application.Current.Properties["SafeMode"] == true) + if ((bool)Application.Current.Properties["SafeMode"]) { this.Title += " [SafeMode]"; } diff --git a/snippets/csharp/System.Windows/FrameworkContentElement/ContextMenuClosing/Window1.xaml.cs b/snippets/csharp/System.Windows/FrameworkContentElement/ContextMenuClosing/Window1.xaml.cs index 29afc5fbb95..63cb27287a4 100644 --- a/snippets/csharp/System.Windows/FrameworkContentElement/ContextMenuClosing/Window1.xaml.cs +++ b/snippets/csharp/System.Windows/FrameworkContentElement/ContextMenuClosing/Window1.xaml.cs @@ -114,7 +114,7 @@ private void CursorTypeChanged(object sender, SelectionChangedEventArgs e) // If the cursor scope is set to the entire application // Use OverrideCursor to force the cursor for all elements - if (cursorScopeElementOnly == false) + if (!cursorScopeElementOnly) { Mouse.OverrideCursor = DisplayArea.Cursor; } diff --git a/snippets/csharp/System.Windows/FrameworkElement/BeginStoryboard/Trackball.cs b/snippets/csharp/System.Windows/FrameworkElement/BeginStoryboard/Trackball.cs index 383ce8356cd..54e2ef2aab5 100644 --- a/snippets/csharp/System.Windows/FrameworkElement/BeginStoryboard/Trackball.cs +++ b/snippets/csharp/System.Windows/FrameworkElement/BeginStoryboard/Trackball.cs @@ -108,7 +108,7 @@ private void MouseMoveHandler(object sender, System.Windows.Input.MouseEventArgs delta /= 2; Quaternion q = _rotation; - if (_rotating == true) + if (_rotating) { // We can redefine this 2D mouse delta as a 3D mouse delta // where "into the screen" is Z @@ -140,7 +140,7 @@ private void MouseDownHandler(object sender, MouseButtonEventArgs e) if (!Enabled) return; e.Handled = true; - if (Keyboard.IsKeyDown(Key.F1) == true) + if (Keyboard.IsKeyDown(Key.F1)) { Reset(); return; @@ -158,7 +158,7 @@ private void MouseDownHandler(object sender, MouseButtonEventArgs e) _scaling = (e.MiddleButton == MouseButtonState.Pressed); - if (Keyboard.IsKeyDown(Key.Space) == false) + if (!Keyboard.IsKeyDown(Key.Space)) _rotating = true; else _rotating = false; @@ -173,7 +173,7 @@ private void MouseUpHandler(object sender, MouseButtonEventArgs e) // Stuff the current initial + delta into initial so when we next move we // start at the right place. - if (_rotating == true) + if (_rotating) { _rotation = _rotationDelta * _rotation; } diff --git a/snippets/csharp/System.Windows/FrameworkElement/MoveFocus/Window1.xaml.cs b/snippets/csharp/System.Windows/FrameworkElement/MoveFocus/Window1.xaml.cs index 11ff7bb26df..3b148563a6d 100644 --- a/snippets/csharp/System.Windows/FrameworkElement/MoveFocus/Window1.xaml.cs +++ b/snippets/csharp/System.Windows/FrameworkElement/MoveFocus/Window1.xaml.cs @@ -107,7 +107,7 @@ private void OnFocusSelected(object sender, RoutedEventArgs e) private void OnPredictFocusMouseUp(object sender, RoutedEventArgs e) { - if (_focusPredicted == true) + if (_focusPredicted) { _predictedControl.Foreground = Brushes.Black; _predictedControl.FontSize -= 10; diff --git a/snippets/csharp/System.Windows/FrameworkPropertyMetadata/.ctor/Class1.cs b/snippets/csharp/System.Windows/FrameworkPropertyMetadata/.ctor/Class1.cs index 5ef0652a1ea..361dfb9854a 100644 --- a/snippets/csharp/System.Windows/FrameworkPropertyMetadata/.ctor/Class1.cs +++ b/snippets/csharp/System.Windows/FrameworkPropertyMetadata/.ctor/Class1.cs @@ -21,7 +21,7 @@ public MyCustomPropertyMetadata(object defaultValue, PropertyChangedCallback pro public Boolean SupportsMyFeature { get { return _supportsMyFeature; } - set { if (this.IsSealed != true) _supportsMyFeature = value; } //else may want to raise exception + set { if (!this.IsSealed) _supportsMyFeature = value; } //else may want to raise exception } protected override void Merge(PropertyMetadata baseMetadata, DependencyProperty dp) { @@ -29,7 +29,7 @@ protected override void Merge(PropertyMetadata baseMetadata, DependencyProperty MyCustomPropertyMetadata mcpm = baseMetadata as MyCustomPropertyMetadata; if (mcpm != null) { - if (this.SupportsMyFeature == false) + if (!this.SupportsMyFeature) {//if not set, revert to base this.SupportsMyFeature = mcpm.SupportsMyFeature; } diff --git a/snippets/csharp/System.Windows/TextWrapping/Overview/Window1.xaml.cs b/snippets/csharp/System.Windows/TextWrapping/Overview/Window1.xaml.cs index 1feeeffc274..07eac5bfffc 100644 --- a/snippets/csharp/System.Windows/TextWrapping/Overview/Window1.xaml.cs +++ b/snippets/csharp/System.Windows/TextWrapping/Overview/Window1.xaml.cs @@ -46,7 +46,7 @@ private void selectAll(object sender, RoutedEventArgs e) // private void undoAction(object sender, RoutedEventArgs e) { - if (myTextBox.CanUndo == true) + if (myTextBox.CanUndo) { myTextBox.Undo(); } @@ -55,7 +55,7 @@ private void undoAction(object sender, RoutedEventArgs e) // private void redoAction(object sender, RoutedEventArgs e) { - if (myTextBox.CanRedo == true) + if (myTextBox.CanRedo) { myTextBox.Redo(); } diff --git a/snippets/csharp/System.Windows/UIElement/ApplyAnimationClock/ClockControllerSpeedRatioExample.cs b/snippets/csharp/System.Windows/UIElement/ApplyAnimationClock/ClockControllerSpeedRatioExample.cs index 26effb8963e..d44b899d978 100644 --- a/snippets/csharp/System.Windows/UIElement/ApplyAnimationClock/ClockControllerSpeedRatioExample.cs +++ b/snippets/csharp/System.Windows/UIElement/ApplyAnimationClock/ClockControllerSpeedRatioExample.cs @@ -122,9 +122,9 @@ private void seekAmountTextBox_TextChanged(object sender, TextChangedEventArgs e TextBox theTextBox = (TextBox)e.Source; if (theTextBox.Text == null || theTextBox.Text.Length < 1 - || Double.TryParse(theTextBox.Text, + || !Double.TryParse(theTextBox.Text, System.Globalization.NumberStyles.Any, - null, out doubleParseResult) == false) + null, out doubleParseResult)) speedRatioButton.IsEnabled = false; else speedRatioButton.IsEnabled = true; diff --git a/snippets/csharp/System.Windows/UIElement/InputBindings/Window1.xaml.cs b/snippets/csharp/System.Windows/UIElement/InputBindings/Window1.xaml.cs index 16e3e3d4a1b..571a5e1d273 100644 --- a/snippets/csharp/System.Windows/UIElement/InputBindings/Window1.xaml.cs +++ b/snippets/csharp/System.Windows/UIElement/InputBindings/Window1.xaml.cs @@ -129,7 +129,7 @@ private void HelpCmdExecuted(object sender, ExecutedRoutedEventArgs e) private void HelpCmdCanExecute(object sender, CanExecuteRoutedEventArgs e) { // HelpFilesExists() determines if the help file exists - if (HelpFileExists() == true) + if (HelpFileExists()) { e.CanExecute = true; } @@ -216,7 +216,7 @@ private void CanExecuteDisplayCommand(object sender, { if (command == MediaCommands.Play) { - if (IsPlaying() == false) + if (!IsPlaying()) { e.CanExecute = true; } @@ -228,7 +228,7 @@ private void CanExecuteDisplayCommand(object sender, if (command == MediaCommands.Stop) { - if (IsPlaying() == true) + if (IsPlaying()) { e.CanExecute = true; } diff --git a/snippets/csharp/System.Windows/UIElement/IsMouseCaptured/Window1.xaml.cs b/snippets/csharp/System.Windows/UIElement/IsMouseCaptured/Window1.xaml.cs index 35d092bfdc3..97b9ff836cd 100644 --- a/snippets/csharp/System.Windows/UIElement/IsMouseCaptured/Window1.xaml.cs +++ b/snippets/csharp/System.Windows/UIElement/IsMouseCaptured/Window1.xaml.cs @@ -268,7 +268,7 @@ private void CaptureMouseOnMouseEnter(object sender, MouseEventArgs e) captureResult = mDevice.Capture(captureTarget); - if (captureResult == true) + if (captureResult) { captureTarget.BorderBrush = Brushes.Red; } diff --git a/snippets/csharp/System.Windows/UIElement/OnRender/OffsetPanel.cs b/snippets/csharp/System.Windows/UIElement/OnRender/OffsetPanel.cs index d0ca46cd6b3..f1a998cd5cb 100644 --- a/snippets/csharp/System.Windows/UIElement/OnRender/OffsetPanel.cs +++ b/snippets/csharp/System.Windows/UIElement/OnRender/OffsetPanel.cs @@ -122,7 +122,7 @@ protected override Size ArrangeOverride(Size arrangeSize) { if (child == null) { continue; } - if (GetShareCoordinates(child) == true) + if (GetShareCoordinates(child)) { double x = GetOffsetLeft(child); double y = GetOffsetTop(child); diff --git a/snippets/csharp/System.Xml/XmlDocument/Overview/form1.cs b/snippets/csharp/System.Xml/XmlDocument/Overview/form1.cs index ba6a9214a3a..901b6328701 100644 --- a/snippets/csharp/System.Xml/XmlDocument/Overview/form1.cs +++ b/snippets/csharp/System.Xml/XmlDocument/Overview/form1.cs @@ -326,7 +326,7 @@ private void loadButton_Click(object sender, EventArgs e) //************************************************************************************ private void validateCheckBox_CheckedChanged(object sender, EventArgs e) { - if (validateCheckBox.Checked == true) + if (validateCheckBox.Checked) { generateSchemaCheckBox.Enabled = true; generateSchemaCheckBox.Visible = true; @@ -482,18 +482,18 @@ private void saveButton_Click(object sender, EventArgs e) //************************************************************************************ private void addFilterButton_Click(object sender, EventArgs e) { - if (condition1Panel.Visible != true) + if (!condition1Panel.Visible) { condition1Panel.Visible = true; applyLabel.Visible = true; matchesLabel.Visible = true; matchesComboBox.Visible = true; } - else if (condition2Panel.Visible != true) + else if (!condition2Panel.Visible) { condition2Panel.Visible = true; } - else if (condition3Panel.Visible != true) + else if (!condition3Panel.Visible) { condition3Panel.Visible = true; } @@ -509,17 +509,17 @@ private void addFilterButton_Click(object sender, EventArgs e) //************************************************************************************ private void clearButton_Click(object sender, EventArgs e) { - if (condition4Panel.Visible != false) + if (condition4Panel.Visible) { condition4Panel.Visible = false; condition4CheckBox.Checked = false; } - else if (condition3Panel.Visible != false) + else if (condition3Panel.Visible) { condition3Panel.Visible = false; condition3CheckBox.Checked = false; } - else if (condition2Panel.Visible != false) + else if (condition2Panel.Visible) { condition2Panel.Visible = false; condition2CheckBox.Checked = false; @@ -659,25 +659,25 @@ private void ConditionCheckChanged(CheckBox conditionCheckBox) ArrayList Operators = new ArrayList(); ArrayList Values =new ArrayList(); - if (condition1CheckBox.Checked == true) + if (condition1CheckBox.Checked) { Conditions.Add(condition1ComboBox.Text); Operators.Add(operator1ComboBox.Text); Values.Add(condition1TextBox.Text); } - if (condition2CheckBox.Checked == true) + if (condition2CheckBox.Checked) { Conditions.Add(condition2ComboBox.Text); Operators.Add(operator2ComboBox.Text); Values.Add(condition2TextBox.Text); } - if (condition3CheckBox.Checked == true) + if (condition3CheckBox.Checked) { Conditions.Add(condition3ComboBox.Text); Operators.Add(operator3ComboBox.Text); Values.Add(condition3TextBox.Text); } - if (condition4CheckBox.Checked == true) + if (condition4CheckBox.Checked) { Conditions.Add(condition4ComboBox.Text); Operators.Add(operator4ComboBox.Text); @@ -695,19 +695,19 @@ private void RemoveFilter() { filterTreeView.Nodes.Clear(); - if (condition1CheckBox.Checked == true) + if (condition1CheckBox.Checked) { ConditionCheckChanged(condition1CheckBox); } - else if (condition2CheckBox.Checked == true) + else if (condition2CheckBox.Checked) { ConditionCheckChanged(condition2CheckBox); } - else if (condition3CheckBox.Checked == true) + else if (condition3CheckBox.Checked) { ConditionCheckChanged(condition3CheckBox); } - else if (condition4CheckBox.Checked == true) + else if (condition4CheckBox.Checked) { ConditionCheckChanged(condition4CheckBox); } @@ -719,10 +719,10 @@ private void RemoveFilter() //************************************************************************************ private void ShowOrHideFilterBox() { - if (condition1CheckBox.Checked == false && - condition2CheckBox.Checked == false && - condition3CheckBox.Checked == false && - condition4CheckBox.Checked == false) + if (!condition1CheckBox.Checked && + !condition2CheckBox.Checked && + !condition3CheckBox.Checked && + !condition4CheckBox.Checked) { filterBox.Visible = false; } @@ -738,7 +738,7 @@ private void ShowOrHideFilterBox() //************************************************************************************ private void FilterChecked(ArrayList conditions, ArrayList operatorSymbols, ArrayList values, CheckBox conditionCheckBox) { - if (conditionCheckBox.Checked == true) + if (conditionCheckBox.Checked) { XmlNodeList nodes = null; @@ -763,7 +763,7 @@ private void FilterChecked(ArrayList conditions, ArrayList operatorSymbols, Arra break; } } - if (failure != true) + if (!failure) { nodes = _xmlHelperMethods.ApplyFilters (conditions, operatorSymbols, values, _doc, matchesComboBox.Text); diff --git a/snippets/csharp/System/AppContext/Overview/Example8.cs b/snippets/csharp/System/AppContext/Overview/Example8.cs index 61c6bc08f02..5fad1b348bb 100644 --- a/snippets/csharp/System/AppContext/Overview/Example8.cs +++ b/snippets/csharp/System/AppContext/Overview/Example8.cs @@ -9,7 +9,7 @@ public static class StringLibrary public static int SubstringStartsAt(string fullString, string substr) { bool flag; - if (AppContext.TryGetSwitch("StringLibrary.DoNotUseCultureSensitiveComparison", out flag) && flag == true) + if (AppContext.TryGetSwitch("StringLibrary.DoNotUseCultureSensitiveComparison", out flag) && flag) return fullString.IndexOf(substr, StringComparison.Ordinal); else return fullString.IndexOf(substr, StringComparison.CurrentCulture); diff --git a/snippets/csharp/System/AppContext/Overview/GetSwitches3.cs b/snippets/csharp/System/AppContext/Overview/GetSwitches3.cs index 8e10f172716..9360ee49e99 100644 --- a/snippets/csharp/System/AppContext/Overview/GetSwitches3.cs +++ b/snippets/csharp/System/AppContext/Overview/GetSwitches3.cs @@ -14,7 +14,7 @@ public static void Main() bool flag = false; // Determine whether the caller has used the AppContext class directly. - if (! AppContext.TryGetSwitch(SwitchName, out flag)) { + if (!AppContext.TryGetSwitch(SwitchName, out flag)) { // If switch is not defined directly, attempt to retrieve it from a configuration file. try { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); diff --git a/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoFind2.cs b/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoFind2.cs index a16c019da52..fc7f98f2040 100644 --- a/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoFind2.cs +++ b/snippets/csharp/System/ArgumentOutOfRangeException/Overview/NoFind2.cs @@ -9,7 +9,7 @@ public static void Main() "runOnPhrase" }; foreach (var phrase in phrases) { string word = GetSecondWord(phrase); - if (! string.IsNullOrEmpty(word)) + if (!string.IsNullOrEmpty(word)) Console.WriteLine("Second word is {0}", word); } } diff --git a/snippets/csharp/System/AsyncCallback/Overview/Async_Poll.cs b/snippets/csharp/System/AsyncCallback/Overview/Async_Poll.cs index 5c1f733b4b6..57b1a056665 100644 --- a/snippets/csharp/System/AsyncCallback/Overview/Async_Poll.cs +++ b/snippets/csharp/System/AsyncCallback/Overview/Async_Poll.cs @@ -35,7 +35,7 @@ public static void Main(string[] args) // Poll for completion information. // Print periods (".") until the operation completes. - while (result.IsCompleted != true) + while (!result.IsCompleted) { UpdateUserInterface(); } diff --git a/snippets/csharp/System/BadImageFormatException/Overview/condition1.cs b/snippets/csharp/System/BadImageFormatException/Overview/condition1.cs index e457b0ac26c..66e73c2635c 100644 --- a/snippets/csharp/System/BadImageFormatException/Overview/condition1.cs +++ b/snippets/csharp/System/BadImageFormatException/Overview/condition1.cs @@ -8,7 +8,7 @@ public static void Main() // // Windows DLL (non-.NET assembly) string filePath = Environment.ExpandEnvironmentVariables("%windir%"); - if (! filePath.Trim().EndsWith(@"\")) + if (!filePath.Trim().EndsWith(@"\")) filePath += @"\"; filePath += @"System32\Kernel32.dll"; diff --git a/snippets/csharp/System/BadImageFormatException/Overview/stringlib.cs b/snippets/csharp/System/BadImageFormatException/Overview/stringlib.cs index 8baca978bb1..03f1763ab3e 100644 --- a/snippets/csharp/System/BadImageFormatException/Overview/stringlib.cs +++ b/snippets/csharp/System/BadImageFormatException/Overview/stringlib.cs @@ -26,7 +26,7 @@ public string ToProperCase(string title) } } - if (! isException) + if (!isException) newWords[ctr] = words[ctr].Substring(0, 1).ToUpper() + words[ctr].Substring(1); else newWords[ctr] = words[ctr]; diff --git a/snippets/csharp/System/BadImageFormatException/Overview/targetplatform1.cs b/snippets/csharp/System/BadImageFormatException/Overview/targetplatform1.cs index ed2d86b487a..55c710aa404 100644 --- a/snippets/csharp/System/BadImageFormatException/Overview/targetplatform1.cs +++ b/snippets/csharp/System/BadImageFormatException/Overview/targetplatform1.cs @@ -17,7 +17,7 @@ public static void Main() // Loop through files and display information about their platform. for (int ctr = 1; ctr < args.Length; ctr++) { string fn = args[ctr]; - if (! File.Exists(fn)) { + if (!File.Exists(fn)) { Console.WriteLine("File: {0}", fn); Console.WriteLine("The file does not exist.\n"); } diff --git a/snippets/csharp/System/Boolean/Overview/format3.cs b/snippets/csharp/System/Boolean/Overview/format3.cs index 84a57bfa8fa..7df289388b1 100644 --- a/snippets/csharp/System/Boolean/Overview/format3.cs +++ b/snippets/csharp/System/Boolean/Overview/format3.cs @@ -41,10 +41,10 @@ public Object GetFormat(Type formatType) public string Format(string fmt, Object arg, IFormatProvider formatProvider) { // Exit if another format provider is used. - if (! formatProvider.Equals(this)) return null; + if (!formatProvider.Equals(this)) return null; // Exit if the type to be formatted is not a Boolean - if (! (arg is Boolean)) return null; + if (!(arg is Boolean)) return null; bool value = (bool) arg; switch (culture.Name) { diff --git a/snippets/csharp/System/Boolean/Overview/operations1.cs b/snippets/csharp/System/Boolean/Overview/operations1.cs index 5449ce16e30..8948f200e66 100644 --- a/snippets/csharp/System/Boolean/Overview/operations1.cs +++ b/snippets/csharp/System/Boolean/Overview/operations1.cs @@ -80,7 +80,7 @@ public void SomeMethod() bool booleanValue = false; // - if (booleanValue == true) { + if (booleanValue ) { // } diff --git a/snippets/csharp/System/Char/TryParse/tp.cs b/snippets/csharp/System/Char/TryParse/tp.cs index c6c6f264fe5..09410a90088 100644 --- a/snippets/csharp/System/Char/TryParse/tp.cs +++ b/snippets/csharp/System/Char/TryParse/tp.cs @@ -137,7 +137,7 @@ protected static void Show(bool parseSuccess, string typeName, string msgSuccess = "Parse for {0} = {1}"; string msgFailure = "** Parse for {0} failed. Invalid input."; // - if (parseSuccess == true) + if (parseSuccess ) Console.WriteLine(msgSuccess, typeName, parseValue); else Console.WriteLine(msgFailure, typeName); diff --git a/snippets/csharp/System/Console/Beep/beep.cs b/snippets/csharp/System/Console/Beep/beep.cs index beb1bea5864..7dbfc5fbc16 100644 --- a/snippets/csharp/System/Console/Beep/beep.cs +++ b/snippets/csharp/System/Console/Beep/beep.cs @@ -9,7 +9,7 @@ public static void Main(String[] args) int x = 0; // if ((args.Length == 1) && - (Int32.TryParse(args[0], out x) == true) && + (Int32.TryParse(args[0], out x)) && ((x >= 1) && (x <= 9))) { for (int i = 1; i <= x; i++) diff --git a/snippets/csharp/System/Console/Clear/clear1.cs b/snippets/csharp/System/Console/Clear/clear1.cs index f171cd2b680..ee3a91ec720 100644 --- a/snippets/csharp/System/Console/Clear/clear1.cs +++ b/snippets/csharp/System/Console/Clear/clear1.cs @@ -78,7 +78,7 @@ private static Char GetKeyPress(String msg, Char[] validChars) Console.WriteLine(); if (Array.Exists(validChars, ch => ch.Equals(Char.ToUpper(keyPressed.KeyChar)))) valid = true; - } while (! valid); + } while (!valid); return keyPressed.KeyChar; } } diff --git a/snippets/csharp/System/Console/CursorVisible/vis.cs b/snippets/csharp/System/Console/CursorVisible/vis.cs index 77a8b1f58f8..a03617a4af4 100644 --- a/snippets/csharp/System/Console/CursorVisible/vis.cs +++ b/snippets/csharp/System/Console/CursorVisible/vis.cs @@ -26,7 +26,7 @@ public static void Main() ((Console.CursorVisible == true) ? "VISIBLE" : "HIDDEN")); s = Console.ReadLine(); - if (String.IsNullOrEmpty(s) == false) + if (!String.IsNullOrEmpty(s)) if (s[0] == '+') Console.CursorVisible = true; else if (s[0] == '-') diff --git a/snippets/csharp/System/Console/Error/error1.cs b/snippets/csharp/System/Console/Error/error1.cs index 2cebf262632..3af1a8fb07c 100644 --- a/snippets/csharp/System/Console/Error/error1.cs +++ b/snippets/csharp/System/Console/Error/error1.cs @@ -8,7 +8,7 @@ public static void Main() int increment = 0; bool exitFlag = false; - while (! exitFlag) { + while (!exitFlag) { if (Console.IsOutputRedirected) Console.Error.WriteLine("Generating multiples of numbers from {0} to {1}", increment + 1, increment + 10); @@ -29,7 +29,7 @@ public static void Main() increment + 1, increment + 10); Char response = Console.ReadKey(true).KeyChar; Console.Error.WriteLine(response); - if (! Console.IsOutputRedirected) + if (!Console.IsOutputRedirected) Console.CursorTop--; if (Char.ToUpperInvariant(response) == 'N') diff --git a/snippets/csharp/System/Console/Error/viewtextfile.cs b/snippets/csharp/System/Console/Error/viewtextfile.cs index 62fc7c2a1c0..93190fc9bb6 100644 --- a/snippets/csharp/System/Console/Error/viewtextfile.cs +++ b/snippets/csharp/System/Console/Error/viewtextfile.cs @@ -14,7 +14,7 @@ public static void Main() for (int ctr = 1; ctr <= args.GetUpperBound(0); ctr++) { // Check whether the file exists. - if (! File.Exists(args[ctr])) { + if (!File.Exists(args[ctr])) { errorOutput += String.Format("'{0}' does not exist.\n", args[ctr]); } else { @@ -30,7 +30,7 @@ public static void Main() } // Check for error conditions. - if (! String.IsNullOrEmpty(errorOutput)) { + if (!String.IsNullOrEmpty(errorOutput)) { // Write error information to a file. Console.SetError(new StreamWriter(@".\ViewTextFile.Err.txt")); Console.Error.WriteLine(errorOutput); diff --git a/snippets/csharp/System/Console/KeyAvailable/ka.cs b/snippets/csharp/System/Console/KeyAvailable/ka.cs index 9787af835bf..141d556c5fa 100644 --- a/snippets/csharp/System/Console/KeyAvailable/ka.cs +++ b/snippets/csharp/System/Console/KeyAvailable/ka.cs @@ -14,7 +14,7 @@ public static void Main() // Your code could perform some useful task in the following loop. However, // for the sake of this example we'll merely pause for a quarter second. - while (Console.KeyAvailable == false) + while (!Console.KeyAvailable) Thread.Sleep(250); // Loop until input is entered. cki = Console.ReadKey(true); diff --git a/snippets/csharp/System/Console/Overview/example3.cs b/snippets/csharp/System/Console/Overview/example3.cs index b802d1f046c..852dbee4cc5 100644 --- a/snippets/csharp/System/Console/Overview/example3.cs +++ b/snippets/csharp/System/Console/Overview/example3.cs @@ -25,7 +25,7 @@ private static void Main(string[] args) setOutputEncodingToUnicode = true; break; case 3: - if (! uint.TryParse(args[0], NumberStyles.HexNumber, null, out rangeStart)) + if (!uint.TryParse(args[0], NumberStyles.HexNumber, null, out rangeStart)) throw new ArgumentException(String.Format("{0} is not a valid hexadecimal number.", args[0])); if (!uint.TryParse(args[1], NumberStyles.HexNumber, null, out rangeEnd)) diff --git a/snippets/csharp/System/Console/ReadLine/ReadLine3.cs b/snippets/csharp/System/Console/ReadLine/ReadLine3.cs index 55f9b97c26b..531421d7f5f 100644 --- a/snippets/csharp/System/Console/ReadLine/ReadLine3.cs +++ b/snippets/csharp/System/Console/ReadLine/ReadLine3.cs @@ -5,7 +5,7 @@ public class Example { public static void Main() { - if (! Console.IsInputRedirected) { + if (!Console.IsInputRedirected) { Console.WriteLine("This example requires that input be redirected from a file."); return; } diff --git a/snippets/csharp/System/Console/ReadLine/readline1.cs b/snippets/csharp/System/Console/ReadLine/readline1.cs index dfbc81f9b95..66248342384 100644 --- a/snippets/csharp/System/Console/ReadLine/readline1.cs +++ b/snippets/csharp/System/Console/ReadLine/readline1.cs @@ -5,7 +5,7 @@ public class Example { public static void Main() { - if (! Console.IsInputRedirected) { + if (!Console.IsInputRedirected) { Console.WriteLine("This example requires that input be redirected from a file."); return; } diff --git a/snippets/csharp/System/Convert/ToByte/Conversion.cs b/snippets/csharp/System/Convert/ToByte/Conversion.cs index 216ac9e2d23..0e6df0a2124 100644 --- a/snippets/csharp/System/Convert/ToByte/Conversion.cs +++ b/snippets/csharp/System/Convert/ToByte/Conversion.cs @@ -152,7 +152,7 @@ private static void ConvertHexToShort() try { targetNumber = Convert.ToInt16(value, 16); - if (! isNegative && ((targetNumber & 0x8000) != 0)) + if (!isNegative && ((targetNumber & 0x8000) != 0)) throw new OverflowException(); else Console.WriteLine("0x{0} converts to {1}.", value, targetNumber); @@ -195,7 +195,7 @@ private static void ConvertHexToLong() try { targetNumber = Convert.ToInt64(value, 16); - if (! isSigned && ((targetNumber & 0x80000000) != 0)) + if (!isSigned && ((targetNumber & 0x80000000) != 0)) throw new OverflowException(); else Console.WriteLine("0x{0} converts to {1}.", value, targetNumber); @@ -238,7 +238,7 @@ private static void ConvertHexToSByte() try { targetNumber = Convert.ToSByte(value, 16); - if (! isSigned && ((targetNumber & 0x80) != 0)) + if (!isSigned && ((targetNumber & 0x80) != 0)) throw new OverflowException(); else Console.WriteLine("0x{0} converts to {1}.", value, targetNumber); diff --git a/snippets/csharp/System/Convert/ToUInt16/touint16_3.cs b/snippets/csharp/System/Convert/ToUInt16/touint16_3.cs index 5abe1de9aca..5941a9ab04b 100644 --- a/snippets/csharp/System/Convert/ToUInt16/touint16_3.cs +++ b/snippets/csharp/System/Convert/ToUInt16/touint16_3.cs @@ -21,7 +21,7 @@ public string Value set { if (value.Trim().Length > 4) throw new ArgumentException("The string representation of a 160bit integer cannot have more than four characters."); - else if (! Regex.IsMatch(value, "([0-9,A-F]){1,4}", RegexOptions.IgnoreCase)) + else if (!Regex.IsMatch(value, "([0-9,A-F]){1,4}", RegexOptions.IgnoreCase)) throw new ArgumentException("The hexadecimal representation of a 16-bit integer contains invalid characters."); else hexString = value; diff --git a/snippets/csharp/System/Convert/ToUInt32/touint32_4.cs b/snippets/csharp/System/Convert/ToUInt32/touint32_4.cs index 7c5b3039b69..19be8f73c38 100644 --- a/snippets/csharp/System/Convert/ToUInt32/touint32_4.cs +++ b/snippets/csharp/System/Convert/ToUInt32/touint32_4.cs @@ -21,7 +21,7 @@ public string Value set { if (value.Trim().Length > 8) throw new ArgumentException("The string representation of a 32-bit integer cannot have more than 8 characters."); - else if (! Regex.IsMatch(value, "([0-9,A-F]){1,8}", RegexOptions.IgnoreCase)) + else if (!Regex.IsMatch(value, "([0-9,A-F]){1,8}", RegexOptions.IgnoreCase)) throw new ArgumentException("The hexadecimal representation of a 32-bit integer contains invalid characters."); else hexString = value; diff --git a/snippets/csharp/System/Convert/ToUInt64/touint64_4.cs b/snippets/csharp/System/Convert/ToUInt64/touint64_4.cs index 861c1cd9127..95699b5cdd6 100644 --- a/snippets/csharp/System/Convert/ToUInt64/touint64_4.cs +++ b/snippets/csharp/System/Convert/ToUInt64/touint64_4.cs @@ -22,7 +22,7 @@ public string Value { if (value.Trim().Length > 16) throw new ArgumentException("The hexadecimal representation of a 64-bit integer cannot have more than 16 characters."); - else if (! Regex.IsMatch(value, "([0-9,A-F]){1,8}", RegexOptions.IgnoreCase)) + else if (!Regex.IsMatch(value, "([0-9,A-F]){1,8}", RegexOptions.IgnoreCase)) throw new ArgumentException("The hexadecimal representation of a 64-bit integer contains invalid characters."); else hexString = value; diff --git a/snippets/csharp/System/DBNull/Overview/DBNullExamples.cs b/snippets/csharp/System/DBNull/Overview/DBNullExamples.cs index ad02b9860fd..2cc2e2db91f 100644 --- a/snippets/csharp/System/DBNull/Overview/DBNullExamples.cs +++ b/snippets/csharp/System/DBNull/Overview/DBNullExamples.cs @@ -64,7 +64,7 @@ private void OutputLabels(DataTable dt) private string AddFieldValue(string label, DataRow row, string fieldName) { - if (! DBNull.Value.Equals(row[fieldName])) + if (!DBNull.Value.Equals(row[fieldName])) return (string) row[fieldName] + " "; else return String.Empty; diff --git a/snippets/csharp/System/DateTimeOffset/FromFileTime/FileTime.cs b/snippets/csharp/System/DateTimeOffset/FromFileTime/FileTime.cs index 479924f763a..664be3058f5 100644 --- a/snippets/csharp/System/DateTimeOffset/FromFileTime/FileTime.cs +++ b/snippets/csharp/System/DateTimeOffset/FromFileTime/FileTime.cs @@ -54,7 +54,7 @@ public static void Main() { // Open file %windir%\write.exe string winDir = Environment.SystemDirectory; - if (! (winDir.EndsWith(Path.DirectorySeparatorChar.ToString()))) + if (!(winDir.EndsWith(Path.DirectorySeparatorChar.ToString()))) winDir += Path.DirectorySeparatorChar; winDir += "write.exe"; diff --git a/snippets/csharp/System/Delegate/GetInvocationList/GetInvocationList1.cs b/snippets/csharp/System/Delegate/GetInvocationList/GetInvocationList1.cs index f535a88ee13..27f139f24bc 100644 --- a/snippets/csharp/System/Delegate/GetInvocationList/GetInvocationList1.cs +++ b/snippets/csharp/System/Delegate/GetInvocationList/GetInvocationList1.cs @@ -37,7 +37,7 @@ public static void Main() // Invoke each delegate that doesn't write to a file. for (int ctr = 0; ctr < outputMessage.GetInvocationList().Length; ctr++) { var outputMsg = outputMessage.GetInvocationList()[ctr]; - if (! outputMsg.GetMethodInfo().Name.Contains("File")) + if (!outputMsg.GetMethodInfo().Name.Contains("File")) outputMsg.DynamicInvoke( new String[] { "Hi!" } ); } } diff --git a/snippets/csharp/System/GC/ReRegisterForFinalize/class1.cs b/snippets/csharp/System/GC/ReRegisterForFinalize/class1.cs index 4dd4dff8d0d..28d4ba2c126 100644 --- a/snippets/csharp/System/GC/ReRegisterForFinalize/class1.cs +++ b/snippets/csharp/System/GC/ReRegisterForFinalize/class1.cs @@ -33,7 +33,7 @@ class MyFinalizeObject ~MyFinalizeObject() { - if(hasFinalized == false) + if(!hasFinalized) { Console.WriteLine("First finalization"); diff --git a/snippets/csharp/System/GC/SuppressFinalize/suppressfinalize1.cs b/snippets/csharp/System/GC/SuppressFinalize/suppressfinalize1.cs index f46c62f05c6..a752e80d9c1 100644 --- a/snippets/csharp/System/GC/SuppressFinalize/suppressfinalize1.cs +++ b/snippets/csharp/System/GC/SuppressFinalize/suppressfinalize1.cs @@ -75,7 +75,7 @@ private void Dispose(bool disposing) WriteConsole(handle, output, (uint) output.Length, out written, IntPtr.Zero); // Execute if resources have not already been disposed. - if (! disposed) { + if (!disposed) { // If the call is from Dispose, free managed resources. if (disposing) { Console.Error.WriteLine("Disposing of managed resources."); @@ -87,7 +87,7 @@ private void Dispose(bool disposing) WriteConsole(handle, output, (uint) output.Length, out written, IntPtr.Zero); if (handle != IntPtr.Zero) { - if (! CloseHandle(handle)) + if (!CloseHandle(handle)) Console.Error.WriteLine("Handle cannot be closed."); } } diff --git a/snippets/csharp/System/IAsyncResult/Overview/polling.cs b/snippets/csharp/System/IAsyncResult/Overview/polling.cs index c558baf5126..a8f5c1075e5 100644 --- a/snippets/csharp/System/IAsyncResult/Overview/polling.cs +++ b/snippets/csharp/System/IAsyncResult/Overview/polling.cs @@ -21,7 +21,7 @@ static void Main() { out threadId, null, null); // Poll while simulating work. - while(result.IsCompleted == false) { + while(!result.IsCompleted) { Thread.Sleep(250); Console.Write("."); } diff --git a/snippets/csharp/System/IFormatProvider/Overview/Provider.cs b/snippets/csharp/System/IFormatProvider/Overview/Provider.cs index 685ab678e20..d45635c89ff 100644 --- a/snippets/csharp/System/IFormatProvider/Overview/Provider.cs +++ b/snippets/csharp/System/IFormatProvider/Overview/Provider.cs @@ -60,7 +60,7 @@ public string Format(string fmt, object arg, IFormatProvider formatProvider) // Provide default formatting for unsupported format strings. string ufmt = fmt.ToUpper(CultureInfo.InvariantCulture); - if (! (ufmt == "H" || ufmt == "I")) + if (!(ufmt == "H" || ufmt == "I")) try { return HandleOtherFormats(fmt, arg); } diff --git a/snippets/csharp/System/IObservableT/Overview/example1.cs b/snippets/csharp/System/IObservableT/Overview/example1.cs index 02634352478..997d5863b23 100644 --- a/snippets/csharp/System/IObservableT/Overview/example1.cs +++ b/snippets/csharp/System/IObservableT/Overview/example1.cs @@ -58,7 +58,7 @@ public Location GetCurrentLocation() _location = new Location(_location.Latitude + rnd.Next(-1, 2), _location.Longitude + rnd.Next(-1, 2), DateTime.UtcNow, status); - if (! _location.Equals(_lastLocation)) + if (!_location.Equals(_lastLocation)) { // Notify observers. foreach (IObserver observer in observers) diff --git a/snippets/csharp/System/IObservableT/Overview/provider.cs b/snippets/csharp/System/IObservableT/Overview/provider.cs index c1fb803ad14..3025d0d5403 100644 --- a/snippets/csharp/System/IObservableT/Overview/provider.cs +++ b/snippets/csharp/System/IObservableT/Overview/provider.cs @@ -33,7 +33,7 @@ public LocationTracker() public IDisposable Subscribe(IObserver observer) { - if (! observers.Contains(observer)) + if (!observers.Contains(observer)) observers.Add(observer); return new Unsubscriber(observers, observer); } @@ -60,7 +60,7 @@ public void Dispose() public void TrackLocation(Nullable loc) { foreach (var observer in observers) { - if (! loc.HasValue) + if (!loc.HasValue) observer.OnError(new LocationUnknownException()); else observer.OnNext(loc.Value); diff --git a/snippets/csharp/System/IndexOutOfRangeException/Overview/negative1.cs b/snippets/csharp/System/IndexOutOfRangeException/Overview/negative1.cs index 5eee1ca52c8..2b9f0d515c3 100644 --- a/snippets/csharp/System/IndexOutOfRangeException/Overview/negative1.cs +++ b/snippets/csharp/System/IndexOutOfRangeException/Overview/negative1.cs @@ -13,7 +13,7 @@ public static void Main() if (args.Length < 2) startValue = 2; else - if (! Int32.TryParse(args[1], out startValue)) + if (!Int32.TryParse(args[1], out startValue)) startValue = 2; ShowValues(startValue); diff --git a/snippets/csharp/System/IndexOutOfRangeException/Overview/negative2.cs b/snippets/csharp/System/IndexOutOfRangeException/Overview/negative2.cs index f9c8e166ca3..79f123f8556 100644 --- a/snippets/csharp/System/IndexOutOfRangeException/Overview/negative2.cs +++ b/snippets/csharp/System/IndexOutOfRangeException/Overview/negative2.cs @@ -13,7 +13,7 @@ public static void Main() if (args.Length < 2) startValue = 2; else - if (! Int32.TryParse(args[1], out startValue)) + if (!Int32.TryParse(args[1], out startValue)) startValue = 2; ShowValues(startValue); diff --git a/snippets/csharp/System/NullReferenceException/Overview/Chain1.cs b/snippets/csharp/System/NullReferenceException/Overview/Chain1.cs index 1fac2e20eb4..e4b5a79e937 100644 --- a/snippets/csharp/System/NullReferenceException/Overview/Chain1.cs +++ b/snippets/csharp/System/NullReferenceException/Overview/Chain1.cs @@ -6,7 +6,7 @@ public class Example public static void Main() { var pages = new Pages(); - if (! String.IsNullOrEmpty(pages.CurrentPage.Title)) { + if (!String.IsNullOrEmpty(pages.CurrentPage.Title)) { String title = pages.CurrentPage.Title; Console.WriteLine("Current title: '{0}'", title); } diff --git a/snippets/csharp/System/String/Contains/ContainsExt1.cs b/snippets/csharp/System/String/Contains/ContainsExt1.cs index a0ca427a78b..7b68c95e12e 100644 --- a/snippets/csharp/System/String/Contains/ContainsExt1.cs +++ b/snippets/csharp/System/String/Contains/ContainsExt1.cs @@ -9,7 +9,7 @@ public static bool Contains(this String str, String substring, if (substring == null) throw new ArgumentNullException("substring", "substring cannot be null."); - else if (! Enum.IsDefined(typeof(StringComparison), comp)) + else if (!Enum.IsDefined(typeof(StringComparison), comp)) throw new ArgumentException("comp is not a member of StringComparison", "comp"); diff --git a/snippets/csharp/System/String/Overview/equality1.cs b/snippets/csharp/System/String/Overview/equality1.cs index c5a35ffc4bd..7f8cf23fca1 100644 --- a/snippets/csharp/System/String/Overview/equality1.cs +++ b/snippets/csharp/System/String/Overview/equality1.cs @@ -12,13 +12,13 @@ public static void Main() string filePath = "file://c:/notes.txt"; Console.WriteLine("Culture-sensitive test for equality:"); - if (! TestForEquality(filePath, StringComparison.CurrentCultureIgnoreCase)) + if (!TestForEquality(filePath, StringComparison.CurrentCultureIgnoreCase)) Console.WriteLine("Access to {0} is allowed.", filePath); else Console.WriteLine("Access to {0} is not allowed.", filePath); Console.WriteLine("\nOrdinal test for equality:"); - if (! TestForEquality(filePath, StringComparison.OrdinalIgnoreCase)) + if (!TestForEquality(filePath, StringComparison.OrdinalIgnoreCase)) Console.WriteLine("Access to {0} is allowed.", filePath); else Console.WriteLine("Access to {0} is not allowed.", filePath); diff --git a/snippets/csharp/System/String/Overview/normalize1.cs b/snippets/csharp/System/String/Overview/normalize1.cs index 814fcf24b4a..6c17b6d3930 100644 --- a/snippets/csharp/System/String/Overview/normalize1.cs +++ b/snippets/csharp/System/String/Overview/normalize1.cs @@ -54,7 +54,7 @@ private static string ShowBytes(string str) private static string[] NormalizeStrings(NormalizationForm nf, params string[] words) { for (int ctr = 0; ctr < words.Length; ctr++) - if (! words[ctr].IsNormalized(nf)) + if (!words[ctr].IsNormalized(nf)) words[ctr] = words[ctr].Normalize(nf); return words; } diff --git a/snippets/csharp/System/TimeZoneInfo+AdjustmentRule/DateEnd/DateStart1.cs b/snippets/csharp/System/TimeZoneInfo+AdjustmentRule/DateEnd/DateStart1.cs index a4ccc811689..1e312e5fb10 100644 --- a/snippets/csharp/System/TimeZoneInfo+AdjustmentRule/DateEnd/DateStart1.cs +++ b/snippets/csharp/System/TimeZoneInfo+AdjustmentRule/DateEnd/DateStart1.cs @@ -34,7 +34,7 @@ public static void Main() // Get start of transition TimeZoneInfo.TransitionTime daylightStart = adjustmentRule.DaylightTransitionStart; // Display information on floating date rule - if (! daylightStart.IsFixedDateRule) + if (!daylightStart.IsFixedDateRule) Console.WriteLine(" Begins at {0:t} on the {1} {2} of {3}", daylightStart.TimeOfDay, (WeekOfMonth) daylightStart.Week, diff --git a/snippets/csharp/System/TimeZoneInfo+TransitionTime/CreateFixedDateRule/System.TimeZone2.TransitionTime.Class.cs b/snippets/csharp/System/TimeZoneInfo+TransitionTime/CreateFixedDateRule/System.TimeZone2.TransitionTime.Class.cs index 4ca43692558..49b940fa108 100644 --- a/snippets/csharp/System/TimeZoneInfo+TransitionTime/CreateFixedDateRule/System.TimeZone2.TransitionTime.Class.cs +++ b/snippets/csharp/System/TimeZoneInfo+TransitionTime/CreateFixedDateRule/System.TimeZone2.TransitionTime.Class.cs @@ -143,7 +143,7 @@ private void GetFloatingTransitionTimes() foreach (TimeZoneInfo.AdjustmentRule adjustmentRule in adjustmentRules) { TimeZoneInfo.TransitionTime daylightStart = adjustmentRule.DaylightTransitionStart; - if (! daylightStart.IsFixedDateRule) + if (!daylightStart.IsFixedDateRule) Console.WriteLine("{0}, {1:d}-{2:d}: Begins at {3:t} on the {4} {5} of {6}.", zone.StandardName, adjustmentRule.DateStart, @@ -154,7 +154,7 @@ private void GetFloatingTransitionTimes() dateInfo.GetMonthName(daylightStart.Month)); TimeZoneInfo.TransitionTime daylightEnd = adjustmentRule.DaylightTransitionEnd; - if (! daylightEnd.IsFixedDateRule) + if (!daylightEnd.IsFixedDateRule) Console.WriteLine("{0}, {1:d}-{2:d}: Ends at {3:t} on the {4} {5} of {6}.", zone.StandardName, adjustmentRule.DateStart, @@ -289,7 +289,7 @@ public void GetAllTransitionTimes() // Get start of transition TimeZoneInfo.TransitionTime daylightStart = adjustmentRule.DaylightTransitionStart; // Display information on fixed date rule - if (! daylightStart.IsFixedDateRule) + if (!daylightStart.IsFixedDateRule) Console.WriteLine(" Begins at {0:t} on the {1} {2} of {3}.", daylightStart.TimeOfDay, ((WeekOfMonth)daylightStart.Week).ToString(), @@ -306,7 +306,7 @@ public void GetAllTransitionTimes() // Get end of transition TimeZoneInfo.TransitionTime daylightEnd = adjustmentRule.DaylightTransitionEnd; // Display information on fixed date rule - if (! daylightEnd.IsFixedDateRule) + if (!daylightEnd.IsFixedDateRule) Console.WriteLine(" Ends at {0:t} on the {1} {2} of {3}.", daylightEnd.TimeOfDay, ((WeekOfMonth)daylightEnd.Week).ToString(), diff --git a/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/TimeZone2_Examples.cs b/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/TimeZone2_Examples.cs index fee0094b2c2..e5fbfa74fd7 100644 --- a/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/TimeZone2_Examples.cs +++ b/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/TimeZone2_Examples.cs @@ -75,7 +75,7 @@ private void ShowNoDSTZones() ReadOnlyCollection zones = TimeZoneInfo.GetSystemTimeZones(); foreach(TimeZoneInfo zone in zones) { - if (! zone.SupportsDaylightSavingTime) + if (!zone.SupportsDaylightSavingTime) Console.WriteLine(zone.DisplayName); } //
diff --git a/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/getsystemtimezones1.cs b/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/getsystemtimezones1.cs index 1bb06077845..5c28ea5f202 100644 --- a/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/getsystemtimezones1.cs +++ b/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/getsystemtimezones1.cs @@ -41,7 +41,7 @@ public static void Main() sw.WriteLine(" From {0} to {1}", rule.DateStart, rule.DateEnd); sw.WriteLine(" Delta: {0}", rule.DaylightDelta); - if (! transTimeStart.IsFixedDateRule) + if (!transTimeStart.IsFixedDateRule) { sw.WriteLine(" Begins at {0:t} on {1} of week {2} of {3}", transTimeStart.TimeOfDay, transTimeStart.DayOfWeek, diff --git a/snippets/csharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.cs b/snippets/csharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.cs index 82982c32680..664a65d775e 100644 --- a/snippets/csharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.cs +++ b/snippets/csharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.cs @@ -211,7 +211,7 @@ private void ConvertHawaiianToLocal() private DateTime ResolveAmbiguousTime(DateTime ambiguousTime) { // Time is not ambiguous - if (! TimeZoneInfo.Local.IsAmbiguousTime(ambiguousTime)) + if (!TimeZoneInfo.Local.IsAmbiguousTime(ambiguousTime)) { return ambiguousTime; } @@ -269,7 +269,7 @@ private DateTime GetUserDateTime() DateTime inputDate = DateTime.MinValue; Console.Write("Enter a local date and time: "); - while (! exitFlag) + while (!exitFlag) { dateString = Console.ReadLine(); if (dateString.ToUpper() == "E") diff --git a/snippets/csharp/System/TimeZoneInfo/CreateCustomTimeZone/System.TimeZone2.CreateTimeZone.cs b/snippets/csharp/System/TimeZoneInfo/CreateCustomTimeZone/System.TimeZone2.CreateTimeZone.cs index eadcdecca02..009775a0c46 100644 --- a/snippets/csharp/System/TimeZoneInfo/CreateCustomTimeZone/System.TimeZone2.CreateTimeZone.cs +++ b/snippets/csharp/System/TimeZoneInfo/CreateCustomTimeZone/System.TimeZone2.CreateTimeZone.cs @@ -160,7 +160,7 @@ private TimeZoneInfo InitializeTimeZone() } } } - if (! found) + if (!found) { // Define transition times to/from DST TimeZoneInfo.TransitionTime startTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 10, 1, DayOfWeek.Sunday); diff --git a/snippets/csharp/System/TimeZoneInfo/GetAmbiguousTimeOffsets/System.TimeZone2.GetAmbiguousTimeOffsets.cs b/snippets/csharp/System/TimeZoneInfo/GetAmbiguousTimeOffsets/System.TimeZone2.GetAmbiguousTimeOffsets.cs index e35edcdab12..e1ab69a2697 100644 --- a/snippets/csharp/System/TimeZoneInfo/GetAmbiguousTimeOffsets/System.TimeZone2.GetAmbiguousTimeOffsets.cs +++ b/snippets/csharp/System/TimeZoneInfo/GetAmbiguousTimeOffsets/System.TimeZone2.GetAmbiguousTimeOffsets.cs @@ -58,7 +58,7 @@ private void Start() private void ShowPossibleUtcTimes(DateTime ambiguousTime, TimeZoneInfo timeZone) { // Determine if time is ambiguous in target time zone - if (! timeZone.IsAmbiguousTime(ambiguousTime)) + if (!timeZone.IsAmbiguousTime(ambiguousTime)) { Console.WriteLine("{0} is not ambiguous in time zone {1}.", ambiguousTime, diff --git a/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7,TRest/System.Collections.IStructuralComparable.CompareTo/compareto2.cs b/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7,TRest/System.Collections.IStructuralComparable.CompareTo/compareto2.cs index f94a4e203ad..e9ff5e13cea 100644 --- a/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7,TRest/System.Collections.IStructuralComparable.CompareTo/compareto2.cs +++ b/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7,TRest/System.Collections.IStructuralComparable.CompareTo/compareto2.cs @@ -13,7 +13,7 @@ public PopulationComparer(int component) : this(component, true) public PopulationComparer(int component, bool descending) { - if (! descending) multiplier = 1; + if (!descending) multiplier = 1; if (component <= 0 || component > 8) throw new ArgumentException("The component argument is out of range."); diff --git a/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7/System.Collections.IStructuralComparable.CompareTo/compareto2.cs b/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7/System.Collections.IStructuralComparable.CompareTo/compareto2.cs index 7a4912bef6e..3c9c896baf8 100644 --- a/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7/System.Collections.IStructuralComparable.CompareTo/compareto2.cs +++ b/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6,T7/System.Collections.IStructuralComparable.CompareTo/compareto2.cs @@ -13,7 +13,7 @@ public PopulationComparer(int component) : this(component, true) public PopulationComparer(int component, bool descending) { - if (! descending) multiplier = 1; + if (!descending) multiplier = 1; if (component <= 0 || component > 7) throw new ArgumentException("The component argument is out of range."); diff --git a/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6/System.Collections.IStructuralComparable.CompareTo/compareto2.cs b/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6/System.Collections.IStructuralComparable.CompareTo/compareto2.cs index 1ff90291620..8bd3fa29ccf 100644 --- a/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6/System.Collections.IStructuralComparable.CompareTo/compareto2.cs +++ b/snippets/csharp/System/TupleT1,T2,T3,T4,T5,T6/System.Collections.IStructuralComparable.CompareTo/compareto2.cs @@ -13,7 +13,7 @@ public PopulationComparer(int component) : this(component, true) public PopulationComparer(int component, bool descending) { - if (! descending) multiplier = 1; + if (!descending) multiplier = 1; if (component <= 0 || component > 6) throw new ArgumentException("The component argument is out of range."); diff --git a/snippets/csharp/System/UnauthorizedAccessException/Overview/withio.cs b/snippets/csharp/System/UnauthorizedAccessException/Overview/withio.cs index 75958d7444b..4b5b6eca616 100644 --- a/snippets/csharp/System/UnauthorizedAccessException/Overview/withio.cs +++ b/snippets/csharp/System/UnauthorizedAccessException/Overview/withio.cs @@ -7,7 +7,7 @@ public class Example public static void Main() { string filePath = @".\ROFile.txt"; - if (! File.Exists(filePath)) + if (!File.Exists(filePath)) File.Create(filePath); // Keep existing attributes, and set ReadOnly attribute. File.SetAttributes(filePath, diff --git a/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs b/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs index 8cbefd18753..a11001351b8 100644 --- a/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs +++ b/snippets/csharp/System/Uri/.ctor/nclurienhancements.cs @@ -36,7 +36,7 @@ private static void SampleTryCreate() string addressString = "catalog/shownew.htm?date=today"; // Parse the string and create a new Uri instance, if possible. Uri result = null; - if (Uri.TryCreate(addressString, UriKind.RelativeOrAbsolute, out result) == true) { + if (Uri.TryCreate(addressString, UriKind.RelativeOrAbsolute, out result)) { // The call was successful. Write the URI address to the console. Console.Write(result.ToString()); // Check whether new Uri instance is absolute or relative. diff --git a/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs b/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs index 14e9853b5ef..05f60b1cd08 100644 --- a/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs +++ b/snippets/csharp/System/Uri/CheckSchemeName/uriexamples.cs @@ -107,7 +107,7 @@ private static void HexConversions() { // char testChar = 'e'; - if (Uri.IsHexDigit(testChar) == true) + if (Uri.IsHexDigit(testChar)) Console.WriteLine("'{0}' is the hexadecimal representation of {1}", testChar, Uri.FromHex(testChar)); else Console.WriteLine("'{0}' is not a hexadecimal character", testChar); @@ -204,7 +204,7 @@ private static void SampleCheckSchemeName() string uriString = String.Format("{0}{1}{2}/", Uri.UriSchemeHttp, Uri.SchemeDelimiter, address); #if OLDMETHOD Uri result; - if (Uri.TryParse(uriString, false, false, out result) == true) + if (Uri.TryParse(uriString, false, false, out result)) Console.WriteLine("{0} is a valid Uri", result.ToString()); else Console.WriteLine("Uri not created"); diff --git a/snippets/csharp/System/ValueType/Overview/example1.cs b/snippets/csharp/System/ValueType/Overview/example1.cs index 590bf08a3f6..c626a8da7e5 100644 --- a/snippets/csharp/System/ValueType/Overview/example1.cs +++ b/snippets/csharp/System/ValueType/Overview/example1.cs @@ -12,9 +12,9 @@ public enum NumericRelationship { public static NumericRelationship Compare(ValueType value1, ValueType value2) { - if (! IsNumeric(value1)) + if (!IsNumeric(value1)) throw new ArgumentException("value1 is not a number."); - else if (! IsNumeric(value2)) + else if (!IsNumeric(value2)) throw new ArgumentException("value2 is not a number."); // Use BigInteger as common integral type diff --git a/snippets/csharp/VS_Snippets_ADO.NET/odbcdatareader_getvalues/cs/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/odbcdatareader_getvalues/cs/source.cs index f7e53e6bcf0..ff2081548be 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/odbcdatareader_getvalues/cs/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/odbcdatareader_getvalues/cs/source.cs @@ -16,7 +16,7 @@ public static void Main() { connection.Open(); OdbcDataReader reader = command.ExecuteReader(); - if (reader.Read() == true) { + if (reader.Read()) { do { int NumberOfColums = reader.GetValues(meta); @@ -25,7 +25,7 @@ public static void Main() { Console.WriteLine(); read = reader.Read(); - } while (read == true); + } while (read); } reader.Close(); } diff --git a/snippets/csharp/VS_Snippets_ADO.NET/oledbdatareader_getvalues/cs/source.cs b/snippets/csharp/VS_Snippets_ADO.NET/oledbdatareader_getvalues/cs/source.cs index 23c1ac8938e..40faeddef13 100644 --- a/snippets/csharp/VS_Snippets_ADO.NET/oledbdatareader_getvalues/cs/source.cs +++ b/snippets/csharp/VS_Snippets_ADO.NET/oledbdatareader_getvalues/cs/source.cs @@ -16,7 +16,7 @@ public static void Main() { connection.Open(); OleDbDataReader reader = command.ExecuteReader(); - if (reader.Read() == true) { + if (reader.Read()) { do { int NumberOfColums = reader.GetValues(meta); @@ -25,7 +25,7 @@ public static void Main() { Console.WriteLine(); read = reader.Read(); - } while (read == true); + } while (read); } reader.Close(); } diff --git a/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs b/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs index f04bf69d3f7..1b34c42fdd3 100644 --- a/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs +++ b/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs @@ -212,7 +212,7 @@ static void snippet33() invoker.InvokeCompleted += delegate(object sender, InvokeCompletedEventArgs args) { - if (args.Cancelled == true) + if (args.Cancelled) { Console.WriteLine("Workflow was cancelled."); } @@ -252,7 +252,7 @@ static void snippet34() invoker.InvokeCompleted += delegate(object sender, InvokeCompletedEventArgs args) { - if (args.Cancelled == true) + if (args.Cancelled) { Console.WriteLine("The workflow was cancelled."); } diff --git a/snippets/csharp/VS_Snippets_CFX/ierrorhandler/cs/ierrorhandler.cs b/snippets/csharp/VS_Snippets_CFX/ierrorhandler/cs/ierrorhandler.cs index 574823ec114..e7373e50979 100644 --- a/snippets/csharp/VS_Snippets_CFX/ierrorhandler/cs/ierrorhandler.cs +++ b/snippets/csharp/VS_Snippets_CFX/ierrorhandler/cs/ierrorhandler.cs @@ -103,7 +103,7 @@ public void Validate(ServiceDescription description, ServiceHostBase serviceHost continue; } } - if (gfExists == false) + if (!gfExists) { throw new InvalidOperationException( "EnforceGreetingFaultBehavior requires a FaultContractAttribute(typeof(GreetingFault)) in an operation contract." diff --git a/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/client.cs b/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/client.cs index 62356ff4647..98c0a739ae6 100644 --- a/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/client.cs +++ b/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/client.cs @@ -98,7 +98,7 @@ void WriteHeaders(MessageHeaders headers) Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\t" + h.Namespace); Console.WriteLine("\t" + h.Relay); - if (h.IsReferenceParameter == true) + if (h.IsReferenceParameter) { Console.WriteLine("IsReferenceParameter header detected: " + h.ToString()); } diff --git a/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/services.cs b/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/services.cs index 35518d9711e..6aed3e312b2 100644 --- a/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/services.cs +++ b/snippets/csharp/VS_Snippets_CFX/operationcontextscope/cs/services.cs @@ -62,7 +62,7 @@ void WriteHeaders(MessageHeaders headers) Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\t" + h.Namespace); Console.WriteLine("\t" + h.Relay); - if (h.IsReferenceParameter == true) + if (h.IsReferenceParameter) { Console.WriteLine("IsReferenceParameter header detected: " + h.ToString()); } diff --git a/snippets/csharp/VS_Snippets_CFX/s_ue_secureconversationservicecredential/cs/source.cs b/snippets/csharp/VS_Snippets_CFX/s_ue_secureconversationservicecredential/cs/source.cs index 4c18deaf869..9f8caa4a0e7 100644 --- a/snippets/csharp/VS_Snippets_CFX/s_ue_secureconversationservicecredential/cs/source.cs +++ b/snippets/csharp/VS_Snippets_CFX/s_ue_secureconversationservicecredential/cs/source.cs @@ -87,7 +87,7 @@ public CertificateSecurityStateEncoder(X509Certificate2 protectionCertificate) throw new ArgumentNullException("protectionCertificate"); } - if (protectionCertificate.HasPrivateKey == false) + if (!protectionCertificate.HasPrivateKey) { throw new ArgumentException("protectionCertificate does not contain the private key which is required for performing encypt / decrypt operations."); } diff --git a/snippets/csharp/VS_Snippets_CFX/uemsmqmessage/cs/program.cs b/snippets/csharp/VS_Snippets_CFX/uemsmqmessage/cs/program.cs index 3160ebc8e5e..99d46512fd8 100644 --- a/snippets/csharp/VS_Snippets_CFX/uemsmqmessage/cs/program.cs +++ b/snippets/csharp/VS_Snippets_CFX/uemsmqmessage/cs/program.cs @@ -40,7 +40,7 @@ static void Main(string[] args) // // - if (message.Authenticated == true) + if (message.Authenticated) Console.WriteLine("Message was authenticated"); // diff --git a/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/snippets.cs b/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/snippets.cs index db3ad8cd6b4..37c4a3bbfd9 100644 --- a/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/snippets.cs +++ b/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/snippets.cs @@ -1105,7 +1105,7 @@ private ICollection LoadWorkflow(WorkflowLoader loader) ResumeLayout(true); - if (btnAutoSynch.Checked == true) + if (btnAutoSynch.Checked) { this.xomlView.Text = GetCurrentXoml(); } @@ -1674,7 +1674,7 @@ public bool Expanded protected override void OnPaint(ActivityDesignerPaintEventArgs e) { - if (this.UseBasePaint == true) + if (this.UseBasePaint) { base.OnPaint(e); return; diff --git a/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/wf_snippets.csproj b/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/wf_snippets.csproj index 9dbfd887dc0..f1a8e9e78f9 100644 --- a/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/wf_snippets.csproj +++ b/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/wf_snippets.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -11,6 +11,13 @@ WF_Snippets + + + + + 2.0 + v4.8.1 + true @@ -20,6 +27,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -28,6 +36,7 @@ TRACE prompt 4 + false @@ -38,9 +47,9 @@ - - - + + + diff --git a/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputCheckBox.ServerChange Example/CS/sourcecs.aspx b/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputCheckBox.ServerChange Example/CS/sourcecs.aspx index adbcac9d64d..ab6565ab955 100644 --- a/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputCheckBox.ServerChange Example/CS/sourcecs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputCheckBox.ServerChange Example/CS/sourcecs.aspx @@ -14,7 +14,7 @@ if (Prev_Check_State.Value == Check1.Checked.ToString()) Span2.InnerHtml = "CheckBox1 did not change state between clicks."; - if (Check1.Checked == true) + if (Check1.Checked) { Span1.InnerHtml = "CheckBox1 is selected!"; Prev_Check_State.Value="True"; diff --git a/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputRadioButton Example/CS/sourcecs.aspx b/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputRadioButton Example/CS/sourcecs.aspx index 084a2e842cf..8e0a029e46a 100644 --- a/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputRadioButton Example/CS/sourcecs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/Classic HtmlInputRadioButton Example/CS/sourcecs.aspx @@ -11,11 +11,11 @@ void Button1_Click(object sender, EventArgs e) { - if (Radio1.Checked == true) + if (Radio1.Checked) Span1.InnerHtml = "Option 1 is selected"; - else if (Radio2.Checked == true) + else if (Radio2.Checked) Span1.InnerHtml = "Option 2 is selected"; - else if (Radio3.Checked == true) + else if (Radio3.Checked) Span1.InnerHtml = "Option 3 is selected"; } diff --git a/snippets/csharp/VS_Snippets_WebNet/Classic ListBox Example 2/CS/source3cs.aspx b/snippets/csharp/VS_Snippets_WebNet/Classic ListBox Example 2/CS/source3cs.aspx index 9d14d6623fe..8aa68c7e532 100644 --- a/snippets/csharp/VS_Snippets_WebNet/Classic ListBox Example 2/CS/source3cs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/Classic ListBox Example 2/CS/source3cs.aspx @@ -11,7 +11,7 @@ string msg = ""; foreach (ListItem li in ListBox1.Items) { - if (li.Selected == true) + if (li.Selected) { msg += "
" + li.Text + " is selected."; } diff --git a/snippets/csharp/VS_Snippets_WebNet/Classic Panel.Wrap Example/CS/sourcecs.aspx b/snippets/csharp/VS_Snippets_WebNet/Classic Panel.Wrap Example/CS/sourcecs.aspx index 607ec195ce4..baf7f9998c6 100644 --- a/snippets/csharp/VS_Snippets_WebNet/Classic Panel.Wrap Example/CS/sourcecs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/Classic Panel.Wrap Example/CS/sourcecs.aspx @@ -14,7 +14,7 @@ } void Button1_Click(Object sender, EventArgs e) { - if (Panel1.Wrap == true) { + if (Panel1.Wrap) { Panel1.Wrap = false; Button1.Text = "Set Wrap=True"; } diff --git a/snippets/csharp/VS_Snippets_WebNet/Classic RadioButtonList Example/CS/sourcecs.aspx b/snippets/csharp/VS_Snippets_WebNet/Classic RadioButtonList Example/CS/sourcecs.aspx index 018a9e5032c..f12582ea015 100644 --- a/snippets/csharp/VS_Snippets_WebNet/Classic RadioButtonList Example/CS/sourcecs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/Classic RadioButtonList Example/CS/sourcecs.aspx @@ -18,7 +18,7 @@ void chkLayout_CheckedChanged(Object sender, EventArgs e) { - if (chkLayout.Checked == true) + if (chkLayout.Checked) { RadioButtonList1.RepeatLayout = RepeatLayout.Table; } @@ -31,7 +31,7 @@ void chkDirection_CheckedChanged(Object sender, EventArgs e) { - if (chkDirection.Checked == true) + if (chkDirection.Checked) { RadioButtonList1.RepeatDirection = RepeatDirection.Horizontal; } diff --git a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlInputCheckBoxOnPreRender/CS/custom_htmlinputcheckbox_onprerendercs.aspx b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlInputCheckBoxOnPreRender/CS/custom_htmlinputcheckbox_onprerendercs.aspx index a6193c08168..a7dfd70f2d5 100644 --- a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlInputCheckBoxOnPreRender/CS/custom_htmlinputcheckbox_onprerendercs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlInputCheckBoxOnPreRender/CS/custom_htmlinputcheckbox_onprerendercs.aspx @@ -11,17 +11,17 @@ { Div1.InnerHtml = ""; - if(HtmlInputCheckBox1.Checked == true) + if (HtmlInputCheckBox1.Checked) { Div1.InnerHtml = "You like basketball. "; } - if(HtmlInputCheckBox2.Checked == true) + if (HtmlInputCheckBox2.Checked) { Div1.InnerHtml += "You like football. "; } - if(HtmlInputCheckBox3.Checked == true) + if (HtmlInputCheckBox3.Checked) { Div1.InnerHtml += "You like soccer. "; } diff --git a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectAddParsedSubObject/CS/custom_htmlselect_addparsedsubobjectcs.aspx b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectAddParsedSubObject/CS/custom_htmlselect_addparsedsubobjectcs.aspx index c8014c68c97..9a75a8530b3 100644 --- a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectAddParsedSubObject/CS/custom_htmlselect_addparsedsubobjectcs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectAddParsedSubObject/CS/custom_htmlselect_addparsedsubobjectcs.aspx @@ -11,12 +11,12 @@ { if (HtmlSelect1.SelectedIndex >= 0) { - if (HtmlSelect1.Multiple == true) + if (HtmlSelect1.Multiple) { Div1.InnerHtml = "You selected:"; for (int i=0; i<=HtmlSelect1.Items.Count - 1; i++) { - if (HtmlSelect1.Items[i].Selected == true) + if (HtmlSelect1.Items[i].Selected) { Div1.InnerHtml += "
   " + HtmlSelect1.Items[i].Value; } diff --git a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectClearSelection/CS/custom_htmlselect_clearselectioncs.aspx b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectClearSelection/CS/custom_htmlselect_clearselectioncs.aspx index 1f9c8a88497..37091237d05 100644 --- a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectClearSelection/CS/custom_htmlselect_clearselectioncs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectClearSelection/CS/custom_htmlselect_clearselectioncs.aspx @@ -11,12 +11,12 @@ { if (HtmlSelect1.SelectedIndex >= 0) { - if (HtmlSelect1.Multiple == true) + if (HtmlSelect1.Multiple) { Div1.InnerHtml = "You selected:"; for (int i=0; i<=HtmlSelect1.Items.Count - 1; i++) { - if (HtmlSelect1.Items[i].Selected == true) + if (HtmlSelect1.Items[i].Selected) { Div1.InnerHtml += "
   " + HtmlSelect1.Items[i].Value; } diff --git a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectOnPreRender/CS/custom_htmlselect_onprerendercs.aspx b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectOnPreRender/CS/custom_htmlselect_onprerendercs.aspx index 10d40fe03ba..c0ce7bd22da 100644 --- a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectOnPreRender/CS/custom_htmlselect_onprerendercs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectOnPreRender/CS/custom_htmlselect_onprerendercs.aspx @@ -11,12 +11,12 @@ { if (HtmlSelect1.SelectedIndex >= 0) { - if (HtmlSelect1.Multiple == true) + if (HtmlSelect1.Multiple) { Div1.InnerHtml = "You selected:"; for (int i=0; i<=HtmlSelect1.Items.Count - 1; i++) { - if (HtmlSelect1.Items[i].Selected == true) + if (HtmlSelect1.Items[i].Selected) { Div1.InnerHtml += "
   " + HtmlSelect1.Items[i].Value; } diff --git a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderAttributes/CS/custom_htmlselect_renderattributescs.aspx b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderAttributes/CS/custom_htmlselect_renderattributescs.aspx index 0ccb5a75927..88a962e977d 100644 --- a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderAttributes/CS/custom_htmlselect_renderattributescs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderAttributes/CS/custom_htmlselect_renderattributescs.aspx @@ -11,12 +11,12 @@ { if (HtmlSelect1.SelectedIndex >= 0) { - if (HtmlSelect1.Multiple == true) + if (HtmlSelect1.Multiple) { Div1.InnerHtml = "You selected:"; for (int i=0; i<=HtmlSelect1.Items.Count - 1; i++) { - if (HtmlSelect1.Items[i].Selected == true) + if (HtmlSelect1.Items[i].Selected) { Div1.InnerHtml += "
   " + HtmlSelect1.Items[i].Value; } diff --git a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderChildren/CS/custom_htmlselect_renderchildrencs.aspx b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderChildren/CS/custom_htmlselect_renderchildrencs.aspx index b9ab043bcc3..5f2d00855d7 100644 --- a/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderChildren/CS/custom_htmlselect_renderchildrencs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/CustomHtmlSelectRenderChildren/CS/custom_htmlselect_renderchildrencs.aspx @@ -11,12 +11,12 @@ { if (HtmlSelect1.SelectedIndex >= 0) { - if (HtmlSelect1.Multiple == true) + if (HtmlSelect1.Multiple) { Div1.InnerHtml = "You selected:"; for (int i=0; i<=HtmlSelect1.Items.Count - 1; i++) { - if (HtmlSelect1.Items[i].Selected == true) + if (HtmlSelect1.Items[i].Selected) { Div1.InnerHtml += "
   " + HtmlSelect1.Items[i].Value; } diff --git a/snippets/csharp/VS_Snippets_WebNet/ListControlDesigner_Samples/CS/SimpleRadioButtonListDataBindingHandler.cs b/snippets/csharp/VS_Snippets_WebNet/ListControlDesigner_Samples/CS/SimpleRadioButtonListDataBindingHandler.cs index 08bd066277b..447e3f7d1aa 100644 --- a/snippets/csharp/VS_Snippets_WebNet/ListControlDesigner_Samples/CS/SimpleRadioButtonListDataBindingHandler.cs +++ b/snippets/csharp/VS_Snippets_WebNet/ListControlDesigner_Samples/CS/SimpleRadioButtonListDataBindingHandler.cs @@ -24,7 +24,7 @@ public override void DataBindControl(IDesignerHost designerHost, // If the binding exists, create a reference to the // list control, clear its ListItemCollection, and then add // an item to the collection. - if (! (dataSourceBinding == null)) + if (!(dataSourceBinding == null)) { SimpleRadioButtonList simpleControl = (SimpleRadioButtonList)control; diff --git a/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.TextBoxSet/CS/textboxset.cs b/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.TextBoxSet/CS/textboxset.cs index c7c8307d705..e9ee2e11066 100644 --- a/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.TextBoxSet/CS/textboxset.cs +++ b/snippets/csharp/VS_Snippets_WebNet/Samples.AspNet.TextBoxSet/CS/textboxset.cs @@ -44,7 +44,7 @@ protected override void PerformSelect() { // Call OnDataBinding here if bound to a data source using the // DataSource property (instead of a DataSourceID), because the // databinding statement is evaluated before the call to GetData. - if (! IsBoundUsingDataSourceID) { + if (!IsBoundUsingDataSourceID) { OnDataBinding(EventArgs.Empty); } diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HealthMonitoringSection/CS/healthmonitoringsection.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HealthMonitoringSection/CS/healthmonitoringsection.cs index 734b804e2e0..4cb7b32ab26 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HealthMonitoringSection/CS/healthmonitoringsection.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HealthMonitoringSection/CS/healthmonitoringsection.cs @@ -516,7 +516,7 @@ public static void Main() // // Update if not locked. - if (! healthMonitoringSection.SectionInformation.IsLocked) + if (!healthMonitoringSection.SectionInformation.IsLocked) { configuration.Save(); Console.WriteLine("** Configuration updated."); diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HttpHandlers/CS/httphandlers.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HttpHandlers/CS/httphandlers.cs index 300ef8f9063..5f21f723a20 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HttpHandlers/CS/httphandlers.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.HttpHandlers/CS/httphandlers.cs @@ -132,7 +132,7 @@ public UsingHttpHandlersSection() } // Update if not locked. - if (! httpHandlersSection.SectionInformation.IsLocked) + if (!httpHandlersSection.SectionInformation.IsLocked) { configuration.Save(); Console.WriteLine("** Configuration updated."); diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.ProfileSection/CS/profilesection.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.ProfileSection/CS/profilesection.cs index 87c656d7b3f..e5154d26c9f 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.ProfileSection/CS/profilesection.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.ProfileSection/CS/profilesection.cs @@ -218,7 +218,7 @@ public static void Main() // // Update if not locked. - if (! profileSection.SectionInformation.IsLocked) + if (!profileSection.SectionInformation.IsLocked) { configuration.Save(); Console.WriteLine("** Configuration updated."); diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.TraceSection2/CS/tracesection.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.TraceSection2/CS/tracesection.cs index 1a169228863..107cbeb7293 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.TraceSection2/CS/tracesection.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.TraceSection2/CS/tracesection.cs @@ -98,7 +98,7 @@ public static void Main() // // Update if not locked. - if (! traceSection.SectionInformation.IsLocked) + if (!traceSection.SectionInformation.IsLocked) { configuration.Save(); Console.WriteLine("** Configuration updated."); diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebPartsSection/CS/usingwebpartssection.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebPartsSection/CS/usingwebpartssection.cs index a7477ac031b..f26e244edb0 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebPartsSection/CS/usingwebpartssection.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.WebPartsSection/CS/usingwebpartssection.cs @@ -120,7 +120,7 @@ public static void Main() //
// Update if not locked. - if (! webPartsSection.IsReadOnly()) + if (!webPartsSection.IsReadOnly()) { configuration.Save(); Console.WriteLine("** Configuration updated."); diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.DynamicData.DynamicDataExtensions/cs/Insert.aspx.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.DynamicData.DynamicDataExtensions/cs/Insert.aspx.cs index fe24c16377f..d9c5c8e2264 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.DynamicData.DynamicDataExtensions/cs/Insert.aspx.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.DynamicData.DynamicDataExtensions/cs/Insert.aspx.cs @@ -30,7 +30,7 @@ protected void Page_Load(object sender, EventArgs e) { protected void DetailsView1_DataBound(object sender, EventArgs e) { var dsc = DetailsView1.FindDataSourceControl() as LinqDataSource; - if (dsc == null || dsc.EnableInsert != true) + if (dsc == null || !dsc.EnableInsert) return; var mTbl = DetailsView1.FindMetaTable() as MetaTable; diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.ControlCollection_NewSamples/CS/controlcollection1_cs.aspx b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.ControlCollection_NewSamples/CS/controlcollection1_cs.aspx index 045a5eb6eb0..e7fcfc85343 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.ControlCollection_NewSamples/CS/controlcollection1_cs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.ControlCollection_NewSamples/CS/controlcollection1_cs.aspx @@ -37,7 +37,7 @@ // use the SyncRoot method to get an object that // allows the enumeration of all controls to be // thread safe. - if (myButton.Controls.IsSynchronized == false) + if (!myButton.Controls.IsSynchronized) { lock (myButton.Controls.SyncRoot) { diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.Page.Validate/CS/validate.cs.aspx b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.Page.Validate/CS/validate.cs.aspx index 646b607313d..bfc01d0256b 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.Page.Validate/CS/validate.cs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.Page.Validate/CS/validate.cs.aspx @@ -18,7 +18,7 @@ private void ValidateBtn_Click(Object Sender, EventArgs E) { Page.Validate(); - if (Page.IsValid == true) + if (Page.IsValid) lblOutput.Text = "Page is Valid!"; else lblOutput.Text = "Some required fields are empty."; diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.TemplateControl_LoadTemplate/CS/loadtemplatecs.aspx b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.TemplateControl_LoadTemplate/CS/loadtemplatecs.aspx index 4914a72a58f..8e58e17ef3d 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.TemplateControl_LoadTemplate/CS/loadtemplatecs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.TemplateControl_LoadTemplate/CS/loadtemplatecs.aspx @@ -47,7 +47,7 @@ DataList1.RepeatLayout = RepeatLayout.Flow; DataList1.RepeatColumns=DropDown3.SelectedIndex+1; - if ((Check1.Checked ==true) && (DataList1.RepeatLayout == RepeatLayout.Table)) + if ((Check1.Checked) && (DataList1.RepeatLayout == RepeatLayout.Table)) { DataList1.BorderWidth = Unit.Pixel(1); DataList1.GridLines = GridLines.Both; diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_1/CS/northwindemployee1.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_1/CS/northwindemployee1.cs index ee2ff6ef94d..8c1236c7e5c 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_1/CS/northwindemployee1.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_1/CS/northwindemployee1.cs @@ -52,7 +52,7 @@ public static NorthwindEmployee GetEmployee(object anID) { public static void UpdateEmployeeInfo(NorthwindEmployee ne) { bool retval = ne.Save(); - if (! retval) { throw new NorthwindDataException("UpdateEmployee failed."); } + if (!retval) { throw new NorthwindDataException("UpdateEmployee failed."); } } public static void DeleteEmployee(NorthwindEmployee ne) { } @@ -95,7 +95,7 @@ public NorthwindEmployee (object anID) { this.lastName = sdr["LastName"].ToString(); this.title = sdr["Title"].ToString(); this.titleOfCourtesy = sdr["TitleOfCourtesy"].ToString(); - if (! sdr.IsDBNull(4)) { + if (!sdr.IsDBNull(4)) { this.reportsTo = sdr.GetInt32(4); } } diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_10/CS/northwindemployee10.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_10/CS/northwindemployee10.cs index 1ae8fa5c28f..09f400cae01 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_10/CS/northwindemployee10.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_10/CS/northwindemployee10.cs @@ -54,7 +54,7 @@ public static NorthwindEmployee GetEmployee(object anID) { public static void DeleteEmployee(NorthwindEmployee ne) { bool retval = ne.Delete(); - if (! retval) { throw new NorthwindDataException("Employee delete failed."); } + if (!retval) { throw new NorthwindDataException("Employee delete failed."); } // Delete the object in memory. ne = null; } diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_11/CS/northwindemployee11.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_11/CS/northwindemployee11.cs index eeaffc17f14..dce87b222b0 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_11/CS/northwindemployee11.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_11/CS/northwindemployee11.cs @@ -54,7 +54,7 @@ public static NorthwindEmployee GetEmployee(int anID) { public static void DeleteEmployee(NorthwindEmployee ne) { bool retval = ne.Delete(); - if (! retval) { throw new NorthwindDataException("Employee delete failed."); } + if (!retval) { throw new NorthwindDataException("Employee delete failed."); } // Delete the object in memory. ne = null; } diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_12/CS/northwindemployee12.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_12/CS/northwindemployee12.cs index deda9b1b928..3c1e8679035 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_12/CS/northwindemployee12.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_12/CS/northwindemployee12.cs @@ -63,7 +63,7 @@ public static NorthwindEmployee GetEmployee(object anID) { // public static void UpdateEmployee(NorthwindEmployee ne) { bool retval = ne.Update(); - if (! retval) { throw new NorthwindDataException("Employee update failed."); } + if (!retval) { throw new NorthwindDataException("Employee update failed."); } } // This method is added as a conveniece wrapper on the original diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_4/CS/northwindemployee4.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_4/CS/northwindemployee4.cs index b673c226e9f..39828c65102 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_4/CS/northwindemployee4.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_4/CS/northwindemployee4.cs @@ -58,12 +58,12 @@ public static NorthwindEmployee GetEmployee(object anID) { public static void UpdateEmployeeInfo(NorthwindEmployee ne) { bool retval = ne.Save(); - if (! retval) { throw new NorthwindDataException("UpdateEmployee failed."); } + if (!retval) { throw new NorthwindDataException("UpdateEmployee failed."); } } public static void DeleteEmployee(NorthwindEmployee ne) { bool retval = ne.Delete(); - if (! retval) { throw new NorthwindDataException("DeleteEmployee failed."); } + if (!retval) { throw new NorthwindDataException("DeleteEmployee failed."); } } // And so on... @@ -105,7 +105,7 @@ SqlConnection conn this.lastName = sdr["LastName"].ToString(); this.title = sdr["Title"].ToString(); this.titleOfCourtesy = sdr["TitleOfCourtesy"].ToString(); - if (! sdr.IsDBNull(4)) { + if (!sdr.IsDBNull(4)) { this.reportsTo = sdr.GetInt32(4); } } diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_5/CS/northwindemployee5.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_5/CS/northwindemployee5.cs index f1f9a3ee247..ae6377eb655 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_5/CS/northwindemployee5.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_5/CS/northwindemployee5.cs @@ -97,12 +97,12 @@ public static NorthwindEmployee GetEmployee(object anID) { public static void UpdateEmployeeInfo(NorthwindEmployee ne) { bool retval = ne.Save(); - if (! retval) { throw new NorthwindDataException("UpdateEmployee failed."); } + if (!retval) { throw new NorthwindDataException("UpdateEmployee failed."); } } public static void DeleteEmployee(NorthwindEmployee ne) { bool retval = ne.Delete(); - if (! retval) { throw new NorthwindDataException("DeleteEmployee failed."); } + if (!retval) { throw new NorthwindDataException("DeleteEmployee failed."); } } } @@ -142,7 +142,7 @@ SqlConnection conn this.lastName = sdr["LastName"].ToString(); this.title = sdr["Title"].ToString(); this.titleOfCourtesy = sdr["TitleOfCourtesy"].ToString(); - if (! sdr.IsDBNull(4)) { + if (!sdr.IsDBNull(4)) { this.reportsTo = sdr.GetInt32(4); } } diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_8/CS/northwindemployee8.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_8/CS/northwindemployee8.cs index 576faa04b6b..401d078d156 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_8/CS/northwindemployee8.cs +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.ObjectDataSource_8/CS/northwindemployee8.cs @@ -85,7 +85,7 @@ public static void InsertNewEmployeeWrapper (string FirstName, public static void InsertNewEmployee(NorthwindEmployee ne) { bool retval = ne.Save(); - if (! retval) { throw new NorthwindDataException("InsertNewEmployee failed."); } + if (!retval) { throw new NorthwindDataException("InsertNewEmployee failed."); } } // // And so on... @@ -126,7 +126,7 @@ public NorthwindEmployee (object anID) { this.lastName = sdr["LastName"].ToString(); this.title = sdr["Title"].ToString(); this.titleOfCourtesy = sdr["TitleOfCourtesy"].ToString(); - if (! sdr.IsDBNull(4)) { + if (!sdr.IsDBNull(4)) { this.reportsTo = sdr.GetInt32(4); } } diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_10sql/CS/sql10cs.aspx b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_10sql/CS/sql10cs.aspx index e870aa2b104..2d477a62e3d 100644 --- a/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_10sql/CS/sql10cs.aspx +++ b/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.WebControls.SqlDataSource_10sql/CS/sql10cs.aspx @@ -6,7 +6,7 @@